libkcal

incidence.cpp
1/*
2 This file is part of libkcal.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#include <tdeglobal.h>
24#include <tdelocale.h>
25#include <kdebug.h>
26
27#include "calformat.h"
28
29#include "incidence.h"
30#include "calendar.h"
31
32using namespace KCal;
33
34Incidence::Incidence() :
36 mRelatedTo(0), mStatus(StatusNone), mSecrecy(SecrecyPublic),
37 mPriority(0), mRecurrence(0),
38 mHasRecurrenceID( false ), mChildRecurrenceEvents()
39{
40 recreate();
41
42 mAlarms.setAutoDelete(true);
43 mAttachments.setAutoDelete(true);
44}
45
46Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ),Recurrence::Observer()
47{
48// TODO: reenable attributes currently commented out.
49 mRevision = i.mRevision;
50 mCreated = i.mCreated;
51 mDescription = i.mDescription;
52 mSummary = i.mSummary;
53 mCategories = i.mCategories;
54// Incidence *mRelatedTo; Incidence *mRelatedTo;
55 mRelatedTo = 0;
56 mRelatedToUid = i.mRelatedToUid;
57// Incidence::List mRelations; Incidence::List mRelations;
58 mResources = i.mResources;
59 mStatusString = i.mStatusString;
60 mStatus = i.mStatus;
61 mSecrecy = i.mSecrecy;
62 mPriority = i.mPriority;
63 mLocation = i.mLocation;
64 mRecurrenceID = i.mRecurrenceID;
65 mHasRecurrenceID = i.mHasRecurrenceID;
66 mChildRecurrenceEvents = i.mChildRecurrenceEvents;
67
68 // Alarms and Attachments are stored in ListBase<...>, which is a TQValueList<...*>.
69 // We need to really duplicate the objects stored therein, otherwise deleting
70 // i will also delete all attachments from this object (setAutoDelete...)
71 Alarm::List::ConstIterator it;
72 for( it = i.mAlarms.begin(); it != i.mAlarms.end(); ++it ) {
73 Alarm *b = new Alarm( **it );
74 b->setParent( this );
75 mAlarms.append( b );
76 }
77 mAlarms.setAutoDelete(true);
78
79 Attachment::List::ConstIterator it1;
80 for ( it1 = i.mAttachments.begin(); it1 != i.mAttachments.end(); ++it1 ) {
81 Attachment *a = new Attachment( **it1 );
82 mAttachments.append( a );
83 }
84 mAttachments.setAutoDelete( true );
85
86 if (i.mRecurrence) {
87 mRecurrence = new Recurrence( *(i.mRecurrence) );
88 mRecurrence->addObserver( this );
89 } else
90 mRecurrence = 0;
91
92 mSchedulingID = i.mSchedulingID;
93}
94
95Incidence::~Incidence()
96{
97 Incidence::List Relations = mRelations;
98 List::ConstIterator it;
99 for ( it = Relations.begin(); it != Relations.end(); ++it ) {
100 if ( (*it)->relatedTo() == this ) (*it)->mRelatedTo = 0;
101 }
102 if ( relatedTo() ) relatedTo()->removeRelation( this );
103
104 delete mRecurrence;
105}
106
107// A string comparison that considers that null and empty are the same
108static bool stringCompare( const TQString& s1, const TQString& s2 )
109{
110 return ( s1.isEmpty() && s2.isEmpty() ) || (s1 == s2);
111}
112
113Incidence& Incidence::operator=( const Incidence &i )
114{
115 if ( &i == this )
116 return *this;
117 IncidenceBase::operator=( i );
118 mRevision = i.mRevision;
119 mCreated = i.mCreated;
120 mDescription = i.mDescription;
121 mSummary = i.mSummary;
122 mCategories = i.mCategories;
123 mRelatedTo = 0;
124 mRelatedToUid = i.mRelatedToUid;
125 mRelations.clear();
126 mResources = i.mResources;
127 mStatusString = i.mStatusString;
128 mStatus = i.mStatus;
129 mSecrecy = i.mSecrecy;
130 mPriority = i.mPriority;
131 mLocation = i.mLocation;
132 mRecurrenceID = i.mRecurrenceID;
133 mHasRecurrenceID = i.mHasRecurrenceID;
134 mChildRecurrenceEvents = i.mChildRecurrenceEvents;
135
136 mAlarms.clearAll();
137 Alarm::List::ConstIterator it;
138 for( it = i.mAlarms.begin(); it != i.mAlarms.end(); ++it ) {
139 Alarm *b = new Alarm( **it );
140 b->setParent( this );
141 mAlarms.append( b );
142 }
143
144 mAttachments.clearAll();
145 Attachment::List::ConstIterator it1;
146 for ( it1 = i.mAttachments.begin(); it1 != i.mAttachments.end(); ++it1 ) {
147 Attachment *a = new Attachment( **it1 );
148 mAttachments.append( a );
149 }
150
151 delete mRecurrence;
152 if (i.mRecurrence) {
153 mRecurrence = new Recurrence( *(i.mRecurrence) );
154 mRecurrence->addObserver( this );
155 } else
156 mRecurrence = 0;
157
158 mSchedulingID = i.mSchedulingID;
159 return *this;
160}
161
162bool Incidence::operator==( const Incidence& i2 ) const
163{
164 if( alarms().count() != i2.alarms().count() ) {
165 return false; // no need to check further
166 }
167
168 Alarm::List::ConstIterator a1 = alarms().begin();
169 Alarm::List::ConstIterator a2 = i2.alarms().begin();
170 for( ; a1 != alarms().end() && a2 != i2.alarms().end(); ++a1, ++a2 )
171 if( **a1 == **a2 )
172 continue;
173 else {
174 return false;
175 }
176
177 if ( !IncidenceBase::operator==(i2) )
178 return false;
179
180 bool recurrenceEqual = ( mRecurrence == 0 && i2.mRecurrence == 0 );
181 if ( !recurrenceEqual )
182 {
183 recurrenceEqual = mRecurrence != 0 &&
184 i2.mRecurrence != 0 &&
185 *mRecurrence == *i2.mRecurrence;
186 }
187
188 return
189 recurrenceEqual &&
190 created() == i2.created() &&
191 stringCompare( description(), i2.description() ) &&
192 stringCompare( summary(), i2.summary() ) &&
193 categories() == i2.categories() &&
194 // no need to compare mRelatedTo
195 stringCompare( relatedToUid(), i2.relatedToUid() ) &&
196 relations() == i2.relations() &&
197 attachments() == i2.attachments() &&
198 resources() == i2.resources() &&
199 mStatus == i2.mStatus &&
200 ( mStatus == StatusNone || stringCompare( mStatusString, i2.mStatusString ) ) &&
201 secrecy() == i2.secrecy() &&
202 priority() == i2.priority() &&
203 stringCompare( location(), i2.location() ) &&
204 stringCompare( schedulingID(), i2.schedulingID() );
205}
206
207
209{
210 setCreated(TQDateTime::currentDateTime());
211
213 setSchedulingID( TQString() );
214
215 setRevision(0);
216
217 setLastModified(TQDateTime::currentDateTime());
218 setPilotId( 0 );
219 setSyncStatus( SYNCNONE );
220}
221
222void Incidence::setReadOnly( bool readOnly )
223{
224 IncidenceBase::setReadOnly( readOnly );
225 if ( mRecurrence )
226 mRecurrence->setRecurReadOnly( readOnly );
227}
228
230{
231 if (mReadOnly) return;
232 if ( recurrence() )
233 recurrence()->setFloats( f );
235}
236
237void Incidence::setCreated( const TQDateTime &created )
238{
239 if (mReadOnly) return;
240 mCreated = created;
241
242// FIXME: Shouldn't we call updated for the creation date, too?
243// updated();
244}
245
246TQDateTime Incidence::created() const
247{
248 return mCreated;
249}
250
252{
253 if (mReadOnly) return;
254 mRevision = rev;
255
256 updated();
257}
258
260{
261 return mRevision;
262}
263
264void Incidence::setDtStart(const TQDateTime &dtStart)
265{
266 if ( mRecurrence ) {
267 mRecurrence->setStartDateTime( dtStart );
268 mRecurrence->setFloats( doesFloat() );
269 }
271}
272
273void Incidence::setDescription(const TQString &description)
274{
275 if (mReadOnly) return;
276 mDescription = description;
277 updated();
278}
279
281{
282 return mDescription;
283}
284
285
286void Incidence::setSummary(const TQString &summary)
287{
288 if (mReadOnly) return;
289 mSummary = summary;
290 updated();
291}
292
293TQString Incidence::summary() const
294{
295 return mSummary;
296}
297
298void Incidence::setCategories(const TQStringList &categories)
299{
300 if (mReadOnly) return;
301 mCategories = categories;
302 updated();
303}
304
305// TODO: remove setCategories(TQString) function
306void Incidence::setCategories(const TQString &catStr)
307{
308 if (mReadOnly) return;
309 mCategories.clear();
310
311 if (catStr.isEmpty()) return;
312
313 mCategories = TQStringList::split(",",catStr);
314
315 TQStringList::Iterator it;
316 for(it = mCategories.begin();it != mCategories.end(); ++it) {
317 *it = (*it).stripWhiteSpace();
318 }
319
320 updated();
321}
322
323TQStringList Incidence::categories() const
324{
325 return mCategories;
326}
327
329{
330 return mCategories.join(",");
331}
332
333void Incidence::setRelatedToUid(const TQString &relatedToUid)
334{
335 if ( mReadOnly || mRelatedToUid == relatedToUid ) return;
336 mRelatedToUid = relatedToUid;
337 updated();
338}
339
341{
342 return mRelatedToUid;
343}
344
346{
347 if (mReadOnly || mRelatedTo == relatedTo) return;
348 if(mRelatedTo)
349 mRelatedTo->removeRelation(this);
350 mRelatedTo = relatedTo;
351 if (mRelatedTo) {
352 mRelatedTo->addRelation(this);
353 if ( mRelatedTo->uid() != mRelatedToUid )
354 setRelatedToUid( mRelatedTo->uid() );
355 } else {
356 setRelatedToUid( TQString() );
357 }
358}
359
361{
362 return mRelatedTo;
363}
364
366{
367 return mRelations;
368}
369
371{
372 if ( mRelations.find( event ) == mRelations.end() ) {
373 mRelations.append( event );
374 }
375}
376
378// Remove the relation of our incident. E.g. if you have a task t and a
379// subtask, the subtask will have its relation to the task t.
380{
381 mRelations.removeRef(event);
382// if (event->getRelatedTo() == this) event->setRelatedTo(0);
383 mRelatedToUid=TQString();
384}
385
386
387// %%%%%%%%%%%% Recurrence-related methods %%%%%%%%%%%%%%%%%%%%
388
389
391{
392 if (!mRecurrence)
393 {
394 const_cast<KCal::Incidence*>(this)->mRecurrence = new Recurrence();
396 mRecurrence->setFloats( doesFloat() );
397 mRecurrence->setRecurReadOnly( mReadOnly );
398 mRecurrence->addObserver( const_cast<KCal::Incidence*>(this) );
399 }
400
401 return mRecurrence;
402}
403
405{
406 delete mRecurrence;
407 mRecurrence = 0;
408}
409
410uint Incidence::recurrenceType() const
411{
412 if ( mRecurrence ) return mRecurrence->recurrenceType();
413 else return Recurrence::rNone;
414}
415
417{
418 if ( mRecurrence ) return mRecurrence->doesRecur();
419 else return false;
420}
421
422bool Incidence::recursOn(const TQDate &qd) const
423{
424 bool doesRecur = false;
425 doesRecur = mRecurrence && mRecurrence->recursOn(qd);
426
427 return doesRecur;
428}
429
430bool Incidence::recursAt(const TQDateTime &qdt) const
431{
432 bool doesRecur = false;
433 doesRecur = mRecurrence && mRecurrence->recursAt(qdt);
434
435 return doesRecur;
436}
437
438bool Incidence::recursOn(const TQDate &qd, Calendar *cal) const
439{
440 bool doesRecur = false;
441 doesRecur = mRecurrence && mRecurrence->recursOn(qd);
442
443 // Make sure that this instance has not been moved through a RECURRENCE-ID statement
444 if (hasRecurrenceID() == false) {
445 IncidenceList il = childIncidences();
446 IncidenceListIterator it;
447 for ( it = il.begin(); it != il.end(); ++it ) {
448 TQDateTime modifiedDt = cal->incidence(*it)->recurrenceID();
449 modifiedDt.setTime(TQTime());
450 if (TQDateTime(qd) == modifiedDt) {
451 doesRecur = false;
452 }
453 }
454 }
455
456 return doesRecur;
457}
458
459bool Incidence::recursAt(const TQDateTime &qdt, Calendar *cal) const
460{
461 bool doesRecur = false;
462 doesRecur = mRecurrence && mRecurrence->recursAt(qdt);
463
464 // Make sure that this instance has not been moved through a RECURRENCE-ID statement
465 if (hasRecurrenceID() == false) {
466 IncidenceList il = childIncidences();
467 IncidenceListIterator it;
468 for ( it = il.begin(); it != il.end(); ++it ) {
469 if (qdt == cal->incidence(*it)->recurrenceID()) {
470 doesRecur = false;
471 }
472 }
473 }
474
475 return doesRecur;
476}
477
486TQValueList<TQDateTime> Incidence::startDateTimesForDate( const TQDate &date ) const
487{
488//kdDebug(5800) << "Incidence::startDateTimesForDate " << date << ", incidence=" << summary() << endl;
489 TQDateTime start = dtStart();
490 TQDateTime end = endDateRecurrenceBase();
491
492 TQValueList<TQDateTime> result;
493
494 // TODO_Recurrence: Also work if only due date is given...
495 if ( !start.isValid() && ! end.isValid() ) {
496 return result;
497 }
498
499 // if the incidence doesn't recur,
500 if ( !doesRecur() ) {
501 if ( !(start.date() > date || end.date() < date ) ) {
502 result << start;
503 }
504 return result;
505 }
506
507 int days = start.daysTo( end );
508 // Account for possible recurrences going over midnight, while the original event doesn't
509 TQDate tmpday( date.addDays( -days - 1 ) );
510 TQDateTime tmp;
511 while ( tmpday <= date ) {
512 if ( recurrence()->recursOn( tmpday ) ) {
513 TQValueList<TQTime> times = recurrence()->recurTimesOn( tmpday );
514 for ( TQValueList<TQTime>::ConstIterator it = times.begin(); it != times.end(); ++it ) {
515 tmp = TQDateTime( tmpday, *it );
516 if ( endDateForStart( tmp ).date() >= date )
517 result << tmp;
518 }
519 }
520 tmpday = tmpday.addDays( 1 );
521 }
522 return result;
523}
524
533TQValueList<TQDateTime> Incidence::startDateTimesForDateTime( const TQDateTime &datetime ) const
534{
535// kdDebug(5800) << "Incidence::startDateTimesForDateTime " << datetime << ", incidence=" << summary() << endl;
536 TQDateTime start = dtStart();
537 TQDateTime end = endDateRecurrenceBase();
538
539 TQValueList<TQDateTime> result;
540
541 // TODO_Recurrence: Also work if only due date is given...
542 if ( !start.isValid() && ! end.isValid() ) {
543 return result;
544 }
545
546 // if the incidence doesn't recur,
547 if ( !doesRecur() ) {
548 if ( !(start > datetime || end < datetime ) ) {
549 result << start;
550 }
551 return result;
552 }
553
554 int days = start.daysTo( end );
555 // Account for possible recurrences going over midnight, while the original event doesn't
556 TQDate tmpday( datetime.date().addDays( -days - 1 ) );
557 TQDateTime tmp;
558 while ( tmpday <= datetime.date() ) {
559 if ( recurrence()->recursOn( tmpday ) ) {
560 TQValueList<TQTime> times = recurrence()->recurTimesOn( tmpday );
561 for ( TQValueList<TQTime>::ConstIterator it = times.begin(); it != times.end(); ++it ) {
562 tmp = TQDateTime( tmpday, *it );
563 if ( !(tmp > datetime || endDateForStart( tmp ) < datetime ) )
564 result << tmp;
565 }
566 }
567 tmpday = tmpday.addDays( 1 );
568 }
569 return result;
570}
571
573TQDateTime Incidence::endDateForStart( const TQDateTime &startDt ) const
574{
575 TQDateTime start = dtStart();
576 TQDateTime end = endDateRecurrenceBase();
577 if ( !end.isValid() ) return start;
578 if ( !start.isValid() ) return end;
579
580 return startDt.addSecs( start.secsTo( end ) );
581}
582
583// %%%%%%%%%%%%%%%%% begin:RecurrenceRule %%%%%%%%%%%%%%%%%
584
585// Exception Dates
586/*void Incidence::setExDates(const DateList &exDates)
587{
588 if ( mReadOnly ) return;
589 recurrence()->setExDates( exDates );
590 updated();
591}
592
593void Incidence::addExDate( const TQDate &date )
594{
595 if ( mReadOnly ) return;
596 recurrence()->addExDate( date );
597 updated();
598}
599
600DateList Incidence::exDates() const
601{
602 if ( mRecurrence ) return mRecurrence->exDates();
603 else return DateList();
604}
605
606
607// Exception DateTimes
608void Incidence::setExDateTimes( const DateTimeList &exDates )
609{
610 if ( mReadOnly ) return;
611 recurrence()->setExDateTimes( exDates );
612 updated();
613}
614
615void Incidence::addExDateTime( const TQDateTime &date )
616{
617 if ( mReadOnly ) return;
618 recurrence()->addExDateTime( date );
619 updated();
620}
621
622DateTimeList Incidence::exDateTimes() const
623{
624 if ( mRecurrence ) return mRecurrence->exDateTimes();
625 else return DateTimeList();
626}
627
628
629// Recurrence Dates
630void Incidence::setRDates(const DateList &exDates)
631{
632 if ( mReadOnly ) return;
633 recurrence()->setRDates( exDates );
634 updated();
635}
636
637void Incidence::addRDate( const TQDate &date )
638{
639 if ( mReadOnly ) return;
640 recurrence()->addRDate( date );
641 updated();
642}
643
644DateList Incidence::rDates() const
645{
646 if ( mRecurrence ) return mRecurrence->rDates();
647 else return DateList();
648}
649
650
651// Recurrence DateTimes
652void Incidence::setRDateTimes( const DateTimeList &exDates )
653{
654 if ( mReadOnly ) return;
655 recurrence()->setRDateTimes( exDates );
656 updated();
657}
658
659void Incidence::addRDateTime( const TQDateTime &date )
660{
661 if ( mReadOnly ) return;
662 recurrence()->addRDateTime( date );
663 updated();
664}
665
666DateTimeList Incidence::rDateTimes() const
667{
668 if ( mRecurrence ) return mRecurrence->rDateTimes();
669 else return DateTimeList();
670}*/
671
672// %%%%%%%%%%%%%%%%% end:RecurrenceRule %%%%%%%%%%%%%%%%%
673
675{
676 if (mReadOnly || !attachment) return;
677 mAttachments.append(attachment);
678 updated();
679}
680
682{
683 mAttachments.removeRef(attachment);
684}
685
686void Incidence::deleteAttachments( const TQString &mime )
687{
688 Attachment::List::Iterator it = mAttachments.begin();
689 while( it != mAttachments.end() ) {
690 if ( (*it)->mimeType() == mime ) mAttachments.remove( it );
691 else ++it;
692 }
693}
694
696{
697 return mAttachments;
698}
699
700Attachment::List Incidence::attachments(const TQString& mime) const
701{
703 Attachment::List::ConstIterator it;
704 for( it = mAttachments.begin(); it != mAttachments.end(); ++it ) {
705 if ( (*it)->mimeType() == mime ) attachments.append( *it );
706 }
707
708 return attachments;
709}
710
712{
713 mAttachments.clearAll();
714}
715
716void Incidence::setResources(const TQStringList &resources)
717{
718 if (mReadOnly) return;
719 mResources = resources;
720 updated();
721}
722
723TQStringList Incidence::resources() const
724{
725 return mResources;
726}
727
728
729void Incidence::setPriority(int priority)
730{
731 if (mReadOnly) return;
732 mPriority = priority;
733 updated();
734}
735
737{
738 return mPriority;
739}
740
742{
743 if (mReadOnly || status == StatusX) return;
744 mStatus = status;
745 mStatusString = TQString();
746 updated();
747}
748
749void Incidence::setCustomStatus(const TQString &status)
750{
751 if (mReadOnly) return;
752 mStatus = status.isEmpty() ? StatusNone : StatusX;
753 mStatusString = status;
754 updated();
755}
756
758{
759 return mStatus;
760}
761
762TQString Incidence::statusStr() const
763{
764 if (mStatus == StatusX)
765 return mStatusString;
766 return statusName(mStatus);
767}
768
770{
771 switch (status) {
772 case StatusTentative: return i18n("incidence status", "Tentative");
773 case StatusConfirmed: return i18n("Confirmed");
774 case StatusCompleted: return i18n("Completed");
775 case StatusNeedsAction: return i18n("Needs-Action");
776 case StatusCanceled: return i18n("Canceled");
777 case StatusInProcess: return i18n("In-Process");
778 case StatusDraft: return i18n("Draft");
779 case StatusFinal: return i18n("Final");
780 case StatusX:
781 case StatusNone:
782 default: return TQString();
783 }
784}
785
787{
788 if (mReadOnly) return;
789 mSecrecy = sec;
790 updated();
791}
792
794{
795 return mSecrecy;
796}
797
798TQString Incidence::secrecyStr() const
799{
800 return secrecyName(mSecrecy);
801}
802
803TQString Incidence::secrecyName(int secrecy)
804{
805 switch (secrecy) {
806 case SecrecyPublic:
807 return i18n("Public");
808 case SecrecyPrivate:
809 return i18n("Private");
810 case SecrecyConfidential:
811 return i18n("Confidential");
812 default:
813 return i18n("Undefined");
814 }
815}
816
818{
819 TQStringList list;
820 list << secrecyName(SecrecyPublic);
821 list << secrecyName(SecrecyPrivate);
822 list << secrecyName(SecrecyConfidential);
823
824 return list;
825}
826
827
829{
830 return mAlarms;
831}
832
834{
835 Alarm* alarm = new Alarm(this);
836 mAlarms.append(alarm);
837// updated();
838 return alarm;
839}
840
842{
843 mAlarms.append(alarm);
844 updated();
845}
846
848{
849 mAlarms.removeRef(alarm);
850 updated();
851}
852
854{
855 mAlarms.clearAll();
856 updated();
857}
858
860{
861 Alarm::List::ConstIterator it;
862 for( it = mAlarms.begin(); it != mAlarms.end(); ++it ) {
863 if ( (*it)->enabled() ) return true;
864 }
865 return false;
866}
867
868void Incidence::setLocation(const TQString &location)
869{
870 if (mReadOnly) return;
871 mLocation = location;
872 updated();
873}
874
875TQString Incidence::location() const
876{
877 return mLocation;
878}
879
880void Incidence::setSchedulingID( const TQString& sid )
881{
882 mSchedulingID = sid;
883}
884
886{
887 if ( mSchedulingID.isNull() )
888 // Nothing set, so use the normal uid
889 return uid();
890 return mSchedulingID;
891}
892
894{
895 return mHasRecurrenceID;
896}
897
898void Incidence::setHasRecurrenceID( bool hasRecurrenceID )
899{
900 if ( mReadOnly ) {
901 return;
902 }
903
904 mHasRecurrenceID = hasRecurrenceID;
905 updated();
906}
907
908TQDateTime Incidence::recurrenceID() const
909{
910 return mRecurrenceID;
911}
912
913void Incidence::setRecurrenceID( const TQDateTime &recurrenceID )
914{
915 if ( mReadOnly ) {
916 return;
917 }
918
919// update();
920 mRecurrenceID = recurrenceID;
921 updated();
922}
923
924void Incidence::addChildIncidence( TQString childIncidence )
925{
926 mChildRecurrenceEvents.append(childIncidence);
927}
928
929void Incidence::deleteChildIncidence( TQString childIncidence )
930{
931 mChildRecurrenceEvents.remove(childIncidence);
932}
933
934IncidenceList Incidence::childIncidences() const
935{
936 return mChildRecurrenceEvents;
937}
938
943{
944 if ( recurrence == mRecurrence )
945 updated();
946}
947
Provides the main "calendar" object class.
This class represents an alarm notification.
Definition: alarm.h:46
void setParent(Incidence *)
Set the alarm's parent incidence.
Definition: alarm.cpp:479
This class represents information related to an attachment.
Definition: attachment.h:35
static TQString createUniqueId()
Create a unique id string.
Definition: calformat.cpp:67
This is the main "calendar" object class.
Definition: calendar.h:171
Incidence * incidence(const TQString &uid)
Returns the Incidence associated with the given unique identifier.
Definition: calendar.cpp:576
This class provides the base class common to all calendar components.
Definition: incidencebase.h:46
void updated()
Call this to notify the observers after the IncidenceBas object has changed.
void setFloats(bool f)
Set whether the incidence floats, i.e.
void setPilotId(unsigned long id)
Set Pilot Id.
bool doesFloat() const
Return true or false depending on whether the incidence "floats," i.e.
TQString uid() const
Return the unique id for the event.
void setUid(const TQString &)
Set the unique id for the event.
virtual void setReadOnly(bool)
Set readonly status.
virtual TQDateTime dtStart() const
returns an event's starting date/time as a TQDateTime.
virtual void setDtStart(const TQDateTime &dtStart)
for setting the event's starting date/time with a TQDateTime.
void setSyncStatus(int status)
Set synchronisation satus.
void setLastModified(const TQDateTime &lm)
Sets the time the incidence was last modified.
This class provides the base class common to all calendar components.
Definition: incidence.h:48
TQString statusStr() const
Return the event's status string.
Definition: incidence.cpp:762
TQString secrecyStr() const
Return secrecy as translated string.
Definition: incidence.cpp:798
void setReadOnly(bool readonly)
Set readonly state of incidence.
Definition: incidence.cpp:222
void addAttachment(Attachment *attachment)
Add attachment.
Definition: incidence.cpp:674
TQString relatedToUid() const
What event does this one relate to? This function should only be used when constructing a calendar be...
Definition: incidence.cpp:340
void setLocation(const TQString &location)
Set the event's/todo's location.
Definition: incidence.cpp:868
void deleteAttachment(Attachment *attachment)
Remove and delete a specific attachment.
Definition: incidence.cpp:681
bool recursAt(const TQDateTime &qdt) const
Returns true if the date/time specified is one on which the incidence will recur.
Definition: incidence.cpp:430
const Alarm::List & alarms() const
All alarms that are associated with this incidence.
Definition: incidence.cpp:828
void setSummary(const TQString &summary)
Set short summary.
Definition: incidence.cpp:286
void recreate()
Recreate event.
Definition: incidence.cpp:208
void setCustomStatus(const TQString &status)
Sets the incidence status to a non-standard status value.
Definition: incidence.cpp:749
void clearAlarms()
Remove all alarms that are associated with this incidence.
Definition: incidence.cpp:853
virtual void recurrenceUpdated(Recurrence *)
Observer interface for the recurrence class.
Definition: incidence.cpp:942
void clearAttachments()
Remove and delete all attachments.
Definition: incidence.cpp:711
void setSchedulingID(const TQString &sid)
Set the event's/todo's scheduling ID.
Definition: incidence.cpp:880
Alarm * newAlarm()
Create a new alarm which is associated with this incidence.
Definition: incidence.cpp:833
void setRelatedTo(Incidence *relatedTo)
Point at some other event to which the event relates.
Definition: incidence.cpp:345
TQDateTime created() const
Return time and date of creation.
Definition: incidence.cpp:246
int revision() const
Return the number of revisions this event has seen.
Definition: incidence.cpp:259
void setPriority(int priority)
Set the incidences priority.
Definition: incidence.cpp:729
virtual TQValueList< TQDateTime > startDateTimesForDateTime(const TQDateTime &datetime) const
Calculates the start date/time for all recurrences that happen at the given time.
Definition: incidence.cpp:533
void setSecrecy(int)
Sets secrecy status.
Definition: incidence.cpp:786
int secrecy() const
Return the event's secrecy.
Definition: incidence.cpp:793
IncidenceList childIncidences() const
Returns an EventList of all child incidences.
Definition: incidence.cpp:934
static TQString secrecyName(int)
Return human-readable translated name of secrecy class.
Definition: incidence.cpp:803
TQString description() const
Return long description.
Definition: incidence.cpp:280
Incidence * relatedTo() const
What event does this one relate to?
Definition: incidence.cpp:360
Status
Enumeration for describing an event's status.
Definition: incidence.h:117
static TQString statusName(Status)
Return human-readable translated name of status value.
Definition: incidence.cpp:769
TQStringList categories() const
Return categories as a list of strings.
Definition: incidence.cpp:323
void setStatus(Status status)
Sets the incidence status to a standard status value.
Definition: incidence.cpp:741
void removeRelation(Incidence *)
Remove event that is related to this event.
Definition: incidence.cpp:377
void setDescription(const TQString &description)
Set the long description.
Definition: incidence.cpp:273
int priority() const
Return priority.
Definition: incidence.cpp:736
Status status() const
Return the event's status.
Definition: incidence.cpp:757
void setFloats(bool f)
Set whether the incidence floats, i.e.
Definition: incidence.cpp:229
void setRelatedToUid(const TQString &)
Point at some other event to which the event relates.
Definition: incidence.cpp:333
bool doesRecur() const
Forward to Recurrence::doesRecur().
Definition: incidence.cpp:416
bool isAlarmEnabled() const
Return whether any alarm associated with this incidence is enabled.
Definition: incidence.cpp:859
virtual void setDtStart(const TQDateTime &dtStart)
Set starting date/time.
Definition: incidence.cpp:264
TQString schedulingID() const
Return the event's/todo's scheduling ID.
Definition: incidence.cpp:885
bool hasRecurrenceID() const
Returns true if the incidence has recurrenceID, otherwise return false.
Definition: incidence.cpp:893
TQDateTime recurrenceID() const
Returns the incidence recurrenceID.
Definition: incidence.cpp:908
void setCategories(const TQStringList &categories)
Set categories.
Definition: incidence.cpp:298
static TQStringList secrecyList()
Return list of all available secrecy states as list of translated strings.
Definition: incidence.cpp:817
void deleteAttachments(const TQString &mime)
Remove and delete all attachments with this mime type.
Definition: incidence.cpp:686
void setResources(const TQStringList &resources)
Set resources used, such as Office, Car, etc.
Definition: incidence.cpp:716
Incidence::List relations() const
All events that are related to this event.
Definition: incidence.cpp:365
TQString location() const
Return the event's/todo's location.
Definition: incidence.cpp:875
virtual TQValueList< TQDateTime > startDateTimesForDate(const TQDate &date) const
Calculates the start date/time for all recurrences that happen at some time on the given date (might ...
Definition: incidence.cpp:486
void addAlarm(Alarm *)
Add an alarm which is associated with this incidence.
Definition: incidence.cpp:841
virtual TQDateTime endDateRecurrenceBase() const
Return the end date/time of the base incidence (e.g.
Definition: incidence.h:552
void removeAlarm(Alarm *)
Remove an alarm that is associated with this incidence.
Definition: incidence.cpp:847
void clearRecurrence()
Removes all recurrence and exception rules and dates.
Definition: incidence.cpp:404
Attachment::List attachments() const
Return list of all associated attachments.
Definition: incidence.cpp:695
TQString categoriesStr() const
Return categories as a comma separated string.
Definition: incidence.cpp:328
TQString summary() const
Return short summary.
Definition: incidence.cpp:293
Recurrence * recurrence() const
Return the recurrence rule associated with this incidence.
Definition: incidence.cpp:390
void setRevision(int rev)
Set the number of revisions this event has seen.
Definition: incidence.cpp:251
void addChildIncidence(TQString childIncidence)
Attach a child incidence to a parent incidence.
Definition: incidence.cpp:924
TQStringList resources() const
Return list of current resources.
Definition: incidence.cpp:723
void deleteChildIncidence(TQString childIncidence)
Detach a child incidence from its parent incidence.
Definition: incidence.cpp:929
void setCreated(const TQDateTime &)
Set creation date.
Definition: incidence.cpp:237
virtual bool recursOn(const TQDate &qd) const
Returns true if the date specified is one on which the incidence will recur.
Definition: incidence.cpp:422
void addRelation(Incidence *)
Add an event which is related to this event.
Definition: incidence.cpp:370
void setHasRecurrenceID(bool hasRecurrenceID)
Sets if the incidence has recurrenceID.
Definition: incidence.cpp:898
virtual TQDateTime endDateForStart(const TQDateTime &startDt) const
Return the end time of the occurrence if it starts at the given date/time.
Definition: incidence.cpp:573
void setRecurrenceID(const TQDateTime &recurrenceID)
Set the incidences recurrenceID.
Definition: incidence.cpp:913
This class represents a recurrence rule for a calendar incidence.
Definition: recurrence.h:90
ushort recurrenceType() const
Returns the event's recurrence status.
Definition: recurrence.cpp:189
void setFloats(bool floats)
Sets whether the dtstart is a floating time (i.e.
Definition: recurrence.cpp:133
void setStartDateTime(const TQDateTime &start)
Set start of recurrence, as a date and time.
Definition: recurrence.cpp:444
void setRecurReadOnly(bool readOnly)
Set if recurrence is read-only or can be changed.
Definition: recurrence.h:139
void addObserver(Observer *observer)
Installs an observer.
Definition: recurrence.cpp:113
TQValueList< TQTime > recurTimesOn(const TQDate &date) const
Returns a list of the times on the specified date at which the recurrence will occur.
Definition: recurrence.cpp:721
bool doesRecur() const
Returns whether the event recurs at all.
Definition: recurrence.cpp:184
bool recursAt(const TQDateTime &) const
Returns true if the date/time specified is one at which the event will recur.
Definition: recurrence.cpp:328
bool recursOn(const TQDate &qd) const
Returns true if the date specified is one on which the event will recur.
Definition: recurrence.cpp:268
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38