summaryrefslogtreecommitdiffabout
path: root/libkcal/calendar.cpp
Unidiff
Diffstat (limited to 'libkcal/calendar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 7e8e2c5..f4350d9 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -45,25 +45,25 @@ Calendar::Calendar( const QString &timeZoneId )
45{ 45{
46 46
47 init(); 47 init();
48 setTimeZoneId(timeZoneId); 48 setTimeZoneId(timeZoneId);
49} 49}
50 50
51void Calendar::init() 51void Calendar::init()
52{ 52{
53 mObserver = 0; 53 mObserver = 0;
54 mNewObserver = false; 54 mNewObserver = false;
55 mUndoIncidence = 0; 55 mUndoIncidence = 0;
56 mModified = false; 56 mModified = false;
57 57 mDefaultCalendar = 1;
58 // Setup default filter, which does nothing 58 // Setup default filter, which does nothing
59 mDefaultFilter = new CalFilter; 59 mDefaultFilter = new CalFilter;
60 mFilter = mDefaultFilter; 60 mFilter = mDefaultFilter;
61 mFilter->setEnabled(false); 61 mFilter->setEnabled(false);
62 62
63 // initialize random numbers. This is a hack, and not 63 // initialize random numbers. This is a hack, and not
64 // even that good of one at that. 64 // even that good of one at that.
65// srandom(time(0)); 65// srandom(time(0));
66 66
67 // user information... 67 // user information...
68 setOwner(i18n("Unknown Name")); 68 setOwner(i18n("Unknown Name"));
69 setEmail(i18n("unknown@nowhere")); 69 setEmail(i18n("unknown@nowhere"));
@@ -103,25 +103,32 @@ void Calendar::init()
103 setTimeZone(tzStr); 103 setTimeZone(tzStr);
104#endif 104#endif
105 105
106// KOPrefs::instance()->writeConfig(); 106// KOPrefs::instance()->writeConfig();
107} 107}
108 108
109Calendar::~Calendar() 109Calendar::~Calendar()
110{ 110{
111 delete mDefaultFilter; 111 delete mDefaultFilter;
112 if ( mUndoIncidence ) 112 if ( mUndoIncidence )
113 delete mUndoIncidence; 113 delete mUndoIncidence;
114} 114}
115 115void Calendar::setDefaultCalendar( int d )
116{
117 mDefaultCalendar = d;
118}
119int Calendar::defaultCalendar()
120{
121 return mDefaultCalendar;
122}
116const QString &Calendar::getOwner() const 123const QString &Calendar::getOwner() const
117{ 124{
118 return mOwner; 125 return mOwner;
119} 126}
120 127
121bool Calendar::undoDeleteIncidence() 128bool Calendar::undoDeleteIncidence()
122{ 129{
123 if (!mUndoIncidence) 130 if (!mUndoIncidence)
124 return false; 131 return false;
125 addIncidence(mUndoIncidence); 132 addIncidence(mUndoIncidence);
126 mUndoIncidence = 0; 133 mUndoIncidence = 0;
127 return true; 134 return true;
@@ -339,25 +346,26 @@ void Calendar::addIncidenceBranch(Incidence *i)
339{ 346{
340 addIncidence( i ); 347 addIncidence( i );
341 Incidence * inc; 348 Incidence * inc;
342 QPtrList<Incidence> Relations = i->relations(); 349 QPtrList<Incidence> Relations = i->relations();
343 for (inc=Relations.first();inc;inc=Relations.next()) { 350 for (inc=Relations.first();inc;inc=Relations.next()) {
344 addIncidenceBranch( inc ); 351 addIncidenceBranch( inc );
345 } 352 }
346} 353}
347 354
348bool Calendar::addIncidence(Incidence *i) 355bool Calendar::addIncidence(Incidence *i)
349{ 356{
350 Incidence::AddVisitor<Calendar> v(this); 357 Incidence::AddVisitor<Calendar> v(this);
351 358 i->setCalID( mDefaultCalendar );
359 i->setCalEnabled( true );
352 return i->accept(v); 360 return i->accept(v);
353} 361}
354void Calendar::deleteIncidence(Incidence *in) 362void Calendar::deleteIncidence(Incidence *in)
355{ 363{
356 if ( in->typeID() == eventID ) 364 if ( in->typeID() == eventID )
357 deleteEvent( (Event*) in ); 365 deleteEvent( (Event*) in );
358 else if ( in->typeID() == todoID ) 366 else if ( in->typeID() == todoID )
359 deleteTodo( (Todo*) in); 367 deleteTodo( (Todo*) in);
360 else if ( in->typeID() == journalID ) 368 else if ( in->typeID() == journalID )
361 deleteJournal( (Journal*) in ); 369 deleteJournal( (Journal*) in );
362} 370}
363 371