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

List:       kde-commits
Subject:    KDE/kdepim/libkcal
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2006-05-27 16:36:25
Message-ID: 1148747785.246677.7911.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 545489 by djarvie:

Add option to inhibit saves without changing resource configuration

 M  +14 -1     resourcecalendar.cpp  
 M  +14 -0     resourcecalendar.h  


--- trunk/KDE/kdepim/libkcal/resourcecalendar.cpp #545488:545489
@@ -34,7 +34,8 @@
 
 ResourceCalendar::ResourceCalendar( const KConfig *config )
     : KRES::Resource( config ),mResolveConflict( false ),
-      mNoReadOnlyOnLoad( false )
+      mNoReadOnlyOnLoad( false ),
+      mInhibitSave( false )
 {
 }
 
@@ -144,6 +145,8 @@
 
 bool ResourceCalendar::save( Incidence *incidence )
 {
+  if ( mInhibitSave )
+    return true;
   if ( !readOnly() ) {
     kDebug(5800) << "Save resource " + resourceName() << endl;
 
@@ -179,6 +182,16 @@
   emit resourceSaveError( this, msg );
 }
 
+void ResourceCalendar::setInhibitSave( bool inhibit )
+{
+  mInhibitSave = inhibit;
+}
+
+bool ResourceCalendar::saveInhibited() const
+{
+  return mInhibitSave;
+}
+
 bool ResourceCalendar::setValue( const QString &key, const QString &value )
 {
   return false;
--- trunk/KDE/kdepim/libkcal/resourcecalendar.h #545488:545489
@@ -116,6 +116,19 @@
     virtual bool isSaving() { return false; }
 
     /**
+      Inhibit or allow saves, overriding the save policy set by setSavePolicy().
+      Inhibiting saves has the same effect as making all resources read-only, except
+      that the inhibit status is not stored in the resource configuration.
+
+      @param inhibit true to inhibit saves, false to allow them
+    */
+    void setInhibitSave( bool inhibit );
+    /**
+      Return whether saves have been inhibited by setInhibitSave().
+     */
+    bool saveInhibited() const;
+
+    /**
       Return object for locking the resource.
     */
     virtual KABC::Lock *lock() = 0;
@@ -389,6 +402,7 @@
     bool mReceivedLoadError;
     bool mReceivedSaveError;
     bool mNoReadOnlyOnLoad;
+    bool mInhibitSave;     // true to prevent saves
 
     class Private;
     Private *d;
[prev in list] [next in list] [prev in thread] [next in thread] 

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