[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kicker/ui
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2003-11-03 23:30:30
[Download RAW message or body]

CVS commit by aseigo: 

make menu title configurable with 

[menus]
ShowMenuTitles=true

for small screens and small minds


  M +12 -8     k_mnu.cpp   1.80
  M +21 -5     service_mnu.cpp   1.68


--- kdebase/kicker/ui/k_mnu.cpp  #1.79:1.80
@@ -198,4 +198,10 @@ void PanelKMenu::initialize()
 */
     PanelServiceMenu::initialize();
+
+    KConfig *config = KGlobal::config();
+    config->setGroup("menus");
+
+    if (config->readBoolEntry("ShowMenuTitles", true))
+    {
     int id;
     id = insertItem(new PopupMenuTitle(i18n("All Applications"), font()), -1 /* id \
*/, 0); @@ -203,10 +209,8 @@ void PanelKMenu::initialize()
     id = insertItem(new PopupMenuTitle(i18n("Actions"), font()), -1 /* id */, -1);
     setItemEnabled( id, false );
+    }
 
     // create recent menu section
     createRecentMenuItems();
-
-    KConfig *config = KGlobal::config();
-    config->setGroup("menus");
 
     bool need_separator = false;

--- kdebase/kicker/ui/service_mnu.cpp  #1.67:1.68
@@ -91,5 +91,8 @@ void PanelServiceMenu::createRecentMenuI
 
     if (RecentApps.count() > 0) {
-        bool bSeparator = false;
+        KConfig* config  = KGlobal::config();
+        config->setGroup("menus");
+        bool showTitles = config->readBoolEntry("ShowMenuTitles", true);
+        bool bSeparator = !showTitles;
         int nId = idStart + kRecentMenusOffset;
 
@@ -102,6 +105,5 @@ void PanelServiceMenu::createRecentMenuI
                 if (!bSeparator) {
                     bSeparator = true;
-                    int id;
-                    id = insertItem(new PopupMenuTitle(s_RecentApps.caption(), \
font()), idStart + kRecentMenusOffset -1, 0); +                    int id = \
insertItem(new PopupMenuTitle(s_RecentApps.caption(), font()), idStart + \
kRecentMenusOffset -1, 0);  setItemEnabled( id, false );
                 }
@@ -113,4 +115,9 @@ void PanelServiceMenu::createRecentMenuI
                 break;
         }
+
+        if (!showTitles)
+        {
+            insertSeparator(s_RecentApps.m_nNumMenuItems);
+        }
     }
 }
@@ -159,5 +166,8 @@ void PanelServiceMenu::updateRecent()
     if (RecentApps.count() > 0)
     {
-        bool bNeedSeparator = true;
+        KConfig* config  = KGlobal::config();
+        config->setGroup("menus");
+        bool showTitles = config->readBoolEntry("ShowMenuTitles", true);
+        bool bNeedSeparator = showTitles;
         for (QValueList<QString>::ConstIterator it = RecentApps.fromLast(); ; --it)
         {
@@ -172,5 +182,6 @@ void PanelServiceMenu::updateRecent()
                 {
                     bNeedSeparator = false;
-                    insertItem(new PopupMenuTitle(s_RecentApps.caption(), font()), \
nId - 1, 0); +                    int id = insertItem(new \
PopupMenuTitle(s_RecentApps.caption(), font()), nId - 1, 0); +                    \
setItemEnabled( id, false );  }
                 insertMenuItem(s, nId++, 1);
@@ -180,4 +191,9 @@ void PanelServiceMenu::updateRecent()
             if (it == RecentApps.begin())
                 break;
+        }
+
+        if (!showTitles)
+        {
+            insertSeparator(s_RecentApps.m_nNumMenuItems);
         }
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic