Kaydet (Commit) 37e36eca authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Related fdo#68240: Rework langselect to provide better error messages

...and in general removed lots of cruft from that code.

Change-Id: Ie673413d8abf5a8ec78c02f4abee2647bdf10a04
üst 38b58556
......@@ -36,7 +36,9 @@
#include "exithelper.h"
#include "migration.hxx"
#include <svl/languageoptions.hxx>
#include <svtools/javacontext.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/AutoRecovery.hpp>
#include <com/sun/star/frame/GlobalEventBroadcaster.hpp>
#include <com/sun/star/frame/SessionListener.hpp>
......@@ -334,7 +336,7 @@ ResMgr* Desktop::GetDesktopResManager()
// Use VCL to get the correct language specific message as we
// are in the bootstrap process and not able to get the installed
// language!!
OUString aUILocaleString = LanguageSelection::getLanguageString();
OUString aUILocaleString = langselect::getEmergencyLocale();
LanguageTag aLanguageTag( aUILocaleString);
//! ResMgr may modify the Locale for fallback!
Desktop::pResMgr = ResMgr::SearchCreateResMgr( "dkt", aLanguageTag);
......@@ -580,13 +582,16 @@ void Desktop::Init()
if ( m_aBootstrapError == BE_OK )
{
// prepare language
if ( !LanguageSelection::prepareLanguage() )
try
{
if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE )
if (!langselect::prepareLocale())
{
SetBootstrapError( BE_LANGUAGE_MISSING, OUString() );
else
SetBootstrapError( BE_OFFICECONFIG_BROKEN, OUString() );
}
}
catch (css::uno::Exception & e)
{
SetBootstrapError( BE_OFFICECONFIG_BROKEN, e.Message );
}
}
......@@ -979,14 +984,15 @@ void Desktop::HandleBootstrapErrors(
}
else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN )
{
OUString aMessage;
OUStringBuffer aDiagnosticMessage( 100 );
OUString aErrorMsg;
aErrorMsg = GetMsgString( STR_CONFIG_ERR_ACCESS_GENERAL,
OUString( "A general error occurred while accessing your central configuration." ) );
aDiagnosticMessage.append( aErrorMsg );
aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() );
FatalError(aMessage);
OUString msg(
GetMsgString(
STR_CONFIG_ERR_ACCESS_GENERAL,
("A general error occurred while accessing your central"
" configuration.")));
if (!aErrorMessage.isEmpty()) {
msg += "\n(\"" + aErrorMessage + "\")";
}
FatalError(MakeStartupErrorMessage(msg));
}
else if ( aBootstrapError == BE_USERINSTALL_FAILED )
{
......
......@@ -17,49 +17,21 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <list>
#include <sal/types.h>
#include <rtl/ustring.hxx>
#include <tools/resid.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <svl/languageoptions.hxx>
#ifndef INCLUDED_DESKTOP_SOURCE_APP_LANGSELECT_HXX
#define INCLUDED_DESKTOP_SOURCE_APP_LANGSELECT_HXX
namespace desktop
{
#include "sal/config.h"
class LanguageSelection
{
public:
enum LanguageSelectionStatus
{
LS_STATUS_OK,
LS_STATUS_CANNOT_DETERMINE_LANGUAGE,
LS_STATUS_CONFIGURATIONACCESS_BROKEN
};
#include "rtl/ustring.hxx"
static OUString getLanguageString();
static bool prepareLanguage();
static LanguageSelectionStatus getStatus();
namespace desktop { namespace langselect {
private:
static OUString aFoundLanguage;
static sal_Bool bFoundLanguage;
static LanguageSelectionStatus m_eStatus;
OUString getEmergencyLocale();
static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False);
static com::sun::star::uno::Sequence< OUString > getInstalledLanguages();
static sal_Bool isInstalledLanguage(OUString& usLocale, sal_Bool bExact=sal_False);
static OUString getFirstInstalledLanguage();
static OUString getUserUILanguage();
static OUString getUserLanguage();
static OUString getSystemLanguage();
static void resetUserLanguage();
static void setDefaultLanguage(const OUString&);
};
bool prepareLocale();
} //namespace desktop
} }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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