[Kst] kdeextragear-2/kst

George Staikos staikos at kde.org
Fri Jul 9 23:04:07 CEST 2004


CVS commit by staikos: 

fix open, cancel


  M +1 -1      devel-docs/RELEASE_PLAN-0.98   1.28
  M +3 -1      kst/kst.cpp   1.181
  M +22 -18    kst/kstdoc.cpp   1.99
  M +2 -2      kst/kstdoc.h   1.32


--- kdeextragear-2/kst/devel-docs/RELEASE_PLAN-0.98  #1.27:1.28
@@ -13,5 +13,5 @@
 - locking is missing in places - especially dialogs (plugin, etc)
 - data manager update doesn't work (ex if vector grows)
-- open new kst file, then cancel, it still kills your old file
+- impossible to create data objects without plotting now
 
 

--- kdeextragear-2/kst/kst/kst.cpp  #1.180:1.181
@@ -798,8 +798,10 @@ void KstApp::slotFileOpen() {
   slotUpdateStatusMsg(i18n("Opening file..."));
 
-  if (doc->saveModified()) {
+  if (doc->saveModified(false)) {
     QString fileToOpen = KFileDialog::getOpenFileName("::<kstfiledir>",
         i18n("*.kst|Kst Plot File (*.kst)\n*|All Files"), this, i18n("Open File"));
     if (!fileToOpen.isEmpty()) {
+      doc->deleteContents();
+      doc->setModified(false);
       doc->openDocument(fileToOpen);
       setCaption(doc->title());

--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.98:1.99
@@ -105,5 +105,5 @@ const QString& KstDoc::title() const {
 }
 
-bool KstDoc::saveModified() {
+bool KstDoc::saveModified(bool doDelete) {
   bool completed = true;
 
@@ -119,11 +119,15 @@ bool KstDoc::saveModified() {
            }
 
+        if (doDelete) {
            deleteContents();
+        }
            completed = true;
            break;
 
       case KMessageBox::No:
+        if (doDelete) {
            setModified(false);
            deleteContents();
+        }
            completed = true;
            break;

--- kdeextragear-2/kst/kst/kstdoc.h  #1.31:1.32
@@ -41,10 +41,10 @@ public:
   /** sets the modified flag for the document after a modifying action
       on the view connected to the document.*/
-  void setModified(bool m = true){ _modified = m; }
+  void setModified(bool m = true) { _modified = m; }
   /** returns if the document is modified or not. Use this to determine
       if your document needs saving by the user on closing.*/
   bool isModified() const { return _modified; }
   /** asks the user for saving if the document is modified */
-  bool saveModified();
+  bool saveModified(bool doDelete = true);
   /** deletes the document's contents */
   void deleteContents();





More information about the Kst mailing list