diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-04-04 18:06:02 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-04-04 18:14:43 +0100 |
commit | 34a48f3809c534a47c65d22a7db6b52d6ff46dee (patch) | |
tree | 36f4b8acd2726764d33172a8f6226d006885c63f /cui/source/dialogs | |
parent | dac9c2c8642c4edeff10a3250f96d1a86e6a2640 (diff) |
restore the build-id setup code, and clean hrc file
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r-- | cui/source/dialogs/about.cxx | 67 | ||||
-rw-r--r-- | cui/source/dialogs/about.hrc | 12 |
2 files changed, 71 insertions, 8 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 2a09ff96d..cd2e416e7 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -72,11 +72,70 @@ Image SfxApplication::GetApplicationLogo() return Image( aBitmap ); } +/* intense magic to get strong version information */ static String -GetVersionStr() +GetBuildId() { - // FIXME: fill me in from sfx2/source/appl/appserv.cxx code ... - return String(); + const String sCWSSchema( String::CreateFromAscii( "[CWS:" ) ); + rtl::OUString sDefault; + String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); + OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" ); + if ( sBuildId.Len() > 0 && sBuildId.Search( sCWSSchema ) == STRING_NOTFOUND ) + { + // no cws part in brand buildid -> try basis buildid + rtl::OUString sBasisBuildId( DEFINE_CONST_OUSTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); + rtl::Bootstrap::expandMacros( sBasisBuildId ); + sal_Int32 nIndex = sBasisBuildId.indexOf( sCWSSchema ); + if ( nIndex != -1 ) + sBuildId += String( sBasisBuildId.copy( nIndex ) ); + } + + String sProductSource( utl::Bootstrap::getProductSource( sDefault ) ); + OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" ); + + // the product source is something like "DEV300", where the + // build id is something like "300m12(Build:12345)". For better readability, + // strip the duplicate UPD ("300"). + if ( sProductSource.Len() ) + { + bool bMatchingUPD = + ( sProductSource.Len() >= 3 ) + && ( sBuildId.Len() >= 3 ) + && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) ); + OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" ); + if ( bMatchingUPD ) + sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 ); + + // prepend the product source + sBuildId.Insert( sProductSource, 0 ); + } + + // Version information (in about box) (#i94693#) + /* if the build ids of the basis or ure layer are different from the build id + * of the brand layer then show them */ + rtl::OUString aBasisProductBuildId( DEFINE_CONST_OUSTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) ); + rtl::Bootstrap::expandMacros( aBasisProductBuildId ); + rtl::OUString aUREProductBuildId( DEFINE_CONST_OUSTRING("${$URE_BIN_DIR/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) ); + rtl::Bootstrap::expandMacros( aUREProductBuildId ); + if ( sBuildId.Search( String( aBasisProductBuildId ) ) == STRING_NOTFOUND + || sBuildId.Search( String( aUREProductBuildId ) ) == STRING_NOTFOUND ) + { + String sTemp( '-' ); + sTemp += String( aBasisProductBuildId ); + sTemp += '-'; + sTemp += String( aUREProductBuildId ); + sBuildId.Insert( sTemp, sBuildId.Search( ')' ) ); + } + + // the build id format is "milestone(build)[cwsname]". For readability, it would + // be nice to have some more spaces in there. + xub_StrLen nPos = 0; + if ( ( nPos = sBuildId.Search( sal_Unicode( '(' ) ) ) != STRING_NOTFOUND ) + sBuildId.Insert( sal_Unicode( ' ' ), nPos ); + if ( ( nPos = sBuildId.Search( sal_Unicode( '[' ) ) ) != STRING_NOTFOUND ) + sBuildId.Insert( sal_Unicode( ' ' ), nPos ); + + return sBuildId; } AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : @@ -111,7 +170,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId) : String sVersion = aVersionTextStr; sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); sVersion += '\n'; - sVersion += GetVersionStr(); + sVersion += GetBuildId(); #ifdef BUILD_VER_STRING String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); sVersion += '\n'; diff --git a/cui/source/dialogs/about.hrc b/cui/source/dialogs/about.hrc index b98d03f10..7a74954c1 100644 --- a/cui/source/dialogs/about.hrc +++ b/cui/source/dialogs/about.hrc @@ -27,8 +27,12 @@ #include <sfx2/sfx.hrc> -#define ABOUT_BTN_OK 1 -#define ABOUT_FTXT_VERSION 1 -#define ABOUT_STR_ACCEL 3 -#define ABOUT_FTXT_COPYRIGHT 4 +#define ABOUT_BTN_OK 1 +#define ABOUT_FTXT_VERSION 2 +#define ABOUT_STR_ACCEL 3 +#define ABOUT_FTXT_COPYRIGHT 4 +#define ABOUT_FTXT_LINK 5 +#define ABOUT_STR_VERSION 6 +#define ABOUT_STR_COPYRIGHT 7 +#define ABOUT_STR_LINK 8 |