pilotDateEntry.h
00001 #ifndef _KPILOT_PILOTDATEENTRY_H
00002 #define _KPILOT_PILOTDATEENTRY_H
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 #include <time.h>
00032 #include <string.h>
00033
00034 #ifndef QBITARRAY_H
00035 #include <qbitarray.h>
00036 #endif
00037
00038 #ifndef _PILOT_MACROS_H_
00039 #include <pi-macros.h>
00040 #endif
00041
00042 #ifndef _PILOT_DATEBOOK_H_
00043 #include <pi-datebook.h>
00044 #endif
00045
00046 #ifndef _KPILOT_PILOTAPPCATEGORY_H
00047 #include "pilotAppCategory.h"
00048 #endif
00049
00050 #ifndef _KPILOT_PILOTRECORD_H
00051 #include "pilotRecord.h"
00052 #endif
00053
00054
00055
00056 class PilotDateEntry : public PilotAppCategory
00057 {
00058 public:
00059 PilotDateEntry(void);
00060 PilotDateEntry(PilotRecord* rec);
00061 ~PilotDateEntry() { free_Appointment(&fAppointmentInfo); }
00062
00063 PilotDateEntry(const PilotDateEntry &e);
00064
00065 PilotDateEntry& operator=(const PilotDateEntry &e);
00066 virtual QString getTextRepresentation(bool richText=false);
00067
00068 PilotRecord* pack() { return PilotAppCategory::pack(); }
00069
00070 bool isEvent() const { return fAppointmentInfo.event; }
00071 int getEvent() const { return fAppointmentInfo.event; }
00072 void setEvent(int event) { fAppointmentInfo.event = event; }
00073
00074 struct tm getEventStart() const { return fAppointmentInfo.begin; }
00075 const struct tm *getEventStart_p() const { return &fAppointmentInfo.begin; }
00076 void setEventStart(struct tm& start) { fAppointmentInfo.begin = start; }
00077
00078 struct tm getEventEnd() const { return fAppointmentInfo.end; }
00079 const struct tm *getEventEnd_p() const { return &fAppointmentInfo.end; }
00080 void setEventEnd(struct tm& end) { fAppointmentInfo.end = end; }
00081
00082 int getAlarm() const { return fAppointmentInfo.alarm; }
00083 void setAlarm(int alarm) { fAppointmentInfo.alarm = alarm; }
00084
00085 int getAdvance() const { return fAppointmentInfo.advance; }
00086 void setAdvance(int advance) { fAppointmentInfo.advance = advance; }
00087
00088 int getAdvanceUnits() const { return fAppointmentInfo.advanceUnits; }
00089 void setAdvanceUnits(int units) { fAppointmentInfo.advanceUnits = units; }
00090
00091
00092 repeatTypes getRepeatType() const { return fAppointmentInfo.repeatType; }
00093 void setRepeatType(repeatTypes r) { fAppointmentInfo.repeatType = r; }
00094
00095 int getRepeatForever() const { return fAppointmentInfo.repeatForever; }
00096 void setRepeatForever(int f = 1) { fAppointmentInfo.repeatForever = f; }
00097
00098 struct tm getRepeatEnd() const { return fAppointmentInfo.repeatEnd; }
00099 void setRepeatEnd(struct tm tm) { fAppointmentInfo.repeatEnd = tm; }
00100
00101 int getRepeatFrequency() const { return fAppointmentInfo.repeatFrequency; }
00102 void setRepeatFrequency(int f) { fAppointmentInfo.repeatFrequency = f; }
00103
00104 DayOfMonthType getRepeatDay() const { return fAppointmentInfo.repeatDay; }
00105 void setRepeatDay(DayOfMonthType rd) { fAppointmentInfo.repeatDay = rd; };
00106
00107 const int *getRepeatDays() const { return fAppointmentInfo.repeatDays; }
00108 void setRepeatDays(int *rd) {
00109 for (int i = 0; i < 7; i++)
00110 fAppointmentInfo.repeatDays[i] = rd[i];
00111 }
00112 void setRepeatDays(QBitArray rba) {
00113 for (int i = 0; i < 7; i++)
00114 fAppointmentInfo.repeatDays[i] = (rba[i] ? 1 : 0);
00115 }
00116
00117 int getExceptionCount() const { return fAppointmentInfo.exceptions; }
00118 void setExceptionCount(int e) { fAppointmentInfo.exceptions = e; }
00119
00120 const struct tm *getExceptions() const { return fAppointmentInfo.exception; }
00121 void setExceptions(struct tm *e);
00122
00123 void setDescription(const QString &);
00124 QString getDescription() const;
00125
00126 void setNote(const QString &);
00127 QString getNote() const;
00128
00129 protected:
00130 void setDescriptionP(const char* desc, int l=-1);
00131 const char* getDescriptionP() const { return fAppointmentInfo.description; }
00132
00133 void setNoteP(const char* note, int l=-1);
00134 const char* getNoteP() const { return fAppointmentInfo.note; }
00135
00136 public:
00137 bool isMultiDay() const {
00138 return ((fAppointmentInfo.repeatType == repeatDaily) &&
00139 (fAppointmentInfo.repeatFrequency == 1) &&
00140 (!fAppointmentInfo.repeatForever) &&
00141 fAppointmentInfo.event);
00142 }
00143
00144 protected:
00145 void *pack(void *, int *);
00146 void unpack(const void *, int = 0) { }
00147
00148 private:
00149 struct Appointment fAppointmentInfo;
00150
00151 void _copyExceptions(const PilotDateEntry &e);
00152 };
00153
00154
00155
00156 #else
00157 #ifdef DEBUG
00158 #warning "File doubly included"
00159 #endif
00160 #endif
This file is part of the documentation for kpilot Library Version 3.2.2.