calformat.h
00001 /* 00002 This file is part of libkcal. 00003 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 #ifndef _CALFORMAT_H 00021 #define _CALFORMAT_H 00022 00023 #include <qstring.h> 00024 #include <qdatetime.h> 00025 #include <qevent.h> 00026 00027 #include "exceptions.h" 00028 #include "event.h" 00029 00030 namespace KCal { 00031 00032 class VCalDrag; 00033 class Calendar; 00034 00041 class CalFormat { 00042 public: 00044 CalFormat(); 00046 virtual ~CalFormat(); 00047 00053 virtual bool load(Calendar *, const QString &fileName) = 0; 00058 virtual bool save(Calendar *, const QString &fileName) = 0; 00059 00063 virtual bool fromString(Calendar *, const QString & ) = 0; 00067 virtual QString toString(Calendar *) = 0; 00068 00070 void clearException(); 00075 ErrorFormat *exception(); 00076 00080 static void setApplication(const QString& app, const QString& productID); 00082 static const QString& application() { return mApplication; } 00084 static const QString& productId() { return mProductId; } 00086 static int calendarVersion(const char* prodId); 00088 const QString &loadedProductId() { return mLoadedProductId; } 00089 00091 static QString createUniqueId(); 00092 00097 void setException(ErrorFormat *error); 00098 00099 protected: 00100 QString mLoadedProductId; // PRODID string loaded from calendar file 00101 00102 private: 00103 QPtrList<Event> mEventsRelate; // events with relations 00104 QPtrList<Event> mTodosRelate; // todos with relations 00105 00106 ErrorFormat *mException; 00107 00108 static QString mApplication; // name of application for unique ID strings 00109 static QString mProductId; // PRODID string to write to calendar files 00110 }; 00111 00112 } 00113 00114 #endif