kabc Library API Documentation

resourcefile.h

00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 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
KDE Logo
This file is part of the documentation for kabc Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:35:18 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003