cui/source/options/appearance.cxx |   73 --------------------------------------
 cui/source/options/appearance.hxx |    5 --
 cui/uiconfig/ui/appearance.ui     |   51 --------------------------
 3 files changed, 1 insertion(+), 128 deletions(-)

New commits:
commit 832850eef18270749c70ff72b1d7e13ded7be26c
Author:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
AuthorDate: Fri May 16 10:32:48 2025 +0530
Commit:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
CommitDate: Fri May 23 11:50:06 2025 +0200

    tdf#164970 remove add and remove buttons from appearance tab
    
    the [new] themes panel doesn't have add/remove buttons. also it was
    discussed multiple times in the design meetings that the user sholdn't
    be allowed to create themes and application appearance should only be
    customizable via extensions.
    
    [new]: 
https://bug-attachments.documentfoundation.org/attachment.cgi?id=200044
    
    Change-Id: I77ca75803a73272a7089a1ac11778445fdb52459
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170965
    Reviewed-by: Sahil Gautam <sahil.gautam.ext...@allotropia.de>
    Tested-by: Jenkins

diff --git a/cui/source/options/appearance.cxx 
b/cui/source/options/appearance.cxx
index 10a796aa038c..644a7e7a06fb 100644
--- a/cui/source/options/appearance.cxx
+++ b/cui/source/options/appearance.cxx
@@ -102,8 +102,6 @@ SvxAppearanceTabPage::SvxAppearanceTabPage(weld::Container* 
pPage,
     , pColorConfig(new EditableColorConfig)
     , m_xSchemeList(m_xBuilder->weld_combo_box(u"scheme"_ustr))
     , m_xMoreThemesBtn(m_xBuilder->weld_button(u"morethemesbtn"_ustr))
-    , m_xAddSchemeBtn(m_xBuilder->weld_button(u"newschemebtn"_ustr))
-    , m_xRemoveSchemeBtn(m_xBuilder->weld_button(u"removeschemebtn"_ustr))
     , m_xColorEntryBtn(m_xBuilder->weld_combo_box(u"registrydropdown"_ustr))
     , m_xColorChangeBtn((new 
ColorListBox(m_xBuilder->weld_menu_button(u"colorsdropdownbtn"_ustr),
                                           [this] { return GetFrameWeld(); })))
@@ -197,8 +195,6 @@ void SvxAppearanceTabPage::Reset(const SfxItemSet* /* rSet 
*/)
         
!officecfg::Office::Common::Appearance::ApplicationAppearance::isReadOnly());
     m_xSchemeList->save_value();
 
-    UpdateRemoveBtnState();
-
     // reset ColorConfig
     pColorConfig->ClearModified();
     pColorConfig->DisableBroadcast();
@@ -337,7 +333,6 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, SchemeChangeHdl, 
weld::ComboBox&, void)
         m_bRestartRequired = true;
 
     UpdateColorDropdown();
-    UpdateRemoveBtnState();
 }
 
 IMPL_LINK_NOARG(SvxAppearanceTabPage, SchemeListToggleHdl, weld::ComboBox&, 
void)
@@ -345,12 +340,6 @@ IMPL_LINK_NOARG(SvxAppearanceTabPage, SchemeListToggleHdl, 
weld::ComboBox&, void
     LoadSchemeList();
 }
 
