[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - cui/source

Eike Rathke erack at redhat.com
Fri May 23 09:09:42 PDT 2014


 cui/source/options/optgdlg.cxx |    6 +++++-
 cui/source/options/optgdlg.hxx |    2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit d11969189092d35c13cd421c57f71ca655ea3d19
Author: Eike Rathke <erack at redhat.com>
Date:   Fri May 23 18:06:52 2014 +0200

    do not store invalid date acceptance patterns in configuration
    
    Change-Id: I78cd8b304db2243fd105d4b13421b6ea0347e042
    (cherry picked from commit e0480c81a956751e48f8ef36a41c3062c1bed345)

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 81cf5d5..7b6f947 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1298,7 +1298,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
 
     // Configured date acceptance patterns, for example Y-M-D;M-D or empty for
     // locale default.
-    if (m_pDatePatternsED->IsValueChangedFromSaved())
+    if (m_bDatePatternsValid && m_pDatePatternsED->IsValueChangedFromSaved())
         pLangConfig->aSysLocaleOptions.SetDatePatternsConfigString( m_pDatePatternsED->GetText());
 
     SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
@@ -1463,6 +1463,8 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
         const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
         aDatePatternsString = lcl_getDatePatternsConfigString( rLocaleWrapper);
     }
+    // Let's assume patterns are valid at this point.
+    m_bDatePatternsValid = true;
     m_pDatePatternsED->SetText( aDatePatternsString);
     bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_DATEPATTERNS);
     m_pDatePatternsED->Enable(!bReadonly);
@@ -1659,6 +1661,7 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
 
     // update the date acceptance patterns
     OUString aDatePatternsString = lcl_getDatePatternsConfigString( aLocaleWrapper);
+    m_bDatePatternsValid = true;
     m_pDatePatternsED->SetText( aDatePatternsString);
 
     return 0;
@@ -1770,6 +1773,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, Edit*, pEd )
         pEd->SetControlForeground( ::Color( RGB_COLORDATA( 0xf0, 0, 0)));
 #endif
     }
+    m_bDatePatternsValid = bValid;
     return 0;
 }
 
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index e015f4c..61b2228 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -157,6 +157,8 @@ class OfaLanguagesTabPage : public SfxTabPage
     OUString        m_sUserLocaleValue;
     OUString        m_sSystemDefaultString;
 
+    bool            m_bDatePatternsValid;
+
     DECL_LINK(  SupportHdl, CheckBox* ) ;
     DECL_LINK(  LocaleSettingHdl, SvxLanguageBox* ) ;
     DECL_LINK(  DatePatternsHdl, Edit* ) ;


More information about the Libreoffice-commits mailing list