KCalCore Library
vcalformat.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00038 #ifndef KCALCORE_VCALFORMAT_H
00039 #define KCALCORE_VCALFORMAT_H
00040
00041 #include "kcalcore_export.h"
00042 #include "attendee.h"
00043 #include "calformat.h"
00044 #include "event.h"
00045 #include "todo.h"
00046 #include "journal.h"
00047
00048 struct VObject;
00049
00050 class KDateTime;
00051
00052 class QDate;
00053
00054 #define _VCAL_VERSION "1.0"
00055
00056 namespace KCalCore {
00057
00058 class Event;
00059 class Todo;
00060
00069 class KCALCORE_EXPORT VCalFormat : public CalFormat
00070 {
00071 public:
00075 VCalFormat();
00076
00080 virtual ~VCalFormat();
00081
00086 bool load( const Calendar::Ptr &calendar, const QString &fileName );
00087
00092 bool save( const Calendar::Ptr &calendar, const QString &fileName );
00093
00098 bool fromString( const Calendar::Ptr &calendar, const QString &string,
00099 bool deleted = false, const QString ¬ebook = QString() );
00100
00105 QString toString( const Calendar::Ptr &calendar, const QString ¬ebook = QString(),
00106 bool deleted = false );
00107
00112 bool fromRawString( const Calendar::Ptr &calendar, const QByteArray &string,
00113 bool deleted = false, const QString ¬ebook = QString() );
00114
00115 protected:
00120 Todo::Ptr VTodoToEvent( VObject *vtodo );
00121
00126 Event::Ptr VEventToEvent( VObject *vevent );
00127
00132 VObject *eventToVEvent( const Event::Ptr &event );
00133
00137 QString parseTZ( const QByteArray &timezone ) const;
00138
00142 QString parseDst( QByteArray &timezone ) const;
00143
00148 VObject *eventToVTodo( const Todo::Ptr &todo );
00149
00154 QString qDateToISO( const QDate &date );
00155
00161 QString kDateTimeToISO( const KDateTime &date, bool zulu = true );
00162
00168 KDateTime ISOToKDateTime( const QString &dtStr );
00169
00175 QDate ISOToQDate( const QString &dtStr );
00176
00187 bool parseTZOffsetISO8601( const QString &s, int &result );
00188
00193 void populate( VObject *vcal, bool deleted = false, const QString ¬ebook = QString() );
00194
00202 const char *dayFromNum( int day );
00203
00210 int numFromDay( const QString &day );
00211
00219 Attendee::PartStat readStatus( const char *s ) const;
00220
00227 QByteArray writeStatus( Attendee::PartStat status ) const;
00228
00229 void readCustomProperties( VObject *o, const Incidence::Ptr &i );
00230 void writeCustomProperties( VObject *o, const Incidence::Ptr &i );
00231
00232 protected:
00237 virtual void virtual_hook( int id, void *data );
00238
00239 private:
00243 enum PilotState {
00244 SYNCNONE = 0,
00245 SYNCMOD = 1,
00246 SYNCDEL = 3
00247 };
00248
00249
00250 Q_DISABLE_COPY( VCalFormat )
00251 class Private;
00252 Private *const d;
00253
00254 };
00255
00256 }
00257
00258 #endif