-IMPL_LINK(SvxAppearanceTabPage, CheckNameHdl_Impl, AbstractSvxNameDialog&, 
rDialog, bool)
-{
-    OUString sName = rDialog.GetName();
-    return !sName.isEmpty() && m_xSchemeList->find_text(sName) == -1;
-}
-
 IMPL_STATIC_LINK_NOARG(SvxAppearanceTabPage, MoreThemesHdl, weld::Button&, 
void)
 {
     css::uno::Sequence<css::beans::PropertyValue> aArgs{ 
comphelper::makePropertyValue(
@@ -358,58 +347,6 @@ IMPL_STATIC_LINK_NOARG(SvxAppearanceTabPage, 
MoreThemesHdl, weld::Button&, void)
     comphelper::dispatchCommand(u".uno:AdditionsDialog"_ustr, aArgs);
 }
 
-IMPL_LINK(SvxAppearanceTabPage, AddRemoveSchemeHdl, weld::Button&, rButton, 
void)
-{
-    if (m_xAddSchemeBtn.get() == &rButton)
-    {
-        OUString sName;
-        SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-        ScopedVclPtr<AbstractSvxNameDialog> 
aNameDlg(pFact->CreateSvxNameDialog(
-            GetFrameWeld(), sName, CuiResId(RID_CUISTR_COLOR_CONFIG_SAVE2)));
-        aNameDlg->SetCheckNameHdl(LINK(this, SvxAppearanceTabPage, 
CheckNameHdl_Impl));
-        aNameDlg->SetText(CuiResId(RID_CUISTR_COLOR_CONFIG_SAVE1));
-        aNameDlg->SetHelpId(HID_OPTIONS_COLORCONFIG_SAVE_SCHEME);
-        aNameDlg->SetCheckNameHdl(LINK(this, SvxAppearanceTabPage, 
CheckNameHdl_Impl));
-        if (RET_OK == aNameDlg->Execute())
-        {
-            sName = aNameDlg->GetName();
-            pColorConfig->AddScheme(sName);
-            m_xSchemeList->append_text(sName);
-            m_xSchemeList->set_active_text(sName);
-            SchemeChangeHdl(*m_xSchemeList);
-
-            ColorConfigValue aValue;
-            aValue.nDarkColor = COL_AUTO;
-            aValue.nLightColor = COL_AUTO;
-
-            for (size_t i = 0; i < WINDOWCOLOR; ++i)
-                pColorConfig->SetColorValue(static_cast<ColorConfigEntry>(i), 
aValue);
-        }
-    }
-    else
-    {
-        DBG_ASSERT(m_xSchemeList->get_count() > 1, "don't delete the last 
scheme");
-        std::unique_ptr<weld::MessageDialog> 
xQuery(Application::CreateMessageDialog(
-            GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
-            CuiResId(RID_CUISTR_COLOR_CONFIG_DELETE)));
-        xQuery->set_title(CuiResId(RID_CUISTR_COLOR_CONFIG_DELETE_TITLE));
-
-        if (RET_YES == xQuery->run())
-        {
-            OUString sDeleteScheme(m_xSchemeList->get_active_text());
-            m_xSchemeList->remove(m_xSchemeList->get_active());
-            m_xSchemeList->set_active(0);
-            SchemeChangeHdl(*m_xSchemeList);
-            //first select the new scheme and then delete the old one
-            pColorConfig->DeleteScheme(sDeleteScheme);
-        }
-    }
-
-    // disable remove button if only one scheme available
-    // or if the selected theme is AUTOMATIC_COLOR_SCHEME
-    UpdateRemoveBtnState();
-}
-
 IMPL_LINK_NOARG(SvxAppearanceTabPage, ColorImageToggleHdl, weld::Toggleable&, 
void)
 {
     // get the active entry
@@ -485,11 +422,7 @@ void SvxAppearanceTabPage::InitThemes()
 
     m_xSchemeList->connect_changed(LINK(this, SvxAppearanceTabPage, 
SchemeChangeHdl));
     m_xSchemeList->connect_popup_toggled(LINK(this, SvxAppearanceTabPage, 
SchemeListToggleHdl));
-    m_xAddSchemeBtn->connect_clicked(LINK(this, SvxAppearanceTabPage, 
AddRemoveSchemeHdl));
     m_xMoreThemesBtn->connect_clicked(LINK(this, SvxAppearanceTabPage, 
MoreThemesHdl));
-    m_xRemoveSchemeBtn->connect_clicked(LINK(this, SvxAppearanceTabPage, 
AddRemoveSchemeHdl));
-
-    UpdateRemoveBtnState();
 }
 
 void SvxAppearanceTabPage::InitCustomization()
@@ -523,12 +456,6 @@ void SvxAppearanceTabPage::InitCustomization()
     EnableImageControls(false);
 }
 
-// enable remove button for custom themes only
-void SvxAppearanceTabPage::UpdateRemoveBtnState()
-{
-    
m_xRemoveSchemeBtn->set_sensitive(ThemeColors::IsCustomTheme(m_xSchemeList->get_active_id()));
-}
-
 void SvxAppearanceTabPage::EnableImageControls(bool bEnabled)
 {
     m_xImageRadioBtn->set_sensitive(bEnabled);
diff --git a/cui/source/options/appearance.hxx 
b/cui/source/options/appearance.hxx
index 3ee7295c1eb5..03dfb850b41b 100644
--- a/cui/source/options/appearance.hxx
+++ b/cui/source/options/appearance.hxx
@@ -38,8 +38,6 @@ private:
 
     std::unique_ptr<weld::ComboBox> m_xSchemeList;
     std::unique_ptr<weld::Button> m_xMoreThemesBtn;
-    std::unique_ptr<weld::Button> m_xAddSchemeBtn;
-    std::unique_ptr<weld::Button> m_xRemoveSchemeBtn;
     std::unique_ptr<weld::ComboBox> m_xColorEntryBtn;
     std::unique_ptr<ColorListBox> m_xColorChangeBtn;
     std::unique_ptr<weld::CheckButton> m_xShowInDocumentChkBtn;
@@ -58,8 +56,6 @@ private:
     DECL_LINK(SchemeChangeHdl, weld::ComboBox&, void);
     DECL_LINK(SchemeListToggleHdl, weld::ComboBox&, void);
     DECL_STATIC_LINK(SvxAppearanceTabPage, MoreThemesHdl, weld::Button&, void);
-    DECL_LINK(AddRemoveSchemeHdl, weld::Button&, void);
-    DECL_LINK(CheckNameHdl_Impl, AbstractSvxNameDialog&, bool);
     DECL_LINK(ColorImageToggleHdl, weld::Toggleable&, void);
     DECL_LINK(StretchedTiledToggleHdl, weld::Toggleable&, void);
     DECL_LINK(BitmapChangeHdl, weld::ComboBox&, void);
@@ -69,7 +65,6 @@ private:
     void InitCustomization();
     void LoadSchemeList();
 
-    void UpdateRemoveBtnState();
     void EnableImageControls(bool bEnabled);
     void UpdateColorDropdown();
     void FillItemsList();
diff --git a/cui/uiconfig/ui/appearance.ui b/cui/uiconfig/ui/appearance.ui
index b3463f394b23..3a8fb4565ef9 100644
--- a/cui/uiconfig/ui/appearance.ui
+++ b/cui/uiconfig/ui/appearance.ui
@@ -80,55 +80,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButtonBox">
-                    <property name="visible">True</property>
-                    <property name="can-focus">False</property>
-                    <property name="margin-top">12</property>
-                    <property name="layout-style">spread</property>
-                    <child>
-                      <object class="GtkButton" id="newschemebtn">
-                        <property name="label" translatable="yes" 
context="appearancetabpage|newschemebtn">New</property>
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="receives-default">True</property>
-                        <property name="margin-end">3</property>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" 
id="newschemebtn-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="appearance|extended_tip|newschemebutton">Click to 
add a new theme to the list. </property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="removeschemebtn">
-                        <property name="label" translatable="yes" 
context="appearancetabpage|removeschemebtn">Remove</property>
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="receives-default">True</property>
-                        <property name="margin-start">3</property>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" 
id="removeschemebtn-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="appearance|extended_tip|removeschemebtn">Click to 
remove the applied scheme. The theme is reset to Automatic.</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
             </child>
@@ -239,7 +191,6 @@
                             <property name="receives-default">True</property>
                             <property name="halign">start</property>
                             <property name="draw-indicator">True</property>
-                            <property name="label" 
translatable="no"></property>
                             <child>
                               <placeholder/>
                             </child>

Reply via email to