24 #include <tqdatetime.h>
26 #include <tqptrlist.h>
32 #include "vcalformat.h"
33 #include "icalformat.h"
35 #include "filestorage.h"
39 FileStorage::FileStorage( Calendar *cal, const TQString &fileName,
42 mFileName( fileName ),
47 FileStorage::~FileStorage()
52 void FileStorage::setFileName( const TQString &fileName )
57 TQString FileStorage::fileName() const
75 bool FileStorage::open()
80 bool FileStorage::load()
86 if (mFileName.isEmpty()) return false;
93 success = saveFormat() && saveFormat()-> load( calendar(), mFileName );
97 success = iCal. load( calendar(), mFileName);
103 kdDebug(5800) << "FileStorage::load() Fallback to VCalFormat" << endl;
105 success = vCal. load( calendar(), mFileName );
111 kdDebug(5800) << "Warning! There should be an exception set." << endl;
125 bool FileStorage::save()
127 if ( mFileName.isEmpty() ) return false;
130 if ( mSaveFormat ) format = mSaveFormat;
133 bool success = format-> save( calendar(), mFileName );
139 kdDebug(5800) << "FileStorage::save(): Error. There should be an exception set."
147 if ( !mSaveFormat ) delete format;
152 bool FileStorage::close()
|