-rw-r--r-- | libkcal/calendar.cpp | 14 | ||||
-rw-r--r-- | libkcal/calendar.h | 9 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 80 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 3 | ||||
-rw-r--r-- | libkcal/calfilter.cpp | 9 | ||||
-rw-r--r-- | libkcal/calfilter.h | 1 | ||||
-rw-r--r-- | libkcal/event.cpp | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 33 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 9 | ||||
-rw-r--r-- | libkcal/todo.cpp | 2 |
10 files changed, 146 insertions, 18 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 7e8e2c5..f4350d9 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -54,7 +54,7 @@ void Calendar::init() | |||
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; |
@@ -112,7 +112,14 @@ Calendar::~Calendar() | |||
112 | if ( mUndoIncidence ) | 112 | if ( mUndoIncidence ) |
113 | delete mUndoIncidence; | 113 | delete mUndoIncidence; |
114 | } | 114 | } |
115 | 115 | void Calendar::setDefaultCalendar( int d ) | |
116 | { | ||
117 | mDefaultCalendar = d; | ||
118 | } | ||
119 | int Calendar::defaultCalendar() | ||
120 | { | ||
121 | return mDefaultCalendar; | ||
122 | } | ||
116 | const QString &Calendar::getOwner() const | 123 | const QString &Calendar::getOwner() const |
117 | { | 124 | { |
118 | return mOwner; | 125 | return mOwner; |
@@ -348,7 +355,8 @@ void Calendar::addIncidenceBranch(Incidence *i) | |||
348 | bool Calendar::addIncidence(Incidence *i) | 355 | bool 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 | } |
354 | void Calendar::deleteIncidence(Incidence *in) | 362 | void Calendar::deleteIncidence(Incidence *in) |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index ab40970..4c6760f 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -302,7 +302,11 @@ public: | |||
302 | QString::null, if no calendar has been loaded. | 302 | QString::null, if no calendar has been loaded. |
303 | */ | 303 | */ |
304 | QString loadedProductId(); | 304 | QString loadedProductId(); |
305 | 305 | void setDefaultCalendar( int ); | |
306 | int defaultCalendar(); | ||
307 | virtual void setCalendarEnabled( int id, bool enable ) = 0; | ||
308 | virtual void setAlarmEnabled( int id, bool enable ) = 0; | ||
309 | virtual void setDefaultCalendarEnabledOnly() = 0; | ||
306 | signals: | 310 | signals: |
307 | void calendarChanged(); | 311 | void calendarChanged(); |
308 | void calendarSaved(); | 312 | void calendarSaved(); |
@@ -326,8 +330,10 @@ public: | |||
326 | */ | 330 | */ |
327 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 331 | virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
328 | bool inclusive = false ) = 0; | 332 | bool inclusive = false ) = 0; |
333 | |||
329 | Incidence *mNextAlarmIncidence; | 334 | Incidence *mNextAlarmIncidence; |
330 | Incidence *mUndoIncidence; | 335 | Incidence *mUndoIncidence; |
336 | int mDefaultCalendar; | ||
331 | 337 | ||
332 | private: | 338 | private: |
333 | void init(); | 339 | void init(); |
@@ -339,6 +345,7 @@ private: | |||
339 | 345 | ||
340 | CalFilter *mFilter; | 346 | CalFilter *mFilter; |
341 | CalFilter *mDefaultFilter; | 347 | CalFilter *mDefaultFilter; |
348 | |||
342 | 349 | ||
343 | QString mTimeZoneId; | 350 | QString mTimeZoneId; |
344 | 351 | ||
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index fe74052..c5500bf 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -150,6 +150,8 @@ bool CalendarLocal::addEvent( Event *event ) | |||
150 | event->registerObserver( this ); | 150 | event->registerObserver( this ); |
151 | 151 | ||
152 | setModified( true ); | 152 | setModified( true ); |
153 | event->setCalID( mDefaultCalendar ); | ||
154 | event->setCalEnabled( true ); | ||
153 | 155 | ||
154 | return true; | 156 | return true; |
155 | } | 157 | } |
@@ -170,7 +172,7 @@ Event *CalendarLocal::event( const QString &uid ) | |||
170 | Event *event; | 172 | Event *event; |
171 | 173 | ||
172 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 174 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
173 | if ( event->uid() == uid ) { | 175 | if ( event->uid() == uid && event->calEnabled() ) { |
174 | return event; | 176 | return event; |
175 | } | 177 | } |
176 | } | 178 | } |
@@ -198,7 +200,8 @@ bool CalendarLocal::addTodo( Todo *todo ) | |||
198 | setupRelations( todo ); | 200 | setupRelations( todo ); |
199 | 201 | ||
200 | setModified( true ); | 202 | setModified( true ); |
201 | 203 | todo->setCalID( mDefaultCalendar ); | |
204 | todo->setCalEnabled( true ); | ||
202 | return true; | 205 | return true; |
203 | } | 206 | } |
204 | 207 | ||
@@ -216,13 +219,16 @@ void CalendarLocal::deleteTodo( Todo *todo ) | |||
216 | 219 | ||
217 | QPtrList<Todo> CalendarLocal::rawTodos() | 220 | QPtrList<Todo> CalendarLocal::rawTodos() |
218 | { | 221 | { |
219 | return mTodoList; | 222 | QPtrList<Todo> el; |
223 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | ||
224 | if ( it->calEnabled() ) el.append( it ); | ||
225 | return el; | ||
220 | } | 226 | } |
221 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 227 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
222 | { | 228 | { |
223 | Todo *todo; | 229 | Todo *todo; |
224 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 230 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
225 | if ( todo->getID( syncProf ) == id ) return todo; | 231 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
226 | } | 232 | } |
227 | 233 | ||
228 | return 0; | 234 | return 0; |
@@ -267,7 +273,7 @@ Event *CalendarLocal::event( QString syncProf, QString id ) | |||
267 | { | 273 | { |
268 | Event *todo; | 274 | Event *todo; |
269 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 275 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
270 | if ( todo->getID( syncProf ) == id ) return todo; | 276 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
271 | } | 277 | } |
272 | 278 | ||
273 | return 0; | 279 | return 0; |
@@ -276,7 +282,7 @@ Todo *CalendarLocal::todo( const QString &uid ) | |||
276 | { | 282 | { |
277 | Todo *todo; | 283 | Todo *todo; |
278 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 284 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
279 | if ( todo->uid() == uid ) return todo; | 285 | if ( todo->calEnabled() && todo->uid() == uid ) return todo; |
280 | } | 286 | } |
281 | 287 | ||
282 | return 0; | 288 | return 0; |
@@ -389,6 +395,7 @@ QPtrList<Todo> CalendarLocal::todos( const QDate &date ) | |||
389 | 395 | ||
390 | Todo *todo; | 396 | Todo *todo; |
391 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 397 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
398 | if ( !todo->calEnabled() ) continue; | ||
392 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { | 399 | if ( todo->hasDueDate() && todo->dtDue().date() == date ) { |
393 | todos.append( todo ); | 400 | todos.append( todo ); |
394 | } | 401 | } |
@@ -421,6 +428,7 @@ QDateTime CalendarLocal::nextAlarm( int daysTo ) | |||
421 | int offset; | 428 | int offset; |
422 | mNextAlarmIncidence = 0; | 429 | mNextAlarmIncidence = 0; |
423 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 430 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
431 | if ( !e->calEnabled() ) continue; | ||
424 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 432 | next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
425 | if ( ok ) { | 433 | if ( ok ) { |
426 | if ( next < nextA ) { | 434 | if ( next < nextA ) { |
@@ -434,6 +442,7 @@ QDateTime CalendarLocal::nextAlarm( int daysTo ) | |||
434 | } | 442 | } |
435 | Todo *t; | 443 | Todo *t; |
436 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 444 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
445 | if ( !t->calEnabled() ) continue; | ||
437 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; | 446 | next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; |
438 | if ( ok ) { | 447 | if ( ok ) { |
439 | if ( next < nextA ) { | 448 | if ( next < nextA ) { |
@@ -464,13 +473,15 @@ Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | |||
464 | Event *e; | 473 | Event *e; |
465 | 474 | ||
466 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 475 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
476 | if ( !e->calEnabled() ) continue; | ||
467 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 477 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
468 | else appendAlarms( alarms, e, from, to ); | 478 | else appendAlarms( alarms, e, from, to ); |
469 | } | 479 | } |
470 | 480 | ||
471 | Todo *t; | 481 | Todo *t; |
472 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { | 482 | for( t = mTodoList.first(); t; t = mTodoList.next() ) { |
473 | appendAlarms( alarms, t, from, to ); | 483 | if ( !t->calEnabled() ) continue; |
484 | appendAlarms( alarms, t, from, to ); | ||
474 | } | 485 | } |
475 | 486 | ||
476 | return alarms; | 487 | return alarms; |
@@ -543,6 +554,7 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | |||
543 | 554 | ||
544 | Event *event; | 555 | Event *event; |
545 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 556 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
557 | if ( !event->calEnabled() ) continue; | ||
546 | if ( event->doesRecur() ) { | 558 | if ( event->doesRecur() ) { |
547 | if ( event->isMultiDay() ) { | 559 | if ( event->isMultiDay() ) { |
548 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); | 560 | int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); |
@@ -595,6 +607,7 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | |||
595 | 607 | ||
596 | // Get non-recurring events | 608 | // Get non-recurring events |
597 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 609 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
610 | if ( !event->calEnabled() ) continue; | ||
598 | if ( event->doesRecur() ) { | 611 | if ( event->doesRecur() ) { |
599 | QDate rStart = event->dtStart().date(); | 612 | QDate rStart = event->dtStart().date(); |
600 | bool found = false; | 613 | bool found = false; |
@@ -670,7 +683,10 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | |||
670 | 683 | ||
671 | QPtrList<Event> CalendarLocal::rawEvents() | 684 | QPtrList<Event> CalendarLocal::rawEvents() |
672 | { | 685 | { |
673 | return mEventList; | 686 | QPtrList<Event> el; |
687 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | ||
688 | if ( it->calEnabled() ) el.append( it ); | ||
689 | return el; | ||
674 | } | 690 | } |
675 | 691 | ||
676 | bool CalendarLocal::addJournal(Journal *journal) | 692 | bool CalendarLocal::addJournal(Journal *journal) |
@@ -685,7 +701,8 @@ bool CalendarLocal::addJournal(Journal *journal) | |||
685 | journal->registerObserver( this ); | 701 | journal->registerObserver( this ); |
686 | 702 | ||
687 | setModified( true ); | 703 | setModified( true ); |
688 | 704 | journal->setCalID( mDefaultCalendar ); | |
705 | journal->setCalEnabled( true ); | ||
689 | return true; | 706 | return true; |
690 | } | 707 | } |
691 | 708 | ||
@@ -704,7 +721,7 @@ Journal *CalendarLocal::journal( const QDate &date ) | |||
704 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 721 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
705 | 722 | ||
706 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 723 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
707 | if ( it->dtStart().date() == date ) | 724 | if ( it->calEnabled() && it->dtStart().date() == date ) |
708 | return it; | 725 | return it; |
709 | 726 | ||
710 | return 0; | 727 | return 0; |
@@ -713,7 +730,7 @@ Journal *CalendarLocal::journal( const QDate &date ) | |||
713 | Journal *CalendarLocal::journal( const QString &uid ) | 730 | Journal *CalendarLocal::journal( const QString &uid ) |
714 | { | 731 | { |
715 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 732 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
716 | if ( it->uid() == uid ) | 733 | if ( it->calEnabled() && it->uid() == uid ) |
717 | return it; | 734 | return it; |
718 | 735 | ||
719 | return 0; | 736 | return 0; |
@@ -721,6 +738,45 @@ Journal *CalendarLocal::journal( const QString &uid ) | |||
721 | 738 | ||
722 | QPtrList<Journal> CalendarLocal::journals() | 739 | QPtrList<Journal> CalendarLocal::journals() |
723 | { | 740 | { |
724 | return mJournalList; | 741 | QPtrList<Journal> el; |
742 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
743 | if ( it->calEnabled() ) el.append( it ); | ||
744 | return el; | ||
725 | } | 745 | } |
726 | 746 | ||
747 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) | ||
748 | { | ||
749 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
750 | if ( it->calID() == id ) it->setCalEnabled( enable ); | ||
751 | |||
752 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | ||
753 | if ( it->calID() == id ) it->setCalEnabled( enable ); | ||
754 | |||
755 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | ||
756 | if ( it->calID() == id ) it->setCalEnabled( enable ); | ||
757 | |||
758 | } | ||
759 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) | ||
760 | { | ||
761 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
762 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | ||
763 | |||
764 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | ||
765 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | ||
766 | |||
767 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | ||
768 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | ||
769 | |||
770 | } | ||
771 | void CalendarLocal::setDefaultCalendarEnabledOnly() | ||
772 | { | ||
773 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
774 | it->setCalEnabled( it->calID() == mDefaultCalendar ); | ||
775 | |||
776 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | ||
777 | it->setCalEnabled( it->calID() == mDefaultCalendar); | ||
778 | |||
779 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | ||
780 | it->setCalEnabled( it->calID() == mDefaultCalendar); | ||
781 | |||
782 | } | ||
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 98ec710..b25fcbe 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -180,6 +180,9 @@ class CalendarLocal : public Calendar | |||
180 | Event *event( QString, QString ); | 180 | Event *event( QString, QString ); |
181 | 181 | ||
182 | 182 | ||
183 | void setCalendarEnabled( int id, bool enable ); | ||
184 | void setAlarmEnabled( int id, bool enable ); | ||
185 | void setDefaultCalendarEnabledOnly(); | ||
183 | 186 | ||
184 | protected: | 187 | protected: |
185 | 188 | ||
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index 20078a7..3510c7d 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp | |||
@@ -78,6 +78,8 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) | |||
78 | } | 78 | } |
79 | bool CalFilter::filterCalendarItem(Incidence *in) | 79 | bool CalFilter::filterCalendarItem(Incidence *in) |
80 | { | 80 | { |
81 | if ( !in->calEnabled() ) | ||
82 | return false; | ||
81 | if ( in->typeID() == eventID ) | 83 | if ( in->typeID() == eventID ) |
82 | return filterEvent( (Event*) in ); | 84 | return filterEvent( (Event*) in ); |
83 | else if ( in->typeID() == todoID ) | 85 | else if ( in->typeID() == todoID ) |
@@ -88,6 +90,9 @@ bool CalFilter::filterCalendarItem(Incidence *in) | |||
88 | } | 90 | } |
89 | bool CalFilter::filterEvent(Event *event) | 91 | bool CalFilter::filterEvent(Event *event) |
90 | { | 92 | { |
93 | |||
94 | if ( !event->calEnabled() ) | ||
95 | return false; | ||
91 | if (mCriteria & HideEvents) | 96 | if (mCriteria & HideEvents) |
92 | return false; | 97 | return false; |
93 | if (mCriteria & HideRecurring) { | 98 | if (mCriteria & HideRecurring) { |
@@ -98,12 +103,16 @@ bool CalFilter::filterEvent(Event *event) | |||
98 | } | 103 | } |
99 | bool CalFilter::filterJournal(Journal *j) | 104 | bool CalFilter::filterJournal(Journal *j) |
100 | { | 105 | { |
106 | if ( !j->calEnabled() ) | ||
107 | return false; | ||
101 | if (mCriteria & HideJournals) | 108 | if (mCriteria & HideJournals) |
102 | return false; | 109 | return false; |
103 | return true; | 110 | return true; |
104 | } | 111 | } |
105 | bool CalFilter::filterTodo(Todo *todo) | 112 | bool CalFilter::filterTodo(Todo *todo) |
106 | { | 113 | { |
114 | if ( !todo->calEnabled() ) | ||
115 | return false; | ||
107 | if (mCriteria & HideTodos) | 116 | if (mCriteria & HideTodos) |
108 | return false; | 117 | return false; |
109 | if (mCriteria & HideCompleted) { | 118 | if (mCriteria & HideCompleted) { |
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h index 29db441..e349770 100644 --- a/libkcal/calfilter.h +++ b/libkcal/calfilter.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include "event.h" | 27 | #include "event.h" |
28 | #include "todo.h" | 28 | #include "todo.h" |
29 | #include "journal.h" | ||
29 | 30 | ||
30 | namespace KCal { | 31 | namespace KCal { |
31 | 32 | ||
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index 9b99855..7cd81fa 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -173,7 +173,9 @@ void Event::setDuration(int seconds) | |||
173 | } | 173 | } |
174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
175 | { | 175 | { |
176 | 176 | *ok = false; | |
177 | if ( !alarmEnabled() ) | ||
178 | return QDateTime (); | ||
177 | bool yes; | 179 | bool yes; |
178 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); | 180 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); |
179 | if ( ! yes || cancelled() ) { | 181 | if ( ! yes || cancelled() ) { |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index b5fe2e6..2ddbb01 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -44,17 +44,24 @@ IncidenceBase::IncidenceBase() : | |||
44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 44 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
45 | mSyncStatus = 0; | 45 | mSyncStatus = 0; |
46 | mAttendees.setAutoDelete( true ); | 46 | mAttendees.setAutoDelete( true ); |
47 | mCalEnabled = true; | ||
48 | mAlarmEnabled = true; | ||
49 | mCalID = 0; | ||
47 | } | 50 | } |
48 | 51 | ||
49 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : | 52 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : |
50 | CustomProperties( i ) | 53 | CustomProperties( i ) |
51 | { | 54 | { |
55 | |||
52 | mReadOnly = i.mReadOnly; | 56 | mReadOnly = i.mReadOnly; |
53 | mDtStart = i.mDtStart; | 57 | mDtStart = i.mDtStart; |
54 | mDuration = i.mDuration; | 58 | mDuration = i.mDuration; |
55 | mHasDuration = i.mHasDuration; | 59 | mHasDuration = i.mHasDuration; |
56 | mOrganizer = i.mOrganizer; | 60 | mOrganizer = i.mOrganizer; |
57 | mUid = i.mUid; | 61 | mUid = i.mUid; |
62 | mCalEnabled = i.mCalEnabled; | ||
63 | mAlarmEnabled = i.mAlarmEnabled; | ||
64 | mCalID = i.mCalID; | ||
58 | QPtrList<Attendee> attendees = i.attendees(); | 65 | QPtrList<Attendee> attendees = i.attendees(); |
59 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { | 66 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { |
60 | mAttendees.append( new Attendee( *a ) ); | 67 | mAttendees.append( new Attendee( *a ) ); |
@@ -132,6 +139,32 @@ QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | |||
132 | return dt; | 139 | return dt; |
133 | } | 140 | } |
134 | 141 | ||
142 | void IncidenceBase::setCalID( int id ) | ||
143 | { | ||
144 | mCalID = id; | ||
145 | } | ||
146 | int IncidenceBase::calID() const | ||
147 | { | ||
148 | return mCalID; | ||
149 | } | ||
150 | void IncidenceBase::setCalEnabled( bool b ) | ||
151 | { | ||
152 | mCalEnabled = b; | ||
153 | } | ||
154 | bool IncidenceBase::calEnabled() const | ||
155 | { | ||
156 | return mCalEnabled; | ||
157 | } | ||
158 | |||
159 | void IncidenceBase::setAlarmEnabled( bool b ) | ||
160 | { | ||
161 | mAlarmEnabled = b; | ||
162 | } | ||
163 | bool IncidenceBase::alarmEnabled() const | ||
164 | { | ||
165 | return mAlarmEnabled; | ||
166 | } | ||
167 | |||
135 | 168 | ||
136 | void IncidenceBase::setUid(const QString &uid) | 169 | void IncidenceBase::setUid(const QString &uid) |
137 | { | 170 | { |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 05209e0..dc6024a 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -141,6 +141,12 @@ class IncidenceBase : public CustomProperties | |||
141 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
142 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
143 | void updated(); | 143 | void updated(); |
144 | void setCalID( int id ); | ||
145 | int calID() const; | ||
146 | void setCalEnabled( bool ); | ||
147 | bool calEnabled() const; | ||
148 | void setAlarmEnabled( bool ); | ||
149 | bool alarmEnabled() const; | ||
144 | 150 | ||
145 | protected: | 151 | protected: |
146 | QDateTime mDtStart; | 152 | QDateTime mDtStart; |
@@ -151,6 +157,9 @@ class IncidenceBase : public CustomProperties | |||
151 | // base components | 157 | // base components |
152 | QString mOrganizer; | 158 | QString mOrganizer; |
153 | QString mUid; | 159 | QString mUid; |
160 | int mCalID; | ||
161 | bool mCalEnabled; | ||
162 | bool mAlarmEnabled; | ||
154 | QDateTime mLastModified; | 163 | QDateTime mLastModified; |
155 | QPtrList<Attendee> mAttendees; | 164 | QPtrList<Attendee> mAttendees; |
156 | 165 | ||
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index c97a61e..42274ff 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -517,7 +517,7 @@ void Todo::setPercentComplete(int v) | |||
517 | } | 517 | } |
518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const | 518 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
519 | { | 519 | { |
520 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { | 520 | if ( isCompleted() || ! hasDueDate() || cancelled() || !alarmEnabled() ) { |
521 | *ok = false; | 521 | *ok = false; |
522 | return QDateTime (); | 522 | return QDateTime (); |
523 | } | 523 | } |