[Kst] [Bug 145822] Dirfile datasource opens the file dialog one folder too deep

Andrew Walker arwalker at sumusltd.com
Fri Jun 29 02:03:24 CEST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=145822         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2007-06-29 02:03 -------
SVN commit 681452 by arwalker:

BUG:145822 Open the file dialog at the correct level for folder based datasources

 M  +27 -0     kstdatawizard_i.cpp  
 M  +2 -0      kstdatawizard_i.h  
 M  +26 -0     kstmatrixdialog_i.cpp  
 M  +3 -1      kstmatrixdialog_i.h  
 M  +26 -0     kstvectordialog_i.cpp  
 M  +3 -1      kstvectordialog_i.h  


--- branches/work/kst/1.5/kst/src/libkstapp/kstdatawizard_i.cpp #681451:681452
 @ -26,8 +26,10  @
 #include <qregexp.h>
 #include <qspinbox.h>
 #include <qstring.h>
+#include <qtimer.h>
 #include <qtooltip.h>
 
+#include <kfiledialog.h>
 #include <kiconloader.h>
 #include <kmessagebox.h>
 #include <knuminput.h>
 @ -81,6 +83,7  @
   _vectors->setSorting(1);
   _vectorsToPlot->setSorting(-1);
 
+  connect(_url, SIGNAL(openFileDialog(KURLRequester *)), this, SLOT(selectFolder()));
   connect(_cycleThrough, SIGNAL(toggled(bool)), _plotNumber, SLOT(setEnabled(bool)));
   connect(_existingPlot, SIGNAL(toggled(bool)), _existingPlotName, SLOT(setEnabled(bool)));
   connect(_existingWindow, SIGNAL(toggled(bool)), _windowName, SLOT(setEnabled(bool)));
 @ -168,6 +171,30  @
 }
 
 
+void KstDataWizard::selectingFolder()
+{
+  QString strFolder = _url->url();
+  KFileDialog *fileDlg = _url->fileDialog();
+  QFileInfo fileInfo(strFolder);
+
+  if (fileDlg) {
+    if (fileInfo.isDir()) {
+      QDir dir(strFolder);
+
+      if (dir.cdUp()) {
+        fileDlg->setURL(KURL(dir.absPath()));
+      }
+    }
+  }
+}
+
+
+void KstDataWizard::selectFolder()
+{
+  QTimer::singleShot(0, this, SLOT(selectingFolder()));
+}
+
+
 void KstDataWizard::setInput(const QString& input)
 {
   _url->setURL(input);
--- branches/work/kst/1.5/kst/src/libkstapp/kstdatawizard_i.h #681451:681452
 @ -40,6 +40,8  @
     void loadSettings();
 
   public slots:
+    void selectFolder();
+    void selectingFolder();
     void setInput( const QString &input );
     void plotColsChanged();
     void xChanged();
--- branches/work/kst/1.5/kst/src/libkstapp/kstmatrixdialog_i.cpp #681451:681452
 @ -27,6 +27,7  @
 
 // include files for KDE
 #include <kcombobox.h>
+#include <kfiledialog.h>
 #include <kmessagebox.h>
 #include <kurlcompletion.h>
 #include <kurlrequester.h>
 @ -66,6 +67,7  @
   connect(_w->_doSkip, SIGNAL(clicked()), this, SLOT(updateEnables()));
 
   _w->_fileName->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly);
+  connect(_w->_fileName, SIGNAL(openFileDialog(KURLRequester *)), this, SLOT(selectFolder()));
   connect(_w->_fileName, SIGNAL(textChanged(const QString&)), this, SLOT(updateCompletion()));
   connect(_w->_configure, SIGNAL(clicked()), this, SLOT(configureSource()));
   connect(_w->_readFromSource, SIGNAL(clicked()), this, SLOT(enableSource()));
 @ -98,6 +100,30  @
 }
 
 
+void KstMatrixDialogI::selectingFolder()
+{
+  QString strFolder = _w->_fileName->url();
+  KFileDialog *fileDlg = _w->_fileName->fileDialog();
+  QFileInfo fileInfo(strFolder);
+
+  if (fileDlg) {
+    if (fileInfo.isDir()) {
+      QDir dir(strFolder);
+
+      if (dir.cdUp()) {
+        fileDlg->setURL(KURL(dir.absPath()));
+      }
+    }
+  }
+}
+
+
+void KstMatrixDialogI::selectFolder()
+{
+  QTimer::singleShot(0, this, SLOT(selectingFolder()));
+}
+
+
 void KstMatrixDialogI::updateWindow() {
 }
 
--- branches/work/kst/1.5/kst/src/libkstapp/kstmatrixdialog_i.h #681451:681452
 @ -36,8 +36,10  @
   protected:
     QString editTitle() { return tr("Edit Matrix"); }
     QString newTitle() { return tr("New Matrix"); }
- 
+
   public slots:
+    void selectFolder();
+    void selectingFolder();
     void update();
     void updateWindow();
     void updateCompletion();
--- branches/work/kst/1.5/kst/src/libkstapp/kstvectordialog_i.cpp #681451:681452
 @ -26,6 +26,7  @
 #include <qvbox.h>
 
 #include <kdialogbase.h>
+#include <kfiledialog.h>
 #include <klineedit.h>
 #include <klocale.h>
 #include <kmessagebox.h>
 @ -68,6 +69,7  @
   _w->FileName->completionObject()->setDir(QDir::currentDirPath());
 
   _w->FileName->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly);
+  connect(_w->FileName, SIGNAL(openFileDialog(KURLRequester *)), this, SLOT(selectFolder()));
   connect(_w->FileName, SIGNAL(textChanged(const QString&)), this, SLOT(updateCompletion()));
   connect(_w->_configure, SIGNAL(clicked()), this, SLOT(configureSource()));
   connect(_w->_readFromSource, SIGNAL(clicked()), this, SLOT(enableSource()));
 @ -98,6 +100,30  @
 }
 
 
+void KstVectorDialogI::selectingFolder()
+{
+  QString strFolder = _w->FileName->url();
+  KFileDialog *fileDlg = _w->FileName->fileDialog();
+  QFileInfo fileInfo(strFolder);
+
+  if (fileDlg) {
+    if (fileInfo.isDir()) {
+      QDir dir(strFolder);
+
+      if (dir.cdUp()) {
+        fileDlg->setURL(KURL(dir.absPath()));
+      }
+    }
+  }
+}
+
+
+void KstVectorDialogI::selectFolder()
+{
+  QTimer::singleShot(0, this, SLOT(selectingFolder()));
+}
+
+
 void KstVectorDialogI::testURL() {
   _inTest = true;
   updateCompletion();
--- branches/work/kst/1.5/kst/src/libkstapp/kstvectordialog_i.h #681451:681452
 @ -34,8 +34,10  @
   protected:
     QString editTitle() { return tr("Edit Vector"); }
     QString newTitle() { return tr("New Vector"); }
- 
+
   public slots:
+    void selectFolder();
+    void selectingFolder();
     bool newObject();
     bool editObject();
     void populateEditMultiple();


More information about the Kst mailing list