[Kst] extragear/graphics/kst/kst/datasources/indirect
George Staikos
staikos at kde.org
Fri Jul 8 00:02:55 CEST 2005
SVN commit 432584 by staikos:
Add support for relative paths in indirect sources
BUG: 103929
M +18 -0 indirect.cpp
--- trunk/extragear/graphics/kst/kst/datasources/indirect/indirect.cpp #432583:432584
@@ -17,7 +17,9 @@
#include "indirect.h"
+#include <qdir.h>
#include <qfile.h>
+#include <qfileinfo.h>
IndirectSource::IndirectSource(KConfig *cfg, const QString& filename, KstDataSourcePtr child)
@@ -45,6 +47,10 @@
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;
+ }
+
if (!_child || ifn.stripWhiteSpace() != _child->fileName()) {
_child = 0L; // release
KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
@@ -124,6 +130,10 @@
return 0L;
}
+ if (QFileInfo(ifn).isRelative()) {
+ ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+ }
+
KstDataSourcePtr p = KstDataSource::loadSource(ifn.stripWhiteSpace());
f.close();
@@ -155,6 +165,10 @@
return 0;
}
+ if (QFileInfo(ifn).isRelative()) {
+ ifn = QFileInfo(filename).dirPath(true) + QDir::separator() + ifn;
+ }
+
return QFile::exists(ifn.stripWhiteSpace()) ? percent : 0;
}
@@ -174,6 +188,10 @@
return QStringList();
}
+ 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