author | zautrix <zautrix> | 2005-06-13 13:57:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-13 13:57:22 (UTC) |
commit | 56de219c5ce910a470a01a0e5003d1a113837ef4 (patch) (unidiff) | |
tree | 3393cb306cec8dcdc05d6ed0fae3ae7d374f2794 /libkcal/calendarlocal.cpp | |
parent | 4f3ff02932b39bf16b9692c3cb69c101a28b4616 (diff) | |
download | kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.zip kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.gz kdepimpi-56de219c5ce910a470a01a0e5003d1a113837ef4.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendarlocal.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e48122a..749d9f6 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -76,44 +76,63 @@ bool CalendarLocal::addCalendarFile( QString name, int id ) | |||
76 | addCalendar( &calendar ); | 76 | addCalendar( &calendar ); |
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | void CalendarLocal::addCalendar( Calendar* cal ) | 81 | void CalendarLocal::addCalendar( Calendar* cal ) |
82 | { | 82 | { |
83 | cal->setDontDeleteIncidencesOnClose(); | 83 | cal->setDontDeleteIncidencesOnClose(); |
84 | { | 84 | { |
85 | QPtrList<Event> EventList = cal->rawEvents(); | 85 | QPtrList<Event> EventList = cal->rawEvents(); |
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(); |
90 | } | 92 | } |
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 | } |
99 | } | 115 | } |
100 | { | 116 | { |
101 | QPtrList<Journal> JournalList = cal->journals(); | 117 | QPtrList<Journal> JournalList = cal->journals(); |
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 ) |
110 | { | 129 | { |
111 | FileStorage storage( this, fileName ); | 130 | FileStorage storage( this, fileName ); |
112 | return storage.load(); | 131 | return storage.load(); |
113 | } | 132 | } |
114 | 133 | ||
115 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 134 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
116 | { | 135 | { |
117 | FileStorage storage( this, fileName, format ); | 136 | FileStorage storage( this, fileName, format ); |
118 | return storage.save(); | 137 | return storage.save(); |
119 | } | 138 | } |
@@ -772,24 +791,60 @@ Journal *CalendarLocal::journal( const QString &uid ) | |||
772 | return it; | 791 | return it; |
773 | 792 | ||
774 | return 0; | 793 | return 0; |
775 | } | 794 | } |
776 | 795 | ||
777 | QPtrList<Journal> CalendarLocal::journals() | 796 | QPtrList<Journal> CalendarLocal::journals() |
778 | { | 797 | { |
779 | QPtrList<Journal> el; | 798 | QPtrList<Journal> el; |
780 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 799 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
781 | if ( it->calEnabled() ) el.append( it ); | 800 | if ( it->calEnabled() ) el.append( it ); |
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 ) |
786 | { | 841 | { |
787 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 842 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
788 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 843 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
789 | 844 | ||
790 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 845 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
791 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 846 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
792 | 847 | ||
793 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 848 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
794 | if ( it->calID() == id ) it->setCalEnabled( enable ); | 849 | if ( it->calID() == id ) it->setCalEnabled( enable ); |
795 | 850 | ||
@@ -809,24 +864,25 @@ void CalendarLocal::setReadOnly( int id, bool enable ) | |||
809 | } | 864 | } |
810 | 865 | ||
811 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) | 866 | void CalendarLocal::setAlarmEnabled( int id, bool enable ) |
812 | { | 867 | { |
813 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 868 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
814 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 869 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
815 | 870 | ||
816 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 871 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
817 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); | 872 | if ( it->calID() == id ) it->setAlarmEnabled( enable ); |
818 | 873 | ||
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 | } |
823 | void CalendarLocal::setDefaultCalendarEnabledOnly() | 879 | void CalendarLocal::setDefaultCalendarEnabledOnly() |
824 | { | 880 | { |
825 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 881 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
826 | it->setCalEnabled( it->calID() == mDefaultCalendar ); | 882 | it->setCalEnabled( it->calID() == mDefaultCalendar ); |
827 | 883 | ||
828 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 884 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
829 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 885 | it->setCalEnabled( it->calID() == mDefaultCalendar); |
830 | 886 | ||
831 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 887 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
832 | it->setCalEnabled( it->calID() == mDefaultCalendar); | 888 | it->setCalEnabled( it->calID() == mDefaultCalendar); |