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   
00067   PilotRecord* pack() { return PilotAppCategory::pack(); }
00068   
00069   bool isEvent() const { return fAppointmentInfo.event; }
00070   int getEvent() const { return fAppointmentInfo.event; }
00071   void setEvent(int event) { fAppointmentInfo.event = event; }
00072   
00073   struct tm getEventStart() const { return fAppointmentInfo.begin; }
00074   const struct tm *getEventStart_p() const { return &fAppointmentInfo.begin; }
00075   void setEventStart(struct tm& start) { fAppointmentInfo.begin = start; }
00076 
00077   struct tm getEventEnd() const { return fAppointmentInfo.end; }
00078   const struct tm *getEventEnd_p() const { return &fAppointmentInfo.end; }
00079   void setEventEnd(struct tm& end) { fAppointmentInfo.end = end; }
00080 
00081   int getAlarm() const { return fAppointmentInfo.alarm; }
00082   void setAlarm(int alarm) { fAppointmentInfo.alarm = alarm; }
00083   
00084   int getAdvance() const { return fAppointmentInfo.advance; }
00085   void setAdvance(int advance) { fAppointmentInfo.advance = advance; }
00086 
00087   int getAdvanceUnits() const { return fAppointmentInfo.advanceUnits; }
00088   void setAdvanceUnits(int units) { fAppointmentInfo.advanceUnits = units; }
00089 
00090   // The following need set routines written
00091   repeatTypes getRepeatType() const { return fAppointmentInfo.repeatType; }
00092   void setRepeatType(repeatTypes r) { fAppointmentInfo.repeatType = r; }
00093 
00094   int getRepeatForever() const { return fAppointmentInfo.repeatForever; }
00095   void setRepeatForever(int f = 1) { fAppointmentInfo.repeatForever = f; }
00096 
00097   struct tm getRepeatEnd() const { return fAppointmentInfo.repeatEnd; }
00098   void setRepeatEnd(struct tm tm) { fAppointmentInfo.repeatEnd = tm; }
00099 
00100   int getRepeatFrequency() const { return fAppointmentInfo.repeatFrequency; }
00101   void setRepeatFrequency(int f) { fAppointmentInfo.repeatFrequency = f; }
00102 
00103   DayOfMonthType getRepeatDay() const { return fAppointmentInfo.repeatDay; }
00104   void setRepeatDay(DayOfMonthType rd) { fAppointmentInfo.repeatDay = rd; };
00105 
00106   const int *getRepeatDays() const { return fAppointmentInfo.repeatDays; }
00107   void setRepeatDays(int *rd) {
00108     for (int i = 0; i < 7; i++)
00109       fAppointmentInfo.repeatDays[i] = rd[i];
00110   }
00111   void setRepeatDays(QBitArray rba) {
00112     for (int i = 0; i < 7; i++)
00113       fAppointmentInfo.repeatDays[i] = (rba[i] ? 1 : 0);
00114   }
00115 
00116   int getExceptionCount() const { return fAppointmentInfo.exceptions; }
00117   void setExceptionCount(int e) { fAppointmentInfo.exceptions = e; }
00118 
00119   const struct tm *getExceptions() const { return fAppointmentInfo.exception; }
00120   void setExceptions(struct tm *e);
00121 
00122         void setDescription(const QString &);
00123         QString getDescription() const;
00124         
00125         void setNote(const QString &);
00126         QString getNote() const;
00127         
00128 protected:
00129         void  setDescriptionP(const char* desc, int l=-1);
00130         const char* getDescriptionP() const { return fAppointmentInfo.description; }
00131 
00132         void  setNoteP(const char* note, int l=-1);
00133         const char* getNoteP() const { return fAppointmentInfo.note; }
00134 
00135 public:
00136   bool isMultiDay() const {
00137     return ((fAppointmentInfo.repeatType == repeatDaily) &&
00138             (fAppointmentInfo.repeatFrequency == 1) &&
00139             (!fAppointmentInfo.repeatForever) &&
00140             fAppointmentInfo.event);
00141   }
00142 
00143 protected:
00144   void *pack(void *, int *);
00145   void unpack(const void *, int = 0) { }
00146 
00147 private:
00148   struct Appointment fAppointmentInfo;
00149 
00150         void _copyExceptions(const PilotDateEntry &e);
00151 };
00152 
00153 
00154 
00155 #else
00156 #ifdef DEBUG
00157 #warning "File doubly included"
00158 #endif
00159 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001