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)
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");
......
......@@ -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();
}
......
......@@ -610,20 +610,6 @@ void UpdateHandler::updateState( UpdateState 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,
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 );
}
//--------------------------------------------------------------------
......
......@@ -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,
......
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