KCalCore Library
icalformat_p.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcalcore library. 00003 00004 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 00006 Copyright (c) 2006 David Jarvie <software@astrojar.org.uk> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License as published by the Free Software Foundation; either 00011 version 2 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public License 00019 along with this library; see the file COPYING.LIB. If not, write to 00020 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 Boston, MA 02110-1301, USA. 00022 */ 00032 #ifndef KCALCORE_ICALFORMAT_P_H 00033 #define KCALCORE_ICALFORMAT_P_H 00034 00035 #include "exceptions.h" 00036 #include "freebusy.h" 00037 #include "todo.h" 00038 #include "journal.h" 00039 #include "event.h" 00040 #include "person.h" 00041 #include "calendar.h" 00042 #include "schedulemessage.h" 00043 00044 #include <KDateTime> 00045 00046 #include <ical.h> 00047 00048 class QDate; 00049 00050 namespace KCalCore { 00051 00052 class Alarm; 00053 class Attachment; 00054 class Attendee; 00055 class Duration; 00056 class Event; 00057 class FreeBusy; 00058 class ICalFormat; 00059 class ICalTimeZones; 00060 class Incidence; 00061 class Journal; 00062 class Recurrence; 00063 class RecurrenceRule; 00064 class Todo; 00065 00070 #define _ICAL_VERSION "2.0" 00071 00082 class ICalFormatImpl 00083 { 00084 public: 00089 explicit ICalFormatImpl( ICalFormat *parent ); 00090 00094 virtual ~ICalFormatImpl(); 00095 00101 bool populate( const Calendar::Ptr &calendar, icalcomponent *fs, 00102 bool deleted = false, const QString ¬ebook = QString() ); 00103 00104 icalcomponent *writeIncidence( const IncidenceBase::Ptr &incidence, 00105 iTIPMethod method = iTIPRequest ); 00106 00107 icalcomponent *writeTodo( const Todo::Ptr &todo, ICalTimeZones *tzlist = 0, 00108 ICalTimeZones *tzUsedList = 0 ); 00109 00110 icalcomponent *writeEvent( const Event::Ptr &event, ICalTimeZones *tzlist = 0, 00111 ICalTimeZones *tzUsedList = 0 ); 00112 00113 icalcomponent *writeJournal( const Journal::Ptr &journal, ICalTimeZones *tzlist = 0, 00114 ICalTimeZones *tzUsedList = 0 ); 00115 00116 icalcomponent *writeFreeBusy( const FreeBusy::Ptr &freebusy, 00117 iTIPMethod method = iTIPPublish ); 00118 00119 void writeIncidence( icalcomponent *parent, const Incidence::Ptr &incidence, 00120 ICalTimeZones *tzlist = 0, ICalTimeZones *tzUsedList = 0 ); 00121 00122 icalproperty *writeDescription( const QString &description, bool isRich = false ); 00123 icalproperty *writeSummary( const QString &summary, bool isRich = false ); 00124 icalproperty *writeLocation( const QString &location, bool isRich = false ); 00125 icalproperty *writeAttendee( const Attendee::Ptr &attendee ); 00126 icalproperty *writeOrganizer( const Person::Ptr &organizer ); 00127 icalproperty *writeAttachment( const Attachment::Ptr &attach ); 00128 icalproperty *writeRecurrenceRule( Recurrence * ); 00129 icalrecurrencetype writeRecurrenceRule( RecurrenceRule *recur ); 00130 icalcomponent *writeAlarm( const Alarm::Ptr &alarm ); 00131 00132 QString extractErrorProperty( icalcomponent * ); 00133 Todo::Ptr readTodo( icalcomponent *vtodo, ICalTimeZones *tzlist ); 00134 Event::Ptr readEvent( icalcomponent *vevent, ICalTimeZones *tzlist ); 00135 FreeBusy::Ptr readFreeBusy( icalcomponent *vfreebusy ); 00136 Journal::Ptr readJournal( icalcomponent *vjournal, ICalTimeZones *tzlist ); 00137 Attendee::Ptr readAttendee( icalproperty *attendee ); 00138 Person::Ptr readOrganizer( icalproperty *organizer ); 00139 Attachment::Ptr readAttachment( icalproperty *attach ); 00140 void readIncidence( icalcomponent *parent, Incidence::Ptr incidence, 00141 ICalTimeZones *tzlist ); 00142 void readRecurrenceRule( icalproperty *rrule, Incidence::Ptr event ); 00143 void readExceptionRule( icalproperty *rrule, Incidence::Ptr incidence ); 00144 void readRecurrence( const struct icalrecurrencetype &r, 00145 RecurrenceRule *recur ); 00146 void readAlarm( icalcomponent *alarm, Incidence::Ptr incidence, 00147 ICalTimeZones *tzlist ); 00148 00152 QString loadedProductId() const; 00153 00154 static icaltimetype writeICalDate( const QDate & ); 00155 00156 static QDate readICalDate(icaltimetype); 00157 00158 static icaltimetype writeICalDateTime( const KDateTime & ); 00159 00160 static icaltimetype writeICalUtcDateTime( const KDateTime & ); 00161 00177 static icalproperty *writeICalDateTimeProperty( const icalproperty_kind kind, 00178 const KDateTime &dt, 00179 ICalTimeZones *tzlist = 0, 00180 ICalTimeZones *tzUsedList = 0 ); 00181 00194 static KDateTime readICalDateTime( icalproperty *p, const icaltimetype &t, 00195 ICalTimeZones *tzlist, bool utc = false ); 00196 00206 static KDateTime readICalUtcDateTime( icalproperty *p, icaltimetype &t, 00207 ICalTimeZones *tzlist = 0 ) 00208 { return readICalDateTime( p, t, tzlist, true ); } 00209 00220 static KDateTime readICalDateTimeProperty( icalproperty *p, 00221 ICalTimeZones *tzlist, bool utc = false ); 00222 00227 static KDateTime readICalUtcDateTimeProperty( icalproperty *p ) 00228 { return readICalDateTimeProperty( p, 0, true ); } 00229 00230 static icaldurationtype writeICalDuration( const Duration &duration ); 00231 00232 static Duration readICalDuration( icaldurationtype d ); 00233 00234 static icaldatetimeperiodtype writeICalDatePeriod( const QDate &date ); 00235 00236 icalcomponent *createCalendarComponent( const Calendar::Ptr &calendar = Calendar::Ptr() ); 00237 00238 icalcomponent *createScheduleComponent( const IncidenceBase::Ptr &incidence, 00239 iTIPMethod method ); 00240 00241 protected: 00242 // void dumpIcalRecurrence( const icalrecurrencetype &r ); 00243 00244 private: 00245 //@cond PRIVATE 00246 class Private; 00247 Private *const d; 00248 //@endcond 00249 }; 00250 00251 } 00252 00253 #endif