resourcedir.h
00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2002 - 2003 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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 TQTimer; 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 TQString &path, const TQString &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 TQString & ); 00067 00071 TQString path() const; 00072 00076 void setFormat( const TQString &format ); 00077 00081 TQString format() const; 00082 00087 virtual void removeAddressee( const Addressee& addr ); 00088 00089 protected slots: 00090 void pathChanged(); 00091 00092 protected: 00093 void init( const TQString &path, const TQString &format ); 00094 00095 private: 00096 FormatPlugin *mFormat; 00097 00098 KDirWatch mDirWatch; 00099 00100 TQString mPath; 00101 TQString mFormatName; 00102 00103 Lock *mLock; 00104 00105 bool mAsynchronous; 00106 00107 class ResourceDirPrivate; 00108 ResourceDirPrivate *d; 00109 }; 00110 00111 } 00112 00113 #endif