[Kst] extragear/graphics/kst

George Staikos staikos at kde.org
Fri Dec 2 00:03:45 CET 2005


SVN commit 484794 by staikos:

cancel dialog should cancel the creation in create mode.


 M  +0 -2      devel-docs/PlotUIFixes  
 M  +2 -1      kst/kst2dplot.cpp  
 M  +1 -1      kst/kst2dplot.h  
 M  +2 -2      kst/ksteditviewobjectdialog_i.cpp  
 M  +6 -5      kst/kstgfxpicturemousehandler.cpp  
 M  +19 -18    kst/kstgfxtextmousehandler.cpp  
 M  +4 -2      kst/kstviewobject.cpp  
 M  +1 -1      kst/kstviewobject.h  


--- trunk/extragear/graphics/kst/devel-docs/PlotUIFixes #484793:484794
@@ -26,6 +26,4 @@
   object, even if the the ellipse is above the other object.
 - Selection points are always clipped even if the object lies below.
 - Flicker!!
-- if 'cancel' is selected from the viewobjectdialogs when creating a new object,
-  the object is not deleted, and hangs around as an invisible, uneditable ghost.
 
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #484793:484794
@@ -6418,10 +6418,11 @@
 }
 
 
-void Kst2DPlot::showDialog(KstTopLevelViewPtr invoker) {
+bool Kst2DPlot::showDialog(KstTopLevelViewPtr invoker) {
   Q_UNUSED(invoker)
   KstViewWidget *viewwidget = KstApp::inst()->activeView()->widget();
   KstApp::inst()->plotDialog()->show_I(viewwidget->viewObject()->tagName(), tagName());
+  return false;
 }
 
 
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #484793:484794
@@ -366,7 +366,7 @@
   void removeCurve(int id);
 
   // used in layout mode
-  void showDialog(KstTopLevelViewPtr invoker);
+  bool showDialog(KstTopLevelViewPtr invoker);
 
 protected slots:
   void menuMoveUp();
--- trunk/extragear/graphics/kst/kst/ksteditviewobjectdialog_i.cpp #484793:484794
@@ -268,7 +268,7 @@
 
 void KstEditViewObjectDialogI::okClicked() {
   if (!_viewObject) {
-    close();
+    QDialog::reject();
     return;
   }
 
@@ -300,7 +300,7 @@
     }
 #endif
   }
-  close();
+  QDialog::accept();
 }
 
 
--- trunk/extragear/graphics/kst/kst/kstgfxpicturemousehandler.cpp #484793:484794
@@ -76,11 +76,12 @@
   // once released, create a picture and popup the edit dialog
   if (!_cancelled && _mouseOrigin != pos) {
     KstViewPicturePtr pic = new KstViewPicture;
-    pic->move(_prevBand.topLeft());
-    pic->resize(_prevBand.size());
-    _top->appendChild(KstViewObjectPtr(pic));
-    pic->showDialog(view);
-    KstApp::inst()->document()->setModified();
+    if (pic->showDialog(view)) {
+      pic->move(_prevBand.topLeft());
+      pic->resize(_prevBand.size());
+      _top->appendChild(KstViewObjectPtr(pic));
+      KstApp::inst()->document()->setModified();
+    }
   }
   _prevBand = QRect(-1,-1, 0, 0);
 }
--- trunk/extragear/graphics/kst/kst/kstgfxtextmousehandler.cpp #484793:484794
@@ -81,26 +81,27 @@
   if (!_cancelled) {
     KstViewLabelPtr label = new KstViewLabel;
     copyDefaults(KstViewObjectPtr(label));
-    _top->appendChild(KstViewObjectPtr(label));
-    
-    QSize size(0,0);
-    if (_mouseOrigin != pos) {
-      label->move(_prevBand.topLeft());
-      size = _prevBand.size();
-    } else {
-      label->move(pos);
-    }
 
-    if (size.width()<3) {
-      size.setWidth(3);
+    if (label->showDialog(view)) {
+      _top->appendChild(KstViewObjectPtr(label));
+
+      QSize size(0,0);
+      if (_mouseOrigin != pos) {
+        label->move(_prevBand.topLeft());
+        size = _prevBand.size();
+      } else {
+        label->move(pos);
+      }
+
+      if (size.width()<3) {
+        size.setWidth(3);
+      }
+      if (size.height()<3) {
+        size.setHeight(3);
+      }
+      label->resize(size);
+      KstApp::inst()->document()->setModified();
     }
-    if (size.height()<3) {
-      size.setHeight(3);
-    }
-    label->resize(size);
-
-    label->showDialog(view);
-    KstApp::inst()->document()->setModified();
   }
   _prevBand = QRect(-1, -1, 0, 0);
 }
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #484793:484794
@@ -1613,13 +1613,15 @@
 }
 
 
-void KstViewObject::showDialog(KstTopLevelViewPtr invoker) {
+bool KstViewObject::showDialog(KstTopLevelViewPtr invoker) {
+  bool rc = false;
   if (!_dialogLock) {
     KstEditViewObjectDialogI *dlg = new KstEditViewObjectDialogI(KstApp::inst());
     dlg->showEditViewObjectDialog(this, invoker);
-    dlg->exec();
+    rc = QDialog::Rejected != dlg->exec();
     delete dlg;
   }
+  return rc;
 }
 
 
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #484793:484794
@@ -235,7 +235,7 @@
     virtual void zoomToggle();
     virtual void copyObject();
     virtual void copyObjectQuietly(KstViewObject& parent, const QString& name = QString::null) const;
-    virtual void showDialog(KstTopLevelViewPtr invoker);
+    virtual bool showDialog(KstTopLevelViewPtr invoker);
 
   protected slots:
     virtual void parentResized();


More information about the Kst mailing list