home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kabc / resourcedir.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.5 KB  |  114 lines

  1. /*
  2.     This file is part of libkabc.
  3.     Copyright (c) 2002 - 2003 Tobias Koenig <tokoe@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_RESOURCEDIR_H
  22. #define KABC_RESOURCEDIR_H
  23.  
  24. #include <kconfig.h>
  25. #include <kdirwatch.h>
  26.  
  27. #include <sys/types.h>
  28.  
  29. #include <kabc/resource.h>
  30.  
  31. class QTimer;
  32.  
  33. namespace KABC {
  34.  
  35. class FormatPlugin;
  36. class Lock;
  37.  
  38. /**
  39.   @internal
  40. */
  41. class KABC_EXPORT ResourceDir : public Resource
  42. {
  43.   Q_OBJECT
  44.  
  45.   public:
  46.     ResourceDir( const KConfig* );
  47.     ResourceDir( const QString &path, const QString &type = "vcard" );
  48.     ~ResourceDir();
  49.  
  50.     virtual void writeConfig( KConfig* );
  51.  
  52.     virtual bool doOpen();
  53.     virtual void doClose();
  54.   
  55.     virtual Ticket *requestSaveTicket();
  56.     virtual void releaseSaveTicket( Ticket* );
  57.  
  58.     virtual bool load();
  59.     virtual bool asyncLoad();
  60.     virtual bool save( Ticket* ticket );
  61.     virtual bool asyncSave( Ticket* ticket );
  62.  
  63.     /**
  64.       Set path to be used for saving.
  65.      */
  66.     void setPath( const QString & );
  67.  
  68.     /**
  69.       Return path used for loading and saving the address book.
  70.      */
  71.     QString path() const;
  72.  
  73.     /**
  74.       Set the format by name.
  75.      */
  76.     void setFormat( const QString &format );
  77.  
  78.     /**
  79.       Returns the format name.
  80.      */
  81.     QString format() const;
  82.   
  83.     /**
  84.       Remove a addressee from its source.
  85.       This method is mainly called by KABC::AddressBook.
  86.      */
  87.     virtual void removeAddressee( const Addressee& addr );
  88.  
  89.   protected slots:
  90.     void pathChanged();
  91.  
  92.   protected:
  93.     void init( const QString &path, const QString &format );
  94.  
  95.   private:
  96.     FormatPlugin *mFormat;
  97.  
  98.     KDirWatch mDirWatch;
  99.  
  100.     QString mPath;
  101.     QString mFormatName;
  102.  
  103.     Lock *mLock;
  104.  
  105.     bool mAsynchronous;
  106.  
  107.     class ResourceDirPrivate;
  108.     ResourceDirPrivate *d;
  109. };
  110.  
  111. }
  112.  
  113. #endif
  114.