[Kst] kst_hfi_calib_branch: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Nov 10 11:36:36 CET 2004


CVS commit by staikos: 

- Show "Plot: tagname" in title instead of "tagname" because it can be
  confusing what the context of the context menu is
  menuTitle() virtual function added to view objects for this.
- Put Edit.. before Delete to avoid accidents
- Don't show the plot context menu in label mode.  It's confusing.  This will
  eventually be unnecessary when we have viewobject based labels.


  M +11 -6     kst2dplot.cpp   1.299.2.2
  M +12 -6     kstviewobject.cpp   1.98.2.2
  M +2 -0      kstviewobject.h   1.81.2.1


--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.98.2.1:1.98.2.2
@@ -622,4 +622,9 @@ void KstViewObject::setContentsRect(QRec
 
 
+QString KstViewObject::menuTitle() const {
+  return tagName();
+}
+
+
 bool KstViewObject::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent) {
   Q_UNUSED(pos)
@@ -627,16 +632,17 @@ bool KstViewObject::popupMenu(KPopupMenu
   bool rc = false;
   int id;
+  QString menuTitle = this->menuTitle();
 
-  if (!tagName().isEmpty()) {
-    menu->insertTitle(tagName());
+  if (!menuTitle.isEmpty()) {
+    menu->insertTitle(menuTitle);
   }
 
-  if (_standardActions & Delete) {
-    menu->insertItem(i18n("&Delete"), this, SLOT(deleteObject()));
+  if (_standardActions & Edit) {
+    menu->insertItem(i18n("&Edit..."), this, SLOT(edit()));
     rc = true;
   }
 
-  if (_standardActions & Edit) {
-    menu->insertItem(i18n("&Edit..."), this, SLOT(edit()));
+  if (_standardActions & Delete) {
+    menu->insertItem(i18n("&Delete"), this, SLOT(deleteObject()));
     rc = true;
   }

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.81:1.81.2.1
@@ -179,4 +179,6 @@ class KstViewObject : public KstObject {
     virtual void load(QDomElement& e);
 
+    virtual QString menuTitle() const;
+
   public slots:
     virtual void paint(KstPaintType type, QPainter& p);

--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.299.2.1:1.299.2.2
@@ -2618,7 +2618,8 @@ void Kst2DPlot::removeCurve(int id) {
 bool Kst2DPlot::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
   bool hasEntry = false;
-  int n_curves = Curves.count();
-  int id;
-  int i;
+
+  if (globalZoomType() == LABEL_TOOL) { // no menu in text mode. it's confusing
+    return false;
+  }
 
   KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(topLevelParent);
@@ -2627,7 +2628,7 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
 
   KPopupMenu *submenu = new KPopupMenu(menu);
-  id = menu->insertItem(i18n("&Match Axis"), submenu);
+  int id = menu->insertItem(i18n("&Match Axis"), submenu);
   Kst2DPlotList pl = globalPlotList();
-  i = 0;
+  int i = 0;
   _plotMap.clear();
   for (Kst2DPlotList::Iterator j = pl.begin(); j != pl.end(); ++j) {
@@ -2703,5 +2704,5 @@ bool Kst2DPlot::popupMenu(KPopupMenu *me
   submenu->setItemEnabled(id, prevMarker(currCenter, tempVal) && (!_xLog || tempVal > 0));
 
-  n_curves = Curves.count();
+  int n_curves = Curves.count();
   int n_images = _images.count();
   if (n_curves + n_images > 0) {
@@ -6017,4 +6018,8 @@ void Kst2DPlot::popPlotColors() {
 
 
+QString Kst2DPlot::menuTitle() const {
+  return i18n("Plot: %1").arg(tagName());
+}
+
 #include "kst2dplot.moc"
 // vim: ts=2 sw=2 et





More information about the Kst mailing list