-rw-r--r-- | libkcal/alarm.cpp | 2 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 54 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 56 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
5 files changed, 87 insertions, 27 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 0afa0a7..79e0464 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp | |||
@@ -372,4 +372,6 @@ QString Alarm::offsetText() | |||
372 | if ( message.isEmpty() ) | 372 | if ( message.isEmpty() ) |
373 | message = i18n("%1min").arg( 0 ); | 373 | message = i18n("%1min").arg( 0 ); |
374 | if ( !mParent->alarmEnabled() ) | ||
375 | return "!"+message + i18n("(disabled)"); | ||
374 | return message; | 376 | return message; |
375 | } | 377 | } |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 5092d1a..a662eeb 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -431,31 +431,31 @@ void Calendar::removeRelations( Incidence *incidence ) | |||
431 | { | 431 | { |
432 | // qDebug("Calendar::removeRelations "); | 432 | // qDebug("Calendar::removeRelations "); |
433 | QString uid = incidence->uid(); | 433 | QString uid = incidence->uid(); |
434 | 434 | ||
435 | QPtrList<Incidence> relations = incidence->relations(); | 435 | QPtrList<Incidence> relations = incidence->relations(); |
436 | for( Incidence* i = relations.first(); i; i = relations.next() ) | 436 | for( Incidence* i = relations.first(); i; i = relations.next() ) |
437 | if( !mOrphanUids.find( i->uid() ) ) { | 437 | if( !mOrphanUids.find( i->uid() ) ) { |
438 | mOrphans.insert( uid, i ); | 438 | mOrphans.insert( uid, i ); |
439 | mOrphanUids.insert( i->uid(), i ); | 439 | mOrphanUids.insert( i->uid(), i ); |
440 | i->setRelatedTo( 0 ); | 440 | i->setRelatedTo( 0 ); |
441 | i->setRelatedToUid( uid ); | 441 | i->setRelatedToUid( uid ); |
442 | } | 442 | } |
443 | 443 | ||
444 | // If this incidence is related to something else, tell that about it | 444 | // If this incidence is related to something else, tell that about it |
445 | if( incidence->relatedTo() ) | 445 | if( incidence->relatedTo() ) |
446 | incidence->relatedTo()->removeRelation( incidence ); | 446 | incidence->relatedTo()->removeRelation( incidence ); |
447 | 447 | ||
448 | // Remove this one from the orphans list | 448 | // Remove this one from the orphans list |
449 | if( mOrphanUids.remove( uid ) ) | 449 | if( mOrphanUids.remove( uid ) ) |
450 | // This incidence is located in the orphans list - it should be removed | 450 | // This incidence is located in the orphans list - it should be removed |
451 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { | 451 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { |
452 | // Removing wasn't that easy | 452 | // Removing wasn't that easy |
453 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { | 453 | for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { |
454 | if( it.current()->uid() == uid ) { | 454 | if( it.current()->uid() == uid ) { |
455 | mOrphans.remove( it.currentKey() ); | 455 | mOrphans.remove( it.currentKey() ); |
456 | break; | 456 | break; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 73f82bb..2243e28 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -313,4 +313,5 @@ public: | |||
313 | virtual void setReadOnly( int id, bool enable ) = 0; | 313 | virtual void setReadOnly( int id, bool enable ) = 0; |
314 | virtual void setDefaultCalendarEnabledOnly() = 0; | 314 | virtual void setDefaultCalendarEnabledOnly() = 0; |
315 | virtual void setCalendarRemove( int id ) = 0; | ||
315 | signals: | 316 | signals: |
316 | void calendarChanged(); | 317 | void calendarChanged(); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e48122a..749d9f6 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -86,4 +86,6 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
86 | Event * ev = EventList.first(); | 86 | Event * ev = EventList.first(); |
87 | while ( ev ) { | 87 | while ( ev ) { |
88 | ev->unRegisterObserver( cal ); | ||
89 | ev->registerObserver( this ); | ||
88 | mEventList.append( ev ); | 90 | mEventList.append( ev ); |
89 | ev = EventList.next(); | 91 | ev = EventList.next(); |
@@ -91,8 +93,22 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
91 | } | 93 | } |
92 | { | 94 | { |
95 | |||
93 | QPtrList<Todo> TodoList = cal->rawTodos(); | 96 | QPtrList<Todo> TodoList = cal->rawTodos(); |
94 | Todo * ev = TodoList.first(); | 97 | Todo * ev = TodoList.first(); |
95 | while ( ev ) { | 98 | while ( ev ) { |
99 | QString rel = ev->relatedToUid(); | ||
100 | if ( !rel.isEmpty() ){ | ||
101 | ev->setRelatedTo ( 0 ); | ||
102 | ev->setRelatedToUid( rel ); | ||
103 | } | ||
104 | ev = TodoList.next(); | ||
105 | } | ||
106 | //TodoList = cal->rawTodos(); | ||
107 | ev = TodoList.first(); | ||
108 | while ( ev ) { | ||
109 | ev->unRegisterObserver( cal ); | ||
110 | ev->registerObserver( this ); | ||
96 | mTodoList.append( ev ); | 111 | mTodoList.append( ev ); |
112 | setupRelations( ev ); | ||
97 | ev = TodoList.next(); | 113 | ev = TodoList.next(); |
98 | } | 114 | } |
@@ -102,8 +118,11 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
102 | Journal * ev = JournalList.first(); | 118 | Journal * ev = JournalList.first(); |
103 | while ( ev ) { | 119 | while ( ev ) { |
120 | ev->unRegisterObserver( cal ); | ||
121 | ev->registerObserver( this ); | ||
104 | mJournalList.append( ev ); | 122 | mJournalList.append( ev ); |
105 | ev = JournalList.next(); | 123 | ev = JournalList.next(); |
106 | } | 124 | } |
107 | } | 125 | } |
126 | setModified( true ); | ||
108 | } | 127 | } |
109 | bool CalendarLocal::load( const QString &fileName ) | 128 | bool CalendarLocal::load( const QString &fileName ) |
@@ -782,4 +801,40 @@ QPtrList<Journal> CalendarLocal::journals() | |||
782 | return el; | 801 | return el; |
783 | } | 802 | } |
803 | void CalendarLocal::setCalendarRemove( int id ) | ||
804 | { | ||
805 | |||
806 | { | ||
807 | QPtrList<Event> EventList = mEventList; | ||
808 | Event * ev = EventList.first(); | ||
809 | while ( ev ) { | ||
810 | if ( ev->calID() == id ) | ||
811 | deleteEvent( ev ); | ||
812 | ev = EventList.next(); | ||
813 | } | ||
814 | } | ||
815 | { | ||
816 | |||
817 | QPtrList<Todo> TodoList = mTodoList; | ||
818 | Todo * ev = TodoList.first(); | ||
819 | while ( ev ) { | ||
820 | if ( ev->calID() == id ) | ||
821 | deleteTodo( ev ); | ||
822 | ev = TodoList.next(); | ||
823 | } | ||
824 | } | ||
825 | { | ||
826 | QPtrList<Journal> JournalList = mJournalList; | ||
827 | Journal * ev = JournalList.first(); | ||
828 | while ( ev ) { | ||
829 | if ( ev->calID() == id ) | ||
830 | deleteJournal( ev ); | ||
831 | ev = JournalList.next(); | ||
832 | } | ||
833 | } | ||
834 | |||
835 | if ( mUndoIncidence ) delete mUndoIncidence; | ||
836 | mUndoIncidence = 0; | ||
837 | |||
838 | } | ||
784 | 839 | ||
785 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) | 840 | void CalendarLocal::setCalendarEnabled( int id, bool enable ) |
@@ -819,4 +874,5 @@ void CalendarLocal::setAlarmEnabled( int id, bool enable ) | |||
819 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 874 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
820 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 875 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
876 | reInitAlarmSettings(); | ||
821 | 877 | ||
822 | } | 878 | } |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 65f6aa7..5bbe55f 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -186,4 +186,5 @@ public slots: | |||
186 | void setReadOnly( int id, bool enable ); | 186 | void setReadOnly( int id, bool enable ); |
187 | void setDefaultCalendarEnabledOnly(); | 187 | void setDefaultCalendarEnabledOnly(); |
188 | void setCalendarRemove( int id ); | ||
188 | 189 | ||
189 | protected: | 190 | protected: |