21 #ifndef TDEABC_RESOURCECACHED_H
22 #define TDEABC_RESOURCECACHED_H
24 #include <tdeabc/resource.h>
25 #include <tdemacros.h>
27 #include <tqdatetime.h>
30 #include "libemailfunctions/idmapper.h"
34 class TDE_EXPORT ResourceCached :
public Resource
45 enum { ReloadNever, ReloadOnStartup, ReloadInterval };
51 enum { SaveNever, SaveOnExit, SaveInterval, SaveDelayed, SaveAlways };
53 ResourceCached(
const TDEConfig* );
63 void setReloadPolicy(
int policy );
69 int reloadPolicy()
const;
75 void setReloadInterval(
int minutes );
80 int reloadInterval()
const;
91 void setSavePolicy(
int policy );
97 int savePolicy()
const;
103 void setSaveInterval(
int minutes );
108 int saveInterval()
const;
110 void setupSaveTimer();
111 void setupReloadTimer();
116 virtual void readConfig( TDEConfig *config );
121 virtual void writeConfig( TDEConfig *config );
126 virtual void insertAddressee(
const Addressee& );
131 virtual void removeAddressee(
const Addressee& addr );
136 void cleanUpCache(
const TDEABC::Addressee::List &list );
141 KPIM::IdMapper& idMapper();
143 bool hasChanges()
const;
145 void clearChange(
const TDEABC::Addressee& );
146 void clearChange(
const TQString& );
148 TDEABC::Addressee::List addedAddressees()
const;
149 TDEABC::Addressee::List changedAddressees()
const;
150 TDEABC::Addressee::List deletedAddressees()
const;
153 virtual TQString cacheFile()
const;
158 virtual TQString changesCacheFile(
const TQString& )
const;
159 void loadChangesCache( TQMap<TQString, TDEABC::Addressee>&,
const TQString& );
160 void loadChangesCache();
161 void saveChangesCache(
const TQMap<TQString, TDEABC::Addressee>&,
const TQString& );
162 void saveChangesCache();
164 void setIdMapperIdentifier();
167 TQMap<TQString, TDEABC::Addressee> mAddedAddressees;
168 TQMap<TQString, TDEABC::Addressee> mChangedAddressees;
169 TQMap<TQString, TDEABC::Addressee> mDeletedAddressees;
171 KPIM::IdMapper mIdMapper;
173 class ResourceCachedPrivate;
174 ResourceCachedPrivate *d;
178 TQTimer mKABCReloadTimer;
183 TQTimer mKABCSaveTimer;
185 TQDateTime mLastLoad;
186 TQDateTime mLastSave;
189 void slotKABCReload();