[Kst] [Bug 103929] indirect source fails on relative paths

George Staikos staikos at kde.org
Fri Jul 8 00:03:05 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=103929         
staikos kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From staikos kde org  2005-07-08 00:03 -------
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