[Kst] extragear/graphics/kst/src/libkstapp

George Staikos staikos at kde.org
Sat Jun 3 17:13:57 CEST 2006


SVN commit 547849 by staikos:

- bump the Kstfile version number to 1.3
- make the check work based on double conversion - works well enough for now
- only do the padding hack if we have a 1.2 kstfile (were there pre-1.2 files
  that did this?  script generated ones don't count)
- make the future-kst-files error a warning instead
   -> note, Kst 1.2 will not load Kst 1.3 files.   If this is a major problem,
     I'll have to make a 1.2.2 release to remove the test.  In retrospect it
     always should have been a warning, not a hard error.


 M  +4 -13     kstdoc.cpp  
 M  +6 -2      kstviewlegend.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstdoc.cpp #547848:547849
@@ -286,18 +286,9 @@
     return false;
   }
 
-  if (docElem.attribute("version") != "1.2" && !docElem.attribute("version").isEmpty()) {
-    QString err = i18n("Error opening file %2.  Version %1 is too new.  Update Kst or fix the Kst file.").arg(docElem.attribute("version")).arg(url.prettyURL());
-    KstDebug::self()->log(err, KstDebug::Error);
-    KMessageBox::sorry(KstApp::inst(), err);
-    opening = false;
-    _updating = false;
-    KstApp::inst()->setPaused(false);
-    QApplication::restoreOverrideCursor();
-    if (cleanupFile) {
-      KIO::NetAccess::removeTempFile(tmpFile);
-    }
-    return false;
+  if (docElem.attribute("version").toDouble() > 1.3 && !docElem.attribute("version").isEmpty()) {
+    QString err = i18n("While opening file %2, version %1 is too new.  Update Kst or fix the Kst file.  Attempting to load as-is.").arg(docElem.attribute("version")).arg(url.prettyURL());
+    KstDebug::self()->log(err, KstDebug::Warning);
   }
 
   QDomNode n = docElem.firstChild();
@@ -594,7 +585,7 @@
 void KstDoc::saveDocument(QTextStream& ts, bool saveAbsoluteVectorPositions) {
   KstApp *app = KstApp::inst();
   ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
-  ts << "<kstdoc version=\"1.2\">" << endl;
+  ts << "<kstdoc version=\"1.3\">" << endl;
   // save window geometry for this kst file
   ts << "  <windowsize>" << endl;
   ts << "    <width>" << app->width() << "</width>" << endl;
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #547848:547849
@@ -125,8 +125,12 @@
     }
   }
   
-  // need the following as some older format kst files save the padding as 5...
-  setPadding(0);
+  // Padding was incorrectly saved as 5 in Kst <= 1.2.0 so we need to strip it
+  // out here since this object is buggy.  Remove this once padding is properly
+  // supported?  Maybe, but geometries are then wrong.
+  if (e.ownerDocument().documentElement().attribute("version") == "1.2") {
+    setPadding(0);
+  }
 }
 
 


More information about the Kst mailing list