[Kst] extragear/graphics/kst/kst

Ted Kisner tskisner.public at gmail.com
Sun Nov 6 01:41:05 CET 2005


SVN commit 478143 by tskisner:

This patch seems to work for me.  I can load local files and urls from the commandline and the saved kst file always has either the url or the full path.  Comments welcome...

 M  +8 -1      main.cpp  


--- trunk/extragear/graphics/kst/kst/main.cpp #478142:478143
@@ -19,6 +19,7 @@
 #include <stdio.h>
 
 #include <qstringlist.h>
+#include <qfileinfo.h>
 
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
@@ -318,6 +319,7 @@
 int main(int argc, char *argv[]) {
   int i_file, i_v, i_curve;
   int i_plot;
+  QString fullPath;
 
   KAboutData aboutData("kst", I18N_NOOP("Kst"),
                        KSTVERSION, description, KAboutData::License_GPL,
@@ -494,7 +496,12 @@
 
       for (i_curve = i_v = 0, i_file = 0; i_file < args->count(); i_file++) {
         // make the file
-        file = KstDataSource::loadSource(args->arg(i_file));
+        if (QFile::exists(args->arg(i_file))) {
+          fullPath = QFileInfo(args->arg(i_file)).absFilePath();
+        } else {
+          fullPath = args->arg(i_file);
+        }
+        file = KstDataSource::loadSource(fullPath);
         if (file) {
           if (!file->isValid() || file->isEmpty()) {
             kstdError() << i18n("No data in file %1.  Trying to continue...").arg(args->arg(i_file)) << endl;


More information about the Kst mailing list