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 / libkcal / resourcelocal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  2.5 KB  |  105 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 1998 Preston Brown <pbrown@kde.org>
  5.     Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public License
  18.     along with this library; see the file COPYING.LIB.  If not, write to
  19.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.     Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef KCAL_RESOURCELOCAL_H
  23. #define KCAL_RESOURCELOCAL_H
  24.  
  25. #include <qstring.h>
  26. #include <qdatetime.h>
  27.  
  28. #include <kurl.h>
  29. #include <kdirwatch.h>
  30. #include <kdepimmacros.h>
  31. class KConfig;
  32.  
  33. #include "calendarlocal.h"
  34. #include "libkcal_export.h"
  35.  
  36. #include "resourcecached.h"
  37.  
  38. namespace KCal {
  39.  
  40. class CalFormat;
  41.  
  42. /**
  43.   This class provides a calendar resource stored as a local file.
  44. */
  45. class LIBKCAL_EXPORT ResourceLocal : public ResourceCached
  46. {
  47.     Q_OBJECT
  48.  
  49.     friend class ResourceLocalConfig;
  50.  
  51.   public:
  52.     /**
  53.       Create resource from configuration information stored in a KConfig object.
  54.     */
  55.     ResourceLocal( const KConfig * );
  56.     /**
  57.       Create resource for file named @a fileName.
  58.     */
  59.     ResourceLocal( const QString& fileName );
  60.     virtual ~ResourceLocal();
  61.  
  62.     virtual void writeConfig( KConfig* config );
  63.  
  64.     KABC::Lock *lock();
  65.  
  66.     QString fileName() const;
  67.     bool setFileName( const QString &fileName );
  68.     bool setValue( const QString &key, const QString &value );
  69.  
  70.  
  71.     void dump() const;
  72.  
  73.   protected slots:
  74.     void reload();
  75.  
  76.   protected:
  77.     virtual bool doLoad();
  78.     virtual bool doSave();
  79.     /**
  80.       Called by reload() to reload the resource, if it is already open.
  81.       @return true if successful, else false. If true is returned,
  82.               reload() will emit a resourceChanged() signal.
  83.     */
  84.     virtual bool doReload();
  85.  
  86.     QDateTime readLastModified();
  87.  
  88.   private:
  89.     void init();
  90.  
  91.     KURL mURL;
  92.     CalFormat *mFormat;
  93.  
  94.     KDirWatch mDirWatch;
  95.  
  96.     KABC::Lock *mLock;
  97.  
  98.     class Private;
  99.     Private *d;
  100. };
  101.  
  102. }
  103.  
  104. #endif
  105.