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 "resource.h"
00030 
00031 class QTimer;
00032 
00033 namespace KABC {
00034 
00035 class FormatPlugin;
00036 class ResourceConfigWidget;
00037 
00041 class ResourceFile : public QObject, public Resource
00042 {
00043   Q_OBJECT
00044 
00045 public:
00046 
00053   ResourceFile( AddressBook *ab, const KConfig *cfg );
00054 
00062   ResourceFile( AddressBook *ab, const QString &filename,
00063                 FormatPlugin *format = 0 );
00064 
00068   ~ResourceFile();
00069 
00074   bool open();
00075 
00079   void close();
00080   
00084   Ticket *requestSaveTicket();
00085 
00090   bool load();
00091 
00098   bool save( Ticket *ticket );
00099 
00103   void setFileName( const QString & );
00104 
00108   QString fileName() const;
00109 
00113   virtual QString identifier() const;
00114 
00119   void removeAddressee( const Addressee& addr );
00120 
00125   virtual void cleanUp();
00126 
00127 protected slots:
00128   void fileChanged();
00129 
00130 protected:
00131   bool lock( const QString &fileName );
00132   void unlock( const QString &fileName );
00133 
00134 private:
00135   void init( const QString &filename, FormatPlugin *format );
00136 
00137   QString mFileName;
00138   FormatPlugin *mFormat;
00139 
00140   QString mLockUniqueName;
00141     
00142   KDirWatch mDirWatch;
00143 };
00144 
00145 }
00146 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:29:21 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001