[Kst] branches/work/kst/portto4/kst/src/libkstapp

Peter Kümmel syntheticpp at gmx.net
Tue Aug 10 10:31:39 CEST 2010


SVN commit 1161403 by kuemmel:

show message when there are errors in Kst .xml files.
Add comment that we could not read Kst 1 file.

 M  +9 -3      document.cpp  
 M  +3 -1      mainwindow.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #1161402:1161403
@@ -28,6 +28,7 @@
 #include <QFile>
 #include <QXmlStreamReader>
 
+
 namespace Kst {
 
 Document::Document(MainWindow *window)
@@ -155,6 +156,11 @@
   return ok;
 }
 
+
+#define malformed() \
+  return false;
+
+
 bool Document::open(const QString& file) {
   _isOpen = false;
   QFile f(file);
@@ -179,8 +185,6 @@
   enum State { Unknown=0, Data, Variables, Objects, Relations, Graphics, View };
   State state = Unknown;
 
-#define malformed()
-
   while (!xml.atEnd()) {
     if (xml.isStartElement()) {
       QString n = xml.name().toString();
@@ -299,7 +303,6 @@
     }
     xml.readNext();
   }
-#undef malformed
 
   if (xml.hasError()) {
     _lastError = QObject::tr("File is malformed and encountered an error while reading.");
@@ -325,6 +328,9 @@
   return _isOpen = true;
 }
 
+#undef malformed
+
+
 void Document::createView() {
   _win->tabWidget()->createView();
 }
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1161402:1161403
@@ -273,7 +273,9 @@
   QApplication::restoreOverrideCursor();
 
   if (!ok) {
-    QMessageBox::critical(this, tr("Kst"), tr("Error opening document '%1':\n%2").arg(file, _doc->lastError()));
+    QMessageBox::critical(this, tr("Kst"), 
+        tr("Error opening document '%1':\n%2\n"
+           "Maybe it is a Kst 1 file which could not be read by Kst 2.").arg(file, _doc->lastError()));
     delete _doc;
     _doc = new Document(this);
   } 


More information about the Kst mailing list