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

George Staikos staikos at kde.org
Fri Jun 1 02:16:25 CEST 2007


SVN commit 670296 by staikos:

some state tracking for Document


 M  +12 -4     document.cpp  
 M  +3 -0      document.h  


--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #670295:670296
@@ -19,7 +19,7 @@
 namespace Kst {
 
 Document::Document()
-: _session(new SessionModel) {
+: _session(new SessionModel), _dirty(false), _isOpen(false) {
 }
 
 
@@ -35,11 +35,13 @@
 
 
 bool Document::save(const QString& to) {
+  setChanged(false);
   return false;
 }
 
 
 bool Document::open(const QString& file) {
+  _isOpen = false;
   QFile f(file);
   if (!f.open(QIODevice::ReadOnly)) {
     // QMessageBox::critical
@@ -61,7 +63,7 @@
     return false;
   }
 
-  return true;
+  return _isOpen = true;
 }
 
 
@@ -71,14 +73,20 @@
 
 
 bool Document::isChanged() const {
-  return true;  // FIXME!
+  return _dirty;
 }
 
 
 bool Document::isOpen() const {
-  return true;  // FIXME!
+  return _isOpen;
 }
 
+
+void Document::setChanged(bool dirty) {
+  _dirty = dirty;
 }
 
+
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/document.h #670295:670296
@@ -29,12 +29,15 @@
     bool save(const QString& to = QString::null);
 
     bool isChanged() const;
+    void setChanged(bool changed);
     bool isOpen() const;
 
     QString lastError() const;
 
   private:
     SessionModel *_session;
+    bool _dirty;
+    bool _isOpen;
 };
 
 }


More information about the Kst mailing list