-rw-r--r-- | libkcal/incidencebase.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -98,199 +98,203 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | |||
98 | if ( !( (*a1) == (*a2)) ) | 98 | if ( !( (*a1) == (*a2)) ) |
99 | { | 99 | { |
100 | //qDebug("Attendee not equal "); | 100 | //qDebug("Attendee not equal "); |
101 | return false; | 101 | return false; |
102 | } | 102 | } |
103 | a1 = i1.attendees().next(); | 103 | a1 = i1.attendees().next(); |
104 | a2 = i2.attendees().next(); | 104 | a2 = i2.attendees().next(); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | //if ( i1.dtStart() != i2.dtStart() ) | 107 | //if ( i1.dtStart() != i2.dtStart() ) |
108 | // return false; | 108 | // return false; |
109 | #if 0 | 109 | #if 0 |
110 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); | 110 | qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); |
111 | qDebug("1 %d ",i1.duration() == i2.duration() ); | 111 | qDebug("1 %d ",i1.duration() == i2.duration() ); |
112 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); | 112 | qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); |
113 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); | 113 | qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); |
114 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); | 114 | qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); |
115 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 115 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
116 | 116 | ||
117 | #endif | 117 | #endif |
118 | if ( i1.hasDuration() == i2.hasDuration() ) { | 118 | if ( i1.hasDuration() == i2.hasDuration() ) { |
119 | if ( i1.hasDuration() ) { | 119 | if ( i1.hasDuration() ) { |
120 | if ( i1.duration() != i2.duration() ) | 120 | if ( i1.duration() != i2.duration() ) |
121 | return false; | 121 | return false; |
122 | } | 122 | } |
123 | } else { | 123 | } else { |
124 | return false; | 124 | return false; |
125 | } | 125 | } |
126 | 126 | ||
127 | return ( i1.organizer() == i2.organizer() && | 127 | return ( i1.organizer() == i2.organizer() && |
128 | // i1.uid() == i2.uid() && | 128 | // i1.uid() == i2.uid() && |
129 | // Don't compare lastModified, otherwise the operator is not | 129 | // Don't compare lastModified, otherwise the operator is not |
130 | // of much use. We are not comparing for identity, after all. | 130 | // of much use. We are not comparing for identity, after all. |
131 | i1.doesFloat() == i2.doesFloat() && | 131 | i1.doesFloat() == i2.doesFloat() && |
132 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 132 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
133 | // no need to compare mObserver | 133 | // no need to compare mObserver |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 137 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
138 | { | 138 | { |
139 | QTime t = dt.time(); | 139 | QTime t = dt.time(); |
140 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 140 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
141 | return dt; | 141 | return dt; |
142 | } | 142 | } |
143 | 143 | ||
144 | bool IncidenceBase::isTagged() const | 144 | bool IncidenceBase::isTagged() const |
145 | { | 145 | { |
146 | return mIsTagged; | 146 | return mIsTagged; |
147 | } | 147 | } |
148 | void IncidenceBase::setTagged( bool b) | 148 | void IncidenceBase::setTagged( bool b) |
149 | { | 149 | { |
150 | mIsTagged = b; | 150 | mIsTagged = b; |
151 | } | 151 | } |
152 | void IncidenceBase::setCalID( int id ) | 152 | void IncidenceBase::setCalID( int id ) |
153 | { | 153 | { |
154 | if ( mCalID > 0 ) { | 154 | if ( mCalID > 0 ) { |
155 | blockLastModified = true; | 155 | blockLastModified = true; |
156 | updated(); | 156 | updated(); |
157 | blockLastModified = false; | 157 | blockLastModified = false; |
158 | } | 158 | } |
159 | mCalID = id; | 159 | mCalID = id; |
160 | } | 160 | } |
161 | int IncidenceBase::calID() const | 161 | int IncidenceBase::calID() const |
162 | { | 162 | { |
163 | return mCalID; | 163 | return mCalID; |
164 | } | 164 | } |
165 | void IncidenceBase::setCalEnabled( bool b ) | 165 | void IncidenceBase::setCalEnabled( bool b ) |
166 | { | 166 | { |
167 | mCalEnabled = b; | 167 | mCalEnabled = b; |
168 | } | 168 | } |
169 | bool IncidenceBase::calEnabled() const | 169 | bool IncidenceBase::calEnabled() const |
170 | { | 170 | { |
171 | return mCalEnabled; | 171 | return mCalEnabled; |
172 | } | 172 | } |
173 | 173 | ||
174 | void IncidenceBase::setAlarmEnabled( bool b ) | 174 | void IncidenceBase::setAlarmEnabled( bool b ) |
175 | { | 175 | { |
176 | mAlarmEnabled = b; | 176 | mAlarmEnabled = b; |
177 | } | 177 | } |
178 | bool IncidenceBase::alarmEnabled() const | 178 | bool IncidenceBase::alarmEnabled() const |
179 | { | 179 | { |
180 | return mAlarmEnabled; | 180 | return mAlarmEnabled; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void IncidenceBase::setUid(const QString &uid) | 184 | void IncidenceBase::setUid(const QString &uid) |
185 | { | 185 | { |
186 | mUid = uid; | 186 | mUid = uid; |
187 | updated(); | 187 | updated(); |
188 | } | 188 | } |
189 | 189 | ||
190 | QString IncidenceBase::uid() const | 190 | QString IncidenceBase::uid() const |
191 | { | 191 | { |
192 | return mUid; | 192 | return mUid; |
193 | } | 193 | } |
194 | void IncidenceBase::setLastModifiedSubInvalid() | ||
195 | { | ||
194 | 196 | ||
197 | } | ||
195 | void IncidenceBase::setLastModified(const QDateTime &lm) | 198 | void IncidenceBase::setLastModified(const QDateTime &lm) |
196 | { | 199 | { |
197 | if ( blockLastModified ) return; | 200 | if ( blockLastModified ) return; |
198 | // DON'T! updated() because we call this from | 201 | // DON'T! updated() because we call this from |
199 | // Calendar::updateEvent(). | 202 | // Calendar::updateEvent(). |
200 | mLastModified = getEvenTime(lm); | 203 | mLastModified = getEvenTime(lm); |
204 | setLastModifiedSubInvalid(); | ||
201 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 205 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
202 | } | 206 | } |
203 | 207 | ||
204 | QDateTime IncidenceBase::lastModified() const | 208 | QDateTime IncidenceBase::lastModified() const |
205 | { | 209 | { |
206 | return mLastModified; | 210 | return mLastModified; |
207 | } | 211 | } |
208 | 212 | ||
209 | void IncidenceBase::setOrganizer(const QString &o) | 213 | void IncidenceBase::setOrganizer(const QString &o) |
210 | { | 214 | { |
211 | // we don't check for readonly here, because it is | 215 | // we don't check for readonly here, because it is |
212 | // possible that by setting the organizer we are changing | 216 | // possible that by setting the organizer we are changing |
213 | // the event's readonly status... | 217 | // the event's readonly status... |
214 | mOrganizer = o; | 218 | mOrganizer = o; |
215 | if (mOrganizer.left(7).upper() == "MAILTO:") | 219 | if (mOrganizer.left(7).upper() == "MAILTO:") |
216 | mOrganizer = mOrganizer.remove(0,7); | 220 | mOrganizer = mOrganizer.remove(0,7); |
217 | 221 | ||
218 | updated(); | 222 | updated(); |
219 | } | 223 | } |
220 | 224 | ||
221 | QString IncidenceBase::organizer() const | 225 | QString IncidenceBase::organizer() const |
222 | { | 226 | { |
223 | return mOrganizer; | 227 | return mOrganizer; |
224 | } | 228 | } |
225 | 229 | ||
226 | void IncidenceBase::setReadOnly( bool readOnly ) | 230 | void IncidenceBase::setReadOnly( bool readOnly ) |
227 | { | 231 | { |
228 | mReadOnly = readOnly; | 232 | mReadOnly = readOnly; |
229 | } | 233 | } |
230 | 234 | ||
231 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 235 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
232 | { | 236 | { |
233 | // if (mReadOnly) return; | 237 | // if (mReadOnly) return; |
234 | mDtStart = getEvenTime(dtStart); | 238 | mDtStart = getEvenTime(dtStart); |
235 | updated(); | 239 | updated(); |
236 | } | 240 | } |
237 | 241 | ||
238 | 242 | ||
239 | QDateTime IncidenceBase::dtStart() const | 243 | QDateTime IncidenceBase::dtStart() const |
240 | { | 244 | { |
241 | return mDtStart; | 245 | return mDtStart; |
242 | } | 246 | } |
243 | 247 | ||
244 | QString IncidenceBase::dtStartTimeStr() const | 248 | QString IncidenceBase::dtStartTimeStr() const |
245 | { | 249 | { |
246 | return KGlobal::locale()->formatTime(dtStart().time()); | 250 | return KGlobal::locale()->formatTime(dtStart().time()); |
247 | } | 251 | } |
248 | 252 | ||
249 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const | 253 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const |
250 | { | 254 | { |
251 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 255 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
252 | } | 256 | } |
253 | 257 | ||
254 | QString IncidenceBase::dtStartStr(bool shortfmt) const | 258 | QString IncidenceBase::dtStartStr(bool shortfmt) const |
255 | { | 259 | { |
256 | if ( doesFloat() ) | 260 | if ( doesFloat() ) |
257 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 261 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
258 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); | 262 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); |
259 | } | 263 | } |
260 | 264 | ||
261 | 265 | ||
262 | bool IncidenceBase::doesFloat() const | 266 | bool IncidenceBase::doesFloat() const |
263 | { | 267 | { |
264 | return mFloats; | 268 | return mFloats; |
265 | } | 269 | } |
266 | 270 | ||
267 | void IncidenceBase::setFloats(bool f) | 271 | void IncidenceBase::setFloats(bool f) |
268 | { | 272 | { |
269 | if (mReadOnly) return; | 273 | if (mReadOnly) return; |
270 | mFloats = f; | 274 | mFloats = f; |
271 | updated(); | 275 | updated(); |
272 | } | 276 | } |
273 | 277 | ||
274 | 278 | ||
275 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) | 279 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) |
276 | { | 280 | { |
277 | if (mReadOnly) return false; | 281 | if (mReadOnly) return false; |
278 | if (a->name().left(7).upper() == "MAILTO:") | 282 | if (a->name().left(7).upper() == "MAILTO:") |
279 | a->setName(a->name().remove(0,7)); | 283 | a->setName(a->name().remove(0,7)); |
280 | 284 | ||
281 | QPtrListIterator<Attendee> qli(mAttendees); | 285 | QPtrListIterator<Attendee> qli(mAttendees); |
282 | 286 | ||
283 | qli.toFirst(); | 287 | qli.toFirst(); |
284 | while (qli) { | 288 | while (qli) { |
285 | if (*qli.current() == *a) | 289 | if (*qli.current() == *a) |
286 | return false; | 290 | return false; |
287 | ++qli; | 291 | ++qli; |
288 | } | 292 | } |
289 | mAttendees.append(a); | 293 | mAttendees.append(a); |
290 | if (doupdate) updated(); | 294 | if (doupdate) updated(); |
291 | return true; | 295 | return true; |
292 | } | 296 | } |
293 | 297 | ||
294 | #if 0 | 298 | #if 0 |
295 | void IncidenceBase::removeAttendee(Attendee *a) | 299 | void IncidenceBase::removeAttendee(Attendee *a) |
296 | { | 300 | { |