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

List:       kde-commits
Subject:    kdebase/kcontrol/kcontrol
From:       Frans Englich <frans.englich () telia ! com>
Date:       2004-08-01 1:58:20
Message-ID: 20040801015820.17A4B9A6D () office ! kde ! org
[Download RAW message or body]

CVS commit by englich: 


Do not show empty categories.

Fix for #85916, probably


  M +13 -9     modules.cpp   1.55
  M +1 -1      modules.h   1.21


--- kdebase/kcontrol/kcontrol/modules.cpp  #1.54:1.55
@@ -256,15 +256,19 @@ void ConfigModuleList::readDesktopEntrie
 }
 
-void ConfigModuleList::readDesktopEntriesRecursive(const QString &path)
+bool ConfigModuleList::readDesktopEntriesRecursive(const QString &path)
 {
-  Menu *menu = new Menu;
-  subMenus.insert(path, menu);
 
   KServiceGroup::Ptr group = KServiceGroup::group(path);
 
-  if (!group || !group->isValid()) return;
+  if (!group || !group->isValid()) return false;
 
   KServiceGroup::List list = group->entries(true, true);
 
+  if( list.isEmpty() )
+          return false;
+
+  Menu *menu = new Menu;
+  subMenus.insert(path, menu);
+
   for( KServiceGroup::List::ConstIterator it = list.begin();
        it != list.end(); it++)
@@ -287,10 +291,10 @@ void ConfigModuleList::readDesktopEntrie
         menu->modules.append(module);
      }
-     else if (p->isType(KST_KServiceGroup))
-     {
-        readDesktopEntriesRecursive(p->entryPath());
+     else if (p->isType(KST_KServiceGroup) && 
+                     readDesktopEntriesRecursive(p->entryPath()) )
         menu->submenus.append(p->entryPath());
+
      }
-  }
+  return true;
 }
 

--- kdebase/kcontrol/kcontrol/modules.h  #1.20:1.21
@@ -90,5 +90,5 @@ public:
 
   void readDesktopEntries();
-  void readDesktopEntriesRecursive(const QString &path);
+  bool readDesktopEntriesRecursive(const QString &path);
 
   /**


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

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