[Libreoffice-commits] core.git: 4 commits - cui/source include/unotools sw/source test/source unotools/source

Eike Rathke erack at redhat.com
Fri Dec 2 19:36:51 UTC 2016


 cui/source/options/optgdlg.cxx              |   20 ++++++++++----------
 include/unotools/syslocaleoptions.hxx       |    4 +---
 sw/source/uibase/config/modcfg.cxx          |    4 ++--
 test/source/screenshot_test.cxx             |    2 +-
 unotools/source/config/syslocaleoptions.cxx |    9 ++-------
 5 files changed, 16 insertions(+), 23 deletions(-)

New commits:
commit b913ce4c321142d0d0948ab4d6d8ba362919d7d8
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 2 20:34:44 2016 +0100

    remove now unused SvtSysLocaleOptions::GetLocaleConfigString()
    
    Which just lead to confusion as could be seen in two earlier commits..
    
    Change-Id: I172127cf08bcd45c3c53e0cf00cf11a41e0dd3a6

diff --git a/include/unotools/syslocaleoptions.hxx b/include/unotools/syslocaleoptions.hxx
index d37fab8..bb86e64 100644
--- a/include/unotools/syslocaleoptions.hxx
+++ b/include/unotools/syslocaleoptions.hxx
@@ -87,10 +87,8 @@ public:
     // config value access methods
 
     /// The config string may be empty to denote the SYSTEM locale
-            const OUString&     GetLocaleConfigString() const;
             void                SetLocaleConfigString( const OUString& rStr );
-            /** Get locale set, if empty denotes SYSTEM locale, not resolved
-                to the real locale. */
+            /** Get locale set, not resolved to the real locale. */
             LanguageTag         GetLanguageTag() const;
             /** Get locale set, always resolved to the real locale. */
             const LanguageTag&  GetRealLanguageTag() const;
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 5f3b00c..a5eaae5 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -566,12 +566,6 @@ void SvtSysLocaleOptions::BlockBroadcasts( bool bBlock )
     pImpl->BlockBroadcasts( bBlock );
 }
 
-const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const
-{
-    MutexGuard aGuard( GetMutex() );
-    return pImpl->GetLocaleString();
-}
-
 void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr )
 {
     MutexGuard aGuard( GetMutex() );
@@ -702,7 +696,8 @@ void SvtSysLocaleOptions::ConfigurationChanged( utl::ConfigurationBroadcaster* p
 
 LanguageTag SvtSysLocaleOptions::GetLanguageTag() const
 {
-    return LanguageTag( GetLocaleConfigString() );
+    MutexGuard aGuard( GetMutex() );
+    return LanguageTag( pImpl->GetLocaleString() );
 }
 
 const LanguageTag & SvtSysLocaleOptions::GetRealLanguageTag() const
commit eb1762fea0c9e281d2bcad2eeffda2a5238816a8
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 2 20:10:29 2016 +0100

    use SvtSysLocaleOptions::GetLanguageTag() instead of GetLocaleConfigString()
    
    Change-Id: Ifcfc4588d5bd6f713a40bd2300740f7a1c52337c

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index e308843..07ed580 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1400,9 +1400,9 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
         SAL_WARN("cui.options", "ignoring Exception \"" << e.Message << "\"");
     }
 
-    OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
-    LanguageType eOldLocale = (!sLang.isEmpty() ?
-        LanguageTag::convertToLanguageTypeWithFallback( sLang ) : LANGUAGE_SYSTEM);
+    LanguageTag aLanguageTag( pLangConfig->aSysLocaleOptions.GetLanguageTag());
+    LanguageType eOldLocale = (aLanguageTag.isSystemLocale() ? LANGUAGE_SYSTEM :
+            aLanguageTag.makeFallback().getLanguageType());
     LanguageType eNewLocale = m_pLocaleSettingLB->GetSelectLanguage();
 
     // If the "Default ..." entry was selected that means SYSTEM, the actual
@@ -1569,11 +1569,11 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
 
 void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
 {
-    OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
-    if ( !sLang.isEmpty() )
-        m_pLocaleSettingLB->SelectLanguage(LanguageTag::convertToLanguageTypeWithFallback(sLang));
-    else
+    LanguageTag aLanguageTag( pLangConfig->aSysLocaleOptions.GetLanguageTag());
+    if ( aLanguageTag.isSystemLocale() )
         m_pLocaleSettingLB->SelectLanguage( LANGUAGE_USER_SYSTEM_CONFIG );
+    else
+        m_pLocaleSettingLB->SelectLanguage( aLanguageTag.makeFallback().getLanguageType());
     bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE);
     m_pLocaleSettingLB->Enable(!bReadonly);
     m_pLocaleSettingFT->Enable(!bReadonly);
@@ -1594,10 +1594,10 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
     OUString aAbbrev;
     LanguageType eLang;
     const NfCurrencyEntry* pCurr = nullptr;
-    sLang = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
-    if ( !sLang.isEmpty() )
+    OUString sCurrency = pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
+    if ( !sCurrency.isEmpty() )
     {
-        SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sLang );
+        SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( aAbbrev, eLang, sCurrency );
         pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
     }
     // if pCurr==NULL the SYSTEM entry is selected
commit 7523b3b3c59187711baa8f6e4e793cf338786a2f
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 2 19:59:50 2016 +0100

    use SvtSysLocaleOptions::GetRealUILanguageTag(), not GetLocaleConfigString()
    
    Assuming that the screenshots directory suffix
    * should match the configured UI locale instead of the work locale
    * should not be empty if configuration says "Default - ..."
      * actually ScreenshotTest::implSaveScreenshot() explicitly tests
        (maCurrentLanguage == "en-US") and then sets the suffix to empty, so no
        other locale should exhibit the same
    
    Change-Id: Ie4561315b67c3ade20f3947772af45e471d0752f

diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index 28788d0..0a3c4f9 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -40,7 +40,7 @@ ScreenshotTest::ScreenshotTest()
     maKnownDialogs()
 {
     SvtSysLocaleOptions localeOptions;
-    maCurrentLanguage = localeOptions.GetLocaleConfigString();
+    maCurrentLanguage = localeOptions.GetRealUILanguageTag().getBcp47();
 }
 
 ScreenshotTest::~ScreenshotTest()
commit 52d591ffde5e449332f9249de83561184650e408
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 2 19:45:28 2016 +0100

    use SvtSysLocaleOptions::GetRealLanguageTag(), not GetLocaleConfigString()
    
    Testing for GetLocaleConfigString() starting with a language code could never
    have worked if configured was "Default - ..." in which case the config string
    is an empty string.
    
    Change-Id: I3a68a168a0f8e53c8c389fc243e40053f5d45e1f

diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index eb3be33..1eb1cfb 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1088,8 +1088,8 @@ void SwInsertConfig::Load()
             {
                 //#i61007#  initialize caption order, right now only HUNGARIAN seems to need a different order
                 SvtSysLocaleOptions aSysLocaleOptions;
-                OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
-                bCaptionOrderNumberingFirst = sLang.startsWith( "hu" );
+                const LanguageTag& rLang = aSysLocaleOptions.GetRealLanguageTag();
+                bCaptionOrderNumberingFirst = (rLang.getLanguage() == "hu");
             }
         }
 


More information about the Libreoffice-commits mailing list