summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-06-29 10:36:31 (UTC)
committer zautrix <zautrix>2005-06-29 10:36:31 (UTC)
commitb7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff)
treeb521090cfc8eb6c8c6a6f6f8167c83058ea1361b /libkcal
parentf226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff)
downloadkdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2
journal fixxx
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp12
-rw-r--r--libkcal/calendarlocal.h1
3 files changed, 9 insertions, 5 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2efa355..4652fe5 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -222,48 +222,49 @@ public:
222 Searches todolist for an event with this unique string identifier, 222 Searches todolist for an event with this unique string identifier,
223 returns a pointer or null. 223 returns a pointer or null.
224 */ 224 */
225 virtual Todo *todo( const QString &uid ) = 0; 225 virtual Todo *todo( const QString &uid ) = 0;
226 virtual Todo *todo( QString, QString ) = 0; 226 virtual Todo *todo( QString, QString ) = 0;
227 /** 227 /**
228 Returns list of todos due on the specified date. 228 Returns list of todos due on the specified date.
229 */ 229 */
230 virtual QPtrList<Todo> todos( const QDate &date ) = 0; 230 virtual QPtrList<Todo> todos( const QDate &date ) = 0;
231 /** 231 /**
232 Return unfiltered list of todos. 232 Return unfiltered list of todos.
233 */ 233 */
234 virtual QPtrList<Todo> rawTodos() = 0; 234 virtual QPtrList<Todo> rawTodos() = 0;
235 235
236 /** 236 /**
237 Add a Journal entry to calendar. 237 Add a Journal entry to calendar.
238 238
239 @return true on success, false on error. 239 @return true on success, false on error.
240 */ 240 */
241 virtual bool addJournal( Journal * ) = 0; 241 virtual bool addJournal( Journal * ) = 0;
242 /** 242 /**
243 Return Journal for given date. 243 Return Journal for given date.
244 */ 244 */
245 virtual Journal *journal( const QDate & ) = 0; 245 virtual Journal *journal( const QDate & ) = 0;
246 virtual QPtrList<Journal> journals4Date( const QDate & ) = 0;
246 /** 247 /**
247 Return Journal with given UID. 248 Return Journal with given UID.
248 */ 249 */
249 virtual Journal *journal( const QString &UID ) = 0; 250 virtual Journal *journal( const QString &UID ) = 0;
250 /** 251 /**
251 Return list of all Journal entries. 252 Return list of all Journal entries.
252 */ 253 */
253 virtual QPtrList<Journal> journals() = 0; 254 virtual QPtrList<Journal> journals() = 0;
254 255
255 /** 256 /**
256 Searches all incidence types for an incidence with this unique 257 Searches all incidence types for an incidence with this unique
257 string identifier, returns a pointer or null. 258 string identifier, returns a pointer or null.
258 */ 259 */
259 Incidence* incidence( const QString&UID ); 260 Incidence* incidence( const QString&UID );
260 261
261 /** 262 /**
262 Setup relations for an incidence. 263 Setup relations for an incidence.
263 */ 264 */
264 virtual void setupRelations( Incidence * ); 265 virtual void setupRelations( Incidence * );
265 /** 266 /**
266 Remove all relations to an incidence 267 Remove all relations to an incidence
267 */ 268 */
268 virtual void removeRelations( Incidence * ); 269 virtual void removeRelations( Incidence * );
269 270
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 418bfca..ca64e66 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -755,73 +755,75 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
755 eventList.append( event ); 755 eventList.append( event );
756 } 756 }
757 } 757 }
758 } 758 }
759 } 759 }
760 760
761 return eventList; 761 return eventList;
762} 762}
763 763
764QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) 764QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
765{ 765{
766 return rawEventsForDate( qdt.date() ); 766 return rawEventsForDate( qdt.date() );
767} 767}
768 768
769QPtrList<Event> CalendarLocal::rawEvents() 769QPtrList<Event> CalendarLocal::rawEvents()
770{ 770{
771 QPtrList<Event> el; 771 QPtrList<Event> el;
772 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 772 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
773 if ( it->calEnabled() ) el.append( it ); 773 if ( it->calEnabled() ) el.append( it );
774 return el; 774 return el;
775} 775}
776 776
777bool CalendarLocal::addJournal(Journal *journal) 777bool CalendarLocal::addJournal(Journal *journal)
778{ 778{
779 if ( journal->dtStart().isValid())
780 kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl;
781 else
782 kdDebug(5800) << "Adding Journal without a DTSTART" << endl;
783
784 mJournalList.append(journal); 779 mJournalList.append(journal);
785 780
786 journal->registerObserver( this ); 781 journal->registerObserver( this );
787 782
788 setModified( true ); 783 setModified( true );
789 journal->setCalID( mDefaultCalendar ); 784 journal->setCalID( mDefaultCalendar );
790 journal->setCalEnabled( true ); 785 journal->setCalEnabled( true );
791 return true; 786 return true;
792} 787}
793 788
794void CalendarLocal::deleteJournal( Journal *journal ) 789void CalendarLocal::deleteJournal( Journal *journal )
795{ 790{
796 if ( mUndoIncidence ) delete mUndoIncidence; 791 if ( mUndoIncidence ) delete mUndoIncidence;
797 mUndoIncidence = journal->clone(); 792 mUndoIncidence = journal->clone();
798 mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); 793 mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
799 if ( mJournalList.removeRef(journal) ) { 794 if ( mJournalList.removeRef(journal) ) {
800 setModified( true ); 795 setModified( true );
801 } 796 }
802} 797}
803 798
799QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
800{
801 QPtrList<Journal> el;
802 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
803 if ( it->calEnabled() && it->dtStart().date() == date) el.append( it );
804 return el;
805}
804Journal *CalendarLocal::journal( const QDate &date ) 806Journal *CalendarLocal::journal( const QDate &date )
805{ 807{
806// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; 808// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
807 809
808 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 810 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
809 if ( it->calEnabled() && it->dtStart().date() == date ) 811 if ( it->calEnabled() && it->dtStart().date() == date )
810 return it; 812 return it;
811 813
812 return 0; 814 return 0;
813} 815}
814 816
815Journal *CalendarLocal::journal( const QString &uid ) 817Journal *CalendarLocal::journal( const QString &uid )
816{ 818{
817 Journal * retVal = 0; 819 Journal * retVal = 0;
818 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 820 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
819 if ( it->calEnabled() && it->uid() == uid ) { 821 if ( it->calEnabled() && it->uid() == uid ) {
820 if ( retVal ) { 822 if ( retVal ) {
821 if ( retVal->calID() > it->calID() ) { 823 if ( retVal->calID() > it->calID() ) {
822 retVal = it; 824 retVal = it;
823 } 825 }
824 } else { 826 } else {
825 retVal = it; 827 retVal = it;
826 } 828 }
827 } 829 }
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index d32597f..98d16a3 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -110,48 +110,49 @@ class CalendarLocal : public Calendar
110 QPtrList<Todo> rawTodos(); 110 QPtrList<Todo> rawTodos();
111 /** 111 /**
112 Returns list of todos due on the specified date. 112 Returns list of todos due on the specified date.
113 */ 113 */
114 QPtrList<Todo> todos( const QDate &date ); 114 QPtrList<Todo> todos( const QDate &date );
115 /** 115 /**
116 Return list of all todos. 116 Return list of all todos.
117 117
118 Workaround because compiler does not recognize function of base class. 118 Workaround because compiler does not recognize function of base class.
119 */ 119 */
120 QPtrList<Todo> todos() { return Calendar::todos(); } 120 QPtrList<Todo> todos() { return Calendar::todos(); }
121 121
122 /** 122 /**
123 Add a Journal entry to calendar. 123 Add a Journal entry to calendar.
124 */ 124 */
125 bool addJournal( Journal * ); 125 bool addJournal( Journal * );
126 /** 126 /**
127 Remove a Journal from the calendar. 127 Remove a Journal from the calendar.
128 */ 128 */
129 void deleteJournal( Journal * ); 129 void deleteJournal( Journal * );
130 /** 130 /**
131 Return Journal for given date. 131 Return Journal for given date.
132 */ 132 */
133 Journal *journal( const QDate & ); 133 Journal *journal( const QDate & );
134 QPtrList<Journal> journals4Date( const QDate & );
134 /** 135 /**
135 Return Journal with given UID. 136 Return Journal with given UID.
136 */ 137 */
137 Journal *journal( const QString &uid ); 138 Journal *journal( const QString &uid );
138 /** 139 /**
139 Return list of all Journals stored in calendar. 140 Return list of all Journals stored in calendar.
140 */ 141 */
141 QPtrList<Journal> journals(); 142 QPtrList<Journal> journals();
142 143
143 /** 144 /**
144 Return all alarms, which ocur in the given time interval. 145 Return all alarms, which ocur in the given time interval.
145 */ 146 */
146 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 147 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
147 148
148 /** 149 /**
149 Return all alarms, which ocur before given date. 150 Return all alarms, which ocur before given date.
150 */ 151 */
151 Alarm::List alarmsTo( const QDateTime &to ); 152 Alarm::List alarmsTo( const QDateTime &to );
152 153
153 QDateTime nextAlarm( int daysTo ) ; 154 QDateTime nextAlarm( int daysTo ) ;
154 QDateTime nextAlarmEventDateTime() const; 155 QDateTime nextAlarmEventDateTime() const;
155 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 156 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
156 void registerAlarm(); 157 void registerAlarm();
157 void deRegisterAlarm(); 158 void deRegisterAlarm();