kpilot Library API Documentation

pilotOrganizerEntry.h

00001 /* pilotOrganizerEntry.h        -*- C++ -*-             KPilot
00002 **
00003 ** Copyright (C) 2002 by Reinhold Kainhofer
00004 */
00005 
00006 /*
00007 ** This program is free software; you can redistribute it and/or modify
00008 ** it under the terms of the GNU General Public License as published by
00009 ** the Free Software Foundation; either version 2 of the License, or
00010 ** (at your option) any later version.
00011 **
00012 ** This program is distributed in the hope that it will be useful,
00013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015 ** GNU General Public License for more details.
00016 **
00017 ** You should have received a copy of the GNU General Public License
00018 ** along with this program in a file called COPYING; if not, write to
00019 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020 ** MA 02111-1307, USA.
00021 */
00022 
00023 /*
00024 ** Bug reports and questions can be sent to reinhold@kainhofer.com
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(); }  // ??? What's this for?
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); // Assign a date directly from the packed value
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);// { fData.descr=dsc; }
00141         
00142         char* getNote() const { return fData.note; }
00143         void setNote(const char*nt);// { fData.note=nt; }
00144         
00145         char* getCustStr() const { return fData.customstr; }
00146         void setCustStr(const char*str);// { fData.customstr=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 // $Log: pilotOrganizerEntry.h,v $
00168 // Revision 1.1.4.1  2003/03/12 23:31:10  adridg
00169 // CVS_SILENT: FSF address change
00170 //
00171 // Revision 1.1  2002/04/07 12:09:43  kainhofe
00172 // Initial checkin of the conduit. The gui works mostly, but syncing crashes KPilot...
00173 //
00174 // Revision 1.11  2002/04/07 11:56:19  reinhold
00175 // Last version before moving to KDE CVS
00176 //
00177 // Revision 1.10  2002/04/07 01:03:53  reinhold
00178 // the list of possible actions is now created dynamically
00179 //
00180 // Revision 1.9  2002/04/05 21:17:01  reinhold
00181 // *** empty log message ***
00182 //
00183 // Revision 1.8  2002/04/01 09:22:10  reinhold
00184 // Implemented the syncNextRecord routine
00185 //
00186 // Revision 1.7  2002/03/27 18:19:17  reinhold
00187 // Reworked the MultiDB structure to make it very
00188 //
00189 // Revision 1.6  2002/03/23 21:46:42  reinhold
00190 // config  dlg works, but the last changes crash the plugin itself
00191 //
00192 // Revision 1.4  2002/03/15 20:43:17  reinhold
00193 // Fixed the crash on loading (member function not defined)...
00194 //
00195 // Revision 1.3  2002/03/10 23:58:32  reinhold
00196 // Made the conduit compile...
00197 //
00198 // Revision 1.2  2002/03/10 16:06:43  reinhold
00199 // Cleaned up the class hierarchy, implemented some more features (should be quite finished now...)
00200 //
00201 // Revision 1.1.1.1  2002/03/09 15:38:45  reinhold
00202 // Initial checin of the  project manager / List manager conduit.
00203 //
00204 //
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:14 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001