From e472bc288eb6a4457a8905619b4baa49ff395509 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Sat, 16 May 2026 06:49:14 +0300
Subject: kcontrol/kicker: add a control for button text color

This adds a KColorButton to choose the color of the text of the menu
button.

Closes: https://mirror.git.trinitydesktop.org/gitea/TDE/tdebase/issues/737
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 kcontrol/kicker/menutab.ui       | 37 +++++++++++++++++++++++++++++++++----
 kcontrol/kicker/menutab_impl.cpp |  7 +++++--
 2 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/kcontrol/kicker/menutab.ui b/kcontrol/kicker/menutab.ui
index 7a9f8b8bc..2dc1f3591 100644
--- a/kcontrol/kicker/menutab.ui
+++ b/kcontrol/kicker/menutab.ui
@@ -8,8 +8,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>749</width>
-            <height>586</height>
+            <width>754</width>
+            <height>600</height>
         </rect>
     </property>
     <property name="caption">
@@ -343,6 +343,22 @@
                                 <string>&lt;qt&gt;When this option is selected the text below will be shown in the TDE Menu button.</string>
                             </property>
                         </widget>
+                        <widget class="TQLabel" row="7" column="0">
+                            <property name="name">
+                                <cstring>colorLabel</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Color:</string>
+                            </property>
+                        </widget>
+                        <widget class="KColorButton" row="7" column="1">
+                            <property name="name">
+                                <cstring>kcfg_ButtonTextColor</cstring>
+                            </property>
+                            <property name="text">
+                                <string></string>
+                            </property>
+                        </widget>
                         <widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="2">
                             <property name="name">
                                 <cstring>kcfg_UseTopPixmap</cstring>
@@ -359,7 +375,7 @@
 								&lt;p&gt;&lt;b&gt;Tip&lt;/b&gt;: You can customize the image that appears in the TDE Menu by putting image files called kside_top_left.png and kside_top_right.png, and a tileable image file called kside_top_tile.png in $TDEHOME/share/apps/kicker/pics.&lt;/qt&gt;</string>
                             </property>
                         </widget>
-                        <spacer row="7" column="1">
+                        <spacer row="8" column="1">
                             <property name="name">
                                 <cstring>spacer6</cstring>
                             </property>
@@ -372,7 +388,7 @@
                             <property name="sizeHint">
                                 <size>
                                     <width>20</width>
-                                    <height>80</height>
+                                    <height>50</height>
                                 </size>
                             </property>
                         </spacer>
@@ -759,6 +775,18 @@
         <receiver>kcfg_ButtonFont</receiver>
         <slot>setEnabled(bool)</slot>
     </connection>
+    <connection>
+        <sender>kcfg_ShowKMenuText</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>colorLabel</receiver>
+        <slot>setEnabled(bool)</slot>
+    </connection>
+    <connection>
+        <sender>kcfg_ShowKMenuText</sender>
+        <signal>toggled(bool)</signal>
+        <receiver>kcfg_ButtonTextColor</receiver>
+        <slot>setEnabled(bool)</slot>
+    </connection>
     <connection>
         <sender>kcfg_UseSearchBar</sender>
         <signal>toggled(bool)</signal>
@@ -793,6 +821,7 @@
     <include location="global" impldecl="in implementation">tdefontrequester.h</include>
     <include location="global" impldecl="in implementation">tdelistview.h</include>
     <include location="global" impldecl="in implementation">kkeybutton.h</include>
+    <include location="global" impldecl="in implementation">kcolorbutton.h</include>
 </includes>
 <layoutdefaults spacing="6" margin="11"/>
 <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp
index 44643d366..4f3ace13a 100644
--- a/kcontrol/kicker/menutab_impl.cpp
+++ b/kcontrol/kicker/menutab_impl.cpp
@@ -37,6 +37,7 @@
 #include <knuminput.h>
 #include <tdestandarddirs.h>
 #include <tdefontrequester.h>
+#include <kcolorbutton.h>
 #include <kkeybutton.h>
 #include <tdemessagebox.h>
 
@@ -255,7 +256,6 @@ void MenuTab::save()
     TQString oldmenutextsetting = c->readEntry("Text", "");
 
     c->setGroup("buttons");
-    TQFont oldmenufontsetting = c->readFontEntry("Font");
 
     if (kmenusetting != oldkmenusetting) {
         forceRestart = true;
@@ -266,7 +266,10 @@ void MenuTab::save()
     if (kcfg_KMenuText->text() != oldmenutextsetting) {
         forceRestart = true;
     }
-    if (kcfg_ButtonFont->font() != oldmenufontsetting) {
+    if (kcfg_ButtonFont->font() != c->readFontEntry("Font")) {
+        forceRestart = true;
+    }
+    if (kcfg_ButtonTextColor->color() != c->readColorEntry("TextColor")) {
         forceRestart = true;
     }
 
-- 
cgit v1.2.3

