[Libreoffice-commits] core.git: cui/source cui/uiconfig

Mike Kaganski mike.kaganski at collabora.com
Thu Nov 9 03:36:38 UTC 2017


 cui/source/options/optgdlg.cxx    |  125 ++++++++++++++++++++++++--------------
 cui/source/options/optgdlg.hxx    |    5 +
 cui/uiconfig/ui/optgeneralpage.ui |   65 +++++++++++++++++++
 3 files changed, 148 insertions(+), 47 deletions(-)

New commits:
commit 6502ebb0e977f6bea305e5e1598520a6b8b9f770
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Wed Nov 8 23:12:44 2017 +0300

    Related: tdf#110448: move Quickstart options to General page
    
    Change-Id: Ib1eab8202903adb5bfcf9bfcabab5d12a773d3bb
    Reviewed-on: https://gerrit.libreoffice.org/44508
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index a9e21f35a0d2..1c90931c7afb 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -203,57 +203,57 @@ DeactivateRC OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
 
 namespace
 {
-        OUString impl_SystemFileOpenServiceName()
-        {
-            const OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
-
-            if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde4") )
-            {
-                #if ENABLE_KDE4
-                return OUString("com.sun.star.ui.dialogs.KDE4FilePicker" );
-                #else
-                return OUString();
-                #endif
-            }
-            #if defined(_WIN32)
-            return OUString("com.sun.star.ui.dialogs.SystemFilePicker");
-            #elif defined MACOSX
-            return OUString("com.sun.star.ui.dialogs.AquaFilePicker");
-            #else
-            return OUString();
-            #endif
-        }
+OUString impl_SystemFileOpenServiceName()
+{
+    const OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
+
+    if ( rDesktopEnvironment.equalsIgnoreAsciiCase("kde4") )
+    {
+        #if ENABLE_KDE4
+        return OUString("com.sun.star.ui.dialogs.KDE4FilePicker" );
+        #else
+        return OUString();
+        #endif
+    }
+    #if defined(_WIN32)
+    return OUString("com.sun.star.ui.dialogs.SystemFilePicker");
+    #elif defined MACOSX
+    return OUString("com.sun.star.ui.dialogs.AquaFilePicker");
+    #else
+    return OUString();
+    #endif
+}
 
-        bool lcl_HasSystemFilePicker()
-        {
-            if( Application::hasNativeFileSelection() )
-                return true;
+bool lcl_HasSystemFilePicker()
+{
+    if( Application::hasNativeFileSelection() )
+        return true;
 
-            // Otherwise fall-back on querying services
-            bool bRet = false;
-            Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+    // Otherwise fall-back on querying services
+    bool bRet = false;
+    Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
 
-            Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
-            Reference< XSet > xSet( xFactory, UNO_QUERY );
+    Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
+    Reference< XSet > xSet( xFactory, UNO_QUERY );
 
-            if ( ! xEnumAccess.is() || ! xSet.is() )
-                return bRet;
+    if ( ! xEnumAccess.is() || ! xSet.is() )
+        return bRet;
 
-            try
-            {
-                OUString aFileService = impl_SystemFileOpenServiceName();
-                Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
-                if ( xEnum.is() && xEnum->hasMoreElements() )
-                    bRet = true;
-            }
-            catch (const IllegalArgumentException&)
-            {
-            }
-            catch (const ElementExistException&)
-            {
-            }
-            return bRet;
-        }
+    try
+    {
+        OUString aFileService = impl_SystemFileOpenServiceName();
+        Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
+        if ( xEnum.is() && xEnum->hasMoreElements() )
+            bRet = true;
+    }
+    catch (const IllegalArgumentException&)
+    {
+    }
+    catch (const ElementExistException&)
+    {
+    }
+    return bRet;
+}
 }
 
 OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
@@ -278,6 +278,13 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
     get(m_pYearValueField, "year");
     get(m_pToYearFT, "toyear");
     get(m_pCollectUsageInfo, "collectusageinfo");
