[Kst] [Bug 109460] allow to load a data file directly from the command line

Andrew Walker arwalker at sumusltd.com
Fri Jul 29 18:44:48 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=109460         
arwalker sumusltd com changed:

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



------- Additional Comments From arwalker sumusltd com  2005-07-29 18:44 -------
SVN commit 440041 by arwalker:

BUG:109460 Allow user to specify data file to be loaded into data wizard on the command line.

 M  +1 -0      datawizard.ui  
 M  +5 -0      datawizard.ui.h  
 M  +16 -0     kst.cpp  
 M  +1 -0      kst.h  
 M  +11 -1     main.cpp  


--- trunk/extragear/graphics/kst/kst/datawizard.ui #440040:440041
 @ -1397,6 +1397,7  @
     <variable access="private">QGuardedPtr&lt;QWidget&gt; _configWidget;</variable>
 </variables>
 <slots>
+    <slot access="public">setInput( const QString &amp; input )</slot>
     <slot access="private">init()</slot>
     <slot access="private">xChanged()</slot>
     <slot access="private">sourceChanged( const QString &amp; txt )</slot>
--- trunk/extragear/graphics/kst/kst/datawizard.ui.h #440040:440041
 @ -56,6 +56,11  @
 }
 
 
+void DataWizard::setInput(const QString &input) {
+  _url->setURL(input);
+}
+
+
 void DataWizard::plotColsChanged() {
   _reGrid->setChecked(true);
 }
--- trunk/extragear/graphics/kst/kst/kst.cpp #440040:440041
 @ -2000,6 +2000,22  @
   }
 }
 
+
+void KstApp::showDataWizardWithFile(const QString &input) {
+  DataWizard *dw = new DataWizard(this, "DataWizard");
+  dw->setInput(input);
+  dw->exec();
+  if (dw->result() == QDialog::Accepted) {
+    delete dw; // leave this here - releases references
+    forceUpdate();
+    doc->setModified();
+    updateDialogs();
+  } else {
+    delete dw;
+  }
+}
+
+
 void KstApp::registerDocChange() {
   kdDebug() << "register doc changed" << endl;
   forceUpdate();
--- trunk/extragear/graphics/kst/kst/kst.h #440040:440041
 @ -323,6 +323,7  @
     void showExtensionManager();
 
     /** creates the data wizard */
+    void showDataWizardWithFile(const QString &input);
     void showDataWizard();
 
     //show the quickstart dialog, but only if specified so in the KstSettings
--- trunk/extragear/graphics/kst/kst/main.cpp #440040:440041
 @ -69,6 +69,7  @
   { "m <NC>", I18N_NOOP("Separate plots arranged in <NC> columns"),0},
   { "d",      I18N_NOOP("Display as points rather than curves"),0},
   { "g",      I18N_NOOP("Provide a legend box"),0},
+  { "w <file>",      I18N_NOOP("Display the data wizard"),"<none>"},
   { "print <file>",  I18N_NOOP("Print to file and exit"),"<none>"},
   { "png <file>",  I18N_NOOP("Save as a png file and exit"),"<none>"},
   { "nq",     I18N_NOOP("Bypass the quickstart dialog"), 0},
 @ -373,12 +374,14  @
     QCStringList::Iterator hs_string;
     QCStringList::Iterator eq_i;
     bool showQuickStart = false;
+    bool showDataWizard = false;
     bool nOK;
     int n_y = 0;
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
     CheckForCMDErrors(args);
 
+    QString wizardfile = args->getOption("w");
     QString printfile = args->getOption("print");
     QString pngfile = args->getOption("png");
     bool print_and_exit = false;
 @ -718,7 +721,11  @
     if (args->isSet("nq")) {
       showQuickStart = false;
     }
-
+    if (args->isSet("w")) {
+      showDataWizard = true;
+      showQuickStart = false;
+    }
+    
     if (printfile != "<none>") {
       kst->forceUpdate();
       kst->immediatePrintToFile(printfile);
 @ -740,6 +747,9  @
       if (showQuickStart) {
         kst->showQuickStartDialog();
       }
+      if (showDataWizard) {
+        kst->showDataWizardWithFile(wizardfile);
+      }
       for (size_t i=0; i<strErrors.size(); i++) {
         KstDebug::self()->log(strErrors[i], KstDebug::Warning);
       }


More information about the Kst mailing list