cui/source/options/optgdlg.cxx    |   29 +++++++++++++++++++----------
 cui/source/options/optgdlg.hxx    |    3 ++-
 cui/uiconfig/ui/optgeneralpage.ui |   37 ++++++++++++++++++++++++++++++++-----
 3 files changed, 53 insertions(+), 16 deletions(-)

New commits:
commit c0d3205c4686680a6eea00286fa49cc3d51be672
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Dec 5 17:43:00 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Dec 6 08:43:33 2025 +0100

    tdf#169505 Add checkbox to enable/disable native color dialog
    
    Add a checkbox in the option dialog's "General" tab to
    allow to easily enable/disable the use of the custom
    LibreOffice color picker dialog instead of a native one.
    
    This makes the option newly introduced in previous commit
    
        Change-Id: I99c5f1e350c36aa3cb70f26724cce9263160f945
        Author: Michael Weghorn <[email protected]>
        Date:   Fri Dec 5 16:59:14 2025 +0100
    
            tdf#169505 Allow disabling native color pickers
    
    settable via a checkbox in that tab page of the dialog
    instead of only via expert settings.
    
    Add the checkbox to the existing frame that provides
    such an option for the file dialogs already, and tweak
    the wording/visibility a bit.
    
    Change-Id: Icf3746d5936d9df6e52554b5c232632689c2729d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195105
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 9f9ece1304d8..ec19175b6eac 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -162,9 +162,10 @@ OfaMiscTabPage::OfaMiscTabPage(weld::Container* pPage, 
weld::DialogController* p
     , m_xPopUpNoHelpImg(m_xBuilder->weld_widget(u"lockpopupnohelp"_ustr))
     , 
m_xShowTipOfTheDay(m_xBuilder->weld_check_button(u"cbShowTipOfTheDay"_ustr))
     , 
m_xShowTipOfTheDayImg(m_xBuilder->weld_widget(u"lockcbShowTipOfTheDay"_ustr))
-    , m_xFileDlgFrame(m_xBuilder->weld_widget(u"filedlgframe"_ustr))
     , m_xFileDlgROImage(m_xBuilder->weld_widget(u"lockimage"_ustr))
     , m_xFileDlgCB(m_xBuilder->weld_check_button(u"filedlg"_ustr))
+    , 
m_xColorDlgROImage(m_xBuilder->weld_widget(u"locksystemcolordialogs"_ustr))
+    , m_xColorDlgCB(m_xBuilder->weld_check_button(u"systemcolordialogs"_ustr))
     , m_xDocStatusCB(m_xBuilder->weld_check_button(u"docstatus"_ustr))
     , m_xDocStatusImg(m_xBuilder->weld_widget(u"lockdocstatus"_ustr))
     , m_xYearFrame(m_xBuilder->weld_widget(u"yearframe"_ustr))
@@ -261,6 +262,12 @@ bool OfaMiscTabPage::FillItemSet( SfxItemSet* rSet )
         bModified = true;
     }
 
+    if (m_xColorDlgCB->get_state_changed_from_saved())
+    {
+        
officecfg::Office::Common::Misc::UseSystemColorDialog::set(!m_xColorDlgCB->get_active(),
 batch);
+        bModified = true;
+    }
+
     if ( m_xFileDlgCB->get_state_changed_from_saved() )
     {
         officecfg::Office::Common::Misc::UseSystemFileDialog::set( 
!m_xFileDlgCB->get_active(), batch );
@@ -330,15 +337,17 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet )
     m_xShowTipOfTheDayImg->set_visible(!bEnable);
     m_xShowTipOfTheDay->save_state();
 
