• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.3 API Reference
  • KDE Home
  • Contact Us
 

kabc

  • kabc
  • plugins
  • file
resourcefile.h
1 /*
2  This file is part of libkabc.
3  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef KABC_RESOURCEFILE_H
22 #define KABC_RESOURCEFILE_H
23 
24 #include "kabc/kabc_export.h"
25 #include "kabc/resource.h"
26 
27 #include <kconfig.h>
28 #include <kdirwatch.h>
29 
30 #include <sys/types.h>
31 
32 class QFile;
33 class KTemporaryFile;
34 
35 class KJob;
36 
37 namespace KABC {
38 
39 class Format;
40 class Lock;
41 
45 class KABC_FILE_CORE_EXPORT ResourceFile : public Resource
46 {
47  Q_OBJECT
48 
49  public:
53  ResourceFile();
59  explicit ResourceFile( const KConfigGroup &group );
60 
67  explicit ResourceFile( const QString &fileName,
68  const QString &formatName = QLatin1String( "vcard" ) );
69 
73  ~ResourceFile();
74 
78  virtual void writeConfig( KConfigGroup &group );
79 
84  virtual bool doOpen();
85 
89  virtual void doClose();
90 
94  virtual Ticket *requestSaveTicket();
95 
96  virtual void releaseSaveTicket( Ticket *ticket );
97 
102  virtual bool load();
103 
104  virtual bool asyncLoad();
105 
112  virtual bool save( Ticket *ticket );
113 
114  virtual bool asyncSave( Ticket *ticket );
115 
119  void setFileName( const QString & );
120 
124  QString fileName() const;
125 
129  void setFormat( const QString &name );
130 
134  QString format() const;
135 
144  virtual void removeAddressee( const Addressee &addr );
145 
146  private Q_SLOTS:
147  void emitLoadingFinished();
148  void emitSavingFinished();
149 
150  protected Q_SLOTS:
151  void fileChanged( const QString &path );
152 
153  protected:
154  void init( const QString &fileName, const QString &format );
155 
156  bool lock( const QString &fileName );
157  void unlock( const QString &fileName );
158 
159  private:
160  bool clearAndLoad( QFile *file );
161  void saveToFile( QFile *file );
162  bool createLocalTempFile();
163  void deleteLocalTempFile();
164  void deleteStaleTempFile();
165  bool hasTempFile() const { return mTempFile != 0; }
166  bool loadDistributionLists();
167  void saveDistributionLists();
168 
169  QString mFileName;
170  QString mFormatName;
171 
172  Format *mFormat;
173 
174  Lock *mLock;
175 
176  KDirWatch mDirWatch;
177 
178  KTemporaryFile *mTempFile;
179 
180  bool mAsynchronous;
181 
182  class ResourceFilePrivate;
183  ResourceFilePrivate *d;
184 };
185 
186 }
187 
188 #endif
KABC::Lock
This class provides locking functionality for a file, directory or an arbitrary string-represented re...
Definition: lock.h:34
KABC::Ticket
Helper class for handling coordinated save of address books.
Definition: resource.h:37
KABC::Addressee
address book entry
Definition: addressee.h:74
KABC::Resource
Definition: resource.h:64
KABC::ResourceFile
This resource allows access to a local file.
Definition: resourcefile.h:45
KABC::Format
Base class for address book formats.
Definition: format.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:04:12 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

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

kdepimlibs-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal