libkcal

icalformatimpl.h

00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KCAL_ICALFORMATIMPL_H
00023 #define KCAL_ICALFORMATIMPL_H
00024 
00025 #include <qstring.h>
00026 #include <qdict.h>
00027 
00028 #include "scheduler.h"
00029 #include "freebusy.h"
00030 
00031 
00032 extern "C" {
00033   #include <ical.h>
00034   #include <icalss.h>
00035 }
00036 
00037 namespace KCal {
00038 
00039 class Compat;
00040 
00046 class ICalFormatImpl
00047 {
00048   public:
00050     ICalFormatImpl( ICalFormat *parent );
00051     virtual ~ICalFormatImpl();
00052 
00053     bool populate( Calendar *, icalcomponent *fs);
00054 
00055     icalcomponent *writeIncidence(IncidenceBase *incidence, Scheduler::Method method = Scheduler::Request );
00056     icalcomponent *writeTodo(Todo *todo);
00057     icalcomponent *writeEvent(Event *event);
00058     icalcomponent *writeFreeBusy(FreeBusy *freebusy,
00059                                  Scheduler::Method method = Scheduler::Publish );
00060     icalcomponent *writeJournal(Journal *journal);
00061     void writeIncidence(icalcomponent *parent,Incidence *incidence);
00062     icalproperty *writeAttendee(Attendee *attendee);
00063     icalproperty *writeOrganizer( const Person &organizer );
00064     icalproperty *writeAttachment(Attachment *attach);
00065     icalproperty *writeRecurrenceRule(Recurrence *);
00066     icalrecurrencetype writeRecurrenceRule( RecurrenceRule *recur );
00067     icalcomponent *writeAlarm(Alarm *alarm);
00068 
00069     QString extractErrorProperty(icalcomponent *);
00070     Todo *readTodo(icalcomponent *vtodo);
00071     Event *readEvent(icalcomponent *vevent, icalcomponent *vtimezone);
00072     FreeBusy *readFreeBusy(icalcomponent *vfreebusy);
00073     Journal *readJournal(icalcomponent *vjournal);
00074     Attendee *readAttendee(icalproperty *attendee);
00075     Person readOrganizer( icalproperty *organizer );
00076     Attachment *readAttachment(icalproperty *attach);
00077     void readIncidence(icalcomponent *parent, icaltimezone *timezone, Incidence *incidence);
00078     void readRecurrenceRule(icalproperty *rrule,Incidence *event );
00079     void readExceptionRule( icalproperty *rrule, Incidence *incidence );
00080     void readRecurrence( const struct icalrecurrencetype &r, RecurrenceRule* recur );
00081     void readAlarm(icalcomponent *alarm,Incidence *incidence);
00083     const QString &loadedProductId()  { return mLoadedProductId; }
00084 
00085     static icaltimetype writeICalDate(const QDate &);
00086     static QDate readICalDate(icaltimetype);
00087     icaltimetype writeICalDateTime(const QDateTime &);
00088     QDateTime readICalDateTime( icaltimetype&, icaltimezone* tz = 0 );
00089     static icaldurationtype writeICalDuration(int seconds);
00090     static int readICalDuration(icaldurationtype);
00091     static icaldatetimeperiodtype writeICalDatePeriod( const QDate &date );
00092     icaldatetimeperiodtype writeICalDateTimePeriod( const QDateTime &date );
00093 
00094     icalcomponent *createCalendarComponent(Calendar * = 0);
00095     icalcomponent *createScheduleComponent(IncidenceBase *,Scheduler::Method);
00096 
00097   protected:
00098     void dumpIcalRecurrence(icalrecurrencetype);
00099   private:
00100     void writeIncidenceBase(icalcomponent *parent,IncidenceBase *);
00101     void readIncidenceBase(icalcomponent *parent, IncidenceBase *);
00102     void writeCustomProperties(icalcomponent *parent,CustomProperties *);
00103     void readCustomProperties(icalcomponent *parent,CustomProperties *);
00104     void readTimezone(icalcomponent *vtimezone);
00105 
00106     ICalFormat *mParent;
00107     Calendar *mCalendar;
00108 
00109     QString mLoadedProductId;         // PRODID string loaded from calendar file
00110 
00111     Event::List mEventsRelate;           // events with relations
00112     Todo::List mTodosRelate;             // todos with relations
00113 
00114     static const int mSecondsPerWeek;
00115     static const int mSecondsPerDay;
00116     static const int mSecondsPerHour;
00117     static const int mSecondsPerMinute;
00118 
00119     Compat *mCompat;
00120 
00121     class ToComponentVisitor;
00122     class Private;
00123     Private *d;
00124 };
00125 
00126 }
00127 
00128 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys