[Kst] extragear/graphics/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Jan 27 23:52:26 CET 2006


SVN commit 503033 by arwalker:

BUG:120882 Disable raise and lower menu items if they will have no effect.

 M  +18 -5     kstviewobject.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #503032:503033
@@ -1080,7 +1080,8 @@
 
   bool rc = false;
   int id;
-
+  int index;
+  
   _moveToMap.clear();
 
   if (!tagName().isEmpty()) {
@@ -1098,23 +1099,35 @@
   }
 
   if (_layoutActions & Raise) {
-    menu->insertItem(i18n("&Raise"), this, SLOT(raise()));
+    index = menu->insertItem(i18n("&Raise"), this, SLOT(raise()));
     rc = true;
+    if (_parent && !_parent->_children.empty() && _parent->_children.last().data() == this) {
+      menu->setItemEnabled(index, false);
+    }
   }
 
   if (_layoutActions & Lower) {
-    menu->insertItem(i18n("&Lower"), this, SLOT(lower()));
+    index = menu->insertItem(i18n("&Lower"), this, SLOT(lower()));
     rc = true;
+    if (_parent && !_parent->_children.empty() && _parent->_children.first().data() == this) {
+      menu->setItemEnabled(index, false);
+    }
   }
 
   if (_layoutActions & RaiseToTop) {
-    menu->insertItem(i18n("Raise to &Top"), this, SLOT(raiseToTop()));
+    index = menu->insertItem(i18n("Raise to &Top"), this, SLOT(raiseToTop()));
     rc = true;
+    if (_parent && !_parent->_children.empty() && _parent->_children.last().data() == this) {
+      menu->setItemEnabled(index, false);
+    }
   }
 
   if (_layoutActions & LowerToBottom) {
-    menu->insertItem(i18n("Lower to &Bottom"), this, SLOT(lowerToBottom()));
+    index = menu->insertItem(i18n("Lower to &Bottom"), this, SLOT(lowerToBottom()));
     rc = true;
+    if (_parent && !_parent->_children.empty() && _parent->_children.first().data() == this) {
+      menu->setItemEnabled(index, false);
+    }
   }
 
   if (_layoutActions & Rename) {


More information about the Kst mailing list