Bug 64893 - autocompletion in vector dialogs only works after data has already been opened
Summary: autocompletion in vector dialogs only works after data has already been opened
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-25 04:33 UTC by Matthew Truch
Modified: 2003-10-24 01:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2003-09-25 04:33:33 UTC
Version:           0.92 (using KDE KDE 3.1)
Installed from:    RedHat RPMs

If you open a fresh kst (not from a .kst file, and with no command line arguments), and then open a vector dialog (eg. quickly create a new curve), there is no auto-completion of vectors (even if you specify the datafile first).  You have to have previous data displayed from that datafile to get vector auto-completion.  Once the datafile has been entered, kst should read the file to get all the vectors for autocompletion.  

I imagine that this would be harder to impliment, but I'll put it in the wishlist anyways.    I'm just hard-core like that.
Comment 1 George Staikos 2003-09-25 10:44:16 UTC
This has been on my TODO list for a while now.  I have to get working on it. 
Comment 2 George Staikos 2003-10-24 01:32:29 UTC
Subject: kdeextragear-2/kst/kst

CVS commit by staikos: 

Implement auto completion immediately.
CCMAIL: 64893-done@bugs.kde.org


  M +30 -12    kstquickcurvesdialog_i.cpp   1.26
  M +2 -2      kstquickcurvesdialog_i.h   1.11


--- kdeextragear-2/kst/kst/kstquickcurvesdialog_i.cpp  #1.25:1.26
@@ -24,4 +24,5 @@
 #include <qspinbox.h>
 #include <qlabel.h>
+#include <kdebug.h>
 #include <kfiledialog.h>
 #include <klocale.h>
@@ -49,4 +50,6 @@ KstQuickCurvesDialogI::KstQuickCurvesDia
                       | KFile::LocalOnly);
 
+    connect(FileName, SIGNAL(textChanged(const QString&)), this, SLOT(updateCompletion()));
+
     _xaxisCompletion = XAxis->completionObject();
     XAxis->setAutoDeleteCompletionObject(true);
@@ -65,4 +68,30 @@ void KstQuickCurvesDialogI::showQuickCur
 
 
+void KstQuickCurvesDialogI::updateCompletion() {
+  /* put INDEX as a default in the X axis list */
+  XAxis->clear();
+  YAxis->clear();
+
+  /* update filename list and fill axes combo boxes */
+  KstDataSourcePtr ds = *KST::dataSourceList.findFileName(FileName->url());
+  if (!ds) {
+    ds = KstDataSource::loadSource(FileName->url());
+    if (ds) { // FIXME we should eventually make KstDataSource::loadFieldList()
+      KST::dataSourceList.append(ds);
+    }
+  }
+
+  if (ds) {
+    XAxis->insertStringList(ds->fieldList());
+    _xaxisCompletion->insertItems(ds->fieldList());
+    YAxis->insertStringList(ds->fieldList());
+    _yaxisCompletion->insertItems(ds->fieldList());
+  }
+
+  XAxis->setCurrentText("INDEX");
+  YAxis->setCurrentText(QString::null);
+}
+
+
 void KstQuickCurvesDialogI::update() {
   unsigned int i;
@@ -72,20 +101,9 @@ void KstQuickCurvesDialogI::update() {
   KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
 
-  /* put INDEX as a default in the X axis list */
-  XAxis->clear();
-  YAxis->clear();
-
-  /* update filename list and fill axes combo boxes */
   j = KST::dataSourceList.count() - 1;
   if (j >= 0) {
     FileName->setURL(KST::dataSourceList[j]->fileName());
-    XAxis->insertStringList(KST::dataSourceList[j]->fieldList());
-    _xaxisCompletion->insertItems(KST::dataSourceList[j]->fieldList());
-    YAxis->insertStringList(KST::dataSourceList[j]->fieldList());
-    _yaxisCompletion->insertItems(KST::dataSourceList[j]->fieldList());
   }
-
-  XAxis->setCurrentText("INDEX");
-  YAxis->setCurrentText(QString::null);
+  updateCompletion();
 
   KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);

--- kdeextragear-2/kst/kst/kstquickcurvesdialog_i.h  #1.10:1.11
@@ -43,6 +43,6 @@ public slots:
   bool addPlot();
 private slots:
-  bool apply(bool autolabel);
-  void apply() { apply(false); }
+  bool apply(bool autolabel = false);
+  void updateCompletion();
 
 signals: