resourcedir.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_RESOURCEDIR_H
00022 #define KABC_RESOURCEDIR_H
00023
00024 #include <kconfig.h>
00025 #include <kdirwatch.h>
00026
00027 #include <sys/types.h>
00028
00029 #include <kabc/resource.h>
00030
00031 class QTimer;
00032
00033 namespace KABC {
00034
00035 class FormatPlugin;
00036 class Lock;
00037
00041 class KABC_EXPORT ResourceDir : public Resource
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 ResourceDir( const KConfig* );
00047 ResourceDir( const QString &path, const QString &type = "vcard" );
00048 ~ResourceDir();
00049
00050 virtual void writeConfig( KConfig* );
00051
00052 virtual bool doOpen();
00053 virtual void doClose();
00054
00055 virtual Ticket *requestSaveTicket();
00056 virtual void releaseSaveTicket( Ticket* );
00057
00058 virtual bool load();
00059 virtual bool asyncLoad();
00060 virtual bool save( Ticket* ticket );
00061 virtual bool asyncSave( Ticket* ticket );
00062
00066 void setPath( const QString & );
00067
00071 QString path() const;
00072
00076 void setFormat( const QString &format );
00077
00081 QString format() const;
00082
00087 virtual void removeAddressee( const Addressee& addr );
00088
00089 protected slots:
00090 void pathChanged();
00091
00092 protected:
00093 void init( const QString &path, const QString &format );
00094
00095 private:
00096 FormatPlugin *mFormat;
00097
00098 KDirWatch mDirWatch;
00099
00100 QString mPath;
00101 QString mFormatName;
00102
00103 Lock *mLock;
00104
00105 bool mAsynchronous;
00106
00107 class ResourceDirPrivate;
00108 ResourceDirPrivate *d;
00109 };
00110
00111 }
00112
00113 #endif
|