+    get(m_pQuickStarterFrame, "quickstarter");
+
+#if defined(UNX)
+    get(m_pQuickLaunchCB, "systray");
+#else
+    get(m_pQuickLaunchCB, "quicklaunch");
+#endif
 
     if (m_pFileDlgCB->IsVisible() && SvtMiscOptions().IsUseSystemFileDialogReadOnly())
     {
@@ -285,6 +292,13 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
         m_pFileDlgCB->Disable();
     }
 
+    m_pQuickLaunchCB->Show();
+
+    //Only available in Win or if building the gtk systray
+#if !defined(_WIN32) && ! ENABLE_GTK
+    m_pQuickStarterFrame->Hide();
+#endif
+
     m_aStrDateInfo = m_pToYearFT->GetText();
     m_pYearValueField->SetUseThousandSep(false);
     m_pYearValueField->SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) );
@@ -308,6 +322,8 @@ void OfaMiscTabPage::dispose()
     m_pYearValueField.clear();
     m_pToYearFT.clear();
     m_pCollectUsageInfo.clear();
+    m_pQuickStarterFrame.clear();
+    m_pQuickLaunchCB.clear();
     SfxTabPage::dispose();
 }
 
@@ -362,6 +378,12 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
 
     batch->commit();
 
+    if( m_pQuickLaunchCB->IsValueChangedFromSaved())
+    {
+        rSet->Put(SfxBoolItem(SID_ATTR_QUICKLAUNCHER, m_pQuickLaunchCB->IsChecked()));
+        bModified = true;
+    }
+
     return bModified;
 }
 
@@ -393,6 +415,17 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
     m_pCollectUsageInfo->Check(officecfg::Office::Common::Misc::CollectUsageInformation::get());
     m_pCollectUsageInfo->Enable(!officecfg::Office::Common::Misc::CollectUsageInformation::isReadOnly());
     m_pCollectUsageInfo->SaveValue();
+
+    SfxItemState eState = rSet->GetItemState( SID_ATTR_QUICKLAUNCHER, false, &pItem );
+    if ( SfxItemState::SET == eState )
+        m_pQuickLaunchCB->Check( static_cast<const SfxBoolItem*>(pItem)->GetValue() );
+    else if ( SfxItemState::DISABLED == eState )
+    {
+        // quickstart not installed
+        m_pQuickStarterFrame->Hide();
+    }
+
+    m_pQuickLaunchCB->SaveValue();
 }
 
 IMPL_LINK_NOARG( OfaMiscTabPage, TwoFigureHdl, Edit&, void )
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index d0255c31793c..ceba711ede24 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -54,10 +54,13 @@ private:
     VclPtr<NumericField> m_pYearValueField;
     VclPtr<FixedText>    m_pToYearFT;
 
-    OUString      m_aStrDateInfo;
+    OUString             m_aStrDateInfo;
 
     VclPtr<CheckBox>     m_pCollectUsageInfo;
 
+    VclPtr<VclContainer> m_pQuickStarterFrame;
+    VclPtr<CheckBox>     m_pQuickLaunchCB;
+
     DECL_LINK( TwoFigureHdl, Edit&, void );
 protected:
     virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui
index 49d383ec4a37..986edb599dfd 100644
--- a/cui/uiconfig/ui/optgeneralpage.ui
+++ b/cui/uiconfig/ui/optgeneralpage.ui
@@ -317,5 +317,70 @@
         <property name="top_attach">5</property>
       </packing>
     </child>
+    <child>
+      <object class="GtkFrame" id="quickstarter">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment7">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkGrid" id="grid7">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkCheckButton" id="quicklaunch">
+                    <property name="label" translatable="yes" context="optgeneralpage|quicklaunch">Load %PRODUCTNAME during system start-up</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="systray">
+                    <property name="label" translatable="yes" context="optgeneralpage|systray">Enable systray Quickstarter</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label8">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes" context="optgeneralpage|label8">%PRODUCTNAME Quickstarter</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">6</property>
+      </packing>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list