resourcefile.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_RESOURCEFILE_H
00022 #define KABC_RESOURCEFILE_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 class KTempFile;
00034
00035 namespace KIO {
00036 class Job;
00037 }
00038
00039 namespace KABC {
00040
00041 class FormatPlugin;
00042 class ResourceConfigWidget;
00043 class Lock;
00044
00048 class KABC_EXPORT ResourceFile : public Resource
00049 {
00050 Q_OBJECT
00051
00052 public:
00058 ResourceFile( const KConfig *cfg );
00059
00063 ResourceFile( const QString &fileName, const QString &formatName = "vcard" );
00064
00068 ~ResourceFile();
00069
00073 virtual void writeConfig( KConfig *cfg );
00074
00079 virtual bool doOpen();
00080
00084 virtual void doClose();
00085
00089 virtual Ticket *requestSaveTicket();
00090
00091 virtual void releaseSaveTicket( Ticket* );
00092
00097 virtual bool load();
00098
00099 virtual bool asyncLoad();
00100
00107 virtual bool save( Ticket *ticket );
00108
00109 virtual bool asyncSave( Ticket *ticket );
00110
00114 void setFileName( const QString & );
00115
00119 QString fileName() const;
00120
00124 void setFormat( const QString &name );
00125
00129 QString format() const;
00130
00135 virtual void removeAddressee( const Addressee& addr );
00136
00137 private slots:
00138 void downloadFinished( KIO::Job* );
00139 void uploadFinished( KIO::Job* );
00140
00141 protected slots:
00142 void fileChanged();
00143
00144 protected:
00145 void init( const QString &fileName, const QString &format );
00146
00147 bool lock( const QString &fileName );
00148 void unlock( const QString &fileName );
00149
00150 private:
00151 QString mFileName;
00152 QString mFormatName;
00153
00154 FormatPlugin *mFormat;
00155
00156 Lock *mLock;
00157
00158 KDirWatch mDirWatch;
00159
00160 QString mTempFile;
00161 KTempFile *mLocalTempFile;
00162
00163 bool mAsynchronous;
00164
00165 class ResourceFilePrivate;
00166 ResourceFilePrivate *d;
00167 };
00168
00169 }
00170
00171 #endif
This file is part of the documentation for kabc Library Version 3.3.90.