00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef INCL_APPLE_EVENT
00037 #define INCL_APPLE_EVENT
00038
00044 #include "base/fscapi.h"
00045 #include "base/Log.h"
00046 #include "vocl/VObject.h"
00047 #include "vocl/Timezone.h"
00048
00049
00050 #define VCALENDAR_VERSION TEXT("1.0")
00051
00052
00053 #define ERR_ITEM_VOBJ_PARSE "VConverter: error occurred parsing the item data."
00054 #define ERR_ITEM_VOBJ_WRONG_TYPE "Error: wrong vobject type \"%ls\" (\"%ls\" expected)"
00055 #define ERR_ITEM_VOBJ_TYPE_NOTFOUND "Error: vobject type not specified (\"%ls\" expected)"
00056 #define ERR_SIFFIELDS_NULL "Parsing error: sifFields must be initialized before parsing data."
00057 #define INFO_ITEM_VOBJ_WRONG_VERSION "Warning! Wrong vobject version \"%ls\" (\"%ls\" expected)"
00058 #define INFO_ITEM_VOBJ_VERSION_NOTFOUND "Warning! VObject version not specified (\"%ls\" expected)"
00059
00060 #include "base/globalsdef.h"
00061
00062 BEGIN_FUNAMBOL_NAMESPACE
00063
00064 typedef enum {
00065 NormalEvt,
00066 PersonalEvt,
00067 PrivateEvt,
00068 ConfidentialEvt
00069 } Sensitivity;
00070
00071 typedef enum {
00072 ImportanceLow,
00073 ImportanceNormal,
00074 ImportanceHigh
00075 } Importance;
00076
00077 typedef enum {
00078 Free,
00079 Tentative,
00080 Busy,
00081 OutOfOffice
00082 } BusyStatus;
00083
00084
00090 class AppleEvent {
00091
00092 protected:
00093
00097 NSDate* start;
00098
00102 NSDate* end;
00103
00107 bool allDayEvent;
00108
00112 bool isRecurring;
00113
00117 StringBuffer title;
00118
00122 StringBuffer note;
00123
00127 StringBuffer location;
00128
00133 bool reminder;
00134 NSDate* alarmDate1;
00135 NSDate* alarmDate2;
00136
00137
00138
00139 Timezone timezone;
00140
00141 BusyStatus busyStatus;
00142 StringBuffer categories;
00143 Importance importance;
00144 Sensitivity sensitivity;
00145
00147 static unsigned long crc32Table[256];
00148
00149 public:
00150
00152 AppleEvent();
00153
00155 virtual ~AppleEvent();
00156
00163 virtual StringBuffer toString() = 0;
00164
00172 virtual int parse(const StringBuffer& dataString) = 0;
00173
00180 char* getVObjectPropertyValue(VObject* vo, const char* propertyName);
00181
00188 virtual long getCRC();
00189
00190 void setAllDayEvent(bool v) { allDayEvent = v; }
00191 bool getAllDayEvent() const { return allDayEvent; }
00192
00193 void setStart(NSDate* d) {
00194 [start autorelease];
00195 start = [d retain];
00196 }
00197 NSDate* getStart() const { return start; }
00198
00199 void setEnd(NSDate* d) {
00200 [end autorelease];
00201 end = [d retain];
00202 }
00203 NSDate* getEnd() const { return end; }
00204
00205 void setIsRecurring(bool v) { isRecurring = v; }
00206 bool getIsRecurring() { return isRecurring; }
00207
00208 void setTitle(const char* v) { title = v; }
00209 const char* getTitle() const { return title; }
00210
00211 void setNote(const char* v) { note = v; }
00212 const char* getNote() const { return note; }
00213
00214 void setLocation(const char* v) { location = v; }
00215 const char* getLocation() const { return location; }
00216
00217 void setReminder(bool v) { reminder = v; }
00218 bool getReminder() const { return reminder; }
00219
00220 void setAlarm1(NSDate* d) {
00221 [alarmDate1 autorelease];
00222 alarmDate1 = [d retain];
00223 }
00224 NSDate* getAlarm1() const { return alarmDate1; }
00225
00226 void setAlarm2(NSDate* d) {
00227 [alarmDate2 autorelease];
00228 alarmDate2 = [d retain];
00229 }
00230 NSDate* getAlarm2() const { return alarmDate2; }
00231
00232
00233
00234
00235 void setEventTimezone(const Timezone& t) { timezone = t; }
00236 Timezone& getEventTimezone() { return timezone; }
00237
00238 void setBusyStatus(BusyStatus v) { busyStatus = v; }
00239 BusyStatus getBusyStatus() { return busyStatus; }
00240
00241 void setImportance(Importance v) { importance = v; }
00242 Importance getImportance() { return importance; }
00243
00244 void setSensitivity(Sensitivity v) { sensitivity = v; }
00245 Sensitivity getSensitivity() { return sensitivity; }
00246
00247 void setCategories(const char* v) { categories = v; }
00248 const char* getCategories() const { return categories; }
00249 };
00250
00251
00252 END_FUNAMBOL_NAMESPACE
00253
00256 #endif