[Kst] extragear/graphics/kst

George Staikos staikos at kde.org
Thu Dec 1 23:14:10 CET 2005


SVN commit 484778 by staikos:

only show dialogs once - adds a lock.  Was implemented a bit more complicated
so we can launch this dialog from other places someday.


 M  +0 -1      devel-docs/PlotUIFixes  
 M  +6 -0      kst/ksteditviewobjectdialog_i.cpp  
 M  +19 -4     kst/kstviewobject.cpp  
 M  +4 -0      kst/kstviewobject.h  


--- trunk/extragear/graphics/kst/devel-docs/PlotUIFixes #484777:484778
@@ -20,7 +20,6 @@
  relative to the axis (imagine an arrow pointing to a feature).
 
 More bugs:
-- Keep doing object->edit, get more and more dialogs.
 - Transparency of labels is quirky (holes are filled with background)
 - Lines and arrows are clipped
 - Selection points are not accessible on ellipses if they overlap another
--- trunk/extragear/graphics/kst/kst/ksteditviewobjectdialog_i.cpp #484777:484778
@@ -51,6 +51,9 @@
 
 
 KstEditViewObjectDialogI::~KstEditViewObjectDialogI() {
+  if (_viewObject) {
+    _viewObject->setDialogLock(false);
+  }
 }
 
 
@@ -61,6 +64,9 @@
 
 void KstEditViewObjectDialogI::showEditViewObjectDialog(KstViewObjectPtr viewObject, KstTopLevelViewPtr top) {
   _viewObject = viewObject;
+  if (_viewObject) {
+    _viewObject->setDialogLock(true);
+  }
   _top = top;
   updateWidgets();
   if (_viewObject) {
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #484777:484778
@@ -69,6 +69,7 @@
   _backgroundColor = KstSettings::globalSettings()->backgroundColor;
   _transparent = false;
   _followsFlow = false;
+  _dialogLock = false;
   setMinimumSize(DEFAULT_MINIMUM_SIZE);
 }
 
@@ -81,6 +82,7 @@
   _parent = 0L;
   _transparent = false;
   _followsFlow = false;
+  _dialogLock = false;
   setMinimumSize(DEFAULT_MINIMUM_SIZE);
   load(e);
 }
@@ -98,6 +100,7 @@
   _onGrid = viewObject._onGrid;
   _columns = viewObject._columns;
   _focus = false;
+  _dialogLock = false;
   _selected = false;
   _geom = viewObject._geom;
   _transparent = viewObject._transparent;
@@ -1611,10 +1614,12 @@
 
 
 void KstViewObject::showDialog(KstTopLevelViewPtr invoker) {
-  KstEditViewObjectDialogI *dlg = new KstEditViewObjectDialogI(KstApp::inst());
-  dlg->showEditViewObjectDialog(this, invoker);
-  dlg->exec();
-  delete dlg;
+  if (!_dialogLock) {
+    KstEditViewObjectDialogI *dlg = new KstEditViewObjectDialogI(KstApp::inst());
+    dlg->showEditViewObjectDialog(this, invoker);
+    dlg->exec();
+    delete dlg;
+  }
 }
 
 
@@ -1666,5 +1671,15 @@
   return 0L;
 }
 
+
+void KstViewObject::setDialogLock(bool lock) {
+  _dialogLock = lock;
+}
+
+
+bool KstViewObject::dialogLocked() const {
+  return _dialogLock;
+}
+
 #include "kstviewobject.moc"
 // vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #484777:484778
@@ -256,6 +256,9 @@
     virtual void edit();
 
   protected:
+    friend class KstEditViewObjectDialogI;
+    void setDialogLock(bool lock);
+    bool dialogLocked() const;
     virtual KstViewObjectFactoryMethod factory() const;
     virtual KstHandlerFactoryMethod handlerFactory() const;
     virtual void writeBinary(QDataStream& str);
@@ -277,6 +280,7 @@
     bool _maximized : 1;
     bool _transparent : 1;
     bool _followsFlow : 1;
+    bool _dialogLock : 1;
     int _columns : 6; // "64 columns ought to be enough for anyone"
     QGuardedPtr<KstViewObject> _topObjectForMenu;
     KstViewObject *_parent; // danger!!


More information about the Kst mailing list