summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.h
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/incidencebase.h
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'libkcal/incidencebase.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 3edc03b..d97f524 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -1,190 +1,192 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KCAL_INCIDENCEBASE_H 20#ifndef KCAL_INCIDENCEBASE_H
21#define KCAL_INCIDENCEBASE_H 21#define KCAL_INCIDENCEBASE_H
22// 22//
23// Incidence - base class of calendaring components 23// Incidence - base class of calendaring components
24// 24//
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28#include <qvaluelist.h> 28#include <q3valuelist.h>
29#include <qptrlist.h> 29#include <q3ptrlist.h>
30//Added by qt3to4:
31#include <Q3CString>
30 32
31#include "customproperties.h" 33#include "customproperties.h"
32#include "attendee.h" 34#include "attendee.h"
33 35
34namespace KCal { 36namespace KCal {
35 37
36typedef QValueList<QDate> DateList; 38typedef Q3ValueList<QDate> DateList;
37 enum IncTypeID { eventID,todoID,journalID,freebusyID }; 39 enum IncTypeID { eventID,todoID,journalID,freebusyID };
38 40
39/** 41/**
40 This class provides the base class common to all calendar components. 42 This class provides the base class common to all calendar components.
41*/ 43*/
42class IncidenceBase : public CustomProperties 44class IncidenceBase : public CustomProperties
43{ 45{
44 public: 46 public:
45 class Observer { 47 class Observer {
46 public: 48 public:
47 virtual void incidenceUpdated( IncidenceBase * ) = 0; 49 virtual void incidenceUpdated( IncidenceBase * ) = 0;
48 }; 50 };
49 51
50 IncidenceBase(); 52 IncidenceBase();
51 IncidenceBase(const IncidenceBase &); 53 IncidenceBase(const IncidenceBase &);
52 virtual ~IncidenceBase(); 54 virtual ~IncidenceBase();
53 55
54 virtual QCString type() const = 0; 56 virtual Q3CString type() const = 0;
55 virtual IncTypeID typeID() const = 0; 57 virtual IncTypeID typeID() const = 0;
56 58
57 /** Set the unique id for the event */ 59 /** Set the unique id for the event */
58 void setUid(const QString &); 60 void setUid(const QString &);
59 /** Return the unique id for the event */ 61 /** Return the unique id for the event */
60 QString uid() const; 62 QString uid() const;
61 63
62 /** Sets the time the incidence was last modified. */ 64 /** Sets the time the incidence was last modified. */
63 void setLastModified(const QDateTime &lm); 65 void setLastModified(const QDateTime &lm);
64 /** Return the time the incidence was last modified. */ 66 /** Return the time the incidence was last modified. */
65 QDateTime lastModified() const; 67 QDateTime lastModified() const;
66 QString lastModifiedSortKey() const; 68 QString lastModifiedSortKey() const;
67 69
68 /** sets the organizer for the event */ 70 /** sets the organizer for the event */
69 void setOrganizer(const QString &o); 71 void setOrganizer(const QString &o);
70 QString organizer() const; 72 QString organizer() const;
71 73
72 /** Set readonly status. */ 74 /** Set readonly status. */
73 virtual void setReadOnly( bool ); 75 virtual void setReadOnly( bool );
74 /** Return if the object is read-only. */ 76 /** Return if the object is read-only. */
75 bool isReadOnly() const { return mReadOnly; } 77 bool isReadOnly() const { return mReadOnly; }
76 78
77 /** for setting the event's starting date/time with a QDateTime. */ 79 /** for setting the event's starting date/time with a QDateTime. */
78 virtual void setDtStart(const QDateTime &dtStart); 80 virtual void setDtStart(const QDateTime &dtStart);
79 /** returns an event's starting date/time as a QDateTime. */ 81 /** returns an event's starting date/time as a QDateTime. */
80 virtual QDateTime dtStart() const; 82 virtual QDateTime dtStart() const;
81 /** returns an event's starting time as a string formatted according to the 83 /** returns an event's starting time as a string formatted according to the
82 users locale settings */ 84 users locale settings */
83 QString dtStartTimeStr() const; 85 QString dtStartTimeStr() const;
84 /** returns an event's starting date as a string formatted according to the 86 /** returns an event's starting date as a string formatted according to the
85 users locale settings */ 87 users locale settings */
86 QString dtStartDateStr(bool shortfmt=true) const; 88 QString dtStartDateStr(bool shortfmt=true) const;
87 /** returns an event's starting date and time as a string formatted according 89 /** returns an event's starting date and time as a string formatted according
88 to the users locale settings */ 90 to the users locale settings */
89 QString dtStartStr(bool shortfmt=true) const; 91 QString dtStartStr(bool shortfmt=true) const;
90 92
91 virtual void setDuration(int seconds); 93 virtual void setDuration(int seconds);
92 int duration() const; 94 int duration() const;
93 void setHasDuration(bool); 95 void setHasDuration(bool);
94 bool hasDuration() const; 96 bool hasDuration() const;
95 97
96 /** Return true or false depending on whether the incidence "floats," 98 /** Return true or false depending on whether the incidence "floats,"
97 * i.e. has a date but no time attached to it. */ 99 * i.e. has a date but no time attached to it. */
98 bool doesFloat() const; 100 bool doesFloat() const;
99 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ 101 /** Set whether the incidence floats, i.e. has a date but no time attached to it. */
100 void setFloats(bool f); 102 void setFloats(bool f);
101 103
102 /** 104 /**
103 Add Attendee to this incidence. IncidenceBase takes ownership of the 105 Add Attendee to this incidence. IncidenceBase takes ownership of the
104 Attendee object. 106 Attendee object.
105 */ 107 */
106 bool addAttendee(Attendee *a, bool doupdate=true ); 108 bool addAttendee(Attendee *a, bool doupdate=true );
107// void removeAttendee(Attendee *a); 109// void removeAttendee(Attendee *a);
108// void removeAttendee(const char *n); 110// void removeAttendee(const char *n);
109 /** Remove all Attendees. */ 111 /** Remove all Attendees. */
110 void clearAttendees(); 112 void clearAttendees();
111 /** Return list of attendees. */ 113 /** Return list of attendees. */
112 QPtrList<Attendee> attendees() const { return mAttendees; }; 114 Q3PtrList<Attendee> attendees() const { return mAttendees; };
113 /** Return number of attendees. */ 115 /** Return number of attendees. */
114 int attendeeCount() const { return mAttendees.count(); }; 116 int attendeeCount() const { return mAttendees.count(); };
115 /** Return the Attendee with this email */ 117 /** Return the Attendee with this email */
116 Attendee* attendeeByMail(const QString &); 118 Attendee* attendeeByMail(const QString &);
117 /** Return first Attendee with one of this emails */ 119 /** Return first Attendee with one of this emails */
118 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); 120 Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null);
119 121
120 /** pilot syncronization states */ 122 /** pilot syncronization states */
121 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; 123 enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
122 /** Set synchronisation satus. */ 124 /** Set synchronisation satus. */
123 void setSyncStatus(int stat); 125 void setSyncStatus(int stat);
124 /** Return synchronisation status. */ 126 /** Return synchronisation status. */
125 int syncStatus() const; 127 int syncStatus() const;
126 128
127 /** Set Pilot Id. */ 129 /** Set Pilot Id. */
128 void setPilotId(int id); 130 void setPilotId(int id);
129 /** Return Pilot Id. */ 131 /** Return Pilot Id. */
130 int pilotId() const; 132 int pilotId() const;
131 133
132 void setTempSyncStat(int id); 134 void setTempSyncStat(int id);
133 int tempSyncStat() const; 135 int tempSyncStat() const;
134 void setIDStr( const QString & ); 136 void setIDStr( const QString & );
135 QString IDStr() const; 137 QString IDStr() const;
136 void setID( const QString &, const QString & ); 138 void setID( const QString &, const QString & );
137 QString getID( const QString & ); 139 QString getID( const QString & );
138 void setCsum( const QString &, const QString & ); 140 void setCsum( const QString &, const QString & );
139 QString getCsum( const QString & ); 141 QString getCsum( const QString & );
140 void removeID(const QString &); 142 void removeID(const QString &);
141 143
142 void registerObserver( Observer * ); 144 void registerObserver( Observer * );
143 void unRegisterObserver( Observer * ); 145 void unRegisterObserver( Observer * );
144 void updated(); 146 void updated();
145 void setCalID( int id ); 147 void setCalID( int id );
146 void setCalID_block( int id ); 148 void setCalID_block( int id );
147 int calID() const; 149 int calID() const;
148 void setCalEnabled( bool ); 150 void setCalEnabled( bool );
149 bool calEnabled() const; 151 bool calEnabled() const;
150 void setAlarmEnabled( bool ); 152 void setAlarmEnabled( bool );
151 bool alarmEnabled() const; 153 bool alarmEnabled() const;
152 bool isTagged() const; 154 bool isTagged() const;
153 void setTagged( bool ); 155 void setTagged( bool );
154 virtual void setLastModifiedSubInvalid(); 156 virtual void setLastModifiedSubInvalid();
155 protected: 157 protected:
156 bool blockLastModified; 158 bool blockLastModified;
157 bool mIsTagged; 159 bool mIsTagged;
158 QDateTime mDtStart; 160 QDateTime mDtStart;
159 bool mReadOnly; 161 bool mReadOnly;
160 QDateTime getEvenTime( QDateTime ); 162 QDateTime getEvenTime( QDateTime );
161 163
162 private: 164 private:
163 // base components 165 // base components
164 QString mOrganizer; 166 QString mOrganizer;
165 QString mLastModifiedKey; 167 QString mLastModifiedKey;
166 QString mUid; 168 QString mUid;
167 int mCalID; 169 int mCalID;
168 bool mCalEnabled; 170 bool mCalEnabled;
169 bool mAlarmEnabled; 171 bool mAlarmEnabled;
170 QDateTime mLastModified; 172 QDateTime mLastModified;
171 QPtrList<Attendee> mAttendees; 173 Q3PtrList<Attendee> mAttendees;
172 174
173 bool mFloats; 175 bool mFloats;
174 176
175 int mDuration; 177 int mDuration;
176 bool mHasDuration; 178 bool mHasDuration;
177 QString mExternalId; 179 QString mExternalId;
178 int mTempSyncStat; 180 int mTempSyncStat;
179 181
180 // PILOT SYNCHRONIZATION STUFF 182 // PILOT SYNCHRONIZATION STUFF
181 int mPilotId; // unique id for pilot sync 183 int mPilotId; // unique id for pilot sync
182 int mSyncStatus; // status (for sync) 184 int mSyncStatus; // status (for sync)
183 185
184 QPtrList<Observer> mObservers; 186 Q3PtrList<Observer> mObservers;
185}; 187};
186 188
187bool operator==( const IncidenceBase&, const IncidenceBase& ); 189bool operator==( const IncidenceBase&, const IncidenceBase& );
188} 190}
189 191
190#endif 192#endif