[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri Oct 29 05:27:53 CEST 2004


CVS commit by staikos: 

store files in the history as absolute paths so that launching Kst from other
directories still allows the user to find his file from the history.  Also
use KURL for URL parsing.  This stuff really should be fixed in kdelibs I
think.


  M +12 -4     datawizard.ui.h   1.93


--- kdeextragear-2/kst/kst/datawizard.ui.h  #1.92:1.93
@@ -96,10 +96,18 @@ void DataWizard::sourceChanged( const QS
     _file = QString::null;
     if (!txt.isEmpty()) {
-        QString file = txt;
-        // FIXME: use KURL to properly parse this
-        if (file.startsWith("file:")) {
-            file.remove(0, 5);
+        KURL url;
+        if (QFile::exists(txt) && QFileInfo(txt).isRelative()) {
+            url.setPath(txt);
+        } else {
+            KURL url = KURL::fromPathOrURL(txt);
+        }
+
+        if (!url.isValid() || (!url.protocol().isEmpty() && url.protocol() != "file")) {
+            setNextEnabled(_pageDataSource, false);
+            return;
         }
 
+        QString file = QFileInfo(url.path()).absFilePath();
+        
         KstDataSourcePtr ds = *KST::dataSourceList.findFileName(file);
         QStringList fl;





More information about the Kst mailing list