-    if (!lcl_HasSystemFilePicker())
-        m_xFileDlgFrame->hide();
-    else
-    {
-        bEnable = 
!officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly();
-        m_xFileDlgCB->set_sensitive(bEnable);
-        m_xFileDlgROImage->set_visible(!bEnable);
-    }
-    
m_xFileDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemFileDialog::get());
+    bEnable = 
!officecfg::Office::Common::Misc::UseSystemColorDialog::isReadOnly();
+    m_xColorDlgCB->set_sensitive(bEnable);
+    m_xColorDlgROImage->set_visible(!bEnable);
+    
m_xColorDlgCB->set_active(!officecfg::Office::Common::Misc::UseSystemColorDialog::get());
+    m_xColorDlgCB->save_state();
+
+    const bool bReadOnly = 
officecfg::Office::Common::Misc::UseSystemFileDialog::isReadOnly();
+    bEnable = !bReadOnly && lcl_HasSystemFilePicker();
+    m_xFileDlgCB->set_sensitive(bEnable);
+    m_xFileDlgROImage->set_visible(bReadOnly);
+    m_xFileDlgCB->set_active(!lcl_HasSystemFilePicker() || 
!officecfg::Office::Common::Misc::UseSystemFileDialog::get());
     m_xFileDlgCB->save_state();
 
     bEnable = 
!officecfg::Office::Common::Print::PrintingModifiesDocument::isReadOnly();
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 30d8c081241c..4bebe067cd41 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -35,9 +35,10 @@ private:
     std::unique_ptr<weld::Widget> m_xPopUpNoHelpImg;
     std::unique_ptr<weld::CheckButton> m_xShowTipOfTheDay;
     std::unique_ptr<weld::Widget> m_xShowTipOfTheDayImg;
-    std::unique_ptr<weld::Widget> m_xFileDlgFrame;
     std::unique_ptr<weld::Widget> m_xFileDlgROImage;
     std::unique_ptr<weld::CheckButton> m_xFileDlgCB;
+    std::unique_ptr<weld::Widget> m_xColorDlgROImage;
+    std::unique_ptr<weld::CheckButton> m_xColorDlgCB;
     std::unique_ptr<weld::CheckButton> m_xDocStatusCB;
     std::unique_ptr<weld::Widget> m_xDocStatusImg;
     std::unique_ptr<weld::Widget> m_xYearFrame;
diff --git a/cui/uiconfig/ui/optgeneralpage.ui 
b/cui/uiconfig/ui/optgeneralpage.ui
index 57e7f0dfc2d3..20cf7d07ea1a 100644
--- a/cui/uiconfig/ui/optgeneralpage.ui
+++ b/cui/uiconfig/ui/optgeneralpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.24"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -134,13 +134,13 @@
       </packing>
     </child>
     <child>
-      <object class="GtkFrame" id="filedlgframe">
+      <object class="GtkFrame" id="customdialogsframe">
         <property name="visible">True</property>
         <property name="can-focus">False</property>
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=2 n-rows=1 -->
+          <!-- n-columns=2 n-rows=2 -->
           <object class="GtkGrid" id="grid4">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -149,7 +149,7 @@
             <property name="column-spacing">6</property>
             <child>
               <object class="GtkCheckButton" id="filedlg">
-                <property name="label" translatable="yes" 
context="optgeneralpage|filedlg">_Use %PRODUCTNAME dialogs</property>
+                <property name="label" translatable="yes" 
context="optgeneralpage|filedlg">_Use %PRODUCTNAME open/save dialogs</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">False</property>
@@ -174,13 +174,40 @@
                 <property name="top-attach">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkImage" id="locksystemcolordialogs">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="systemcolordialogs">
+                <property name="label" translatable="yes" 
context="optgeneralpage|filedlg">U_se %PRODUCTNAME color dialog</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">False</property>
+                <property name="use-underline">True</property>
+                <property name="draw-indicator">True</property>
+              </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
           </object>
         </child>
         <child type="label">
           <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="optgeneralpage|label2">Open/Save Dialogs</property>
+            <property name="label" translatable="yes" 
context="optgeneralpage|label2">Dialogs</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>

Reply via email to