diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-17 02:27:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-17 02:27:43 +0000 |
commit | 8f37a4f755113e7440ae985111d36985d500cc95 (patch) | |
tree | 3750f2ad5f3ffaac64a98b5fc1a0389838296669 /libkdepim/kabcresourcecached.h | |
parent | 6d83f2c4e31c985122f6de9dab69d9f1d727b48a (diff) | |
download | tdepim-8f37a4f755113e7440ae985111d36985d500cc95.tar.gz tdepim-8f37a4f755113e7440ae985111d36985d500cc95.zip |
Slew of fixes and upgrades, including:
Added kaddressbook automatic sync
Added carddav autosync options
Added DCOP calls for kaddressbook and korganizer manual resync
Repaired Kontact refresh button through above mentioned DCOP calls
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1164528 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/kabcresourcecached.h')
-rw-r--r-- | libkdepim/kabcresourcecached.h | 100 |
1 files changed, 97 insertions, 3 deletions
diff --git a/libkdepim/kabcresourcecached.h b/libkdepim/kabcresourcecached.h index c7ea30fe4..00d6f4e8b 100644 --- a/libkdepim/kabcresourcecached.h +++ b/libkdepim/kabcresourcecached.h @@ -24,6 +24,9 @@ #include <kabc/resource.h> #include <kdepimmacros.h> +#include <tqdatetime.h> +#include <tqtimer.h> + #include "libemailfunctions/idmapper.h" namespace KABC { @@ -33,11 +36,86 @@ class KDE_EXPORT ResourceCached : public Resource Q_OBJECT public: + /** + Reload policy. + + @see setReloadPolicy(), reloadPolicy() + */ + enum { ReloadNever, ReloadOnStartup, ReloadInterval }; + /** + Save policy. + + @see setSavePolicy(), savePolicy() + */ + enum { SaveNever, SaveOnExit, SaveInterval, SaveDelayed, SaveAlways }; + ResourceCached( const KConfig* ); ~ResourceCached(); /** - Writes the resource specific config to file. + Set reload policy. This controls when the cache is refreshed. + + ReloadNever never reload + ReloadOnStartup reload when resource is started + ReloadInterval reload regularly after given interval + */ + void setReloadPolicy( int policy ); + /** + Return reload policy. + + @see setReloadPolicy() + */ + int reloadPolicy() const; + + /** + Set reload interval in minutes which is used when reload policy is + ReloadInterval. + */ + void setReloadInterval( int minutes ); + + /** + Return reload interval in minutes. + */ + int reloadInterval() const; + + /** + Set save policy. This controls when the cache is refreshed. + + SaveNever never save + SaveOnExit save when resource is exited + SaveInterval save regularly after given interval + SaveDelayed save after small delay + SaveAlways save on every change + */ + void setSavePolicy( int policy ); + /** + Return save policy. + + @see setsavePolicy() + */ + int savePolicy() const; + + /** + Set save interval in minutes which is used when save policy is + SaveInterval. + */ + void setSaveInterval( int minutes ); + + /** + Return save interval in minutes. + */ + int saveInterval() const; + + void setupSaveTimer(); + void setupReloadTimer(); + + /** + Reads the resource specific config from disk. + */ + virtual void readConfig( KConfig *config ); + + /** + Writes the resource specific config to disk. */ virtual void writeConfig( KConfig *config ); @@ -85,14 +163,30 @@ class KDE_EXPORT ResourceCached : public Resource void setIdMapperIdentifier(); private: - KPIM::IdMapper mIdMapper; - TQMap<TQString, KABC::Addressee> mAddedAddressees; TQMap<TQString, KABC::Addressee> mChangedAddressees; TQMap<TQString, KABC::Addressee> mDeletedAddressees; + KPIM::IdMapper mIdMapper; + class ResourceCachedPrivate; ResourceCachedPrivate *d; + + int mReloadPolicy; + int mReloadInterval; + TQTimer mKABCReloadTimer; + bool mReloaded; + + int mSavePolicy; + int mSaveInterval; + TQTimer mKABCSaveTimer; + + TQDateTime mLastLoad; + TQDateTime mLastSave; + + protected slots: + void slotKABCReload(); + void slotKABCSave(); }; } |