[Kst] [Bug 103930] indirect source should support URLs
George Staikos
staikos at kde.org
Fri Jul 8 00:46:40 CEST 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=103930
staikos kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From staikos kde org 2005-07-08 00:46 -------
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);
More information about the Kst
mailing list