Bug 103930 - indirect source should support URLs
Summary: indirect source should support URLs
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: datasources (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-15 04:46 UTC by George Staikos
Modified: 2010-08-14 14:40 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 George Staikos 2005-04-15 04:46:40 UTC
Now that datasources support URLs, the indirect source should also support 
them.  It currently doesn't because it uses QFile.
Comment 1 George Staikos 2005-07-08 00:46:39 UTC
SVN commit 432601 by staikos:

Add support for URLs to indirect sources
FEATURE: 103930


 M  +26 -10    indirect.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/indirect/indirect.cpp #432600:432601
@@ -17,6 +17,9 @@
 
 #include "indirect.h"
 
+#include <kio/netaccess.h>
+#include <kurl.h>
+
 #include <qdir.h>
 #include <qfile.h>
 #include <qfileinfo.h>
@@ -47,8 +50,11 @@
   if (f.open(IO_ReadOnly)) {
     QString ifn;
     if (0 < f.readLine(ifn, 1000)) {
-      if (QFileInfo(ifn).isRelative()) {
-        ifn = QFileInfo(_filename).dirPath(true) + QDir::separator() + ifn;
+      KURL url = KURL::fromPathOrURL(ifn);
+      if (url.isLocalFile() || url.protocol().isEmpty()) {
+        if (QFileInfo(ifn).isRelative()) {
+          ifn = QFileInfo(_filename).dirPath(true) + QDir::separator() + ifn;
+        }
       }
 
       if (!_child || ifn.stripWhiteSpace() != _child->fileName()) {
@@ -130,8 +136,11 @@
     return 0L;
   }
 
-  if (QFileInfo(ifn).isRelative()) {
-    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  KURL url = KURL::fromPathOrURL(ifn);
+  if (url.isLocalFile() || url.protocol().isEmpty()) {
+    if (QFileInfo(ifn).isRelative()) {
+      ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+    }
   }
 
   KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
@@ -165,11 +174,15 @@
     return 0;
   }
 
-  if (QFileInfo(ifn).isRelative()) {
-    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  KURL url = KURL::fromPathOrURL(ifn.stripWhiteSpace());
+  if (url.isLocalFile() || url.protocol().isEmpty()) {
+    if (QFileInfo(ifn).isRelative()) {
+      ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+    }
+    return QFile::exists(ifn.stripWhiteSpace()) ? percent : 0;
+  } else {
+    return KIO::NetAccess::exists(url, true, 0L) ? percent : 0;
   }
-
-  return QFile::exists(ifn.stripWhiteSpace()) ? percent : 0;
 }
 
 
@@ -188,8 +201,11 @@
     return QStringList();
   }
 
-  if (QFileInfo(ifn).isRelative()) {
-    ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+  KURL url = KURL::fromPathOrURL(ifn);
+  if (url.isLocalFile() || url.protocol().isEmpty()) {
+    if (QFileInfo(ifn).isRelative()) {
+      ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+    }
   }
 
   return KstDataSource::fieldListForSource(ifn.stripWhiteSpace(), type, typeSuggestion, complete);
Comment 2 Peter Kümmel 2010-08-14 14:40:39 UTC
Change version to 1.x