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