[Libreoffice-commits] core.git: 2 commits - cui/source include/svtools svtools/source vcl/source

Jan Holesovsky kendy at collabora.com
Mon May 25 02:47:46 PDT 2015


 cui/source/options/optgdlg.cxx    |    8 ++---
 include/svtools/miscopt.hxx       |    1 
 svtools/source/config/miscopt.cxx |   57 ++++++++++----------------------------
 vcl/source/app/settings.cxx       |   13 ++++++++
 4 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit 55c6bd93e9c02b2160b82c0d489d05ba31a0f13c
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon May 25 11:39:42 2015 +0200

    tdf#90127: Read icon theme from the config when called too early.
    
    Change-Id: I9999150cafde6b103cf1a80232113b7a3d11cfdb

diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 15eca7d..5e67ba9c 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -3028,6 +3028,19 @@ StyleSettings::SetIconTheme(const OUString& theme)
 OUString
 StyleSettings::DetermineIconTheme() const
 {
+    if (mxData->mIconTheme.isEmpty())
+    {
+        // read from the configuration, or fallback to what the desktop wants
+        uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+        if (xContext.is())
+        {
+            mxData->mIconTheme = officecfg::Office::Common::Misc::SymbolStyle::get(xContext);
+
+            if (mxData->mIconTheme.isEmpty() || mxData->mIconTheme == "auto")
+                mxData->mIconTheme = GetAutomaticallyChosenIconTheme();
+        }
+    }
+
     OUString r = mxData->mIconThemeSelector->SelectIconTheme(
                         mxData->mIconThemeScanner->GetFoundIconThemes(),
                         mxData->mIconTheme
commit 4163bde70568d6d5dd7144293484f797e8df9e63
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon May 25 11:08:13 2015 +0200

    related tdf#90127: Simplify setting of the 'auto' icon theme.
    
    Change-Id: I9aedfd0b7943517b5444195b63140132dd728d57

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 893ab53..b82189f 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 28cd67c..6e321d2 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 e3384e5..48adb6f 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()
 {


More information about the Libreoffice-commits mailing list