libkcal Library API Documentation

incidence.h

00001 /*
00002     This file is part of libkcal.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef INCIDENCE_H
00021 #define INCIDENCE_H
00022 //
00023 // Incidence - base class of calendaring components
00024 //
00025 
00026 #include <qdatetime.h>
00027 #include <qstringlist.h>
00028 #include <qvaluelist.h>
00029 
00030 #include "recurrence.h"
00031 #include "alarm.h"
00032 
00033 #include "incidencebase.h"
00034 
00035 namespace KCal {
00036 
00037 class Event;
00038 class Todo;
00039 class Journal;
00040 
00044 class Incidence : public IncidenceBase
00045 {
00046   public:
00053     class Visitor
00054     {
00055       public:
00057         virtual ~Visitor() {}
00058 
00063         virtual bool visit(Event *) { return false; }
00068         virtual bool visit(Todo *) { return false; }
00073         virtual bool visit(Journal *) { return false; }
00074 
00075       protected:
00077         Visitor() {}
00078     };
00079 
00081     enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
00082 
00083     Incidence();
00084     Incidence(const Incidence &);
00085     ~Incidence();
00086 
00094     virtual bool accept(Visitor &) { return false; }
00095 
00096     virtual Incidence *clone() = 0;
00097 
00098     void setReadOnly( bool );
00099 
00105     void recreate();
00106 
00108     void setCreated(QDateTime);
00110     QDateTime created() const;
00111 
00113     void setRevision(int rev);
00115     int revision() const;
00116 
00118     void setDtStart(const QDateTime &dtStart);
00119 
00121     void setDescription(const QString &description);
00123     QString description() const;
00124 
00126     void setSummary(const QString &summary);
00128     QString summary() const;
00129 
00131     void setCategories(const QStringList &categories);
00133     void setCategories(const QString &catStr);
00135     QStringList categories() const;
00137     QString categoriesStr();
00138 
00142     void setRelatedToUid(const QString &);
00146     QString relatedToUid() const;
00148     void setRelatedTo(Incidence *relatedTo);
00150     Incidence *relatedTo() const;
00152     QPtrList<Incidence> relations() const;
00154     void addRelation(Incidence *);
00156     void removeRelation(Incidence *);
00157 
00159     DateList exDates() const;
00161     void setExDates(const DateList &_exDates);
00162     void setExDates(const char *dates);
00164     void addExDate(const QDate &date);
00165 
00168     bool isException(const QDate &qd) const;
00169 
00171     void setAttachments(const QStringList &attachments);
00173     QStringList attachments() const;
00174 
00177     void setSecrecy(int);
00179     int secrecy() const;
00181     QString secrecyStr() const;
00183     static QStringList secrecyList();
00185     static QString secrecyName(int);
00186 
00189     bool recursOn(const QDate &qd) const;
00190 
00191     // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
00192 
00194     void setResources(const QStringList &resources);
00196     QStringList resources() const;
00197 
00199     void setPriority(int priority);
00201     int priority() const;
00202 
00204     QPtrList<Alarm> alarms() const;
00206     Alarm* newAlarm();
00208     void addAlarm(Alarm*);
00210     void removeAlarm(Alarm*);
00212     void clearAlarms();
00214     bool isAlarmEnabled() const;
00215 
00220     Recurrence *recurrence() const;
00221     
00223     void setLocation(const QString &location);
00225     QString location() const;
00226     
00227   private:
00228     int mRevision;
00229 
00230     // base components of jounal, event and todo
00231     QDateTime mCreated;
00232     QString mDescription;
00233     QString mSummary;
00234     QStringList mCategories;
00235     Incidence *mRelatedTo;
00236     QString mRelatedToUid;
00237     QPtrList<Incidence> mRelations;
00238     DateList mExDates;
00239     QStringList mAttachments;
00240     QStringList mResources;
00241 
00242     int mSecrecy;
00243     int mPriority;                        // 1 = highest, 2 = less, etc.
00244 
00245     QPtrList<Alarm> mAlarms;
00246     Recurrence *mRecurrence;
00247     
00248     QString mLocation;
00249 };
00250 
00251 }
00252 
00253 #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:27 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001