calformat.h
00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 2001-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., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 #ifndef KCAL_CALFORMAT_H 00022 #define KCAL_CALFORMAT_H 00023 00024 #include <qstring.h> 00025 #include <qdatetime.h> 00026 #include <qevent.h> 00027 00028 #include "exceptions.h" 00029 #include "event.h" 00030 00031 namespace KCal { 00032 00033 class VCalDrag; 00034 class Calendar; 00035 00042 class CalFormat 00043 { 00044 public: 00046 CalFormat(); 00048 virtual ~CalFormat(); 00049 00055 virtual bool load(Calendar *, const QString &fileName) = 0; 00060 virtual bool save(Calendar *, const QString &fileName) = 0; 00061 00065 virtual bool fromString(Calendar *, const QString & ) = 0; 00069 virtual QString toString(Calendar *) = 0; 00070 00072 void clearException(); 00077 ErrorFormat *exception(); 00078 00082 static void setApplication(const QString& app, const QString& productID); 00084 static const QString& application() { return mApplication; } 00086 static const QString& productId() { return mProductId; } 00088 static int calendarVersion(const char* prodId); 00090 const QString &loadedProductId() { return mLoadedProductId; } 00091 00093 static QString createUniqueId(); 00094 00099 void setException(ErrorFormat *error); 00100 00101 protected: 00102 QString mLoadedProductId; // PRODID string loaded from calendar file 00103 00104 private: 00105 ErrorFormat *mException; 00106 00107 static QString mApplication; // name of application for unique ID strings 00108 static QString mProductId; // PRODID string to write to calendar files 00109 00110 class Private; 00111 Private *d; 00112 }; 00113 00114 } 00115 00116 #endif