libkcal

resourcelocaldir.h

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 TQString;
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   TQ_OBJECT
00049 
00050     friend class ResourceLocalDirConfig;
00051 
00052   public:
00053     ResourceLocalDir( const KConfig * );
00054     ResourceLocalDir( const TQString& fileName );
00055     virtual ~ResourceLocalDir();
00056 
00057     void readConfig( const KConfig *config );
00058     void writeConfig( KConfig* config );
00059 
00060     KABC::Lock *lock();
00061 
00063     bool deleteEvent(Event *);
00064 
00068     bool deleteTodo( Todo * );
00069 
00073     bool deleteJournal( Journal * );
00074 
00075     void dump() const;
00076 
00077   protected slots:
00078     void reload( const TQString & );
00079 
00080   protected:
00081     virtual bool doOpen();
00082     virtual bool doLoad();
00083     virtual bool doSave();
00084     bool doSave( Incidence * );
00085     virtual bool doFileLoad( CalendarLocal &, const TQString &fileName );
00086 
00087   private:
00088     void init();
00089     bool deleteIncidenceFile(Incidence *incidence);
00090 
00091     KURL mURL;
00092 //     ICalFormat mFormat;
00093 
00094     KDirWatch mDirWatch;
00095 
00096     KABC::Lock *mLock;
00097 
00098     TQPtrList<Incidence>mDeletedIncidences;
00099     class Private;
00100     Private *d;
00101 };
00102 
00103 }
00104 
00105 #endif