diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-20 11:46:52 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-20 11:46:52 +0000 |
commit | f2c4534897cb050c980be4470251e19008cbd150 (patch) | |
tree | c7fdab6828faa72342b0144642189c4c317216ca /extensions/source | |
parent | 920580527a4de83b119f73bac1587e8884b375a5 (diff) |
CWS-TOOLING: integrate CWS onlineupdate7_DEV300
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/update/check/updatecheck.cxx | 27 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.cxx | 62 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.hxx | 6 | ||||
-rw-r--r-- | extensions/source/update/check/updateprotocol.cxx | 19 | ||||
-rw-r--r-- | extensions/source/update/feed/updatefeed.cxx | 153 |
5 files changed, 152 insertions, 115 deletions
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 6dfb1d03599e..1c4eb7191592 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: updatecheck.cxx,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.76.1 $ * * This file is part of OpenOffice.org. * @@ -117,32 +117,19 @@ rtl::OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDo namespace { -static rtl::OUString getBootstrapValue(const rtl::OUString& aFile, const rtl::OUString& aValue) -{ - rtl::OUString aPath, aRet; - if( rtl::Bootstrap::get(UNISTRING("BRAND_BASE_DIR"), aPath) ) - { - aPath += UNISTRING("/program/"); - aPath += aFile; - - rtl::Bootstrap aVersionFile(aPath); - aVersionFile.getFrom(aValue, aRet, rtl::OUString()); - } - return aRet; -} - -//------------------------------------------------------------------------------ - static inline rtl::OUString getBuildId() { - return getBootstrapValue(UNISTRING( SAL_CONFIGFILE( "version" ) ), UNISTRING("buildid") ); + rtl::OUString aPathVal(UNISTRING("${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}")); + rtl::Bootstrap::expandMacros(aPathVal); + return aPathVal; } //------------------------------------------------------------------------------ - static inline rtl::OUString getBaseInstallation() { - return getBootstrapValue(UNISTRING( SAL_CONFIGFILE( "bootstrap" ) ), UNISTRING("BaseInstallation") ); + rtl::OUString aPathVal(UNISTRING("${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("bootstrap") ":BaseInstallation}")); + rtl::Bootstrap::expandMacros(aPathVal); + return aPathVal; } //------------------------------------------------------------------------------ diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 2aa27cd9b8f4..80fa14ac830a 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -38,6 +38,7 @@ #include "osl/thread.hxx" #include "osl/file.hxx" #include "rtl/ustring.hxx" +#include "rtl/bootstrap.hxx" #include "com/sun/star/uno/Sequence.h" @@ -631,9 +632,6 @@ rtl::OUString UpdateHandler::loadString( const uno::Reference< resource::XResour sString = UNISTRING("Missing ") + sKey; } - searchAndReplaceAll( sString, UNISTRING( "%PRODUCTNAME" ), msProductName ); - searchAndReplaceAll( sString, UNISTRING( "%PRODUCTVERSION" ), msProductVersion ); - return sString; } @@ -684,12 +682,13 @@ void UpdateHandler::loadStrings() if ( !xBundle.is() ) return; - getProductName(); - msChecking = loadString( xBundle, RID_UPDATE_STR_CHECKING ); msCheckingError = loadString( xBundle, RID_UPDATE_STR_CHECKING_ERR ); msNoUpdFound = loadString( xBundle, RID_UPDATE_STR_NO_UPD_FOUND ); + msUpdFound = loadString( xBundle, RID_UPDATE_STR_UPD_FOUND ); + setFullVersion( msUpdFound ); + msDlgTitle = loadString( xBundle, RID_UPDATE_STR_DLG_TITLE ); msDownloadPause = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_PAUSE ); msDownloadError = loadString( xBundle, RID_UPDATE_STR_DOWNLOAD_ERR ); @@ -835,7 +834,7 @@ void UpdateHandler::insertControlModel( uno::Reference< awt::XControlModel > & r } //-------------------------------------------------------------------- -void UpdateHandler::getProductName() +void UpdateHandler::setFullVersion( rtl::OUString& rString ) { if( !mxContext.is() ) throw uno::RuntimeException( UNISTRING( "getProductName: empty component context" ), *this ); @@ -861,10 +860,55 @@ void UpdateHandler::getProductName() aArgumentList ); uno::Reference< container::XNameAccess > xNameAccess( xConfigAccess, uno::UNO_QUERY_THROW ); - rtl::OUString aProductName; - xNameAccess->getByName(UNISTRING("ooName")) >>= msProductName; - xNameAccess->getByName(UNISTRING("ooSetupVersion")) >>= msProductVersion; + rtl::OUString aProductVersion; + rtl::OUString aProductFullVersion; + + xNameAccess->getByName(UNISTRING("ooSetupVersion")) >>= aProductVersion; + aProductFullVersion = aProductVersion; + + sal_Int32 nVerIndex = rString.indexOf( aProductVersion ); + if ( nVerIndex != -1 ) + { + rtl::OUString aPackageVersion = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":OOOPackageVersion}" ); + rtl::Bootstrap::expandMacros( aPackageVersion ); + + if ( aPackageVersion.getLength() ) + { + sal_Int32 nTokIndex = 0; + rtl::OUString aVersionMinor = aPackageVersion.getToken( 1, '.', nTokIndex ); + rtl::OUString aVersionMicro; + + if ( nTokIndex > 0 ) + aVersionMicro = aPackageVersion.getToken( 0, '.', nTokIndex ); + + if ( aVersionMinor.getLength() == 0 ) + aVersionMinor = UNISTRING( "0" ); + if ( aVersionMicro.getLength() == 0 ) + aVersionMicro = UNISTRING( "0" ); + + sal_Int32 nIndex = aProductFullVersion.indexOf( '.' ); + if ( nIndex == -1 ) + { + aProductFullVersion += UNISTRING( "." ); + aProductFullVersion += aVersionMinor; + } + else + { + nIndex = aProductFullVersion.indexOf( '.', nIndex+1 ); + } + if ( nIndex == -1 ) + { + aProductFullVersion += UNISTRING( "." ); + aProductFullVersion += aVersionMicro; + } + else + { + aProductFullVersion = aProductFullVersion.replaceAt( nIndex+1, aProductFullVersion.getLength()-nIndex-1, aVersionMicro ); + } + } + rString = rString.replaceAt( nVerIndex, aProductVersion.getLength(), aProductFullVersion ); + } } //-------------------------------------------------------------------- diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index cbfe7a211a4e..9b33098f30f1 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: updatehdl.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.94.1 $ * * This file is part of OpenOffice.org. * @@ -104,8 +104,6 @@ private: osl::Mutex maMutex; - rtl::OUString msProductName; - rtl::OUString msProductVersion; rtl::OUString msNextVersion; rtl::OUString msDownloadPath; rtl::OUString msDownloadFile; @@ -166,7 +164,7 @@ private: com::sun::star::awt::Rectangle const & rPosSize, com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > const & rProps ); - void getProductName(); + void setFullVersion( rtl::OUString& rString ); void searchAndReplaceAll( rtl::OUString &rText, const rtl::OUString &rWhat, const rtl::OUString &rWith ) const; public: diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 1de8da99b82b..2794f299928c 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: updateprotocol.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.70.1 $ * * This file is part of OpenOffice.org. * @@ -68,18 +68,19 @@ getBootstrapData( ::rtl::OUString & rBuildID, ::rtl::OUString & rInstallSetID) { - rtl::OUString aPath, aPath2; - if( !rtl::Bootstrap::get(UNISTRING("BRAND_BASE_DIR"), aPath) ) + rBuildID = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ); + rtl::Bootstrap::expandMacros( rBuildID ); + if ( ! rBuildID.getLength() ) return false; - aPath += UNISTRING( "/program/" SAL_CONFIGFILE( "version" ) ); + rInstallSetID = UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateID}" ); + rtl::Bootstrap::expandMacros( rInstallSetID ); + if ( ! rInstallSetID.getLength() ) + return false; - rtl::Bootstrap aVersionFile(aPath); - aVersionFile.getFrom(UNISTRING("ProductBuildid"), rBuildID, rtl::OUString()); - aVersionFile.getFrom(UNISTRING("UpdateID"), rInstallSetID, rtl::OUString()); + rtl::OUString aValue( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateURL}" ) ); + rtl::Bootstrap::expandMacros( aValue ); - rtl::OUString aValue; - aVersionFile.getFrom(UNISTRING("UpdateURL"), aValue, rtl::OUString()); if( aValue.getLength() > 0 ) { rRepositoryList.realloc(1); diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index f4d23d4228a5..2d21629ca5e0 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: updatefeed.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.52.2 $ * * This file is part of OpenOffice.org. * @@ -504,82 +504,89 @@ UpdateInformationProvider::UpdateInformationProvider( m_xContentProvider(xContentProvider), m_xDocumentBuilder(xDocumentBuilder), m_xXPathAPI(xXPathAPI), m_aRequestHeaderList(2) { - rtl::OUString aPath; - if( rtl::Bootstrap::get( UNISTRING("BRAND_BASE_DIR"), aPath ) ) - { - uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); - if( !xServiceManager.is() ) - throw uno::RuntimeException( - UNISTRING("unable to obtain service manager from component context"), - uno::Reference< uno::XInterface >()); - - uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( - xServiceManager->createInstanceWithContext( - UNISTRING("com.sun.star.configuration.ConfigurationProvider"), - xContext ), - uno::UNO_QUERY_THROW); - - aPath += UNISTRING( "/program/" SAL_CONFIGFILE( "version" ) ); - - rtl::Bootstrap aVersionFile(aPath); - - rtl::OUStringBuffer buf; - rtl::OUString name; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooName")) >>= name; - buf.append(name); + uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager()); + if( !xServiceManager.is() ) + throw uno::RuntimeException( + UNISTRING("unable to obtain service manager from component context"), + uno::Reference< uno::XInterface >()); + + uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( + xServiceManager->createInstanceWithContext( + UNISTRING("com.sun.star.configuration.ConfigurationProvider"), + xContext ), + uno::UNO_QUERY_THROW); + + rtl::OUStringBuffer buf; + rtl::OUString name; + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooName")) >>= name; + buf.append(name); + buf.append(sal_Unicode(' ')); + rtl::OUString version; + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooSetupVersion")) >>= version; + buf.append(version); + rtl::OUString edition( + UNISTRING( + "${${BRAND_BASE_DIR}/program/edition/edition.ini:" + "EDITIONNAME}")); + rtl::Bootstrap::expandMacros(edition); + if (edition.getLength() != 0) { buf.append(sal_Unicode(' ')); - rtl::OUString version; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupVersion")) >>= version; - buf.append(version); - rtl::OUString edition( - UNISTRING( - "${${BRAND_BASE_DIR}/program/edition/edition.ini:" - "EDITIONNAME}")); - rtl::Bootstrap::expandMacros(edition); - if (edition.getLength() != 0) { - buf.append(sal_Unicode(' ')); - buf.append(edition); - } - rtl::OUString extension; - getConfigurationItem( - xConfigurationProvider, - UNISTRING("org.openoffice.Setup/Product"), - UNISTRING("ooSetupExtension")) >>= extension; - if (extension.getLength() != 0) { - buf.append(sal_Unicode(' ')); - buf.append(extension); - } - rtl::OUString product(buf.makeStringAndClear()); - rtl::OUString aUserAgent; - aVersionFile.getFrom(UNISTRING("UpdateUserAgent"), aUserAgent, rtl::OUString()); - for (sal_Int32 i = 0;;) { - i = aUserAgent.indexOfAsciiL( - RTL_CONSTASCII_STRINGPARAM("<PRODUCT>"), i); - if (i == -1) { - break; - } - aUserAgent = aUserAgent.replaceAt( - i, RTL_CONSTASCII_LENGTH("<PRODUCT>"), product); - i += product.getLength(); - } + buf.append(edition); + } + rtl::OUString extension; + getConfigurationItem( + xConfigurationProvider, + UNISTRING("org.openoffice.Setup/Product"), + UNISTRING("ooSetupExtension")) >>= extension; + if (extension.getLength() != 0) { + buf.append(sal_Unicode(' ')); + buf.append(extension); + } + rtl::OUString product(buf.makeStringAndClear()); - m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language"); - m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); - m_aRequestHeaderList[1].Name = UNISTRING("Accept-Encoding"); - m_aRequestHeaderList[1].Value = uno::makeAny( UNISTRING("gzip,deflate") ); + rtl::OUString aBaseBuildId( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); + rtl::Bootstrap::expandMacros( aBaseBuildId ); - if( aUserAgent.getLength() > 0 ) - { - m_aRequestHeaderList.realloc(3); - m_aRequestHeaderList[2].Name = UNISTRING("User-Agent"); - m_aRequestHeaderList[2].Value = uno::makeAny(aUserAgent); + rtl::OUString aBrandBuildId( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); + rtl::Bootstrap::expandMacros( aBrandBuildId ); + + rtl::OUString aUserAgent( UNISTRING( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":UpdateUserAgent}" ) ); + rtl::Bootstrap::expandMacros( aUserAgent ); + + if ( ! aBaseBuildId.equals( aBrandBuildId ) ) + { + sal_Int32 nIndex = aUserAgent.indexOf( aBrandBuildId, 0 ); + if ( nIndex != -1 ) + aUserAgent = aUserAgent.replaceAt( nIndex, aBrandBuildId.getLength(), aBaseBuildId ); + } + + for (sal_Int32 i = 0;;) { + i = aUserAgent.indexOfAsciiL( + RTL_CONSTASCII_STRINGPARAM("<PRODUCT>"), i); + if (i == -1) { + break; } + aUserAgent = aUserAgent.replaceAt( + i, RTL_CONSTASCII_LENGTH("<PRODUCT>"), product); + i += product.getLength(); + } + + m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language"); + m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") ); + m_aRequestHeaderList[1].Name = UNISTRING("Accept-Encoding"); + m_aRequestHeaderList[1].Value = uno::makeAny( UNISTRING("gzip,deflate") ); + + if( aUserAgent.getLength() > 0 ) + { + m_aRequestHeaderList.realloc(3); + m_aRequestHeaderList[2].Name = UNISTRING("User-Agent"); + m_aRequestHeaderList[2].Value = uno::makeAny(aUserAgent); } } |