[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Jun 9 20:33:05 CEST 2004


CVS commit by arwalker: 

Added the ability to create a new window through DCOP.


  M +26 -13    kst.cpp   1.147
  M +1 -0      kst.h   1.68
  M +1 -0      kstiface.h   1.12
  M +9 -0      kstiface_impl.cpp   1.24
  M +1 -0      kstiface_impl.h   1.12


--- kdeextragear-2/kst/kst/kst.cpp  #1.146:1.147
@@ -216,10 +216,5 @@ KstApp::KstApp(QWidget *parent, const ch
   }
 
-  KstViewWindow *w = new KstViewWindow();
-  QString wname = KST::suggestWinName();
-  w->setCaption(wname);
-  w->setTabCaption(wname);
-  addWindow(w);
-  w->activate();
+  newWindow( QString::null );
 }
 
@@ -1322,7 +1317,28 @@ void KstApp::slotFileNewWindow() {
 
 
+QString KstApp::newWindow(const QString& name) {
+  KstViewWindow *w = new KstViewWindow;
+  QString nameToUse = QString::null;
+  
+  if (w) {
+    if (name.isEmpty() || findWindow(name)) {
+      nameToUse = KST::suggestWinName();
+    } else {
+      nameToUse = name;
+    }
+    w->setCaption(nameToUse);
+    w->setTabCaption(nameToUse);
+    addWindow(w);
+    w->activate();
+  }
+
+  return nameToUse;
+}
+
+
 QString KstApp::newWindow(bool prompt) {
   bool ok = false;
   QString name;
+  QString nameUsed;
 
   do {
@@ -1342,10 +1358,7 @@ QString KstApp::newWindow(bool prompt) {
   } while(true);
 
-  KstViewWindow *w = new KstViewWindow;
-  w->setCaption(name);
-  w->setTabCaption(name);
-  addWindow(w);
-  w->activate();
-  return name;
+  nameUsed = newWindow( name );
+
+  return nameUsed;
 }
 

--- kdeextragear-2/kst/kst/kst.h  #1.67:1.68
@@ -112,4 +112,5 @@ class KstApp : public KMdiMainFrm {
     Kst2DPlotMap& plotHolderWhileOpeningDocument();
 
+    QString newWindow(const QString& name);
     QString newWindow(bool prompt = true);
 

--- kdeextragear-2/kst/kst/kstiface.h  #1.11:1.12
@@ -75,4 +75,5 @@ k_dcop:
   virtual bool printPostScript(const QString& filename) = 0;
 
+  virtual const QString& createWindow(const QString& name) = 0;
   virtual const QString& createPlot(const QString& name) = 0;
   virtual bool deletePlot(const QString& name) = 0;

--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.23:1.24
@@ -517,4 +517,13 @@ bool KstIfaceImpl::clearVector(const QSt
 
 
+const QString& KstIfaceImpl::createWindow(const QString& name) {
+  QString nameUsed;
+
+  nameUsed = KstApp::inst()->newWindow( name );
+
+  return nameUsed;
+}
+
+
 const QString& KstIfaceImpl::createPlot(const QString& name) {
 #if 0

--- kdeextragear-2/kst/kst/kstiface_impl.h  #1.11:1.12
@@ -69,4 +69,5 @@ public:
   virtual bool printPostScript(const QString& filename);
 
+  virtual const QString& createWindow(const QString& name);
   virtual const QString& createPlot(const QString& name);
   virtual bool deletePlot(const QString& name);





More information about the Kst mailing list