kpilot Library API Documentation

pilotDateEntry.h

00001 #ifndef _KPILOT_PILOTDATEENTRY_H
00002 #define _KPILOT_PILOTDATEENTRY_H
00003 /* pilotDateEntry.h -*- C++ -*- KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** See the .cc file for an explanation of what this file is for.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU Lesser General Public License as published by
00013 ** the Free Software Foundation; either version 2.1 of the License, or
00014 ** (at your option) any later version.
00015 **
00016 ** This program is distributed in the hope that it will be useful,
00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 ** GNU Lesser General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU Lesser General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024 ** MA 02111-1307, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
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   // The following need set routines written
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
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003