summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-13 20:12:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-14 14:04:03 +0100
commit82937ce3d7bc2382c4da22365d1245c9f7db178c (patch)
treedbae8b3a02a1b0f21326ba2d5da41cf946d48962 /desktop
parent46894ec48eb33dc99dab807c9fcaf0caa7c6cd84 (diff)
String::SearchAndReplaceAllAscii -> OUString::replaceAll
Change-Id: I5091835c9f71c712f15996e5c6263fc5f21f6f96
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx44
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.hxx2
-rw-r--r--desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx20
-rw-r--r--desktop/source/deployment/inc/dp_resource.h2
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx8
-rw-r--r--desktop/source/deployment/misc/dp_resource.cxx10
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx23
7 files changed, 53 insertions, 56 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 5c66a3672859..493943555df5 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -573,13 +573,13 @@ ResId DialogHelper::getResId( sal_uInt16 nId )
}
//------------------------------------------------------------------------------
-String DialogHelper::getResourceString( sal_uInt16 id )
+OUString DialogHelper::getResourceString(sal_uInt16 id)
{
const SolarMutexGuard guard;
- String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
- if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
- ret.SearchAndReplaceAllAscii(
- "%PRODUCTNAME", utl::ConfigManager::getProductName() );
+ OUString ret(ResId(id, *DeploymentGuiResMgr::get()).toString());
+ if (ret.indexOf("%PRODUCTNAME" ) != -1)
+ {
+ ret = ret.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName());
}
return ret;
}
@@ -603,9 +603,9 @@ bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::
{
const SolarMutexGuard guard;
WarningBox aInfoBox( pParent, getResId( nResID ) );
- String aMsgText = aInfoBox.GetMessText();
- aMsgText.SearchAndReplaceAllAscii(
- "%PRODUCTNAME", utl::ConfigManager::getProductName() );
+ OUString aMsgText = aInfoBox.GetMessText();
+ aMsgText = aMsgText.replaceAll(
+ "%PRODUCTNAME", utl::ConfigManager::getProductName());
aInfoBox.SetMessText( aMsgText );
bHadWarning = true;
@@ -649,9 +649,9 @@ bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
const SolarMutexGuard guard;
WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
- String sText( aInfo.GetMessText() );
- sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
- aInfo.SetMessText( sText );
+ OUString sText(aInfo.GetMessText());
+ sText = sText.replaceAll("%NAME", rExtensionName);
+ aInfo.SetMessText(sText);
return ( RET_OK == aInfo.Execute() );
}
@@ -662,10 +662,10 @@ bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
const SolarMutexGuard guard;
QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
- String sMsgText = aQuery.GetMessText();
- sMsgText.SearchAndReplaceAllAscii(
- "%PRODUCTNAME", utl::ConfigManager::getProductName() );
- aQuery.SetMessText( sMsgText );
+ OUString sMsgText(aQuery.GetMessText());
+ sMsgText = sMsgText.replaceAll(
+ "%PRODUCTNAME", utl::ConfigManager::getProductName());
+ aQuery.SetMessText(sMsgText);
sal_uInt16 nYesBtnID = aQuery.GetButtonId( 0 );
sal_uInt16 nNoBtnID = aQuery.GetButtonId( 1 );
@@ -808,9 +808,9 @@ bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
const SolarMutexGuard guard;
WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_REMOVE_EXTENSION ) );
- String sText( aInfo.GetMessText() );
- sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
- aInfo.SetMessText( sText );
+ OUString sText(aInfo.GetMessText());
+ sText = sText.replaceAll("%NAME", rExtensionName);
+ aInfo.SetMessText(sText);
return ( RET_OK == aInfo.Execute() );
}
@@ -1224,10 +1224,10 @@ UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager
m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
- String aText = m_aUpdateNeeded.GetText();
- aText.SearchAndReplaceAllAscii(
- "%PRODUCTNAME", utl::ConfigManager::getProductName() );
- m_aUpdateNeeded.SetText( aText );
+ OUString aText = m_aUpdateNeeded.GetText();
+ aText = aText.replaceAll(
+ "%PRODUCTNAME", utl::ConfigManager::getProductName());
+ m_aUpdateNeeded.SetText(aText);
// resize update button
Size aBtnSize = m_aUpdateBtn.GetSizePixel();
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index b5a5aa430483..436879b1885f 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -81,7 +81,7 @@ public:
virtual void checkEntries() = 0;
static ResId getResId( sal_uInt16 nId );
- static String getResourceString( sal_uInt16 id );
+ static OUString getResourceString( sal_uInt16 id );
static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &);
static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
Window *pParent,
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index c9bdf06c7844..8b2cd3369248 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -456,7 +456,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
{
SolarMutexGuard guard;
WarningBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, ResId(id, *DeploymentGuiResMgr::get()));
- String s;
+ OUString s;
if (bEqualNames)
{
s = box.GetMessText();
@@ -466,20 +466,20 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
//hypothetical: requires two instances of an extension with the same
//version to have different display names. Probably the developer forgot
//to change the version.
- s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()));
+ s = ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString();
}
else if (id == RID_WARNINGBOX_VERSION_LESS)
{
- s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()));
+ s = ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString();
}
else if (id == RID_WARNINGBOX_VERSION_GREATER)
{
- s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()));
+ s = ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, *DeploymentGuiResMgr::get()).toString();
}
- s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName);
- s.SearchAndReplaceAllAscii( "$OLDNAME", verExc.Deployed->getDisplayName());
- s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) );
- s.SearchAndReplaceAllAscii( "$DEPLOYED", getVersion(verExc.Deployed) );
+ s = s.replaceAll("$NAME", verExc.NewDisplayName);
+ s = s.replaceAll("$OLDNAME", verExc.Deployed->getDisplayName());
+ s = s.replaceAll("$NEW", getVersion(verExc.NewVersion));
+ s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed));
box.SetMessText(s);
approve = box.Execute() == RET_OK;
abort = !approve;
@@ -507,8 +507,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
else if (request >>= platExc)
{
SolarMutexGuard guard;
- String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get() ) );
- sMsg.SearchAndReplaceAllAscii( "%Name", platExc.package->getDisplayName() );
+ OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *DeploymentGuiResMgr::get()).toString());
+ sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName());
ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, WB_OK, sMsg );
box.Execute();
approve = true;
diff --git a/desktop/source/deployment/inc/dp_resource.h b/desktop/source/deployment/inc/dp_resource.h
index 04dc52c82889..ebd8331ecdcc 100644
--- a/desktop/source/deployment/inc/dp_resource.h
+++ b/desktop/source/deployment/inc/dp_resource.h
@@ -33,7 +33,7 @@ namespace dp_misc {
ResId getResId( sal_uInt16 id );
//==============================================================================
-DESKTOP_DEPLOYMENTMISC_DLLPUBLIC String getResourceString( sal_uInt16 id );
+DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getResourceString( sal_uInt16 id );
template <typename Unique, sal_uInt16 id>
struct StaticResourceString :
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 85f0566b326d..7811aabb270a 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -1307,14 +1307,14 @@ sal_Bool ExtensionManager::synchronize(
try
{
::osl::MutexGuard guard(getMutex());
- String sSynchronizingShared(StrSyncRepository::get());
- sSynchronizingShared.SearchAndReplaceAllAscii( "%NAME", OUString("shared"));
+ OUString sSynchronizingShared(StrSyncRepository::get());
+ sSynchronizingShared = sSynchronizingShared.replaceAll("%NAME", "shared");
dp_misc::ProgressLevel progressShared(xCmdEnv, sSynchronizingShared);
sal_Bool bModified = getSharedRepository()->synchronize(xAbortChannel, xCmdEnv);
progressShared.update("\n\n");
- String sSynchronizingBundled(StrSyncRepository::get());
- sSynchronizingBundled.SearchAndReplaceAllAscii( "%NAME", OUString("bundled"));
+ OUString sSynchronizingBundled(StrSyncRepository::get());
+ sSynchronizingBundled = sSynchronizingBundled.replaceAll("%NAME", "bundled");
dp_misc::ProgressLevel progressBundled(xCmdEnv, sSynchronizingBundled);
bModified |= getBundledRepository()->synchronize(xAbortChannel, xCmdEnv);
progressBundled.update("\n\n");
diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx
index 802e37f3d0c4..f8c43d75a3bf 100644
--- a/desktop/source/deployment/misc/dp_resource.cxx
+++ b/desktop/source/deployment/misc/dp_resource.cxx
@@ -66,13 +66,11 @@ ResId getResId( sal_uInt16 id )
}
//==============================================================================
-String getResourceString( sal_uInt16 id )
+OUString getResourceString( sal_uInt16 id )
{
- const osl::MutexGuard guard( theResourceMutex::get() );
- String ret( ResId( id, *DeploymentResMgr::get() ) );
- ret.SearchAndReplaceAllAscii(
- "%PRODUCTNAME", utl::ConfigManager::getProductName() );
- return ret;
+ const osl::MutexGuard guard(theResourceMutex::get());
+ OUString ret(ResId(id, *DeploymentResMgr::get()).toString());
+ return ret.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName());
}
//==============================================================================
diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
index 430401fc3bc6..35ae4ecbc03e 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
@@ -139,16 +139,15 @@ void CommandEnvironmentImpl::printLicense(
const OUString & sName, const OUString& sLicense, bool & accept, bool &decline)
{
ResMgr * pResMgr = DeploymentResMgr::get();
- String s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr));
- s1tmp.SearchAndReplaceAllAscii( "$NAME", sName );
- OUString s1(s1tmp);
- OUString s2 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr));
- OUString s3 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr));
- OUString s4 = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr));
- OUString sYES = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr));
- OUString sY = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr));
- OUString sNO = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr));
- OUString sN = String(ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr));
+ OUString s1tmp(ResId(RID_STR_UNOPKG_ACCEPT_LIC_1, *pResMgr).toString());
+ OUString s1(s1tmp.replaceAll("$NAME", sName));
+ OUString s2 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_2, *pResMgr).toString();
+ OUString s3 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_3, *pResMgr).toString();
+ OUString s4 = ResId(RID_STR_UNOPKG_ACCEPT_LIC_4, *pResMgr).toString();
+ OUString sYES = ResId(RID_STR_UNOPKG_ACCEPT_LIC_YES, *pResMgr).toString();
+ OUString sY = ResId(RID_STR_UNOPKG_ACCEPT_LIC_Y, *pResMgr).toString();
+ OUString sNO = ResId(RID_STR_UNOPKG_ACCEPT_LIC_NO, *pResMgr).toString();
+ OUString sN = ResId(RID_STR_UNOPKG_ACCEPT_LIC_N, *pResMgr).toString();
OUString sNewLine("\n");
@@ -270,8 +269,8 @@ void CommandEnvironmentImpl::handle(
}
else if (request >>= platExc)
{
- String sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get()));
- sMsg.SearchAndReplaceAllAscii("%Name", platExc.package->getDisplayName());
+ OUString sMsg(ResId(RID_STR_UNSUPPORTED_PLATFORM, *dp_gui::DeploymentGuiResMgr::get()).toString());
+ sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName());
dp_misc::writeConsole(OUString("\n") + sMsg + "\n\n");
approve = true;
}