Now that datasources support URLs, the indirect source should also support them. It currently doesn't because it uses QFile.
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);
Change version to 1.x