[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeutils/kjots
From:       Stanislav Kljuhhin <crz () starman ! ee>
Date:       2003-08-31 2:24:11
[Download RAW message or body]

CVS commit by crzcrz: 

doesn't autosave books if contents haven't changed


  M +15 -2     KJotsMain.cpp   1.115
  M +2 -7      kjotsentry.cpp   1.8
  M +3 -1      kjotsentry.h   1.6


--- kdeutils/kjots/KJotsMain.cpp  #1.114:1.115
@@ -20,5 +20,5 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
-
+#include <iostream>
 #include <qbuttongroup.h>
 #include <qcursor.h>
@@ -505,5 +505,10 @@ void KJotsMain::doAutoSave(void)
 
         if (book && book->isDirty())
+        {
             book->closeBook(true);
+            std::cout<<"saving dirty book\n";
+        }
+        else
+            std::cout<<"not saving book\n";
 
         b = b->nextSibling();
@@ -615,6 +620,14 @@ void KJotsMain::syncTextWithEntry(KJotsS
 void KJotsMain::syncEntryWithText(KJotsSubject* entry)
 {
-    if (!entry)
+    if (!entry || !me_text->edited())
         return;
+    
+    KJotsBook* b=dynamic_cast<KJotsBook*>(entry->parent());
+
+    if (b)
+    {
+        b->setDirty(true);
+        std::cout<<"book got dirty\n";
+    }
 
     entry->setBody(me_text->text());

--- kdeutils/kjots/kjotsentry.cpp  #1.7:1.8
@@ -77,5 +77,6 @@ KJotsBook::KJotsBook(KListView* parent, 
     : KJotsEntryBase(parent, after),
       m_open(false),
-      m_deleteFlag(false)
+      m_deleteFlag(false),
+      m_dirty(false)
 {
     KJotsEntryBase::setSubject(subj);
@@ -113,10 +114,4 @@ bool KJotsBook::isBookFile(const QString
     }
 
-    return true;
-}
-
-bool KJotsBook::isDirty(void)
-{
-    // TODO: implement
     return true;
 }

--- kdeutils/kjots/kjotsentry.h  #1.5:1.6
@@ -72,6 +72,8 @@ class KJotsBook : public KJotsEntryBase
         KJotsSubject* addSubject(QString subject = QString::null, QListViewItem* after = 0);
         void print(QFont& defaultFont);
-        bool isDirty(void);
+        bool isDirty(void) { return m_dirty; }
+        void setDirty(bool d) { m_dirty=d; }
     private:
+        bool m_dirty;
         bool m_open;
         bool m_deleteFlag;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic