summaryrefslogtreecommitdiff
path: root/extensions/source/update
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-15 22:52:13 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-15 22:52:26 +0200
commitd9da04ddc1d72eea1a691652117d37319570fa31 (patch)
treef8ecb7f3ff0a872cb3cc6a8987592b595c0f00ef /extensions/source/update
parent57af2ee947feb06caaa8ffca1320a950bb049605 (diff)
Some string clean-up
Change-Id: Ic046150605c599746ed3235c04bcbc981e18e589
Diffstat (limited to 'extensions/source/update')
-rw-r--r--extensions/source/update/check/download.cxx6
-rw-r--r--extensions/source/update/check/updatecheckconfig.cxx7
-rw-r--r--extensions/source/update/check/updatehdl.cxx46
-rw-r--r--extensions/source/update/check/updatehdl.hxx1
4 files changed, 18 insertions, 42 deletions
diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx
index 093ef0246bfb..4809cf41b818 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -201,17 +201,17 @@ Download::getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort)
sal_Int32 nProxyType = aValue.get< sal_Int32 >();
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");
rPort = getInt32Value(xNameAccess, "ooInetHTTPProxyPort");
}
- else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("https:")) )
+ else if( rURL.startsWith("https:") )
{
rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName");
rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort");
}
- else if( rURL.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("ftp:")) )
+ else if( rURL.startsWith("ftp:") )
{
rHost = getStringValue(xNameAccess, "ooInetFTPProxyName");
rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort");
diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx
index d739bdc6ec5c..198414a3a634 100644
--- a/extensions/source/update/check/updatecheckconfig.cxx
+++ b/extensions/source/update/check/updatecheckconfig.cxx
@@ -592,16 +592,13 @@ UpdateCheckConfig::commitChanges()
for( sal_Int32 i=0; i<nChanges; ++i )
{
aChangesSet[i].Accessor >>= aString;
-
- // FIXME: use non IgnoreAsciiCase version as soon as it becomes available
- if( aString.endsWithIgnoreAsciiCaseAsciiL(AUTOCHECK_ENABLED "']", sizeof(AUTOCHECK_ENABLED)+1) )
+ if( aString.endsWith(AUTOCHECK_ENABLED "']") )
{
sal_Bool bEnabled = sal_False;
aChangesSet[i].Element >>= bEnabled;
m_rListener->autoCheckStatusChanged(sal_True == bEnabled);
}
- // FIXME: use non IgnoreAsciiCase version as soon as it becomes available
- else if( aString.endsWithIgnoreAsciiCaseAsciiL(CHECK_INTERVAL "']", sizeof(CHECK_INTERVAL)+1) )
+ else if( aString.endsWith(CHECK_INTERVAL "']") )
{
m_rListener->autoCheckIntervalChanged();
}
diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx
index 86fc8ff10662..57ff85fbe0ba 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -611,20 +611,6 @@ void UpdateHandler::updateState( UpdateState 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,
sal_Int32 nResourceId ) const
{
@@ -646,14 +632,11 @@ OUString UpdateHandler::loadString( const uno::Reference< resource::XResourceBun
OUString UpdateHandler::substVariables( const OUString &rSource ) const
{
- OUString sString( rSource );
-
- searchAndReplaceAll( sString, "%NEXTVERSION", msNextVersion );
- searchAndReplaceAll( sString, "%DOWNLOAD_PATH", msDownloadPath );
- searchAndReplaceAll( sString, "%FILE_NAME", msDownloadFile );
- searchAndReplaceAll( sString, "%PERCENT", OUString::number( mnPercent ) );
-
- return sString;
+ return rSource
+ .replaceAll( "%NEXTVERSION", msNextVersion )
+ .replaceAll( "%DOWNLOAD_PATH", msDownloadPath )
+ .replaceAll( "%FILE_NAME", msDownloadFile )
+ .replaceAll( "%PERCENT", OUString::number( mnPercent ) );
}
//--------------------------------------------------------------------
@@ -866,13 +849,9 @@ void UpdateHandler::setFullVersion( OUString& rString )
OUString aProductVersion;
xNameAccess->getByName("ooSetupVersion") >>= aProductVersion;
- sal_Int32 nVerIndex = rString.indexOf( aProductVersion );
- if ( nVerIndex != -1 )
- {
- OUString aProductFullVersion;
- xNameAccess->getByName("ooSetupVersionAboutBox") >>= aProductFullVersion;
- rString = rString.replaceAt( nVerIndex, aProductVersion.getLength(), aProductFullVersion );
- }
+ OUString aProductFullVersion;
+ xNameAccess->getByName("ooSetupVersionAboutBox") >>= aProductFullVersion;
+ rString = rString.replaceFirst( aProductVersion, aProductFullVersion );
}
//--------------------------------------------------------------------
@@ -996,10 +975,11 @@ bool UpdateHandler::showWarning( const OUString &rWarningText,
//--------------------------------------------------------------------
bool UpdateHandler::showOverwriteWarning( const OUString& rFileName ) const
{
- OUString aMsg( msReloadWarning );
- searchAndReplaceAll( aMsg, "%FILENAME", rFileName );
- searchAndReplaceAll( aMsg, "%DOWNLOAD_PATH", msDownloadPath );
- return showWarning( aMsg, msReloadContinue, msReloadReload );
+ return showWarning(
+ (msReloadWarning
+ .replaceAll( "%FILENAME", rFileName )
+ .replaceAll( "%DOWNLOAD_PATH", msDownloadPath )),
+ msReloadContinue, msReloadReload );
}
//--------------------------------------------------------------------
diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx
index 661b6a8d75a2..ee6538142351 100644
--- a/extensions/source/update/check/updatehdl.hxx
+++ b/extensions/source/update/check/updatehdl.hxx
@@ -156,7 +156,6 @@ private:
com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > const & rProps );
void setFullVersion( OUString& rString );
- void searchAndReplaceAll( OUString &rText, const OUString &rWhat, const OUString &rWith ) const;
public:
UpdateHandler( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext,