summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-05-23 18:06:52 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-05-23 16:02:18 -0500
commit8de2b492b1344f832fd118be22aaab9947bec865 (patch)
tree6b4182bc577b0f02ccd4d3547edcd2c310254e6b
parent860e8915ff22b610985845b88f5293629f24250a (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/options/optgdlg.cxx6
-rw-r--r--cui/source/options/optgdlg.hxx2
2 files changed, 7 insertions, 1 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 5e826bd30d17..7fc1fe26fed0 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 3b5799fda5be..2f649d40e000 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* ) ;