[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Oct 27 19:37:28 CEST 2004


CVS commit by staikos: 

- i18n fixes in main
- document exit() calls as doomed to crash
- remove the last processEvents() calls (this needs testing!!)


  M +2 -3      kst.cpp   1.251
  M +2 -2      kstdoc.h   1.37
  M +12 -17    main.cpp   1.88


--- kdeextragear-2/kst/kst/kst.cpp  #1.250:1.251
@@ -870,6 +870,5 @@ bool KstApp::queryClose() {
      doc->cancelUpdate();
     _stopping = true;
-    kapp->processEvents(); // danger
-    doc->deleteContents();
+    QTimer::singleShot(0, doc, SLOT(deleteContents()));
     return true;
   }
@@ -976,5 +975,5 @@ void KstApp::slotFileClose() {
     _stopping = true;
     kapp->processEvents(); // danger
-    doc->deleteContents();
+    QTimer::singleShot(0, doc, SLOT(deleteContents()));
     close();
   }

--- kdeextragear-2/kst/kst/kstdoc.h  #1.36:1.37
@@ -41,6 +41,4 @@ public:
   /** asks the user for saving if the document is modified */
   bool saveModified(bool doDelete = true);
-  /** deletes the document's contents */
-  void deleteContents();
   /** initializes the document generally */
   bool newDocument();
@@ -71,4 +69,6 @@ public:
 
 public slots:
+  /** deletes the document's contents */
+  void deleteContents();
   void purge();
   void wasModified();

--- kdeextragear-2/kst/kst/main.cpp  #1.87:1.88
@@ -1,4 +1,4 @@
 /***************************************************************************
-                          main.cpp  -  description
+                                  main.cpp 
                              -------------------
     begin                : Tue Aug 22 13:46:13 CST 2000
@@ -18,9 +18,8 @@
 #include <stdlib.h>
 #include <stdio.h>
-#include <iostream>
 
-#include <kdebug.h>
-#include <kcmdlineargs.h>
 #include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kdebug.h>
 #include <kimageio.h>
 
@@ -100,12 +99,12 @@ static void CheckForCMDErrors(KCmdLineAr
 
   if (args->getOption("n").toInt(&nOK) == 0) {
-    std::cerr << I18N_NOOP("error: exiting because '-n 0' requests vectors with no data in them\n");
-    exit(0);
+    kdError() << i18n("Exiting because '-n 0' requests vectors with no data in them.") << endl;
+    exit(0); // FIXME: can cause crashes
   }
   if (args->getOption("n").toInt(&nOK)>0) {
     if (args->getOption("n").toInt(&nOK) <
         2*args->getOption("s").toInt(&nOK)) {
-      std::cerr << "error: requested data skipping would leave vector with fewer than two points\n";
-      exit(0);
+      kdError() << i18n("Requested data skipping would leave vector with fewer than two points.") << endl;
+      exit(0); // FIXME: can cause crashes
     }
   }
@@ -254,7 +253,6 @@ static KstRVector *GetOrCreateVector(con
        + "-" + field, in.f, in.n, in.skip, in.doskip, in.doave);
   if (!V->isValid()) {
-    kdError() << I18N_NOOP("Error: Invalid field: ") << V->field()
-              << endl << I18N_NOOP("File: ") << V->filename() << endl;
-    exit(0); // fixme: this can cause crashes
+    kdError() << i18n("Invalid field: %1 in file %2").arg(V->field()).arg(V->filename()) << endl;
+    exit(0); // FIXME: this can cause crashes
   }
 
@@ -407,5 +405,5 @@ int main(int argc, char *argv[]) {
 
       if (!tlv) {
-        exit(0);
+        exit(0); // FIXME: can cause crashes
       }
 
@@ -471,6 +469,5 @@ int main(int argc, char *argv[]) {
 
         if (!file) {
-          std::cerr << I18N_NOOP("Error: No data in file: ")
-               << args->arg(i_file) << "\n";
+          kdError() << i18n("No data in file: %1").arg(args->arg(i_file)) << endl;
           delete kst;
           exit(0);
@@ -478,7 +475,5 @@ int main(int argc, char *argv[]) {
 
         if (!file->isValid() || file->isEmpty()) {
-          std::cerr << I18N_NOOP("No data in file: ")
-            << args->arg(i_file)
-            << ".  Trying to continue...\n";
+          kdError() << i18n("No data in file %1.  Trying to continue...").arg(args->arg(i_file)) << endl;
           // The file might get data later!
         }





More information about the Kst mailing list