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

List:       kde-commits
Subject:    kdebase/kmenuedit
From:       Waldo Bastian <bastian () kde ! org>
Date:       2004-05-04 9:03:21
Message-ID: 20040504090321.8E6289263 () office ! kde ! org
[Download RAW message or body]

CVS commit by waba: 

It's ok to have multiple empty shortcuts. (BR74358)
(Shortcut can be empty without being null!)


  M +15 -2     menuinfo.cpp   1.10


--- kdebase/kmenuedit/menuinfo.cpp  #1.9:1.10
@@ -359,7 +359,17 @@ KShortcut MenuEntryInfo::shortcut()
 }
 
+static bool isEmpty(const KShortcut &shortCut)
+{
+   for(int i = shortCut.count(); i--;)
+   {
+      if (!shortCut.seq(i).isNull())
+         return false;
+   }
+   return true;
+}
+
 static void freeShortcut(const KShortcut &shortCut)
 {
-   if (!shortCut.isNull())
+   if (!isEmpty(shortCut))
    {
       QString shortcutKey = shortCut.toString();
@@ -376,5 +386,5 @@ static void freeShortcut(const KShortcut
 static void allocateShortcut(const KShortcut &shortCut)
 {
-   if (!shortCut.isNull())
+   if (!isEmpty(shortCut))
    {
       QString shortcutKey = shortCut.toString();
@@ -398,4 +408,7 @@ void MenuEntryInfo::setShortcut(const KS
 
    shortCut = _shortcut;
+   if (isEmpty(shortCut))
+      shortCut = KShortcut(); // Normalize
+
    shortcutLoaded = true;
    shortcutDirty = true;


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

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