| Summary: | indirect source should support URLs | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | George Staikos <staikos> |
| Component: | datasources | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
George Staikos
2005-04-15 04:46:40 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);
Change version to 1.x |