1 | /* |
2 | This file is part of the kcal library. |
3 | |
4 | Copyright (c) 2001-2003 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 | @file |
24 | This file is part of the API for handling calendar data and |
25 | defines the Incidence class. |
26 | |
27 | @author Cornelius Schumacher \<schumacher@kde.org\> |
28 | @author Reinhold Kainhofer \<reinhold@kainhofer.com\> |
29 | */ |
30 | |
31 | #ifndef INCIDENCE_H |
32 | #define INCIDENCE_H |
33 | |
34 | #include "kcal_export.h" |
35 | #include "incidencebase.h" |
36 | #include "alarm.h" |
37 | #include "attachment.h" |
38 | #include "recurrence.h" |
39 | |
40 | #include <QtCore/QList> |
41 | #include <QtCore/QMetaType> |
42 | |
43 | namespace boost { |
44 | template <typename T> class shared_ptr; |
45 | } |
46 | |
47 | namespace KCal { |
48 | |
49 | /** |
50 | @brief |
51 | Provides the abstract base class common to non-FreeBusy (Events, To-dos, |
52 | Journals) calendar components known as incidences. |
53 | |
54 | Several properties are not allowed for VFREEBUSY objects (see rfc:2445), |
55 | so they are not in IncidenceBase. The hierarchy is: |
56 | |
57 | IncidenceBase |
58 | + FreeBusy |
59 | + Incidence |
60 | + Event |
61 | + Todo |
62 | + Journal |
63 | |
64 | So IncidenceBase contains all properties that are common to all classes, |
65 | and Incidence contains all additional properties that are common to |
66 | Events, Todos and Journals, but are not allowed for FreeBusy entries. |
67 | */ |
68 | class KCAL_DEPRECATED_EXPORT Incidence //krazy:exclude=dpointer since nested class templates confuse krazy |
69 | : public IncidenceBase, public Recurrence::RecurrenceObserver |
70 | { |
71 | public: |
72 | /** |
73 | Template for a class that implements a visitor for adding an Incidence |
74 | to a resource supporting addEvent(), addTodo() and addJournal() calls. |
75 | */ |
76 | //@cond PRIVATE |
77 | template<class T> |
78 | class AddVisitor : public IncidenceBase::Visitor |
79 | { |
80 | public: |
81 | AddVisitor( T *r ) : mResource( r ) {} |
82 | |
83 | bool visit( Event *e ) |
84 | { |
85 | return mResource->addEvent( e ); |
86 | } |
87 | bool visit( Todo *t ) |
88 | { |
89 | return mResource->addTodo( t ); |
90 | } |
91 | bool visit( Journal *j ) |
92 | { |
93 | return mResource->addJournal( j ); |
94 | } |
95 | bool visit( FreeBusy * ) |
96 | { |
97 | return false; |
98 | } |
99 | |
100 | private: |
101 | T *mResource; |
102 | }; |
103 | //@endcond |
104 | |
105 | /** |
106 | Template for a class that implements a visitor for deleting an Incidence |
107 | from a resource supporting deleteEvent(), deleteTodo() and deleteJournal() |
108 | calls. |
109 | */ |
110 | //@cond PRIVATE |
111 | template<class T> |
112 | class DeleteVisitor : public IncidenceBase::Visitor |
113 | { |
114 | public: |
115 | DeleteVisitor( T *r ) : mResource( r ) {} |
116 | |
117 | bool visit( Event *e ) |
118 | { |
119 | mResource->deleteEvent( e ); |
120 | return true; |
121 | } |
122 | bool visit( Todo *t ) |
123 | { |
124 | mResource->deleteTodo( t ); |
125 | return true; |
126 | } |
127 | bool visit( Journal *j ) |
128 | { |
129 | mResource->deleteJournal( j ); |
130 | return true; |
131 | } |
132 | bool visit( FreeBusy * ) |
133 | { |
134 | return false; |
135 | } |
136 | |
137 | private: |
138 | T *mResource; |
139 | }; |
140 | //@endcond |
141 | |
142 | /** |
143 | The different types of overall incidence status or confirmation. |
144 | The meaning is specific to the incidence type in context. |
145 | */ |
146 | enum Status { |
147 | StatusNone, /**< No status */ |
148 | StatusTentative, /**< event is tentative */ |
149 | StatusConfirmed, /**< event is definite */ |
150 | StatusCompleted, /**< to-do completed */ |
151 | StatusNeedsAction, /**< to-do needs action */ |
152 | StatusCanceled, /**< event or to-do canceled; journal removed */ |
153 | StatusInProcess, /**< to-do in process */ |
154 | StatusDraft, /**< journal is draft */ |
155 | StatusFinal, /**< journal is final */ |
156 | StatusX /**< a non-standard status string */ |
157 | }; |
158 | |
159 | /** |
160 | The different types of incidence access classifications. |
161 | */ |
162 | enum Secrecy { |
163 | SecrecyPublic=0, /**< Not secret (default) */ |
164 | SecrecyPrivate=1, /**< Secret to the owner */ |
165 | SecrecyConfidential=2 /**< Secret to the owner and some others */ |
166 | }; |
167 | |
168 | /** |
169 | List of incidences. |
170 | */ |
171 | typedef ListBase<Incidence> List; |
172 | |
173 | /** |
174 | A shared pointer to an Incidence. |
175 | */ |
176 | typedef boost::shared_ptr<Incidence> Ptr; |
177 | |
178 | /** |
179 | A shared pointer to a non-mutable Incidence. |
180 | */ |
181 | typedef boost::shared_ptr<const Incidence> ConstPtr; |
182 | |
183 | /** |
184 | Constructs an empty incidence.* |
185 | */ |
186 | Incidence(); |
187 | |
188 | /** |
189 | Copy constructor. |
190 | @param other is the incidence to copy. |
191 | */ |
192 | Incidence( const Incidence &other ); |
193 | |
194 | /** |
195 | Destroys an incidence. |
196 | */ |
197 | ~Incidence(); |
198 | |
199 | /** |
200 | Returns an exact copy of this incidence. The returned object is owned |
201 | by the caller. |
202 | */ |
203 | virtual Incidence *clone() = 0; //TODO KDE5: make this const |
204 | |
205 | /** |
206 | Set readonly state of incidence. |
207 | |
208 | @param readonly If true, the incidence is set to readonly, if false the |
209 | incidence is set to readwrite. |
210 | */ |
211 | void setReadOnly( bool readonly ); |
212 | |
213 | /** |
214 | @copydoc |
215 | IncidenceBase::setAllDay(). |
216 | */ |
217 | void setAllDay( bool allDay ); |
218 | |
219 | /** |
220 | Recreate event. The event is made a new unique event, but already stored |
221 | event information is preserved. Sets uniquie id, creation date, last |
222 | modification date and revision number. |
223 | */ |
224 | void recreate(); |
225 | |
226 | /** |
227 | Sets the incidence creation date/time. It is stored as a UTC date/time. |
228 | |
229 | @param dt is the creation date/time. |
230 | @see created(). |
231 | */ |
232 | void setCreated( const KDateTime &dt ); |
233 | |
234 | /** |
235 | Returns the incidence creation date/time. |
236 | @see setCreated(). |
237 | */ |
238 | KDateTime created() const; |
239 | |
240 | /** |
241 | Sets the number of revisions this incidence has seen. |
242 | |
243 | @param rev is the incidence revision number. |
244 | @see revision(). |
245 | */ |
246 | void setRevision( int rev ); |
247 | |
248 | /** |
249 | Returns the number of revisions this incidence has seen. |
250 | @see setRevision(). |
251 | */ |
252 | int revision() const; |
253 | |
254 | /** |
255 | Sets the incidence starting date/time. |
256 | |
257 | @param dt is the starting date/time. |
258 | @see IncidenceBase::dtStart(). |
259 | */ |
260 | virtual void setDtStart( const KDateTime &dt ); |
261 | |
262 | /** |
263 | Returns the incidence ending date/time. |
264 | @see IncidenceBase::dtStart(). |
265 | */ |
266 | virtual KDateTime dtEnd() const; |
267 | |
268 | /** |
269 | @copydoc |
270 | IncidenceBase::shiftTimes() |
271 | */ |
272 | virtual void shiftTimes( const KDateTime::Spec &oldSpec, |
273 | const KDateTime::Spec &newSpec ); |
274 | |
275 | /** |
276 | Sets the incidence description. |
277 | |
278 | @param description is the incidence description string. |
279 | @param isRich if true indicates the description string contains richtext. |
280 | @see description(). |
281 | */ |
282 | void setDescription( const QString &description, bool isRich ); |
283 | |
284 | /** |
285 | Sets the incidence description and tries to guess if the description |
286 | is rich text. |
287 | |
288 | @param description is the incidence description string. |
289 | @see description(). |
290 | @since 4.1 |
291 | */ |
292 | void setDescription( const QString &description ); |
293 | |
294 | /** |
295 | Returns the incidence description. |
296 | @see setDescription(). |
297 | @see richDescription(). |
298 | */ |
299 | QString description() const; |
300 | |
301 | /** |
302 | Returns the incidence description in rich text format. |
303 | @see setDescription(). |
304 | @see description(). |
305 | @since 4.1 |
306 | */ |
307 | QString richDescription() const; |
308 | |
309 | /** |
310 | Returns true if incidence description contains RichText; false otherwise. |
311 | @see setDescription(), description(). |
312 | */ |
313 | bool descriptionIsRich() const; |
314 | |
315 | /** |
316 | Sets the incidence summary. |
317 | |
318 | @param summary is the incidence summary string. |
319 | @param isRich if true indicates the summary string contains richtext. |
320 | @see summary(). |
321 | */ |
322 | void setSummary( const QString &summary, bool isRich ); |
323 | |
324 | /** |
325 | Sets the incidence summary and tries to guess if the summary is richtext. |
326 | |
327 | @param summary is the incidence summary string. |
328 | @see summary(). |
329 | @since 4.1 |
330 | */ |
331 | void setSummary( const QString &summary ); |
332 | |
333 | /** |
334 | Returns the incidence summary. |
335 | @see setSummary(). |
336 | @see richSummary(). |
337 | */ |
338 | QString summary() const; |
339 | |
340 | /** |
341 | Returns the incidence summary in rich text format. |
342 | @see setSummary(). |
343 | @see summary(). |
344 | @since 4.1 |
345 | */ |
346 | QString richSummary() const; |
347 | |
348 | /** |
349 | Returns true if incidence summary contains RichText; false otherwise. |
350 | @see setSummary(), summary(). |
351 | */ |
352 | bool summaryIsRich() const; |
353 | |
354 | /** |
355 | Sets the incidence location. Do _not_ use with journals. |
356 | |
357 | @param location is the incidence location string. |
358 | @param isRich if true indicates the location string contains richtext. |
359 | @see location(). |
360 | */ |
361 | void setLocation( const QString &location, bool isRich ); |
362 | |
363 | /** |
364 | Sets the incidence location and tries to guess if the location is |
365 | richtext. Do _not_ use with journals. |
366 | |
367 | @param location is the incidence location string. |
368 | @see location(). |
369 | @since 4.1 |
370 | */ |
371 | void setLocation( const QString &location ); |
372 | |
373 | /** |
374 | Returns the incidence location. Do _not_ use with journals. |
375 | @see setLocation(). |
376 | @see richLocation(). |
377 | */ |
378 | QString location() const; |
379 | |
380 | /** |
381 | Returns the incidence location in rich text format. |
382 | @see setLocation(). |
383 | @see location(). |
384 | @since 4.1 |
385 | */ |
386 | QString richLocation() const; |
387 | |
388 | /** |
389 | Returns true if incidence location contains RichText; false otherwise. |
390 | @see setLocation(), location(). |
391 | */ |
392 | bool locationIsRich() const; |
393 | |
394 | /** |
395 | Sets the incidence category list. |
396 | |
397 | @param categories is a list of category strings. |
398 | @see setCategories( const QString &), categories(). |
399 | */ |
400 | void setCategories( const QStringList &categories ); |
401 | |
402 | /** |
403 | Sets the incidence category list based on a comma delimited string. |
404 | |
405 | @param catStr is a QString containing a list of categories which |
406 | are delimited by a comma character. |
407 | @see setCategories( const QStringList &), categories(). |
408 | */ |
409 | void setCategories( const QString &catStr ); |
410 | |
411 | /** |
412 | Returns the incidence categories as a list of strings. |
413 | @see setCategories( const QStringList &), setCategories( Const QString &). |
414 | */ |
415 | QStringList categories() const; |
416 | |
417 | /** |
418 | Returns the incidence categories as a comma separated string. |
419 | @see categories(). |
420 | */ |
421 | QString categoriesStr() const; |
422 | |
423 | /** |
424 | Relates another incidence to this one, by UID. This function should only |
425 | be used when constructing a calendar before the related incidence exists. |
426 | |
427 | @param uid is a QString containing a UID for another incidence. |
428 | @see relatedToUid(), setRelatedTo(). |
429 | */ |
430 | void setRelatedToUid( const QString &uid ); |
431 | |
432 | /** |
433 | Returns a UID string for the incidence that is related to this one. |
434 | This function should only be used when constructing a calendar before |
435 | the related incidence exists. |
436 | @see setRelatedToUid(), relatedTo(). |
437 | */ |
438 | QString relatedToUid() const; |
439 | |
440 | /** |
441 | Relates another incidence to this one. This function should only be |
442 | used when constructing a calendar before the related incidence exists. |
443 | |
444 | @param incidence is a pointer to another incidence object. |
445 | @see relatedTo(), setRelatedToUid(). |
446 | */ |
447 | void setRelatedTo( Incidence *incidence ); |
448 | |
449 | /** |
450 | Returns a pointer for the incidence that is related to this one. |
451 | This function should only be used when constructing a calendar before |
452 | the related incidence exists. |
453 | @see setRelatedTo(), relatedToUid(). |
454 | */ |
455 | Incidence *relatedTo() const; |
456 | |
457 | /** |
458 | Returns a list of all incidences related to this one. |
459 | @see addRelation, removeRelation(). |
460 | */ |
461 | Incidence::List relations() const; |
462 | |
463 | /** |
464 | Adds an incidence that is related to this one. |
465 | |
466 | @param incidence is a pointer to an Incidence object. |
467 | @see removeRelation(), relations(). |
468 | */ |
469 | void addRelation( Incidence *incidence ); |
470 | |
471 | /** |
472 | Removes an incidence that is related to this one. |
473 | |
474 | @param incidence is a pointer to an Incidence object. |
475 | @see addRelation(), relations(). |
476 | */ |
477 | void removeRelation( Incidence *incidence ); |
478 | |
479 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
480 | // %%%%% Recurrence-related methods |
481 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
482 | |
483 | /** |
484 | Returns the recurrence rule associated with this incidence. If there is |
485 | none, returns an appropriate (non-0) object. |
486 | */ |
487 | Recurrence *recurrence() const; |
488 | |
489 | /** |
490 | Removes all recurrence and exception rules and dates. |
491 | */ |
492 | void clearRecurrence(); |
493 | |
494 | /** |
495 | @copydoc |
496 | Recurrence::recurs() |
497 | */ |
498 | bool recurs() const; |
499 | |
500 | /** |
501 | @copydoc |
502 | Recurrence::recurrenceType() |
503 | */ |
504 | ushort recurrenceType() const; |
505 | |
506 | /** |
507 | @copydoc |
508 | Recurrence::recursOn() |
509 | */ |
510 | virtual bool recursOn( const QDate &date, const KDateTime::Spec &timeSpec ) const; |
511 | |
512 | /** |
513 | @copydoc |
514 | Recurrence::recursAt() |
515 | */ |
516 | bool recursAt( const KDateTime &dt ) const; |
517 | |
518 | /** |
519 | Calculates the start date/time for all recurrences that happen at some |
520 | time on the given date (might start before that date, but end on or |
521 | after the given date). |
522 | |
523 | @param date the date when the incidence should occur |
524 | @param timeSpec time specification for @p date. |
525 | @return the start date/time of all occurrences that overlap with the |
526 | given date; an empty list if the incidence does not overlap with the |
527 | date at all. |
528 | */ |
529 | virtual QList<KDateTime> startDateTimesForDate( |
530 | const QDate &date, |
531 | const KDateTime::Spec &timeSpec = KDateTime::LocalZone ) const; |
532 | |
533 | /** |
534 | Calculates the start date/time for all recurrences that happen at the |
535 | given time. |
536 | |
537 | @param datetime the date/time when the incidence should occur. |
538 | @return the start date/time of all occurrences that overlap with the |
539 | given date/time; an empty list if the incidence does not happen at the |
540 | given time at all. |
541 | */ |
542 | virtual QList<KDateTime> startDateTimesForDateTime( |
543 | const KDateTime &datetime ) const; |
544 | |
545 | /** |
546 | Returns the end date/time of the incidence occurrence if it starts at |
547 | specified date/time. |
548 | |
549 | @param startDt is the specified starting date/time. |
550 | @return the corresponding end date/time for the occurrence; or the start |
551 | date/time if the end date/time is invalid; or the end date/time if |
552 | the start date/time is invalid. |
553 | */ |
554 | virtual KDateTime endDateForStart( const KDateTime &startDt ) const; |
555 | |
556 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
557 | // %%%%% Attachment-related methods |
558 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
559 | |
560 | /** |
561 | Adds an attachment to the incidence. |
562 | |
563 | @param attachment is a pointer to a valid Attachment object. |
564 | @see deleteAttachment(). |
565 | */ |
566 | void addAttachment( Attachment *attachment ); |
567 | |
568 | /** |
569 | Removes the specified attachment from the incidence. Additionally, |
570 | the memory used by the attachment is freed. |
571 | |
572 | @param attachment is a pointer to a valid Attachment object. |
573 | @see addAttachment(), deleteAttachments(). |
574 | */ |
575 | void deleteAttachment( Attachment *attachment ); |
576 | |
577 | /** |
578 | Removes all attachments of the specified MIME type from the incidence. |
579 | The memory used by all the removed attachments is freed. |
580 | |
581 | @param mime is a QString containing the MIME type. |
582 | @see deleteAttachment(). |
583 | */ |
584 | void deleteAttachments( const QString &mime ); |
585 | |
586 | /** |
587 | Returns a list of all incidence attachments. |
588 | @see attachments( const QString &). |
589 | */ |
590 | Attachment::List attachments() const; |
591 | |
592 | /** |
593 | Returns a list of all incidence attachments with the specified MIME type. |
594 | |
595 | @param mime is a QString containing the MIME type. |
596 | @see attachments(). |
597 | */ |
598 | Attachment::List attachments( const QString &mime ) const; |
599 | |
600 | /** |
601 | Removes all attachments and frees the memory used by them. |
602 | @see deleteAttachment( Attachment *), deleteAttachments( const QString &). |
603 | */ |
604 | void clearAttachments(); |
605 | |
606 | /** |
607 | * Writes the data in the attachment @p attachment to a temporary file |
608 | * and returns the local name of the temporary file. |
609 | */ |
610 | QString writeAttachmentToTempFile( Attachment *attachment ) const; |
611 | |
612 | void clearTempFiles(); |
613 | |
614 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
615 | // %%%%% Secrecy and Status methods |
616 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
617 | |
618 | /** |
619 | Sets the incidence #Secrecy. |
620 | |
621 | @param secrecy is the incidence #Secrecy to set. |
622 | @see secrecy(), secrecyStr(). |
623 | */ |
624 | void setSecrecy( Secrecy secrecy ); |
625 | |
626 | /** |
627 | Returns the incidence #Secrecy. |
628 | @see setSecrecy(), secrecyStr(). |
629 | */ |
630 | Secrecy secrecy() const; |
631 | |
632 | /** |
633 | Returns the incidence #Secrecy as translated string. |
634 | @see secrecy(). |
635 | */ |
636 | QString secrecyStr() const; |
637 | |
638 | /** |
639 | Returns a list of all available #Secrecy types as a list of translated |
640 | strings. |
641 | @see secrecyName(). |
642 | */ |
643 | static QStringList secrecyList(); |
644 | |
645 | /** |
646 | Returns the translated string form of a specified #Secrecy. |
647 | |
648 | @param secrecy is a #Secrecy type. |
649 | @see secrecyList(). |
650 | */ |
651 | static QString secrecyName( Secrecy secrecy ); |
652 | |
653 | /** |
654 | Sets the incidence status to a standard #Status value. |
655 | Note that StatusX cannot be specified. |
656 | |
657 | @param status is the incidence #Status to set. |
658 | @see status(), setCustomStatus(). |
659 | */ |
660 | void setStatus( Status status ); |
661 | |
662 | /** |
663 | Sets the incidence #Status to a non-standard status value. |
664 | |
665 | @param status is a non-standard status string. If empty, |
666 | the incidence #Status will be set to StatusNone. |
667 | @see setStatus(), status(). |
668 | */ |
669 | void setCustomStatus( const QString &status ); |
670 | |
671 | /** |
672 | Returns the incidence #Status. |
673 | @see setStatus(), setCustomStatus(), statusStr(). |
674 | */ |
675 | Status status() const; |
676 | |
677 | /** |
678 | Returns the incidence #Status as translated string. |
679 | @see status(). |
680 | */ |
681 | QString statusStr() const; |
682 | |
683 | /** |
684 | Returns the translated string form of a specified #Status. |
685 | |
686 | @param status is a #Status type. |
687 | */ |
688 | static QString statusName( Status status ); |
689 | |
690 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
691 | // %%%%% Other methods |
692 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
693 | |
694 | /** |
695 | Sets a list of incidence resources. (Note: resources in this context |
696 | means items used by the incidence such as money, fuel, hours, etc). |
697 | |
698 | @param resources is a list of resource strings. |
699 | @see resources(). |
700 | */ |
701 | void setResources( const QStringList &resources ); |
702 | |
703 | /** |
704 | Returns the incidence resources as a list of strings. |
705 | @see setResources(). |
706 | */ |
707 | QStringList resources() const; |
708 | |
709 | /** |
710 | Sets the incidences priority. The priority must be an integer value |
711 | between 0 and 9, where 0 is undefined, 1 is the highest, and 9 is the |
712 | lowest priority (decreasing order). |
713 | |
714 | @param priority is the incidence priority to set. |
715 | @see priority(). |
716 | */ |
717 | void setPriority( int priority ); |
718 | |
719 | /** |
720 | Returns the incidence priority. |
721 | @see setPriority(). |
722 | */ |
723 | int priority() const; |
724 | |
725 | /** |
726 | Returns true if the incidence has geo data, otherwise return false. |
727 | @see setHasGeo(), setGeoLatitude(float), setGeoLongitude(float). |
728 | @since 4.3 |
729 | */ |
730 | bool hasGeo() const; |
731 | |
732 | /** |
733 | Sets if the incidence has geo data. |
734 | @param hasGeo true if incidence has geo data, otherwise false |
735 | @see hasGeo(), geoLatitude(), geoLongitude(). |
736 | @since 4.3 |
737 | */ |
738 | void setHasGeo( bool hasGeo ); |
739 | |
740 | /** |
741 | Set the incidences geoLatitude. |
742 | @param geolatitude is the incidence geolatitude to set |
743 | @see geoLatitude(). |
744 | @since 4.3 |
745 | */ |
746 | void setGeoLatitude( float geolatitude ); |
747 | |
748 | /** |
749 | Returns the incidence geoLatidude. |
750 | @return incidences geolatitude value |
751 | @see setGeoLatitude(). |
752 | @since 4.3 |
753 | */ |
754 | float &geoLatitude() const; |
755 | |
756 | /** |
757 | Set the incidencesgeoLongitude. |
758 | @param geolongitude is the incidence geolongitude to set |
759 | @see geoLongitude(). |
760 | @since 4.3 |
761 | */ |
762 | void setGeoLongitude( float geolongitude ); |
763 | |
764 | /** |
765 | Returns the incidence geoLongitude. |
766 | @return incidences geolongitude value |
767 | @see setGeoLongitude(). |
768 | @since 4.3 |
769 | */ |
770 | float &geoLongitude() const; |
771 | |
772 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
773 | // %%%%% Alarm-related methods |
774 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
775 | |
776 | /** |
777 | Returns a list of all incidence alarms. |
778 | */ |
779 | const Alarm::List &alarms() const; |
780 | |
781 | /** |
782 | Create a new incidence alarm. |
783 | */ |
784 | Alarm *newAlarm(); |
785 | |
786 | /** |
787 | Adds an alarm to the incidence. |
788 | |
789 | @param alarm is a pointer to a valid Alarm object. |
790 | @see removeAlarm(). |
791 | */ |
792 | void addAlarm( Alarm *alarm ); |
793 | |
794 | /** |
795 | Removes the specified alarm from the incidence. |
796 | |
797 | @param alarm is a pointer to a valid Alarm object. |
798 | @see addAlarm(). |
799 | */ |
800 | void removeAlarm( Alarm *alarm ); |
801 | |
802 | /** |
803 | Removes all alarms. |
804 | @see removeAlarm(). |
805 | */ |
806 | void clearAlarms(); |
807 | |
808 | /** |
809 | Returns true if any of the incidence alarms are enabled; false otherwise. |
810 | */ |
811 | bool isAlarmEnabled() const; |
812 | |
813 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
814 | // %%%%% Other methods |
815 | // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
816 | |
817 | /** |
818 | Set the incidence scheduling ID. Do _not_ use with journals. |
819 | This is used for accepted invitations as the place to store the UID |
820 | of the invitation. It is later used again if updates to the |
821 | invitation comes in. |
822 | If we did not set a new UID on incidences from invitations, we can |
823 | end up with more than one resource having events with the same UID, |
824 | if you have access to other peoples resources. |
825 | |
826 | @param sid is a QString containing the scheduling ID. |
827 | @see schedulingID(). |
828 | */ |
829 | void setSchedulingID( const QString &sid ); |
830 | |
831 | /** |
832 | Returns the incidence scheduling ID. Do _not_ use with journals. |
833 | If a scheduling ID is not set, then return the incidence UID. |
834 | @see setSchedulingID(). |
835 | */ |
836 | QString schedulingID() const; |
837 | |
838 | /** |
839 | Observer interface for the recurrence class. If the recurrence is |
840 | changed, this method will be called for the incidence the recurrence |
841 | object belongs to. |
842 | |
843 | @param recurrence is a pointer to a valid Recurrence object. |
844 | */ |
845 | virtual void recurrenceUpdated( Recurrence *recurrence ); |
846 | |
847 | /** |
848 | Assignment operator. |
849 | |
850 | @warning Not polymorphic. Use AssignmentVisitor for correct |
851 | assignment of an instance of type IncidenceBase to another |
852 | instance of type Incidence. |
853 | |
854 | @param other is the Incidence to assign. |
855 | |
856 | @see AssignmentVisitor |
857 | */ |
858 | Incidence &operator=( const Incidence &other ); // KDE5: make protected to |
859 | // prevent accidental usage |
860 | |
861 | /** |
862 | Compares this with Incidence @p ib for equality. |
863 | |
864 | @warning Not polymorphic. Use ComparisonVisitor for correct |
865 | comparison of two instances of type Incidence. |
866 | |
867 | @param incidence is the Incidence to compare. |
868 | |
869 | @see ComparisonVisitor |
870 | */ |
871 | bool operator==( const Incidence &incidence ) const; // KDE5: make protected to |
872 | // prevent accidental usage |
873 | |
874 | protected: |
875 | /** |
876 | Returns the end date/time of the base incidence (e.g. due date/time for |
877 | to-dos, end date/time for events). |
878 | This method must be reimplemented by derived classes. |
879 | */ |
880 | virtual KDateTime endDateRecurrenceBase() const |
881 | { |
882 | return dtStart(); |
883 | } |
884 | |
885 | private: |
886 | void init( const Incidence &other ); |
887 | //@cond PRIVATE |
888 | class Private; |
889 | Private *const d; |
890 | //@endcond |
891 | }; |
892 | |
893 | } |
894 | |
895 | #define KCAL_INCIDENCE_METATYPE_DEFINED 1 |
896 | Q_DECLARE_METATYPE( KCal::Incidence* ) |
897 | |
898 | #endif |
899 | |