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

Eike Rathke erack at redhat.com
Fri May 23 14:02:43 PDT 2014


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

New commits:
commit 8de2b492b1344f832fd118be22aaab9947bec865
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
    
    (cherry picked from commit e0480c81a956751e48f8ef36a41c3062c1bed345)
    
    Conflicts:
    	cui/source/options/optgdlg.cxx
    
    Change-Id: I78cd8b304db2243fd105d4b13421b6ea0347e042
    Reviewed-on: https://gerrit.libreoffice.org/9453
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 5e826bd30..7fc1fe2 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1310,7 +1310,7 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
 
     // Configured date acceptance patterns, for example Y-M-D;M-D or empty for
     // locale default.
-    if (m_pDatePatternsED->GetText() != m_pDatePatternsED->GetSavedValue())
+    if (m_bDatePatternsValid && m_pDatePatternsED->GetText() != m_pDatePatternsED->GetSavedValue())
         pLangConfig->aSysLocaleOptions.SetDatePatternsConfigString( m_pDatePatternsED->GetText());
 
     SfxObjectShell* pCurrentDocShell = SfxObjectShell::Current();
@@ -1474,6 +1474,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);
@@ -1670,6 +1672,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;
@@ -1750,6 +1753,7 @@ IMPL_LINK( OfaLanguagesTabPage, DatePatternsHdl, Edit*, pEd )
         pEd->SetControlForeground( INVALID_PATTERN_BACKGROUND_COLOR);
 #endif
     }
+    m_bDatePatternsValid = bValid;
     return 0;
 }
 
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 3b5799f..2f649d4 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -155,6 +155,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