libkcal

resourcelocaldir.h

Go to the documentation of this file.
00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KCAL_RESOURCELOCALDIRDIR_H
00022 #define KCAL_RESOURCELOCALDIRDIR_H
00023 
00024 #include <kurl.h>
00025 #include <kdirwatch.h>
00026 #include <kdepimmacros.h>
00027 
00028 #include "resourcecached.h"
00029 
00030 #include "libkcal_export.h"
00031 
00032 class QString;
00033 class KConfig;
00034 
00035 namespace KCal {
00036 
00037 class CalendarLocal;
00038 class Incidence;
00039 
00045 class LIBKCAL_EXPORT ResourceLocalDir : public ResourceCached
00046 {
00047     Q_OBJECT
00048 
00049     friend class ResourceLocalDirConfig;
00050 
00051   public:
00052     ResourceLocalDir( const KConfig * );
00053     ResourceLocalDir( const QString& fileName );
00054     virtual ~ResourceLocalDir();
00055 
00056     void readConfig( const KConfig *config );
00057     void writeConfig( KConfig* config );
00058 
00059     KABC::Lock *lock();
00060 
00062     bool deleteEvent(Event *);
00063 
00067     bool deleteTodo( Todo * );
00068 
00072     bool deleteJournal( Journal * );
00073 
00074     void dump() const;
00075 
00076   protected slots:
00077     void reload( const QString & );
00078 
00079   protected:
00080     virtual bool doOpen();
00081     virtual bool doLoad();
00082     virtual bool doSave();
00083     bool doSave( Incidence * );
00084     virtual bool doFileLoad( CalendarLocal &, const QString &fileName );
00085 
00086   private:
00087     void init();
00088     bool deleteIncidenceFile(Incidence *incidence);
00089 
00090     KURL mURL;
00091 //     ICalFormat mFormat;
00092 
00093     KDirWatch mDirWatch;
00094 
00095     KABC::Lock *mLock;
00096 
00097     class Private;
00098     Private *d;
00099 };
00100 
00101 }
00102 
00103 #endif