Kaydet (Commit) 6a97d9c4 authored tarafından Timotej Lazar's avatar Timotej Lazar Kaydeden (comit) Noel Grandin

tdf#112689 Replace chained O(U)StringBuffer::append with operator+

Change-Id: Iea9a6e2104966bd47f09a82df9b01f065f678d17
Reviewed-on: https://gerrit.libreoffice.org/45079Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMuhammet Kara <muhammet.kara@pardus.org.tr>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst db2111d2
...@@ -337,31 +337,19 @@ namespace { ...@@ -337,31 +337,19 @@ namespace {
OUString MakeStartupErrorMessage(OUString const & aErrorMessage) OUString MakeStartupErrorMessage(OUString const & aErrorMessage)
{ {
OUStringBuffer aDiagnosticMessage( 100 ); return DpResId(STR_BOOTSTRAP_ERR_CANNOT_START) + "\n" + aErrorMessage;
aDiagnosticMessage.append(DpResId(STR_BOOTSTRAP_ERR_CANNOT_START));
aDiagnosticMessage.append( "\n" );
aDiagnosticMessage.append( aErrorMessage );
return aDiagnosticMessage.makeStringAndClear();
} }
OUString MakeStartupConfigAccessErrorMessage( OUString const & aInternalErrMsg ) OUString MakeStartupConfigAccessErrorMessage( OUString const & aInternalErrMsg )
{ {
OUStringBuffer aDiagnosticMessage( 200 ); OUString aDiagnosticMessage = DpResId(STR_BOOTSTRAP_ERR_CFG_DATAACCESS);
aDiagnosticMessage.append(DpResId(STR_BOOTSTRAP_ERR_CFG_DATAACCESS));
if ( !aInternalErrMsg.isEmpty() ) if ( !aInternalErrMsg.isEmpty() )
{ {
aDiagnosticMessage.append("\n\n"); aDiagnosticMessage += "\n\n"
aDiagnosticMessage.append(DpResId(STR_INTERNAL_ERRMSG)); + DpResId(STR_INTERNAL_ERRMSG)
aDiagnosticMessage.append(aInternalErrMsg); + aInternalErrMsg;
} }
return aDiagnosticMessage;
return aDiagnosticMessage.makeStringAndClear();
} }
...@@ -386,11 +374,8 @@ void FatalError(const OUString& sMessage) ...@@ -386,11 +374,8 @@ void FatalError(const OUString& sMessage)
sProductKey = sProductKey.copy( nLastIndex+1 ); sProductKey = sProductKey.copy( nLastIndex+1 );
} }
OUStringBuffer sTitle (128); OUString sTitle = sProductKey + " - Fatal Error";
sTitle.append (sProductKey ); Application::ShowNativeErrorBox (sTitle, sMessage);
sTitle.append (" - Fatal Error");
Application::ShowNativeErrorBox (sTitle.makeStringAndClear (), sMessage);
_exit(EXITHELPER_FATAL_ERROR); _exit(EXITHELPER_FATAL_ERROR);
} }
...@@ -849,29 +834,18 @@ void Desktop::HandleBootstrapErrors( ...@@ -849,29 +834,18 @@ void Desktop::HandleBootstrapErrors(
} }
// First sentence. We cannot bootstrap office further! // First sentence. We cannot bootstrap office further!
OUString aMessage; OUString aDiagnosticMessage = DpResId(STR_BOOTSTRAP_ERR_NO_CFG_SERVICE) + "\n";
OUStringBuffer aDiagnosticMessage( 100 );
OUString aErrorMsg = DpResId(STR_BOOTSTRAP_ERR_NO_CFG_SERVICE);
aDiagnosticMessage.append( aErrorMsg );
aDiagnosticMessage.append( "\n" );
if ( !aErrorMessage.isEmpty() ) if ( !aErrorMessage.isEmpty() )
{ {
aDiagnosticMessage.append( "(\"" ); aDiagnosticMessage += "(\"" + aErrorMessage + "\")\n";
aDiagnosticMessage.append( aErrorMessage );
aDiagnosticMessage.append( "\")\n" );
} }
// Due to the fact the we haven't a backup applicat.rdb file anymore it is not possible to // Due to the fact the we haven't a backup applicat.rdb file anymore it is not possible to
// repair the installation with the setup executable besides the office executable. Now // repair the installation with the setup executable besides the office executable. Now
// we have to ask the user to start the setup on CD/installation directory manually!! // we have to ask the user to start the setup on CD/installation directory manually!!
OUString aStartSetupManually(DpResId(STR_ASK_START_SETUP_MANUALLY)); aDiagnosticMessage += DpResId(STR_ASK_START_SETUP_MANUALLY);
aDiagnosticMessage.append(aStartSetupManually); FatalError(MakeStartupErrorMessage(aDiagnosticMessage));
aMessage = MakeStartupErrorMessage(aDiagnosticMessage.makeStringAndClear());
FatalError( aMessage);
} }
else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN ) else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN )
{ {
...@@ -891,50 +865,30 @@ void Desktop::HandleBootstrapErrors( ...@@ -891,50 +865,30 @@ void Desktop::HandleBootstrapErrors(
} }
else if ( aBootstrapError == BE_USERINSTALL_FAILED ) else if ( aBootstrapError == BE_USERINSTALL_FAILED )
{ {
OUString aMessage; OUString aDiagnosticMessage = DpResId(STR_BOOTSTRAP_ERR_USERINSTALL_FAILED);
OUStringBuffer aDiagnosticMessage( 100 ); FatalError(MakeStartupErrorMessage(aDiagnosticMessage));
OUString aErrorMsg;
aErrorMsg = DpResId(STR_BOOTSTRAP_ERR_USERINSTALL_FAILED);
aDiagnosticMessage.append( aErrorMsg );
aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() );
FatalError(aMessage);
} }
else if ( aBootstrapError == BE_LANGUAGE_MISSING ) else if ( aBootstrapError == BE_LANGUAGE_MISSING )
{ {
OUString aMessage; OUString aDiagnosticMessage = DpResId(STR_BOOTSTRAP_ERR_LANGUAGE_MISSING);
OUStringBuffer aDiagnosticMessage( 100 ); FatalError(MakeStartupErrorMessage(aDiagnosticMessage));
OUString aErrorMsg;
aErrorMsg = DpResId(
//@@@ FIXME: should use an own resource string => #i36213#
STR_BOOTSTRAP_ERR_LANGUAGE_MISSING);
aDiagnosticMessage.append( aErrorMsg );
aMessage = MakeStartupErrorMessage(
aDiagnosticMessage.makeStringAndClear() );
FatalError(aMessage);
} }
else if (( aBootstrapError == BE_USERINSTALL_NOTENOUGHDISKSPACE ) || else if (( aBootstrapError == BE_USERINSTALL_NOTENOUGHDISKSPACE ) ||
( aBootstrapError == BE_USERINSTALL_NOWRITEACCESS )) ( aBootstrapError == BE_USERINSTALL_NOWRITEACCESS ))
{ {
OUString aUserInstallationURL; OUString aUserInstallationURL;
OUString aUserInstallationPath; OUString aUserInstallationPath;
OUString aMessage;
OUString aErrorMsg;
OUStringBuffer aDiagnosticMessage( 100 );
utl::Bootstrap::locateUserInstallation( aUserInstallationURL ); utl::Bootstrap::locateUserInstallation( aUserInstallationURL );
osl::File::getSystemPathFromFileURL( aUserInstallationURL, aUserInstallationPath );
OUString aDiagnosticMessage;
if ( aBootstrapError == BE_USERINSTALL_NOTENOUGHDISKSPACE ) if ( aBootstrapError == BE_USERINSTALL_NOTENOUGHDISKSPACE )
aErrorMsg = DpResId(STR_BOOSTRAP_ERR_NOTENOUGHDISKSPACE); aDiagnosticMessage = DpResId(STR_BOOSTRAP_ERR_NOTENOUGHDISKSPACE);
else else
aErrorMsg = DpResId(STR_BOOSTRAP_ERR_NOACCESSRIGHTS); aDiagnosticMessage = DpResId(STR_BOOSTRAP_ERR_NOACCESSRIGHTS);
aDiagnosticMessage += aUserInstallationPath;
osl::File::getSystemPathFromFileURL( aUserInstallationURL, aUserInstallationPath );
aDiagnosticMessage.append( aErrorMsg ); FatalError(MakeStartupErrorMessage(aDiagnosticMessage));
aDiagnosticMessage.append( aUserInstallationPath );
aMessage = MakeStartupErrorMessage(
aDiagnosticMessage.makeStringAndClear() );
FatalError(aMessage);
} }
} }
...@@ -1996,40 +1950,33 @@ void Desktop::OpenClients() ...@@ -1996,40 +1950,33 @@ void Desktop::OpenClients()
if (!rArgs.IsQuickstart()) if (!rArgs.IsQuickstart())
{ {
bool bShowHelp = false; OUString aHelpModule;
OUStringBuffer aHelpURLBuffer;
if (rArgs.IsHelpWriter()) { if (rArgs.IsHelpWriter()) {
bShowHelp = true; aHelpModule = "swriter";
aHelpURLBuffer.append("vnd.sun.star.help://swriter/start");
} else if (rArgs.IsHelpCalc()) { } else if (rArgs.IsHelpCalc()) {
bShowHelp = true; aHelpModule = "scalc";
aHelpURLBuffer.append("vnd.sun.star.help://scalc/start");
} else if (rArgs.IsHelpDraw()) { } else if (rArgs.IsHelpDraw()) {
bShowHelp = true; aHelpModule = "sdraw";
aHelpURLBuffer.append("vnd.sun.star.help://sdraw/start");
} else if (rArgs.IsHelpImpress()) { } else if (rArgs.IsHelpImpress()) {
bShowHelp = true; aHelpModule = "simpress";
aHelpURLBuffer.append("vnd.sun.star.help://simpress/start");
} else if (rArgs.IsHelpBase()) { } else if (rArgs.IsHelpBase()) {
bShowHelp = true; aHelpModule = "sdatabase";
aHelpURLBuffer.append("vnd.sun.star.help://sdatabase/start");
} else if (rArgs.IsHelpBasic()) { } else if (rArgs.IsHelpBasic()) {
bShowHelp = true; aHelpModule = "sbasic";
aHelpURLBuffer.append("vnd.sun.star.help://sbasic/start");
} else if (rArgs.IsHelpMath()) { } else if (rArgs.IsHelpMath()) {
bShowHelp = true; aHelpModule = "smath";
aHelpURLBuffer.append("vnd.sun.star.help://smath/start");
} }
if (bShowHelp) { if (!aHelpModule.isEmpty()) {
aHelpURLBuffer.append("?Language="); OUString aHelpURL = "vnd.sun.star.help://"
aHelpURLBuffer.append(utl::ConfigManager::getLocale()); + aHelpModule
+ "/start?Language="
+ utl::ConfigManager::getLocale();
#if defined UNX #if defined UNX
aHelpURLBuffer.append("&System=UNX"); aHelpURL += "&System=UNX";
#elif defined WNT #elif defined WNT
aHelpURLBuffer.append("&System=WIN"); aHelpURL += "&System=WIN";
#endif #endif
Application::GetHelp()->Start( Application::GetHelp()->Start(aHelpURL, nullptr);
aHelpURLBuffer.makeStringAndClear(), nullptr);
return; return;
} }
} }
......
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