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

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-01-25 1:41:17
Message-ID: 1201225277.117921.31214.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 766021 by aseigo:

put the applet's menu items first, put remove at the end.


 M  +32 -28    containment.cpp  


--- trunk/KDE/kdebase/workspace/libs/plasma/containment.cpp #766020:766021
@@ -226,28 +226,17 @@
 
     KMenu desktopMenu;
     //kDebug() << "context menu event " << (QObject*)applet;
-    if (!applet) {
-        if (!scene() || (static_cast<Corona*>(scene())->isImmutable() && \
                !KAuthorized::authorizeKAction("unlock_desktop"))) {
-            //kDebug() << "immutability";
-            Applet::contextMenuEvent(event);
-            return;
-        }
+    if (applet) {
+        bool hasEntries = false;
 
-        //FIXME: change this to show this only in debug mode (or not at all?)
-        //       before final release
-        QList<QAction*> actions = contextActions();
-
-        if (actions.count() < 1) {
-            //kDebug() << "no applet, but no actions";
-            Applet::contextMenuEvent(event);
-            return;
+        QList<QAction*> actions = applet->contextActions();
+        if (!actions.isEmpty()) {
+            foreach(QAction* action, actions) {
+                desktopMenu.addAction(action);
+            }
+            hasEntries = true;
         }
 
-        foreach(QAction* action, actions) {
-            desktopMenu.addAction(action);
-        }
-    } else {
-        bool hasEntries = false;
         if (applet->hasConfigurationInterface()) {
             QAction* configureApplet = new QAction(i18n("%1 Settings", \
applet->name()), &desktopMenu);  configureApplet->setIcon(KIcon("configure"));
@@ -258,6 +247,10 @@
         }
 
         if (scene() && !static_cast<Corona*>(scene())->isImmutable()) {
+            if (hasEntries) {
+                desktopMenu.addSeparator();
+            }
+
             QAction* closeApplet = new QAction(i18n("Remove this %1", \
applet->name()), &desktopMenu);  QVariant appletV;
             appletV.setValue((QObject*)applet);
@@ -269,20 +262,31 @@
             hasEntries = true;
         }
 
-        QList<QAction*> actions = applet->contextActions();
-        if (!actions.isEmpty()) {
-            desktopMenu.addSeparator();
-            foreach(QAction* action, actions) {
-                desktopMenu.addAction(action);
-            }
-            hasEntries = true;
-        }
-
         if (!hasEntries) {
             Applet::contextMenuEvent(event);
             kDebug() << "no entries";
             return;
         }
+    } else {
+        if (!scene() || (static_cast<Corona*>(scene())->isImmutable() && \
!KAuthorized::authorizeKAction("unlock_desktop"))) { +            //kDebug() << \
"immutability"; +            Applet::contextMenuEvent(event);
+            return;
+        }
+
+        //FIXME: change this to show this only in debug mode (or not at all?)
+        //       before final release
+        QList<QAction*> actions = contextActions();
+
+        if (actions.count() < 1) {
+            //kDebug() << "no applet, but no actions";
+            Applet::contextMenuEvent(event);
+            return;
+        }
+
+        foreach(QAction* action, actions) {
+            desktopMenu.addAction(action);
+        }
     }
 
     event->accept();


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

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