Kaydet (Commit) d9da04dd authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some string clean-up

Change-Id: Ic046150605c599746ed3235c04bcbc981e18e589
üst 57af2ee9
...@@ -201,17 +201,17 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) ...@@ -201,17 +201,17 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort)
sal_Int32 nProxyType = aValue.get< sal_Int32 >(); sal_Int32 nProxyType = aValue.get< sal_Int32 >();
if( 0 != nProxyType ) // type 0 means "direct connection to the internet if( 0 != nProxyType ) // type 0 means "direct connection to the internet
{ {
if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("http:")) ) if( rURL.startsWith("http:") )
{ {
rHost = getStringValue(xNameAccess, "ooInetHTTPProxyName"); rHost = getStringValue(xNameAccess, "ooInetHTTPProxyName");
rPort = getInt32Value(xNameAccess, "ooInetHTTPProxyPort"); rPort = getInt32Value(xNameAccess, "ooInetHTTPProxyPort");
} }
else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("https:")) ) else if( rURL.startsWith("https:") )
{ {
rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName"); rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName");
rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort"); rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort");
} }
else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("ftp:")) ) else if( rURL.startsWith("ftp:") )
{ {
rHost = getStringValue(xNameAccess, "ooInetFTPProxyName"); rHost = getStringValue(xNameAccess, "ooInetFTPProxyName");
rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort"); rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort");
......
...@@ -592,16 +592,13 @@ UpdateCheckConfig::commitChanges() ...@@ -592,16 +592,13 @@ UpdateCheckConfig::commitChanges()
for( sal_Int32 i=0; i<nChanges; ++i ) for( sal_Int32 i=0; i<nChanges; ++i )
{ {
aChangesSet[i].Accessor >>= aString; aChangesSet[i].Accessor >>= aString;
if( aString.endsWith(AUTOCHECK_ENABLED "']") )
// FIXME: use non IgnoreAsciiCase version as soon as it becomes available
if( aString.endsWithIgnoreAsciiCaseAsciiL(AUTOCHECK_ENABLED "']", sizeof(AUTOCHECK_ENABLED)+1) )
{ {
sal_Bool bEnabled = sal_False; sal_Bool bEnabled = sal_False;
aChangesSet[i].Element >>= bEnabled; aChangesSet[i].Element >>= bEnabled;
m_rListener->autoCheckStatusChanged(sal_True == bEnabled); m_rListener->autoCheckStatusChanged(sal_True == bEnabled);
} }
// FIXME: use non IgnoreAsciiCase version as soon as it becomes available else if( aString.endsWith(CHECK_INTERVAL "']") )
else if( aString.endsWithIgnoreAsciiCaseAsciiL(CHECK_INTERVAL "']", sizeof(CHECK_INTERVAL)+1) )
{ {
m_rListener->autoCheckIntervalChanged(); m_rListener->autoCheckIntervalChanged();
} }
......
...@@ -610,20 +610,6 @@ void UpdateHandler::updateState( UpdateState eState ) ...@@ -610,20 +610,6 @@ void UpdateHandler::updateState( UpdateState eState )
meLastState = eState; meLastState = eState;
} }
//--------------------------------------------------------------------
void UpdateHandler::searchAndReplaceAll( OUString &rText,
const OUString &rWhat,
const OUString &rWith ) const
{
sal_Int32 nIndex = rText.indexOf( rWhat );
while ( nIndex != -1 )
{
rText = rText.replaceAt( nIndex, rWhat.getLength(), rWith );
nIndex = rText.indexOf( rWhat, nIndex );
}
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBundle > xBundle, OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBundle > xBundle,
sal_Int32 nResourceId ) const sal_Int32 nResourceId ) const
...@@ -646,14 +632,11 @@ OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBun ...@@ -646,14 +632,11 @@ OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBun
OUString UpdateHandler::substVariables( const OUString &rSource ) const OUString UpdateHandler::substVariables( const OUString &rSource ) const
{ {
OUString sString( rSource ); return rSource
.replaceAll( "%NEXTVERSION", msNextVersion )
searchAndReplaceAll( sString, "%NEXTVERSION", msNextVersion ); .replaceAll( "%DOWNLOAD_PATH", msDownloadPath )
searchAndReplaceAll( sString, "%DOWNLOAD_PATH", msDownloadPath ); .replaceAll( "%FILE_NAME", msDownloadFile )
searchAndReplaceAll( sString, "%FILE_NAME", msDownloadFile ); .replaceAll( "%PERCENT", OUString::number( mnPercent ) );
searchAndReplaceAll( sString, "%PERCENT", OUString::number( mnPercent ) );
return sString;
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -866,13 +849,9 @@ void UpdateHandler::setFullVersion( OUString& rString ) ...@@ -866,13 +849,9 @@ void UpdateHandler::setFullVersion( OUString& rString )
OUString aProductVersion; OUString aProductVersion;
xNameAccess->getByName("ooSetupVersion") >>= aProductVersion; xNameAccess->getByName("ooSetupVersion") >>= aProductVersion;
sal_Int32 nVerIndex = rString.indexOf( aProductVersion ); OUString aProductFullVersion;
if ( nVerIndex != -1 ) xNameAccess->getByName("ooSetupVersionAboutBox") >>= aProductFullVersion;
{ rString = rString.replaceFirst( aProductVersion, aProductFullVersion );
OUString aProductFullVersion;
xNameAccess->getByName("ooSetupVersionAboutBox") >>= aProductFullVersion;
rString = rString.replaceAt( nVerIndex, aProductVersion.getLength(), aProductFullVersion );
}
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -996,10 +975,11 @@ bool UpdateHandler::showWarning( const OUString &rWarningText, ...@@ -996,10 +975,11 @@ bool UpdateHandler::showWarning( const OUString &rWarningText,
//-------------------------------------------------------------------- //--------------------------------------------------------------------
bool UpdateHandler::showOverwriteWarning( const OUString& rFileName ) const bool UpdateHandler::showOverwriteWarning( const OUString& rFileName ) const
{ {
OUString aMsg( msReloadWarning ); return showWarning(
searchAndReplaceAll( aMsg, "%FILENAME", rFileName ); (msReloadWarning
searchAndReplaceAll( aMsg, "%DOWNLOAD_PATH", msDownloadPath ); .replaceAll( "%FILENAME", rFileName )
return showWarning( aMsg, msReloadContinue, msReloadReload ); .replaceAll( "%DOWNLOAD_PATH", msDownloadPath )),
msReloadContinue, msReloadReload );
} }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
......
...@@ -156,7 +156,6 @@ private: ...@@ -156,7 +156,6 @@ private:
com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > const & rProps ); com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > const & rProps );
void setFullVersion( OUString& rString ); void setFullVersion( OUString& rString );
void searchAndReplaceAll( OUString &rText, const OUString &rWhat, const OUString &rWith ) const;
public: public:
UpdateHandler( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext, UpdateHandler( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment