summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.cpp
Unidiff
Diffstat (limited to 'libkcal/calendar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 32aac7a..a3977d7 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -1,426 +1,441 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <stdlib.h> 22#include <stdlib.h>
23#include <time.h> 23#include <time.h>
24 24
25#include <kdebug.h> 25#include <kdebug.h>
26#include <kglobal.h> 26#include <kglobal.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29#include "exceptions.h" 29#include "exceptions.h"
30#include "calfilter.h" 30#include "calfilter.h"
31 31
32#include "calendar.h" 32#include "calendar.h"
33#include "syncdefines.h"
33 34
34using namespace KCal; 35using namespace KCal;
35 36
36Calendar::Calendar() 37Calendar::Calendar()
37{ 38{
38 39
39 init(); 40 init();
40 setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") ); 41 setTimeZoneId( i18n (" 00:00 Europe/London(UTC)") );
41} 42}
42 43
43Calendar::Calendar( const QString &timeZoneId ) 44Calendar::Calendar( const QString &timeZoneId )
44{ 45{
45 46
46 init(); 47 init();
47 setTimeZoneId(timeZoneId); 48 setTimeZoneId(timeZoneId);
48} 49}
49 50
50void Calendar::init() 51void Calendar::init()
51{ 52{
52 mObserver = 0; 53 mObserver = 0;
53 mNewObserver = false; 54 mNewObserver = false;
54 55
55 mModified = false; 56 mModified = false;
56 57
57 // Setup default filter, which does nothing 58 // Setup default filter, which does nothing
58 mDefaultFilter = new CalFilter; 59 mDefaultFilter = new CalFilter;
59 mFilter = mDefaultFilter; 60 mFilter = mDefaultFilter;
60 mFilter->setEnabled(false); 61 mFilter->setEnabled(false);
61 62
62 // initialize random numbers. This is a hack, and not 63 // initialize random numbers. This is a hack, and not
63 // even that good of one at that. 64 // even that good of one at that.
64// srandom(time(0)); 65// srandom(time(0));
65 66
66 // user information... 67 // user information...
67 setOwner(i18n("Unknown Name")); 68 setOwner(i18n("Unknown Name"));
68 setEmail(i18n("unknown@nowhere")); 69 setEmail(i18n("unknown@nowhere"));
69 70
70#if 0 71#if 0
71 tmpStr = KOPrefs::instance()->mTimeZone; 72 tmpStr = KOPrefs::instance()->mTimeZone;
72// kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl; 73// kdDebug(5800) << "Calendar::Calendar(): TimeZone: " << tmpStr << endl;
73 int dstSetting = KOPrefs::instance()->mDaylightSavings; 74 int dstSetting = KOPrefs::instance()->mDaylightSavings;
74 extern long int timezone; 75 extern long int timezone;
75 struct tm *now; 76 struct tm *now;
76 time_t curtime; 77 time_t curtime;
77 curtime = time(0); 78 curtime = time(0);
78 now = localtime(&curtime); 79 now = localtime(&curtime);
79 int hourOff = - ((timezone / 60) / 60); 80 int hourOff = - ((timezone / 60) / 60);
80 if (now->tm_isdst) 81 if (now->tm_isdst)
81 hourOff += 1; 82 hourOff += 1;
82 QString tzStr; 83 QString tzStr;
83 tzStr.sprintf("%.2d%.2d", 84 tzStr.sprintf("%.2d%.2d",
84 hourOff, 85 hourOff,
85 abs((timezone / 60) % 60)); 86 abs((timezone / 60) % 60));
86 87
87 // if no time zone was in the config file, write what we just discovered. 88 // if no time zone was in the config file, write what we just discovered.
88 if (tmpStr.isEmpty()) { 89 if (tmpStr.isEmpty()) {
89// KOPrefs::instance()->mTimeZone = tzStr; 90// KOPrefs::instance()->mTimeZone = tzStr;
90 } else { 91 } else {
91 tzStr = tmpStr; 92 tzStr = tmpStr;
92 } 93 }
93 94
94 // if daylight savings has changed since last load time, we need 95 // if daylight savings has changed since last load time, we need
95 // to rewrite these settings to the config file. 96 // to rewrite these settings to the config file.
96 if ((now->tm_isdst && !dstSetting) || 97 if ((now->tm_isdst && !dstSetting) ||
97 (!now->tm_isdst && dstSetting)) { 98 (!now->tm_isdst && dstSetting)) {
98 KOPrefs::instance()->mTimeZone = tzStr; 99 KOPrefs::instance()->mTimeZone = tzStr;
99 KOPrefs::instance()->mDaylightSavings = now->tm_isdst; 100 KOPrefs::instance()->mDaylightSavings = now->tm_isdst;
100 } 101 }
101 102
102 setTimeZone(tzStr); 103 setTimeZone(tzStr);
103#endif 104#endif
104 105
105// KOPrefs::instance()->writeConfig(); 106// KOPrefs::instance()->writeConfig();
106} 107}
107 108
108Calendar::~Calendar() 109Calendar::~Calendar()
109{ 110{
110 delete mDefaultFilter; 111 delete mDefaultFilter;
111} 112}
112 113
113const QString &Calendar::getOwner() const 114const QString &Calendar::getOwner() const
114{ 115{
115 return mOwner; 116 return mOwner;
116} 117}
117 118
118void Calendar::setOwner(const QString &os) 119void Calendar::setOwner(const QString &os)
119{ 120{
120 int i; 121 int i;
121 mOwner = os; 122 mOwner = os;
122 i = mOwner.find(','); 123 i = mOwner.find(',');
123 if (i != -1) 124 if (i != -1)
124 mOwner = mOwner.left(i); 125 mOwner = mOwner.left(i);
125 126
126 setModified( true ); 127 setModified( true );
127} 128}
128 129
129void Calendar::setTimeZone(const QString & tz) 130void Calendar::setTimeZone(const QString & tz)
130{ 131{
131 bool neg = FALSE; 132 bool neg = FALSE;
132 int hours, minutes; 133 int hours, minutes;
133 QString tmpStr(tz); 134 QString tmpStr(tz);
134 135
135 if (tmpStr.left(1) == "-") 136 if (tmpStr.left(1) == "-")
136 neg = TRUE; 137 neg = TRUE;
137 if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+") 138 if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+")
138 tmpStr.remove(0, 1); 139 tmpStr.remove(0, 1);
139 hours = tmpStr.left(2).toInt(); 140 hours = tmpStr.left(2).toInt();
140 if (tmpStr.length() > 2) 141 if (tmpStr.length() > 2)
141 minutes = tmpStr.right(2).toInt(); 142 minutes = tmpStr.right(2).toInt();
142 else 143 else
143 minutes = 0; 144 minutes = 0;
144 mTimeZone = (60*hours+minutes); 145 mTimeZone = (60*hours+minutes);
145 if (neg) 146 if (neg)
146 mTimeZone = -mTimeZone; 147 mTimeZone = -mTimeZone;
147 mLocalTime = false; 148 mLocalTime = false;
148 149
149 setModified( true ); 150 setModified( true );
150} 151}
151 152
152QString Calendar::getTimeZoneStr() const 153QString Calendar::getTimeZoneStr() const
153{ 154{
154 if (mLocalTime) 155 if (mLocalTime)
155 return ""; 156 return "";
156 QString tmpStr; 157 QString tmpStr;
157 int hours = abs(mTimeZone / 60); 158 int hours = abs(mTimeZone / 60);
158 int minutes = abs(mTimeZone % 60); 159 int minutes = abs(mTimeZone % 60);
159 bool neg = mTimeZone < 0; 160 bool neg = mTimeZone < 0;
160 161
161 tmpStr.sprintf("%c%.2d%.2d", 162 tmpStr.sprintf("%c%.2d%.2d",
162 (neg ? '-' : '+'), 163 (neg ? '-' : '+'),
163 hours, minutes); 164 hours, minutes);
164 return tmpStr; 165 return tmpStr;
165} 166}
166 167
167void Calendar::setTimeZone(int tz) 168void Calendar::setTimeZone(int tz)
168{ 169{
169 mTimeZone = tz; 170 mTimeZone = tz;
170 mLocalTime = false; 171 mLocalTime = false;
171 172
172 setModified( true ); 173 setModified( true );
173} 174}
174 175
175int Calendar::getTimeZone() const 176int Calendar::getTimeZone() const
176{ 177{
177 return mTimeZone; 178 return mTimeZone;
178} 179}
179 180
180void Calendar::setTimeZoneId(const QString &id) 181void Calendar::setTimeZoneId(const QString &id)
181{ 182{
182 mTimeZoneId = id; 183 mTimeZoneId = id;
183 mLocalTime = false; 184 mLocalTime = false;
184 mTimeZone = KGlobal::locale()->timezoneOffset(mTimeZoneId); 185 mTimeZone = KGlobal::locale()->timezoneOffset(mTimeZoneId);
185 if ( mTimeZone > 1000) 186 if ( mTimeZone > 1000)
186 setLocalTime(); 187 setLocalTime();
187 //qDebug("Calendar::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), mTimeZone); 188 //qDebug("Calendar::setTimeZoneOffset %s %d ",mTimeZoneId.latin1(), mTimeZone);
188 setModified( true ); 189 setModified( true );
189} 190}
190 191
191QString Calendar::timeZoneId() const 192QString Calendar::timeZoneId() const
192{ 193{
193 return mTimeZoneId; 194 return mTimeZoneId;
194} 195}
195 196
196void Calendar::setLocalTime() 197void Calendar::setLocalTime()
197{ 198{
198 //qDebug("Calendar::setLocalTime() "); 199 //qDebug("Calendar::setLocalTime() ");
199 mLocalTime = true; 200 mLocalTime = true;
200 mTimeZone = 0; 201 mTimeZone = 0;
201 mTimeZoneId = ""; 202 mTimeZoneId = "";
202 203
203 setModified( true ); 204 setModified( true );
204} 205}
205 206
206bool Calendar::isLocalTime() const 207bool Calendar::isLocalTime() const
207{ 208{
208 return mLocalTime; 209 return mLocalTime;
209} 210}
210 211
211const QString &Calendar::getEmail() 212const QString &Calendar::getEmail()
212{ 213{
213 return mOwnerEmail; 214 return mOwnerEmail;
214} 215}
215 216
216void Calendar::setEmail(const QString &e) 217void Calendar::setEmail(const QString &e)
217{ 218{
218 mOwnerEmail = e; 219 mOwnerEmail = e;
219 220
220 setModified( true ); 221 setModified( true );
221} 222}
222 223
223void Calendar::setFilter(CalFilter *filter) 224void Calendar::setFilter(CalFilter *filter)
224{ 225{
225 mFilter = filter; 226 mFilter = filter;
226} 227}
227 228
228CalFilter *Calendar::filter() 229CalFilter *Calendar::filter()
229{ 230{
230 return mFilter; 231 return mFilter;
231} 232}
232 233
233QPtrList<Incidence> Calendar::incidences() 234QPtrList<Incidence> Calendar::incidences()
234{ 235{
235 QPtrList<Incidence> incidences; 236 QPtrList<Incidence> incidences;
236 237
237 Incidence *i; 238 Incidence *i;
238 239
239 QPtrList<Event> e = events(); 240 QPtrList<Event> e = events();
240 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 241 for( i = e.first(); i; i = e.next() ) incidences.append( i );
241 242
242 QPtrList<Todo> t = todos(); 243 QPtrList<Todo> t = todos();
243 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 244 for( i = t.first(); i; i = t.next() ) incidences.append( i );
244 245
245 QPtrList<Journal> j = journals(); 246 QPtrList<Journal> j = journals();
246 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 247 for( i = j.first(); i; i = j.next() ) incidences.append( i );
247 248
248 return incidences; 249 return incidences;
249} 250}
251void Calendar::resetTempSyncStat()
252{
253 QPtrList<Incidence> incidences;
254
255 Incidence *i;
256
257 QPtrList<Event> e = rawEvents();
258 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
250 259
260 QPtrList<Todo> t = rawTodos();
261 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
262
263 QPtrList<Journal> j = journals();
264 for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
265}
251QPtrList<Incidence> Calendar::rawIncidences() 266QPtrList<Incidence> Calendar::rawIncidences()
252{ 267{
253 QPtrList<Incidence> incidences; 268 QPtrList<Incidence> incidences;
254 269
255 Incidence *i; 270 Incidence *i;
256 271
257 QPtrList<Event> e = rawEvents(); 272 QPtrList<Event> e = rawEvents();
258 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 273 for( i = e.first(); i; i = e.next() ) incidences.append( i );
259 274
260 QPtrList<Todo> t = rawTodos(); 275 QPtrList<Todo> t = rawTodos();
261 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 276 for( i = t.first(); i; i = t.next() ) incidences.append( i );
262 277
263 QPtrList<Journal> j = journals(); 278 QPtrList<Journal> j = journals();
264 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 279 for( i = j.first(); i; i = j.next() ) incidences.append( i );
265 280
266 return incidences; 281 return incidences;
267} 282}
268 283
269QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) 284QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
270{ 285{
271 QPtrList<Event> el = rawEventsForDate(date,sorted); 286 QPtrList<Event> el = rawEventsForDate(date,sorted);
272 mFilter->apply(&el); 287 mFilter->apply(&el);
273 return el; 288 return el;
274} 289}
275 290
276QPtrList<Event> Calendar::events( const QDateTime &qdt ) 291QPtrList<Event> Calendar::events( const QDateTime &qdt )
277{ 292{
278 QPtrList<Event> el = rawEventsForDate(qdt); 293 QPtrList<Event> el = rawEventsForDate(qdt);
279 mFilter->apply(&el); 294 mFilter->apply(&el);
280 return el; 295 return el;
281} 296}
282 297
283QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, 298QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
284 bool inclusive) 299 bool inclusive)
285{ 300{
286 QPtrList<Event> el = rawEvents(start,end,inclusive); 301 QPtrList<Event> el = rawEvents(start,end,inclusive);
287 mFilter->apply(&el); 302 mFilter->apply(&el);
288 return el; 303 return el;
289} 304}
290 305
291QPtrList<Event> Calendar::events() 306QPtrList<Event> Calendar::events()
292{ 307{
293 QPtrList<Event> el = rawEvents(); 308 QPtrList<Event> el = rawEvents();
294 mFilter->apply(&el); 309 mFilter->apply(&el);
295 return el; 310 return el;
296} 311}
297 312
298 313
299bool Calendar::addIncidence(Incidence *i) 314bool Calendar::addIncidence(Incidence *i)
300{ 315{
301 Incidence::AddVisitor<Calendar> v(this); 316 Incidence::AddVisitor<Calendar> v(this);
302 317
303 return i->accept(v); 318 return i->accept(v);
304} 319}
305void Calendar::deleteIncidence(Incidence *in) 320void Calendar::deleteIncidence(Incidence *in)
306{ 321{
307 if ( in->type() == "Event" ) 322 if ( in->type() == "Event" )
308 deleteEvent( (Event*) in ); 323 deleteEvent( (Event*) in );
309 else if ( in->type() =="Todo" ) 324 else if ( in->type() =="Todo" )
310 deleteTodo( (Todo*) in); 325 deleteTodo( (Todo*) in);
311 else if ( in->type() =="Journal" ) 326 else if ( in->type() =="Journal" )
312 deleteJournal( (Journal*) in ); 327 deleteJournal( (Journal*) in );
313} 328}
314 329
315Incidence* Calendar::incidence( const QString& uid ) 330Incidence* Calendar::incidence( const QString& uid )
316{ 331{
317 Incidence* i; 332 Incidence* i;
318 333
319 if( (i = todo( uid )) != 0 ) 334 if( (i = todo( uid )) != 0 )
320 return i; 335 return i;
321 if( (i = event( uid )) != 0 ) 336 if( (i = event( uid )) != 0 )
322 return i; 337 return i;
323 if( (i = journal( uid )) != 0 ) 338 if( (i = journal( uid )) != 0 )
324 return i; 339 return i;
325 340
326 return 0; 341 return 0;
327} 342}
328 343
329QPtrList<Todo> Calendar::todos() 344QPtrList<Todo> Calendar::todos()
330{ 345{
331 QPtrList<Todo> tl = rawTodos(); 346 QPtrList<Todo> tl = rawTodos();
332 mFilter->apply( &tl ); 347 mFilter->apply( &tl );
333 return tl; 348 return tl;
334} 349}
335 350
336// When this is called, the todo have already been added to the calendar. 351// When this is called, the todo have already been added to the calendar.
337// This method is only about linking related todos 352// This method is only about linking related todos
338void Calendar::setupRelations( Incidence *incidence ) 353void Calendar::setupRelations( Incidence *incidence )
339{ 354{
340 QString uid = incidence->uid(); 355 QString uid = incidence->uid();
341 //qDebug("Calendar::setupRelations "); 356 //qDebug("Calendar::setupRelations ");
342 // First, go over the list of orphans and see if this is their parent 357 // First, go over the list of orphans and see if this is their parent
343 while( Incidence* i = mOrphans[ uid ] ) { 358 while( Incidence* i = mOrphans[ uid ] ) {
344 mOrphans.remove( uid ); 359 mOrphans.remove( uid );
345 i->setRelatedTo( incidence ); 360 i->setRelatedTo( incidence );
346 incidence->addRelation( i ); 361 incidence->addRelation( i );
347 mOrphanUids.remove( i->uid() ); 362 mOrphanUids.remove( i->uid() );
348 } 363 }
349 364
350 // Now see about this incidences parent 365 // Now see about this incidences parent
351 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { 366 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
352 // This incidence has a uid it is related to, but is not registered to it yet 367 // This incidence has a uid it is related to, but is not registered to it yet
353 // Try to find it 368 // Try to find it
354 Incidence* parent = this->incidence( incidence->relatedToUid() ); 369 Incidence* parent = this->incidence( incidence->relatedToUid() );
355 if( parent ) { 370 if( parent ) {
356 // Found it 371 // Found it
357 incidence->setRelatedTo( parent ); 372 incidence->setRelatedTo( parent );
358 parent->addRelation( incidence ); 373 parent->addRelation( incidence );
359 } else { 374 } else {
360 // Not found, put this in the mOrphans list 375 // Not found, put this in the mOrphans list
361 mOrphans.insert( incidence->relatedToUid(), incidence ); 376 mOrphans.insert( incidence->relatedToUid(), incidence );
362 mOrphanUids.insert( incidence->uid(), incidence ); 377 mOrphanUids.insert( incidence->uid(), incidence );
363 } 378 }
364 } 379 }
365} 380}
366 381
367// If a task with subtasks is deleted, move it's subtasks to the orphans list 382// If a task with subtasks is deleted, move it's subtasks to the orphans list
368void Calendar::removeRelations( Incidence *incidence ) 383void Calendar::removeRelations( Incidence *incidence )
369{ 384{
370 // qDebug("Calendar::removeRelations "); 385 // qDebug("Calendar::removeRelations ");
371 QString uid = incidence->uid(); 386 QString uid = incidence->uid();
372 387
373 QPtrList<Incidence> relations = incidence->relations(); 388 QPtrList<Incidence> relations = incidence->relations();
374 for( Incidence* i = relations.first(); i; i = relations.next() ) 389 for( Incidence* i = relations.first(); i; i = relations.next() )
375 if( !mOrphanUids.find( i->uid() ) ) { 390 if( !mOrphanUids.find( i->uid() ) ) {
376 mOrphans.insert( uid, i ); 391 mOrphans.insert( uid, i );
377 mOrphanUids.insert( i->uid(), i ); 392 mOrphanUids.insert( i->uid(), i );
378 i->setRelatedTo( 0 ); 393 i->setRelatedTo( 0 );
379 i->setRelatedToUid( uid ); 394 i->setRelatedToUid( uid );
380 } 395 }
381 396
382 // If this incidence is related to something else, tell that about it 397 // If this incidence is related to something else, tell that about it
383 if( incidence->relatedTo() ) 398 if( incidence->relatedTo() )
384 incidence->relatedTo()->removeRelation( incidence ); 399 incidence->relatedTo()->removeRelation( incidence );
385 400
386 // Remove this one from the orphans list 401 // Remove this one from the orphans list
387 if( mOrphanUids.remove( uid ) ) 402 if( mOrphanUids.remove( uid ) )
388 // This incidence is located in the orphans list - it should be removed 403 // This incidence is located in the orphans list - it should be removed
389 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { 404 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
390 // Removing wasn't that easy 405 // Removing wasn't that easy
391 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { 406 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
392 if( it.current()->uid() == uid ) { 407 if( it.current()->uid() == uid ) {
393 mOrphans.remove( it.currentKey() ); 408 mOrphans.remove( it.currentKey() );
394 break; 409 break;
395 } 410 }
396 } 411 }
397 } 412 }
398} 413}
399 414
400void Calendar::registerObserver( Observer *observer ) 415void Calendar::registerObserver( Observer *observer )
401{ 416{
402 mObserver = observer; 417 mObserver = observer;
403 mNewObserver = true; 418 mNewObserver = true;
404} 419}
405 420
406void Calendar::setModified( bool modified ) 421void Calendar::setModified( bool modified )
407{ 422{
408 if ( mObserver ) mObserver->calendarModified( modified, this ); 423 if ( mObserver ) mObserver->calendarModified( modified, this );
409 if ( modified != mModified || mNewObserver ) { 424 if ( modified != mModified || mNewObserver ) {
410 mNewObserver = false; 425 mNewObserver = false;
411 // if ( mObserver ) mObserver->calendarModified( modified, this ); 426 // if ( mObserver ) mObserver->calendarModified( modified, this );
412 mModified = modified; 427 mModified = modified;
413 } 428 }
414} 429}
415 430
416void Calendar::setLoadedProductId( const QString &id ) 431void Calendar::setLoadedProductId( const QString &id )
417{ 432{
418 mLoadedProductId = id; 433 mLoadedProductId = id;
419} 434}
420 435
421QString Calendar::loadedProductId() 436QString Calendar::loadedProductId()
422{ 437{
423 return mLoadedProductId; 438 return mLoadedProductId;
424} 439}
425 440
426//#include "calendar.moc" 441//#include "calendar.moc"