[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Nov 5 23:13:52 CET 2003


CVS commit by staikos: 

Allow the reading of vectors from files via DCOP


  M +2 -0      kstiface.h   1.8
  M +38 -0     kstiface_impl.cpp   1.11
  M +2 -0      kstiface_impl.h   1.8


--- kdeextragear-2/kst/kst/kstiface.h  #1.7:1.8
@@ -78,4 +78,6 @@ k_dcop:
   virtual void reloadVectors() = 0;
   virtual void reloadVector(const QString& vector) = 0;
+
+  virtual const QString& loadVector(const QString& file, const QString& field) = 0;
 };
 

--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.10:1.11
@@ -482,3 +482,41 @@ void KstIfaceImpl::reloadVector(const QS
 
 
+const QString& KstIfaceImpl::loadVector(const QString& file, const QString& field) {
+  KstDataSourcePtr src;
+  /* generate or find the kstfile */
+  KstDataSourceList::Iterator it = KST::dataSourceList.findFileName(file);
+
+  if (it == KST::dataSourceList.end()) {
+    src = KstDataSource::loadSource(file);
+    if (!src || !src->isValid()) {
+      return QString::null;
+    }
+    if (src->frameCount() < 1) {
+      return QString::null;
+    }
+    KST::dataSourceList.append(src);
+  } else {
+    src = *it;
+  }
+
+  QString vname = "V" + QString::number(KST::vectorList.count() + 1);
+
+  while (KST::vectorTagNameNotUnique(vname, false)) {
+    vname = "V" + QString::number(KST::vectorList.count() + 1);
+  }
+
+  KstVectorPtr p = new KstRVector(src, field, vname, 0, -1, 0, false, false);
+
+  if (p) {
+    _doc->update();
+    _doc->setModified();
+    _doc->updateDialogs();
+    return p->tagName();
+  }
+
+  return QString::null;
+}
+
+
+
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kstiface_impl.h  #1.7:1.8
@@ -74,4 +74,6 @@ public:
   virtual void reloadVector(const QString& vector);
 
+  virtual const QString& loadVector(const QString& file, const QString& field);
+
 private:
   KstDoc *_doc;





More information about the Kst mailing list