[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Feb 5 06:39:16 CET 2004


CVS commit by staikos: 

hack in auto completion on text changed - need to watch for events to do this
more cleanly.


  M +22 -0     kstvectordialog_i.cpp   1.23
  M +2 -0      kstvectordialog_i.h   1.10


--- kdeextragear-2/kst/kst/kstvectordialog_i.cpp  #1.22:1.23
@@ -59,4 +59,5 @@ KstVectorDialogI::KstVectorDialogI(QWidg
     FileName->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly
                       | KFile::LocalOnly);
+    connect(FileName, SIGNAL(textChanged(const QString&)), this, SLOT(updateCompletion()));
     _fieldCompletion = Field->completionObject();
     Field->setAutoDeleteCompletionObject( true );
@@ -69,4 +70,24 @@ KstVectorDialogI::~KstVectorDialogI() {
 }
 
+void KstVectorDialogI::updateCompletion() {
+  Field->clear();
+
+  /* update filename list and fill axes combo boxes */
+  KstDataSourcePtr ds = *KST::dataSourceList.findFileName(FileName->url());
+  if (!ds && FileName->url() != "stdin") {
+    ds = KstDataSource::loadSource(FileName->url());
+    if (ds) { // FIXME we should eventually make KstDataSource::loadFieldList()
+      KST::dataSourceList.append(ds);
+    }
+  }
+
+  if (ds) {
+    Field->insertStringList(ds->fieldList());
+    _fieldCompletion->insertItems(ds->fieldList());
+  }
+
+  Field->setCurrentText(QString::null);
+}
+
 void KstVectorDialogI::show_I() {
   update();
@@ -357,2 +378,3 @@ void KstVectorDialogI::delete_I() {
 
 #include "kstvectordialog_i.moc"
+// vim: sw=2 ts=2 et

--- kdeextragear-2/kst/kst/kstvectordialog_i.h  #1.9:1.10
@@ -47,4 +47,6 @@ public slots:
   static KstVectorDialogI *globalInstance();
 
+  void updateCompletion();
+
 signals:
   void modified();





More information about the Kst mailing list