• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

kabc

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., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KABC_RESOURCEFILE_H
00022 #define KABC_RESOURCEFILE_H
00023 
00024 #include "kabc/kabc_export.h"
00025 #include "kabc/resource.h"
00026 
00027 #include <kconfig.h>
00028 #include <kdirwatch.h>
00029 
00030 #include <sys/types.h>
00031 
00032 class QFile;
00033 class KTemporaryFile;
00034 
00035 class KJob;
00036 
00037 namespace KABC {
00038 
00039 class Format;
00040 class Lock;
00041 
00045 class KABC_FILE_CORE_EXPORT ResourceFile : public Resource
00046 {
00047   Q_OBJECT
00048 
00049   public:
00053     ResourceFile();
00059     explicit ResourceFile( const KConfigGroup &group );
00060 
00067     explicit ResourceFile( const QString &fileName,
00068                            const QString &formatName = QLatin1String( "vcard" ) );
00069 
00073     ~ResourceFile();
00074 
00078     virtual void writeConfig( KConfigGroup &group );
00079 
00084     virtual bool doOpen();
00085 
00089     virtual void doClose();
00090 
00094     virtual Ticket *requestSaveTicket();
00095 
00096     virtual void releaseSaveTicket( Ticket *ticket );
00097 
00102     virtual bool load();
00103 
00104     virtual bool asyncLoad();
00105 
00112     virtual bool save( Ticket *ticket );
00113 
00114     virtual bool asyncSave( Ticket *ticket );
00115 
00119     void setFileName( const QString & );
00120 
00124     QString fileName() const;
00125 
00129     void setFormat( const QString &name );
00130 
00134     QString format() const;
00135 
00144     virtual void removeAddressee( const Addressee &addr );
00145 
00146   private Q_SLOTS:
00147     void emitLoadingFinished();
00148     void emitSavingFinished();
00149 
00150   protected Q_SLOTS:
00151     void fileChanged( const QString &path );
00152 
00153   protected:
00154     void init( const QString &fileName, const QString &format );
00155 
00156     bool lock( const QString &fileName );
00157     void unlock( const QString &fileName );
00158 
00159   private:
00160     bool clearAndLoad( QFile *file );
00161     void saveToFile( QFile *file );
00162     bool createLocalTempFile();
00163     void deleteLocalTempFile();
00164     void deleteStaleTempFile();
00165     bool hasTempFile() const { return mTempFile != 0; }
00166     bool loadDistributionLists();
00167     void saveDistributionLists();
00168 
00169     QString mFileName;
00170     QString mFormatName;
00171 
00172     Format *mFormat;
00173 
00174     Lock *mLock;
00175 
00176     KDirWatch mDirWatch;
00177 
00178     KTemporaryFile *mTempFile;
00179 
00180     bool mAsynchronous;
00181 
00182     class ResourceFilePrivate;
00183     ResourceFilePrivate *d;
00184 };
00185 
00186 }
00187 
00188 #endif

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal