[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Jun 24 02:22:03 CEST 2004


CVS commit by arwalker: 

Add realtime checking to the input file name.


  M +2 -1      datawizard.ui   1.41
  M +72 -4     datawizard.ui.h   1.47


--- kdeextragear-2/kst/kst/datawizard.ui  #1.40:1.41
@@ -830,5 +830,5 @@
             <height>-1</height>
         </sizehint>
-        <container>1</container>
+        <container>0</container>
         <sizepolicy>
             <hordata>5</hordata>
@@ -1066,4 +1066,5 @@
     <slot access="private">_disableWindowEntries()</slot>
     <slot access="private">_enableWindowEntries()</slot>
+    <slot access="private">sourceChangedBase(const QString &amp; txt)</slot>
 </slots>
 <functions>

--- kdeextragear-2/kst/kst/datawizard.ui.h  #1.46:1.47
@@ -13,5 +13,8 @@
 #include <qobjectlist.h>
 #include <qmessagebox.h>
+
 #include <kpushbutton.h>
+#include <kurlrequester.h>
+#include <kurlcombobox.h>
 
 #include "datarangewidget.h"
@@ -19,5 +22,4 @@
 
 void DataWizard::init() {
-  KstFileDialog* fd;
   QBoxLayout* pBoxLayout;
   QLayout* pLayout;
@@ -28,8 +30,13 @@ void DataWizard::init() {
   default_source = KST::vectorDefaults.dataSource();
   
+#define FILE_INPUT_EMBEDDED 1
+
+#ifdef FILE_INPUT_EMBEDDED
+  KstFileDialog* fd;
+
   //
   // set up the file dialog embedded in the wizard...
   //
-  fd = new KstFileDialog(default_source, QString::null, NULL, "this", false);
+  fd = new KstFileDialog(default_source, QString::null, NULL, "file dialog", false);
   fd->reparent(page(0), point);
   
@@ -50,5 +57,44 @@ void DataWizard::init() {
   fd->setFocus();
 
+  KURLComboBox *comboDir = (KURLComboBox*)fd->child( "path combo", "KURLComboBox", TRUE );
+  if (comboDir) {
+    connect(comboDir, SIGNAL(textChanged(const QString&)), this, SLOT(sourceChangedBase(const QString&)));
+  }
+
+  KURLComboBox *comboFiles = (KURLComboBox*)fd->child( "LocationEdit", "KURLComboBox", TRUE );
+  if (comboFiles) {
+    connect(comboFiles, SIGNAL(textChanged(const QString&)), this, SLOT(sourceChangedBase(const QString&)));
+  }
+  
   connect(fd, SIGNAL(fileHighlighted(const QString&)), this, SLOT(sourceChanged(const QString&)));
+#else
+  KURLRequester* fd;
+  QSpacerItem* spacerLo;
+  QSpacerItem* spacerHi;
+  
+  fd = new KURLRequester();
+  fd->reparent(page(0), point);
+
+  spacerLo = new QSpacerItem(10, 50);
+  spacerHi = new QSpacerItem(10, 50);
+  
+  pLayout = page(0)->layout();
+  if (pLayout) {
+    pBoxLayout = dynamic_cast<QBoxLayout*>(pLayout);
+    if (pBoxLayout) {
+      pBoxLayout->addItem(spacerLo);
+      pBoxLayout->addWidget(fd);
+      pBoxLayout->addItem(spacerHi);
+    }
+  }
+
+  fd->setPreviewWidget((KPreviewWidgetBase*)NULL);
+  fd->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
+  fd->setURL(default_source);
+
+  sourceChanged(default_source);
+
+  connect(fd, SIGNAL(textChanged(const QString&)), this, SLOT(sourceChanged(const QString&)));
+#endif  
   
   setAppropriate(_pageFilters, false);
@@ -120,5 +166,27 @@ void DataWizard::xChanged( const QString
 
 
-void DataWizard::sourceChanged( const QString & txt ) {
+void DataWizard::sourceChangedBase( const QString &txt ) {
+  KFileDialog *fileDialog = (KFileDialog*)child( "file dialog", "KFileDialog", TRUE );
+  QString file;
+  
+  if (fileDialog) {
+    KURLComboBox *combo;
+
+    combo = (KURLComboBox*)fileDialog->child( "path combo", "KURLComboBox", TRUE );
+    if (combo) {
+      file  = combo->currentText();
+    }
+
+    combo = (KURLComboBox*)fileDialog->child( "LocationEdit", "KURLComboBox", TRUE );
+    if (combo) {
+      file += combo->currentText();
+    }
+    
+    sourceChanged( file );
+  }
+}
+
+
+void DataWizard::sourceChanged( const QString &txt ) {
   bool ok = false;
   QString file;





More information about the Kst mailing list