pilotOrganizerEntry.h
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 #ifndef _KPILOT_PILOTOrganizerENTRY_H
00027 #define _KPILOT_PILOTOrganizerENTRY_H
00028
00029 #include <time.h>
00030 #include <string.h>
00031 #include <qdatetime.h>
00032
00033 #ifndef QBITARRAY_H
00034 #include <qbitarray.h>
00035 #endif
00036
00037 #include "options.h"
00038 #ifndef _KPILOT_PILOTAPPCATEGORY_H
00039 #include "pilotAppCategory.h"
00040 #endif
00041
00042 #include <calendar.h>
00043
00044 using namespace KCal;
00045
00046
00047 #define HAS_PREVIOUS 0x8000
00048 #define HAS_NEXT 0x4000
00049 #define HAS_CHILDREN 0x2000
00050 #define IS_CHECKED 0x1000
00051 #define IS_EXPANDED 0x0800
00052 #define IS_VISIBLE 0x0400
00053 #define FLAG_CUSTOM1 0x0200
00054 #define FLAG_CUSTOM2 0x0100
00055 #define FLAG_TYPE 0x00f0
00056 #define FLAG_PRIORITY 0x000f
00057
00058 typedef enum {
00059 DATE_CREATED,
00060 DATE_STARTED,
00061 DATE_DUE,
00062 DATE_FINISHED
00063 } po_date_type;
00064
00065 typedef struct entryFlags {
00066 int hasPrevious:1;
00067 int hasNext:1;
00068 int hasChildren:1;
00069 int checked:1;
00070 int expanded:1;
00071 int visible:1;
00072 int custom2:1;
00073 int custom1:1;
00074
00075 int type:4;
00076 int priority:4;
00077 };
00078
00079 typedef struct OrganizerEnty {
00080 union {
00081 struct entryFlags flags;
00082 int iFlags;
00083 };
00084
00085 QDateTime dates[4];
00086
00087 int progress;
00088 int level;
00089 int nr;
00090 long todolnk;
00091
00092 char*descr;
00093 char*note;
00094 char*customstr;
00095
00096 } OrganizerEntry;
00097
00098
00099 class PilotOrganizerEntry : public PilotAppCategory {
00100 protected:
00101 OrganizerEntry fData;
00102 public:
00103 PilotOrganizerEntry(void);
00104 PilotOrganizerEntry(const PilotOrganizerEntry &e);
00105 PilotOrganizerEntry(PilotRecord* rec);
00106 PilotOrganizerEntry(KCal::Todo*todo);
00107 ~PilotOrganizerEntry() { free_OrganizerEntry(&fData); }
00108
00109 PilotOrganizerEntry& operator=(const PilotOrganizerEntry &e);
00110 PilotOrganizerEntry& operator=(const KCal::Todo &todo);
00111 KCal::Todo* getTodo();
00112
00113 PilotRecord* pack() { return PilotAppCategory::pack(); }
00114
00115 bool getFlag(const int flag) const { return fData.iFlags|flag;}
00116 void setFlag(const int flag, const bool val) {fData.iFlags=val?(fData.iFlags|flag):(fData.iFlags&(!flag)); }
00117
00118 int getLevel() const { return fData.level; }
00119 void setLevel(const int l) { fData.level=l; }
00120
00121 int getType() const { return (fData.iFlags&FLAG_TYPE)>>4; }
00122 void setType(const int t) { fData.iFlags=(fData.iFlags & !FLAG_TYPE) | (t<<4 & FLAG_TYPE); }
00123
00124 int getPriority() const { return (fData.iFlags&FLAG_PRIORITY); }
00125 void setPriority(const int t) { fData.iFlags=(fData.iFlags & !FLAG_PRIORITY) | (t & FLAG_PRIORITY); }
00126
00127 bool hasDate(po_date_type tp) const {return fData.dates[tp].date().isValid(); }
00128 QDateTime getDate(po_date_type tp) const { return fData.dates[tp]; }
00129 void setDate(const po_date_type tp, QDateTime dt) { fData.dates[tp]=dt; }
00130 void setDate(const po_date_type tp, unsigned short int);
00131 void deleteDate(po_date_type tp) {QDate dt; fData.dates[tp].setDate(dt); QTime tm; fData.dates[tp].setTime(tm);}
00132
00133 int getProgress() const { return fData.progress; }
00134 void setProgress(const int pg) { fData.progress=pg; }
00135
00136 int getNumber() const { return fData.nr; }
00137 void setNumber(const int n) { fData.nr=n; }
00138
00139 char* getDescription() const { return fData.descr; }
00140 void setDescription(const char*dsc);
00141
00142 char* getNote() const { return fData.note; }
00143 void setNote(const char*nt);
00144
00145 char* getCustStr() const { return fData.customstr; }
00146 void setCustStr(const char*str);
00147
00148 long getTodoLink() const {return fData.todolnk; }
00149 void setTodoLink(long tdlnk) { fData.todolnk=tdlnk; }
00150
00151 protected:
00152 virtual void *pack(void *, int *)=0;
00153 virtual void unpack(const void *, int = 0)=0;
00154
00155 private:
00156 void free_OrganizerEntry(OrganizerEntry*entry);
00157 };
00158
00159
00160 #else
00161 #ifdef DEBUG
00162 #warning "File doubly included"
00163 #endif
00164 #endif
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
This file is part of the documentation for kdelibs Version 3.1.4.