summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-05-25 11:08:13 +0200
committerJan Holesovsky <kendy@collabora.com>2015-05-25 11:47:15 +0200
commit4163bde70568d6d5dd7144293484f797e8df9e63 (patch)
tree1a4527d2f773f10ffcbeb78d49f2815fce276d89
parent677484ce014df4b76dbd24526ea5c74f6bd044d5 (diff)
related tdf#90127: Simplify setting of the 'auto' icon theme.
Change-Id: I9aedfd0b7943517b5444195b63140132dd728d57
-rw-r--r--cui/source/options/optgdlg.cxx8
-rw-r--r--include/svtools/miscopt.hxx1
-rw-r--r--svtools/source/config/miscopt.cxx57
3 files changed, 20 insertions, 46 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 893ab5338d86..b82189f610b0 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -789,10 +789,10 @@ bool OfaViewTabPage::FillItemSet( SfxItemSet* )
if( nStyleLB_InitialSelection != nStyleLB_NewSelection )
{
// 0 means choose style automatically
- if (nStyleLB_NewSelection == 0) {
- aMiscOptions.SetIconThemeAutomatically();
- }
- else {
+ if (nStyleLB_NewSelection == 0)
+ aMiscOptions.SetIconTheme("auto");
+ else
+ {
sal_uInt16 pos = m_pIconStyleLB->GetSelectEntryPos();
const vcl::IconThemeInfo& iconThemeId = mInstalledIconThemes.at(pos-1);
aMiscOptions.SetIconTheme(iconThemeId.GetThemeId());
diff --git a/include/svtools/miscopt.hxx b/include/svtools/miscopt.hxx
index 28cd67c9649b..6e321d26dfea 100644
--- a/include/svtools/miscopt.hxx
+++ b/include/svtools/miscopt.hxx
@@ -78,7 +78,6 @@ class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options
OUString GetIconTheme() const;
void SetIconTheme(const OUString&);
- void SetIconThemeAutomatically();
bool IconThemeWasSetAutomatically();
sal_Int16 GetToolboxStyle() const;
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index e3384e5c2e96..48adb6f4a119 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -179,11 +179,6 @@ class SvtMiscOptions_Impl : public ConfigItem
bool IconThemeWasSetAutomatically()
{return m_bIconThemeWasSetAutomatically;}
- /** Set the icon theme automatically by detecting the best theme for the desktop environment.
- * The parameter setModified controls whether SetModified() will be called.
- */
- void SetIconThemeAutomatically(SetModifiedFlag = SET_MODIFIED);
-
// translate to VCL settings ( "0" = 3D, "1" = FLAT )
inline sal_Int16 GetToolboxStyle()
{ return m_nToolboxStyle ? VCL_TOOLBOX_STYLE_FLAT : 0; }
@@ -333,18 +328,11 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl()
case PROPERTYHANDLE_SYMBOLSTYLE :
{
OUString aIconTheme;
- if( seqValues[nProperty] >>= aIconTheme ) {
- if (aIconTheme == "auto") {
- SetIconThemeAutomatically(DONT_SET_MODIFIED);
- }
- else {
- SetIconTheme(aIconTheme, DONT_SET_MODIFIED);
- }
- }
+ if (seqValues[nProperty] >>= aIconTheme)
+ SetIconTheme(aIconTheme, DONT_SET_MODIFIED);
else
- {
OSL_FAIL("Wrong type of \"Misc\\SymbolStyle\"!" );
- }
+
m_bIsSymbolsStyleRO = seqRO[nProperty];
break;
}
@@ -462,17 +450,10 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
break;
case PROPERTYHANDLE_SYMBOLSTYLE : {
OUString aIconTheme;
- if( seqValues[nProperty] >>= aIconTheme ) {
- if (aIconTheme == "auto") {
- SetIconThemeAutomatically(DONT_SET_MODIFIED);
- }
- else {
- SetIconTheme(aIconTheme, DONT_SET_MODIFIED);
- }
- }
- else {
+ if (seqValues[nProperty] >>= aIconTheme)
+ SetIconTheme(aIconTheme, DONT_SET_MODIFIED);
+ else
OSL_FAIL("Wrong type of \"Misc\\SymbolStyle\"!" );
- }
}
break;
case PROPERTYHANDLE_DISABLEUICUSTOMIZATION : {
@@ -536,10 +517,18 @@ OUString SvtMiscOptions_Impl::GetIconTheme()
void
SvtMiscOptions_Impl::SetIconTheme(const OUString &rName, SetModifiedFlag setModified)
{
+ OUString aTheme(rName);
+ if (aTheme.isEmpty() || aTheme == "auto")
+ {
+ aTheme = Application::GetSettings().GetStyleSettings().GetAutomaticallyChosenIconTheme();
+ m_bIconThemeWasSetAutomatically = true;
+ }
+ else
+ m_bIconThemeWasSetAutomatically = false;
+
AllSettings aAllSettings = Application::GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
- aStyleSettings.SetIconTheme( rName );
- m_bIconThemeWasSetAutomatically = false;
+ aStyleSettings.SetIconTheme(aTheme);
aAllSettings.SetStyleSettings(aStyleSettings);
Application::MergeSystemSettings( aAllSettings );
@@ -883,20 +872,6 @@ void SvtMiscOptions::RemoveListenerLink( const Link<>& rLink )
m_pDataContainer->RemoveListenerLink( rLink );
}
-void
-SvtMiscOptions_Impl::SetIconThemeAutomatically(enum SetModifiedFlag setModified)
-{
- OUString theme = Application::GetSettings().GetStyleSettings().GetAutomaticallyChosenIconTheme();
- SetIconTheme(theme, setModified);
- m_bIconThemeWasSetAutomatically = true;
-}
-
-void
-SvtMiscOptions::SetIconThemeAutomatically()
-{
- m_pDataContainer->SetIconThemeAutomatically();
-}
-
bool
SvtMiscOptions::IconThemeWasSetAutomatically()
{