summaryrefslogtreecommitdiff
path: root/vcl/generic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-18 12:40:57 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-20 11:13:02 +0000
commit98acef27d06dfa63274ec4ce0ec934fc52e5a15d (patch)
treef93de91fe26c9e10553cdf15e7f1bf6f323a8109 /vcl/generic
parentab76bfc0366d72d80698e4145130a072aed64d31 (diff)
Don't access broken service mgr during bootstrap failure
...so that displaying a (non-translated) error box upon BE_UNO_SERVICEMANAGER works after all. Augment the error text with an exception message where appropriate. This allows to revert fdfb7a3c4b3a89b73ab5546b9620348bc4984d8f "Related fdo#51252: Report uncaught exceptions with MessageBox on Windows" as that was to catch and display failures from instantiating the service mgr. (cherry picked from commit cccc6bcfa095121c91e8bbc396f5bcf7e95424b9) Change-Id: I049a38e95342634796eb0e940e2ee8e55193c9d3 Reviewed-on: https://gerrit.libreoffice.org/654 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/app/gensys.cxx60
1 files changed, 51 insertions, 9 deletions
diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx
index ded4900e8809..4a26a4b19968 100644
--- a/vcl/generic/app/gensys.cxx
+++ b/vcl/generic/app/gensys.cxx
@@ -47,6 +47,47 @@
using namespace com::sun::star;
+namespace {
+
+OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources )
+{
+ OUString aText;
+ if( bUseResources )
+ {
+ aText = Button::GetStandardText( nButtonId );
+ }
+ if( aText.isEmpty() )
+ {
+ switch( nButtonId )
+ {
+ case BUTTON_OK:
+ aText = "OK";
+ break;
+ case BUTTON_CANCEL:
+ aText = "Cancel";
+ break;
+ case BUTTON_ABORT:
+ aText = "Abort";
+ break;
+ case BUTTON_RETRY:
+ aText = "Retry";
+ break;
+ case BUTTON_IGNORE:
+ aText = "Ignore";
+ break;
+ case BUTTON_YES:
+ aText = "Yes";
+ break;
+ case BUTTON_NO:
+ aText = "No";
+ break;
+ }
+ }
+ return aText;
+}
+
+}
+
SalGenericSystem::SalGenericSystem()
{
}
@@ -56,7 +97,8 @@ SalGenericSystem::~SalGenericSystem()
}
int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage,
- int nButtonCombination, int nDefaultButton )
+ int nButtonCombination, int nDefaultButton,
+ bool bUseResources )
{
int nDefButton = 0;
std::list< rtl::OUString > aButtons;
@@ -67,15 +109,15 @@ int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const r
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK ||
nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL )
{
- aButtons.push_back( Button::GetStandardText( BUTTON_OK ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_OK, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK;
}
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL ||
nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO )
{
- aButtons.push_back( Button::GetStandardText( BUTTON_YES ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_YES, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES;
- aButtons.push_back( Button::GetStandardText( BUTTON_NO ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_NO, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO;
if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO )
nDefButton = 1;
@@ -86,21 +128,21 @@ int SalGenericSystem::ShowNativeMessageBox( const rtl::OUString& rTitle, const r
{
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL )
{
- aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
}
- aButtons.push_back( Button::GetStandardText( BUTTON_CANCEL ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_CANCEL, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL;
if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL )
nDefButton = aButtons.size()-1;
}
if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE )
{
- aButtons.push_back( Button::GetStandardText( BUTTON_ABORT ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_ABORT, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT;
- aButtons.push_back( Button::GetStandardText( BUTTON_RETRY ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY;
- aButtons.push_back( Button::GetStandardText( BUTTON_IGNORE ) );
+ aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_IGNORE, bUseResources ) );
nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE;
switch( nDefaultButton )
{