kpilot/lib
pilotDateEntry.hGo to the documentation of this file.00001 #ifndef _KPILOT_PILOTDATEENTRY_H
00002 #define _KPILOT_PILOTDATEENTRY_H
00003
00004
00005
00006
00007
00008
00009
00010
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <qbitarray.h>
00035
00036 #include <pi-macros.h>
00037 #include <pi-datebook.h>
00038
00039 #include "pilotRecord.h"
00040 #include "pilotAppInfo.h"
00041
00042 namespace KCal
00043 {
00044 class Event;
00045 }
00046
00048 class KDE_EXPORT PilotDateEntry : public PilotRecordBase
00049 {
00050 public:
00052 PilotDateEntry(struct AppointmentAppInfo &appInfo);
00053
00055 PilotDateEntry(struct AppointmentAppInfo &appInfo, PilotRecord *rec);
00056
00058 PilotDateEntry(const PilotDateEntry &e);
00059
00061 ~PilotDateEntry()
00062 {
00063 free_Appointment(&fAppointmentInfo);
00064 }
00065
00067 PilotDateEntry& operator=(const PilotDateEntry &e);
00068
00073 virtual QString getTextRepresentation(bool richText=false);
00074
00083 bool doesFloat() const
00084 {
00085 return fAppointmentInfo.event;
00086 }
00087
00091 inline bool isEvent() const
00092 {
00093 return doesFloat();
00094 }
00095
00104 void setFloats(bool f)
00105 {
00106 fAppointmentInfo.event = (f ? 1 : 0) ;
00107 }
00108
00110 struct tm getEventStart() const { return fAppointmentInfo.begin; }
00111
00113 const struct tm *getEventStart_p() const
00114 {
00115 return &fAppointmentInfo.begin;
00116 }
00117
00119 void setEventStart(struct tm& start)
00120 {
00121 fAppointmentInfo.begin = start;
00122 }
00123
00130 QDateTime dtStart() const;
00131
00133 struct tm getEventEnd() const
00134 {
00135 return fAppointmentInfo.end;
00136 }
00137
00139 const struct tm *getEventEnd_p() const
00140 {
00141 return &fAppointmentInfo.end;
00142 }
00143
00145 void setEventEnd(struct tm& end)
00146 {
00147 fAppointmentInfo.end = end;
00148 }
00149
00156 QDateTime dtEnd() const;
00157
00162 bool isAlarmEnabled() const
00163 {
00164 return fAppointmentInfo.alarm;
00165 }
00166
00168 void setAlarmEnabled(bool b)
00169 {
00170 fAppointmentInfo.alarm = (b?1:0) ;
00171 }
00172
00182 int getAdvance() const
00183 {
00184 return fAppointmentInfo.advance;
00185 }
00186
00188 void setAdvance(int advance)
00189 {
00190 fAppointmentInfo.advance = advance;
00191 }
00192
00194 int getAdvanceUnits() const
00195 {
00196 return fAppointmentInfo.advanceUnits;
00197 }
00198
00200 void setAdvanceUnits(int units)
00201 {
00202 fAppointmentInfo.advanceUnits = units;
00203 }
00204
00209 unsigned int alarmLeadTime() const;
00210
00214 QDateTime dtAlarm() const
00215 {
00216 return dtStart().addSecs(-alarmLeadTime());
00217 }
00218
00219
00220 repeatTypes getRepeatType() const
00221 {
00222 return fAppointmentInfo.repeatType;
00223 }
00224 void setRepeatType(repeatTypes r)
00225 {
00226 fAppointmentInfo.repeatType = r;
00227 }
00228
00229 int getRepeatForever() const
00230 {
00231 return fAppointmentInfo.repeatForever;
00232 }
00233 void setRepeatForever(int f = 1)
00234 {
00235 fAppointmentInfo.repeatForever = f;
00236 }
00237
00238 struct tm getRepeatEnd() const
00239 {
00240 return fAppointmentInfo.repeatEnd;
00241 }
00242 void setRepeatEnd(struct tm tm)
00243 {
00244 fAppointmentInfo.repeatEnd = tm;
00245 }
00246
00250 QDateTime dtRepeatEnd() const;
00251
00252 int getRepeatFrequency() const
00253 {
00254 return fAppointmentInfo.repeatFrequency;
00255 }
00256 void setRepeatFrequency(int f)
00257 {
00258 fAppointmentInfo.repeatFrequency = f;
00259 }
00260
00261 DayOfMonthType getRepeatDay() const
00262 {
00263 return fAppointmentInfo.repeatDay;
00264 }
00265 void setRepeatDay(DayOfMonthType rd)
00266 {
00267 fAppointmentInfo.repeatDay = rd;
00268 };
00269
00270 const int *getRepeatDays() const
00271 {
00272 return fAppointmentInfo.repeatDays;
00273 }
00274 void setRepeatDays(int *rd)
00275 {
00276 for (int i = 0; i < 7; i++)
00277 {
00278 fAppointmentInfo.repeatDays[i] = rd[i];
00279 }
00280 }
00281 void setRepeatDays(QBitArray rba)
00282 {
00283 for (int i = 0; i < 7; i++)
00284 {
00285 fAppointmentInfo.repeatDays[i] = (rba[i] ? 1 : 0);
00286 }
00287 }
00288
00289 int getExceptionCount() const
00290 {
00291 return fAppointmentInfo.exceptions;
00292 }
00293 void setExceptionCount(int e)
00294 {
00295 fAppointmentInfo.exceptions = e;
00296 }
00297
00298 const struct tm *getExceptions() const
00299 {
00300 return fAppointmentInfo.exception;
00301 }
00302 void setExceptions(struct tm *e);
00303
00308 void setDescription(const QString &);
00310 QString getDescription() const;
00311
00316 void setNote(const QString &);
00318 QString getNote() const;
00319
00327 void setLocation(const QString &);
00328
00330 QString getLocation() const;
00331
00332 protected:
00333 void setDescriptionP(const char* desc, int l=-1);
00334 const char* getDescriptionP() const
00335 {
00336 return fAppointmentInfo.description;
00337 }
00338
00339 void setNoteP(const char* note, int l=-1);
00340 const char* getNoteP() const
00341 {
00342 return fAppointmentInfo.note;
00343 }
00344
00345 public:
00346 bool isMultiDay() const
00347 {
00348 return ((fAppointmentInfo.repeatType == repeatDaily) &&
00349 (fAppointmentInfo.repeatFrequency == 1) &&
00350 ( !getRepeatForever() ) &&
00351 !doesFloat() );
00352 }
00353
00354 QString getCategoryLabel() const;
00355 inline bool setCategory(const QString &label)
00356 {
00357 return Pilot::insertCategory(&fAppInfo.category,label,false) >= 0;
00358 } ;
00359
00360 PilotRecord *pack() const;
00361
00362 private:
00363 struct Appointment fAppointmentInfo;
00364 struct AppointmentAppInfo &fAppInfo;
00365 void _copyExceptions(const PilotDateEntry &e);
00366 };
00367
00368
00369 typedef PilotAppInfo<AppointmentAppInfo,unpack_AppointmentAppInfo, pack_AppointmentAppInfo> PilotDateInfo;
00370
00371
00372 #endif
00373
|