1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the QtOrganizer module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL21$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 or version 3 as published by the Free
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22** following information to ensure the GNU Lesser General Public License
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25**
26** As a special exception, The Qt Company gives you certain additional
27** rights. These rights are described in The Qt Company LGPL Exception
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29**
30** $QT_END_LICENSE$
31**
32****************************************************************************/
33
34#include "qdeclarativeorganizeritemdetail_p.h"
35
36#include <QtQml/qqmlinfo.h>
37#include <QtQml/QJSValue>
38
39#include <QtOrganizer/qorganizeritemdetails.h>
40#include <QtOrganizer/qorganizeritemid.h>
41
42QTORGANIZER_USE_NAMESPACE
43
44QT_BEGIN_NAMESPACE
45
46/*!
47 \qmltype Detail
48 \instantiates QDeclarativeOrganizerItemDetail
49 \brief The Detail element represents a single, complete detail about a organizer item.
50 \inqmlmodule QtOrganizer
51 \ingroup qml-organizer-main
52
53 \sa QOrganizerItemDetail
54 */
55
56/*!
57 \qmlsignal Detail::onDetailChanged()
58
59 This signal is emitted, when any of the Details's or child element's (like EventTime, DisplayLabel etc) properties have been changed.
60 */
61
62/*!
63 \internal
64 */
65QDeclarativeOrganizerItemDetail::QDeclarativeOrganizerItemDetail(QObject *parent)
66 : QObject(parent)
67{
68}
69
70/*!
71 \internal
72 */
73QDeclarativeOrganizerItemDetail::~QDeclarativeOrganizerItemDetail()
74{
75}
76
77/*!
78 \qmlproperty enumeration Detail::type
79
80 This property holds the type of the detail and is read only. It can be one of:
81
82 \list
83 \li Detail.Undefined
84 \li Detail.Classification
85 \li Detail.Comment
86 \li Detail.Description
87 \li Detail.DisplayLabel
88 \li Detail.ItemType
89 \li Detail.Guid
90 \li Detail.Location
91 \li Detail.Parent
92 \li Detail.Priority
93 \li Detail.Recurrence
94 \li Detail.Tag
95 \li Detail.Timestamp
96 \li Detail.Version
97 \li Detail.Reminder
98 \li Detail.AudibleReminder
99 \li Detail.EmailReminder
100 \li Detail.VisualReminder
101 \li Detail.ExtendedDetail
102 \li Detail.EventAttendee
103 \li Detail.EventRsvp
104 \li Detail.EventTime
105 \li Detail.JournalTime
106 \li Detail.TodoTime
107 \li Detail.TodoProgress
108 \endlist
109
110 \sa Classification, Comment, Description, DisplayLabel, ItemType, Guid, Location, Parent, Priority, Recurrence, Tag, Timestamp
111 \sa Version, Reminder, AudibleReminder, EmailReminder, VisualReminder, ExtendedDetail, EventAttendee, EventRsvp, EventTime
112 \sa JournalTime, TodoTime TodoProgress
113 */
114QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemDetail::type() const
115{
116 return Undefined;
117}
118
119/*!
120 \qmlmethod variant Detail::value(field)
121
122 Returns the value stored in this detail for the given \a field, or an empty variant if not available.
123 */
124QVariant QDeclarativeOrganizerItemDetail::value(int field) const
125{
126 return m_detail.value(field);
127}
128
129/*!
130 \qmlmethod bool Detail::setValue(field, value)
131
132 Inserts \a value into the detail for the given \a key if value is valid. If value is invalid, removes
133 the field with the given key from the detail. Returns true if the given value was set for the key (if
134 the value was valid), or if the given key was removed from detail (if the value was invalid), otherwise
135 returns false if the key was unable to be removed (and the value was invalid).
136 */
137bool QDeclarativeOrganizerItemDetail::setValue(int field, const QVariant &value)
138{
139 bool ok = m_detail.setValue(field, value);
140 if (ok)
141 emit detailChanged();
142 return ok;
143}
144
145/*!
146 \qmlmethod bool Detail::removeValue(field)
147
148 Removes the value stored in this detail for the given \a field. Returns true if a value was stored for
149 the given key and the operation succeeded, and false otherwise.
150 */
151bool QDeclarativeOrganizerItemDetail::removeValue(int field)
152{
153 bool ok = m_detail.removeValue(field);
154 if (ok)
155 emit detailChanged();
156 return ok;
157}
158
159// non-QML APIs
160/*!
161 \internal
162 */
163QOrganizerItemDetail QDeclarativeOrganizerItemDetail::detail() const
164{
165 return m_detail;
166}
167
168/*!
169 \internal
170 */
171void QDeclarativeOrganizerItemDetail::setDetail(const QOrganizerItemDetail &detail)
172{
173 m_detail = detail;
174 emit detailChanged();
175}
176
177
178/*!
179 \qmltype EventTime
180 \instantiates QDeclarativeOrganizerEventTime
181 \brief The EventTime element contains the start and end dates and times of a recurring event series, or occurrence of an event.
182 \inqmlmodule QtOrganizer
183 \ingroup qml-organizer-details
184
185 The following fields are supported:
186 \list
187 \li EventTime.FieldStartDateTime
188 \li EventTime.FieldEndDateTime
189 \li EventTime.FieldAllDay
190 \endlist
191
192 \sa QOrganizerEventTime
193 */
194
195/*!
196 \qmlsignal EventTime::onDetailChanged()
197
198 \sa Detail::onDetailChanged
199*/
200
201QDeclarativeOrganizerEventTime::QDeclarativeOrganizerEventTime(QObject *parent)
202 : QDeclarativeOrganizerItemDetail(parent)
203{
204 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
205 setDetail(QOrganizerEventTime());
206}
207
208QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerEventTime::type() const
209{
210 return QDeclarativeOrganizerItemDetail::EventTime;
211}
212
213/*!
214 \qmlproperty date EventTime::allDay
215
216 This property holds whether the time is significant in the start datetime.
217 */
218void QDeclarativeOrganizerEventTime::setAllDay(bool allDay)
219{
220 if (allDay != isAllDay()) {
221 m_detail.setValue(field: QOrganizerEventTime::FieldAllDay, value: allDay);
222 emit valueChanged();
223 }
224}
225
226bool QDeclarativeOrganizerEventTime::isAllDay()
227{
228 return m_detail.value<bool>(field: QOrganizerEventTime::FieldAllDay);
229}
230
231/*!
232 \qmlproperty date EventTime::startDateTime
233
234 This property holds the start date and time value of the event.
235 */
236void QDeclarativeOrganizerEventTime::setStartDateTime(const QDateTime &datetime)
237{
238 if (datetime != startDateTime()) {
239 m_detail.setValue(field: QOrganizerEventTime::FieldStartDateTime, value: datetime.toUTC());
240 emit valueChanged();
241 }
242}
243
244QDateTime QDeclarativeOrganizerEventTime::startDateTime() const
245{
246 return m_detail.value<QDateTime>(field: QOrganizerEventTime::FieldStartDateTime).toLocalTime();
247}
248
249/*!
250 \qmlproperty date EventTime::endDateTime
251
252 This property holds the end date and time value of the event.
253 */
254void QDeclarativeOrganizerEventTime::setEndDateTime(const QDateTime &datetime)
255{
256 if (datetime != endDateTime()) {
257 m_detail.setValue(field: QOrganizerEventTime::FieldEndDateTime, value: datetime.toUTC());
258 emit valueChanged();
259 }
260}
261
262QDateTime QDeclarativeOrganizerEventTime::endDateTime() const
263{
264 return m_detail.value<QDateTime>(field: QOrganizerEventTime::FieldEndDateTime).toLocalTime();
265}
266
267
268/*!
269 \qmltype Comment
270 \instantiates QDeclarativeOrganizerItemComment
271 \brief The Comment element contains the comment text of an organizer item.
272 \inqmlmodule QtOrganizer
273 \ingroup qml-organizer-details
274
275 The following fields are supported:
276 \list
277 \li Comment.FieldComment
278 \endlist
279
280 \sa QOrganizerItemComment
281 */
282
283/*!
284 \qmlsignal Comment::onDetailChanged()
285
286 \sa Detail::onDetailChanged
287*/
288
289QDeclarativeOrganizerItemComment::QDeclarativeOrganizerItemComment(QObject *parent)
290 : QDeclarativeOrganizerItemDetail(parent)
291{
292 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
293 setDetail(QOrganizerItemComment());
294}
295
296QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemComment::type() const
297{
298 return QDeclarativeOrganizerItemDetail::Comment;
299}
300
301/*!
302 \qmlproperty string Comment::comment
303
304 This property holds the text of the comment.
305 */
306void QDeclarativeOrganizerItemComment::setComment(const QString &newComment)
307{
308 if (newComment != comment()) {
309 m_detail.setValue(field: QOrganizerItemComment::FieldComment, value: newComment);
310 emit valueChanged();
311 }
312}
313
314QString QDeclarativeOrganizerItemComment::comment() const
315{
316 return m_detail.value(field: QOrganizerItemComment::FieldComment).toString();
317}
318
319
320/*!
321 \qmltype Description
322 \instantiates QDeclarativeOrganizerItemDescription
323 \brief The Description element contains the description text of an organizer item.
324 \inqmlmodule QtOrganizer
325 \ingroup qml-organizer-details
326
327 The following fields are supported:
328 \list
329 \li Description.FieldDescription
330 \endlist
331
332 \sa QOrganizerItemDescription
333 */
334
335/*!
336 \qmlsignal Description::onDetailChanged()
337
338 \sa Detail::onDetailChanged
339*/
340
341QDeclarativeOrganizerItemDescription::QDeclarativeOrganizerItemDescription(QObject *parent)
342 : QDeclarativeOrganizerItemDetail(parent)
343{
344 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
345 setDetail(QOrganizerItemDescription());
346}
347
348QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemDescription::type() const
349{
350 return QDeclarativeOrganizerItemDetail::Description;
351}
352
353/*!
354 \qmlproperty string Description::description
355
356 This property holds the text of the description.
357 */
358void QDeclarativeOrganizerItemDescription::setDescription(const QString &desc)
359{
360 if (desc != description()) {
361 m_detail.setValue(field: QOrganizerItemDescription::FieldDescription, value: desc);
362 emit valueChanged();
363 }
364}
365
366QString QDeclarativeOrganizerItemDescription::description() const
367{
368 return m_detail.value(field: QOrganizerItemDescription::FieldDescription).toString();
369}
370
371
372/*!
373 \qmltype DisplayLabel
374 \instantiates QDeclarativeOrganizerItemDisplayLabel
375 \brief The DisplayLabel element contains the display label of an organizer item.
376 \inqmlmodule QtOrganizer
377 \ingroup qml-organizer-details
378
379 The following fields are supported:
380 \list
381 \li DisplayLabel.FieldLabel
382 \endlist
383
384 \sa QOrganizerItemDisplayLabel
385 */
386
387/*!
388 \qmlsignal DisplayLabel::onDetailChanged()
389
390 \sa Detail::onDetailChanged
391*/
392
393QDeclarativeOrganizerItemDisplayLabel::QDeclarativeOrganizerItemDisplayLabel(QObject *parent)
394 : QDeclarativeOrganizerItemDetail(parent)
395{
396 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
397 setDetail(QOrganizerItemDisplayLabel());
398}
399
400QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemDisplayLabel::type() const
401{
402 return QDeclarativeOrganizerItemDetail::DisplayLabel;
403}
404
405/*!
406 \qmlproperty string DisplayLabel::label
407
408 This property holds the display label text.
409 */
410void QDeclarativeOrganizerItemDisplayLabel::setLabel(const QString &newLabel)
411{
412 if (newLabel != label()) {
413 m_detail.setValue(field: QOrganizerItemDisplayLabel::FieldLabel, value: newLabel);
414 emit valueChanged();
415 }
416}
417
418QString QDeclarativeOrganizerItemDisplayLabel::label() const
419{
420 return m_detail.value(field: QOrganizerItemDisplayLabel::FieldLabel).toString();
421}
422
423
424/*!
425 \qmltype Guid
426 \instantiates QDeclarativeOrganizerItemGuid
427 \brief The Guid element contains the GUID string of an organizer item.
428 \inqmlmodule QtOrganizer
429 \ingroup qml-organizer-details
430
431 The following fields are supported:
432 \list
433 \li Guid.FieldGuid
434 \endlist
435
436 \sa QOrganizerItemGuid
437 */
438
439/*!
440 \qmlsignal Guid::onDetailChanged()
441
442 \sa Detail::onDetailChanged
443*/
444
445QDeclarativeOrganizerItemGuid::QDeclarativeOrganizerItemGuid(QObject *parent)
446 : QDeclarativeOrganizerItemDetail(parent)
447{
448 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
449 setDetail(QOrganizerItemGuid());
450}
451
452QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemGuid::type() const
453{
454 return QDeclarativeOrganizerItemDetail::Guid;
455}
456
457/*!
458 \qmlproperty string Guid::guid
459
460 This property holds the GUID string.
461 */
462void QDeclarativeOrganizerItemGuid::setGuid(const QString &newGuid)
463{
464 if (newGuid != guid()) {
465 m_detail.setValue(field: QOrganizerItemGuid::FieldGuid, value: newGuid);
466 emit valueChanged();
467 }
468}
469
470QString QDeclarativeOrganizerItemGuid::guid() const
471{
472 return m_detail.value(field: QOrganizerItemGuid::FieldGuid).toString();
473}
474
475
476/*!
477 \qmltype Location
478 \instantiates QDeclarativeOrganizerItemLocation
479 \brief The Location element contains information about a location which is related to the organizer item in some manner.
480 \inqmlmodule QtOrganizer
481 \ingroup qml-organizer-details
482
483 The following fields are supported:
484 \list
485 \li Location.FieldLabel
486 \li Location.FieldLatitude
487 \li Location.FieldLongitude
488 \endlist
489
490 \sa QOrganizerItemLocation
491 */
492
493/*!
494 \qmlsignal Location::onDetailChanged()
495
496 \sa Detail::onDetailChanged
497*/
498
499QDeclarativeOrganizerItemLocation::QDeclarativeOrganizerItemLocation(QObject *parent)
500 : QDeclarativeOrganizerItemDetail(parent)
501{
502 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
503 setDetail(QOrganizerItemLocation());
504}
505
506QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemLocation::type() const
507{
508 return QDeclarativeOrganizerItemDetail::Location;
509}
510
511/*!
512 \qmlproperty double Location::latitude
513
514 This property holds the location latitude value.
515 */
516void QDeclarativeOrganizerItemLocation::setLatitude(double newLatitude)
517{
518 if (!qFuzzyCompare(p1: newLatitude, p2: latitude())) {
519 m_detail.setValue(field: QOrganizerItemLocation::FieldLatitude, value: newLatitude);
520 emit valueChanged();
521 }
522}
523
524double QDeclarativeOrganizerItemLocation::latitude() const
525{
526 return m_detail.value<double>(field: QOrganizerItemLocation::FieldLatitude);
527}
528
529/*!
530 \qmlproperty double Location::longitude
531
532 This property holds the location longitude value .
533 */
534void QDeclarativeOrganizerItemLocation::setLongitude(double newLongitude)
535{
536 if (!qFuzzyCompare(p1: newLongitude, p2: longitude())) {
537 m_detail.setValue(field: QOrganizerItemLocation::FieldLongitude, value: newLongitude);
538 emit valueChanged();
539 }
540}
541
542double QDeclarativeOrganizerItemLocation::longitude() const
543{
544 return m_detail.value<double>(field: QOrganizerItemLocation::FieldLongitude);
545}
546
547/*!
548 \qmlproperty string Location::label
549
550 This property holds the location label value.
551 */
552void QDeclarativeOrganizerItemLocation::setLabel(const QString &newLabel)
553{
554 if (newLabel != label()) {
555 m_detail.setValue(field: QOrganizerItemLocation::FieldLabel, value: newLabel);
556 emit valueChanged();
557 }
558}
559
560QString QDeclarativeOrganizerItemLocation::label() const
561{
562 return m_detail.value(field: QOrganizerItemLocation::FieldLabel).toString();
563}
564
565
566/*!
567 \qmltype Parent
568 \instantiates QDeclarativeOrganizerItemParent
569 \brief The Parent element contains information about the event or todo that generated this item.
570 \inqmlmodule QtOrganizer
571 \ingroup qml-organizer-details
572
573 The following fields are supported:
574 \list
575 \li Parent.FieldParentId
576 \li Parent.FieldOriginalDate
577 \endlist
578
579 \sa QOrganizerItemParent
580 */
581
582/*!
583 \qmlsignal Parent::onDetailChanged()
584
585 \sa Detail::onDetailChanged
586*/
587
588QDeclarativeOrganizerItemParent::QDeclarativeOrganizerItemParent(QObject *parent)
589 : QDeclarativeOrganizerItemDetail(parent)
590{
591 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
592 setDetail(QOrganizerItemParent());
593}
594
595QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemParent::type() const
596{
597 return QDeclarativeOrganizerItemDetail::Parent;
598}
599
600/*!
601 \qmlmethod variant Parent::value(field)
602
603 \sa Detail::value
604 */
605QVariant QDeclarativeOrganizerItemParent::value(int field) const
606{
607 switch (field) {
608 case FieldParentId:
609 {
610 QString id = parentId();
611 return id.isNull() ? QVariant() : id;
612 }
613 case FieldOriginalDate:
614 {
615 QDateTime date = originalDate();
616 return date.isValid() ? date : QVariant();
617 }
618 default:
619 {
620 return QVariant();
621 }
622 }
623}
624
625/*!
626 \qmlmethod bool Parent::setValue(field, value)
627
628 \sa Detail::setValue
629 */
630bool QDeclarativeOrganizerItemParent::setValue(int field, const QVariant &value)
631{
632 switch (field) {
633 case FieldParentId:
634 {
635 if (value.canConvert<QString>()) {
636 setParentId(value.toString());
637 return true;
638 }
639 break;
640 }
641 case FieldOriginalDate:
642 {
643 if (value.canConvert<QDateTime>()) {
644 setOriginalDate(value.toDateTime());
645 return true;
646 }
647 break;
648 }
649 default:
650 {
651 return false;
652 }
653 }
654 return false;
655}
656
657/*!
658 \qmlproperty date Parent::originalDate
659
660 This property holds the original date of this instance origin item.
661 */
662void QDeclarativeOrganizerItemParent::setOriginalDate(const QDateTime &date)
663{
664 if (date != originalDate()) {
665 // If the value was likely set as a QDate, then assume that the time info can be ignored.
666 // This is to ensure that dates like "2002-01-01" don't get interpretted as being
667 // "2002-01-01T00:00:00+10:00" if the local timezone is GMT+10, and then being converted
668 // to "2001-31-12T14:00:00Z" in UTC before having the (different) date "2001-31-12"
669 // extracted for insertion into the FieldResponseDeadline value.
670 if (date.timeSpec() == Qt::LocalTime && date.time() == QTime(0,0,0,0)) {
671 m_detail.setValue(field: QOrganizerItemParent::FieldOriginalDate, value: date.date());
672 } else {
673 m_detail.setValue(field: QOrganizerItemParent::FieldOriginalDate, value: date.toUTC().date());
674 }
675 emit valueChanged();
676 }
677}
678
679QDateTime QDeclarativeOrganizerItemParent::originalDate() const
680{
681 QDateTime retDateTime(m_detail.value(field: QOrganizerItemParent::FieldOriginalDate).toDate(), QTime(0, 0, 0, 0), Qt::UTC);
682 return retDateTime;
683}
684
685/*!
686 \qmlproperty string Parent::parentId
687
688 This property holds the organizer item id of the parent recurrent event or todo.
689 */
690void QDeclarativeOrganizerItemParent::setParentId(const QString &newParentId)
691{
692 if (newParentId != parentId()) {
693 m_detail.setValue(field: QOrganizerItemParent::FieldParentId,
694 value: QVariant::fromValue(value: QOrganizerItemId::fromString(idString: newParentId)));
695 emit valueChanged();
696 }
697}
698
699QString QDeclarativeOrganizerItemParent::parentId() const
700{
701 return m_detail.value(field: QOrganizerItemParent::FieldParentId).value<QOrganizerItemId>().toString();
702}
703
704
705/*!
706 \qmltype Priority
707 \instantiates QDeclarativeOrganizerItemPriority
708 \brief The Priority element contains the priority of the organizer item, which may be used to resolve scheduling conflicts.
709 \inqmlmodule QtOrganizer
710 \ingroup qml-organizer-details
711
712 The following fields are supported:
713 \list
714 \li Priority.FieldPriority
715 \endlist
716
717 \sa QOrganizerItemPriority
718 */
719
720/*!
721 \qmlsignal Priority::onDetailChanged()
722
723 \sa Detail::onDetailChanged
724*/
725
726QDeclarativeOrganizerItemPriority::QDeclarativeOrganizerItemPriority(QObject *parent)
727 : QDeclarativeOrganizerItemDetail(parent)
728{
729 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
730 setDetail(QOrganizerItemPriority());
731}
732
733QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemPriority::type() const
734{
735 return QDeclarativeOrganizerItemDetail::Priority;
736}
737
738
739/*!
740 \qmlproperty enumeration Priority::priority
741
742 This property holds the priority associated with an organizer item. The value can be one of:
743 \list
744 \li Priority.Unknown
745 \li Priority.Highest
746 \li Priority.ExtremelyHigh
747 \li Priority.VeryHigh
748 \li Priority.High
749 \li Priority.Medium
750 \li Priority.Low
751 \li Priority.VeryLow
752 \li Priority.ExtremelyLow
753 \li Priority.Lowest
754 \endlist
755 */
756void QDeclarativeOrganizerItemPriority::setPriority(QDeclarativeOrganizerItemPriority::Priority newPriority)
757{
758 if (newPriority != priority()) {
759 m_detail.setValue(field: QOrganizerItemPriority::FieldPriority, value: static_cast<int>(newPriority));
760 emit valueChanged();
761 }
762}
763
764QDeclarativeOrganizerItemPriority::Priority QDeclarativeOrganizerItemPriority::priority() const
765{
766 return static_cast<Priority>(m_detail.value<int>(field: QOrganizerItemPriority::FieldPriority));
767}
768
769
770/*!
771 \qmltype Recurrence
772 \instantiates QDeclarativeOrganizerItemRecurrence
773 \brief The Recurrence element contains a list of rules and dates on which the recurrent item occurs,
774 and a list of rules and dates on which exceptions occur.
775 \inqmlmodule QtOrganizer
776 \ingroup qml-organizer-details
777
778 The following fields are supported:
779 \list
780 \li Recurrence.FieldRecurrenceRules
781 \li Recurrence.FieldExceptionRules
782 \li Recurrence.FieldRecurrenceDates
783 \li Recurrence.FieldExceptionDates
784 \endlist
785 */
786
787/*!
788 \qmlsignal Recurrence::onDetailChanged()
789
790 \sa Detail::onDetailChanged
791*/
792
793QDeclarativeOrganizerItemRecurrence::QDeclarativeOrganizerItemRecurrence(QObject *parent)
794 : QDeclarativeOrganizerItemDetail(parent)
795{
796 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
797 setDetail(QOrganizerItemRecurrence());
798 connect(asender: this, SIGNAL(recurrenceRulesChanged()), SLOT(_saveRecurrenceRules()));
799 connect(asender: this, SIGNAL(exceptionRulesChanged()), SLOT(_saveExceptionRules()));
800}
801
802QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemRecurrence::type() const
803{
804 return QDeclarativeOrganizerItemDetail::Recurrence;
805}
806
807/*!
808 \qmlmethod variant Recurrence::value(field)
809
810 \sa Detail::value
811 */
812QVariant QDeclarativeOrganizerItemRecurrence::value(int field) const
813{
814 switch (field) {
815 case FieldRecurrenceDates:
816 {
817 QVariantList rdates = recurrenceDates();
818 return rdates;
819 }
820 case FieldExceptionDates:
821 {
822 QVariantList edates = exceptionDates();
823 return edates;
824 }
825 default:
826 {
827 // TODO: proper handling of FieldRecurrenceRules and FieldExceptionRules --> conversion
828 // from QSet<QOrganizerRecurrenceRule> to QVariantList
829 return QVariant();
830 }
831 }
832}
833
834/*!
835 \qmlmethod bool Recurrence::setValue(field, value)
836
837 \sa Detail::setValue
838 */
839bool QDeclarativeOrganizerItemRecurrence::setValue(int field, const QVariant &value)
840{
841 switch (field) {
842 case FieldRecurrenceDates:
843 {
844 if (value.canConvert<QVariantList>()) {
845 setRecurrenceDates(value.toList());
846 return true;
847 }
848 break;
849 }
850 case FieldExceptionDates:
851 {
852 if (value.canConvert<QVariantList>()) {
853 setExceptionDates(value.toList());
854 return true;
855 }
856 break;
857 }
858 default:
859 {
860 // TODO: proper handling of FieldRecurrenceRules and FieldExceptionRules --> conversion
861 // from QVariantList to QSet<QOrganizerRecurrenceRule>
862 return false;
863 }
864 }
865 return false;
866}
867
868/*!
869 \qmlproperty list<RecurrenceRule> Recurrence::recurrenceRules
870
871 This property holds the list of recurrence rules.
872
873 \sa RecurrenceRule
874 */
875QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> QDeclarativeOrganizerItemRecurrence::recurrenceRules()
876{
877 QSet<QOrganizerRecurrenceRule> ruleSet = m_detail.value(field: QOrganizerItemRecurrence::FieldRecurrenceRules).value< QSet<QOrganizerRecurrenceRule> >();
878 if (m_recurrenceRules.isEmpty() && !ruleSet.isEmpty()) {
879 foreach (QOrganizerRecurrenceRule rule, ruleSet) {
880 QDeclarativeOrganizerRecurrenceRule* drule = new QDeclarativeOrganizerRecurrenceRule(this);
881 drule->setRule(rule);
882 connect(sender: drule, SIGNAL(recurrenceRuleChanged()), receiver: this, SLOT(_saveRecurrenceRules()));
883 m_recurrenceRules.append(t: drule);
884 }
885 }
886 return QQmlListProperty<QDeclarativeOrganizerRecurrenceRule>(this, &m_recurrenceRules, rrule_append, rule_count, rule_at, rrule_clear);
887}
888
889/*!
890 \qmlproperty list<RecurrenceRule> Recurrence::exceptionRules
891
892 This property holds the list of exception rules.
893
894 \sa RecurrenceRule
895 */
896QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> QDeclarativeOrganizerItemRecurrence::exceptionRules()
897{
898 QSet<QOrganizerRecurrenceRule> ruleSet = m_detail.value(field: QOrganizerItemRecurrence::FieldExceptionRules).value< QSet<QOrganizerRecurrenceRule> >();
899 if (m_exceptionRules.isEmpty() && !ruleSet.isEmpty()) {
900 foreach (QOrganizerRecurrenceRule rule, ruleSet) {
901 QDeclarativeOrganizerRecurrenceRule* drule = new QDeclarativeOrganizerRecurrenceRule(this);
902 drule->setRule(rule);
903 connect(sender: drule, SIGNAL(recurrenceRuleChanged()), receiver: this, SLOT(_saveExceptionRules()));
904 m_exceptionRules.append(t: drule);
905 }
906 }
907 return QQmlListProperty<QDeclarativeOrganizerRecurrenceRule>(this, &m_exceptionRules, xrule_append, rule_count, rule_at, xrule_clear);
908}
909
910/*!
911 \qmlproperty list<date> Recurrence::recurrenceDates
912
913 This property holds the list of recurrence dates.
914 */
915void QDeclarativeOrganizerItemRecurrence::setRecurrenceDates(const QVariantList &dates)
916{
917 if (dates != recurrenceDates()) {
918 QSet<QDate> dateSet;
919 QVariant dateSetVariant;
920 Q_FOREACH (const QVariant &date, dates) {
921 if (date.canConvert(targetTypeId: QVariant::DateTime)) {
922 QDateTime dt = date.toDateTime();
923 // If the value was likely set as a QDate, then assume that the time info can be ignored.
924 // This is to ensure that dates like "2002-01-01" don't get interpretted as being
925 // "2002-01-01T00:00:00+10:00" if the local timezone is GMT+10, and then being converted
926 // to "2001-31-12T14:00:00Z" in UTC before having the (different) date "2001-31-12"
927 // extracted for insertion into the dateSet.
928 if (dt.timeSpec() == Qt::LocalTime && dt.time() == QTime(0,0,0,0)) {
929 dateSet.insert(value: dt.date());
930 } else {
931 dateSet.insert(value: dt.toUTC().date());
932 }
933 }
934 }
935 dateSetVariant.setValue(dateSet);
936 m_detail.setValue(field: QOrganizerItemRecurrence::FieldRecurrenceDates, value: dateSetVariant);
937 emit valueChanged();
938 }
939}
940
941QVariantList QDeclarativeOrganizerItemRecurrence::recurrenceDates() const
942{
943 QVariant dateSetVariant = m_detail.value(field: QOrganizerItemRecurrence::FieldRecurrenceDates);
944 QSet<QDate> dateSet = dateSetVariant.value<QSet <QDate> >();
945 QVariantList dates;
946 foreach (QDate date, dateSet) {
947 QDateTime dateTime(date, QTime(0, 0, 0, 0), Qt::UTC);
948 dates.append(t: QVariant(dateTime));
949 }
950 return dates;
951}
952
953/*!
954 \qmlproperty list<date> Recurrence::exceptionDates
955
956 This property holds the list of exception dates.
957 */
958void QDeclarativeOrganizerItemRecurrence::setExceptionDates(const QVariantList& dates)
959{
960 if (dates != exceptionDates()) {
961 QSet<QDate> dateSet;
962 QVariant dateSetVariant;
963 Q_FOREACH (const QVariant &date, dates) {
964 if (date.canConvert(targetTypeId: QVariant::DateTime)) {
965 QDateTime dt = date.toDateTime();
966 // If the value was likely set as a QDate, then assume that the time info can be ignored.
967 // This is to ensure that dates like "2002-01-01" don't get interpretted as being
968 // "2002-01-01T00:00:00+10:00" if the local timezone is GMT+10, and then being converted
969 // to "2001-31-12T14:00:00Z" in UTC before having the (different) date "2001-31-12"
970 // extracted for insertion into the dateSet.
971 if (dt.timeSpec() == Qt::LocalTime && dt.time() == QTime(0,0,0,0)) {
972 dateSet.insert(value: dt.date());
973 } else {
974 dateSet.insert(value: dt.toUTC().date());
975 }
976 }
977 }
978 dateSetVariant.setValue(dateSet);
979 m_detail.setValue(field: QOrganizerItemRecurrence::FieldExceptionDates, value: dateSetVariant);
980 emit valueChanged();
981 }
982}
983
984QVariantList QDeclarativeOrganizerItemRecurrence::exceptionDates() const
985{
986 QVariant dateSetVariant = m_detail.value(field: QOrganizerItemRecurrence::FieldExceptionDates);
987 QSet<QDate> dateSet = dateSetVariant.value<QSet <QDate> >();
988 QVariantList dates;
989 foreach (QDate date, dateSet) {
990 QDateTime dateTime(date, QTime(0, 0, 0, 0), Qt::UTC);
991 dates.append(t: QVariant(dateTime));
992 }
993 return dates;
994}
995
996void QDeclarativeOrganizerItemRecurrence::_saveRecurrenceRules()
997{
998 QSet<QOrganizerRecurrenceRule> rules;
999 foreach (const QDeclarativeOrganizerRecurrenceRule *r, m_recurrenceRules)
1000 rules << r->rule();
1001 m_detail.setValue(field: QOrganizerItemRecurrence::FieldRecurrenceRules, value: QVariant::fromValue(value: rules));
1002 emit valueChanged();
1003}
1004
1005void QDeclarativeOrganizerItemRecurrence::_saveExceptionRules()
1006{
1007 QSet<QOrganizerRecurrenceRule> rules;
1008 foreach (const QDeclarativeOrganizerRecurrenceRule *r, m_exceptionRules)
1009 rules << r->rule();
1010 m_detail.setValue(field: QOrganizerItemRecurrence::FieldExceptionRules, value: QVariant::fromValue(value: rules));
1011 emit valueChanged();
1012}
1013
1014void QDeclarativeOrganizerItemRecurrence::rrule_append(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p,
1015 QDeclarativeOrganizerRecurrenceRule *item)
1016{
1017 QDeclarativeOrganizerItemRecurrence* recurrence = qobject_cast<QDeclarativeOrganizerItemRecurrence*>(object: p->object);
1018 connect(sender: item, SIGNAL(recurrenceRuleChanged()), receiver: recurrence, SLOT(_saveRecurrenceRules()));
1019 static_cast<QList <QDeclarativeOrganizerRecurrenceRule*> *>(p->data)->append(t: item);
1020 emit recurrence->recurrenceRulesChanged();
1021}
1022
1023void QDeclarativeOrganizerItemRecurrence::xrule_append(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p,
1024 QDeclarativeOrganizerRecurrenceRule *item)
1025{
1026 QDeclarativeOrganizerItemRecurrence* recurrence = qobject_cast<QDeclarativeOrganizerItemRecurrence*>(object: p->object);
1027 connect(sender: item, SIGNAL(recurrenceRuleChanged()), receiver: recurrence, SLOT(_saveExceptionRules()));
1028 static_cast<QList <QDeclarativeOrganizerRecurrenceRule*> *>(p->data)->append(t: item);
1029 emit recurrence->exceptionRulesChanged();
1030}
1031
1032int QDeclarativeOrganizerItemRecurrence::rule_count(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p)
1033{
1034 return static_cast<QList<QDeclarativeOrganizerRecurrenceRule*>*>(p->data)->count();
1035}
1036
1037QDeclarativeOrganizerRecurrenceRule* QDeclarativeOrganizerItemRecurrence::rule_at(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p, int idx)
1038{
1039 return static_cast<QList<QDeclarativeOrganizerRecurrenceRule*>*>(p->data)->at(i: idx);
1040}
1041
1042void QDeclarativeOrganizerItemRecurrence::rrule_clear(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p)
1043{
1044 static_cast<QList<QDeclarativeOrganizerRecurrenceRule*>*>(p->data)->clear();
1045 emit qobject_cast<QDeclarativeOrganizerItemRecurrence*>(object: p->object)->recurrenceRulesChanged();
1046}
1047
1048void QDeclarativeOrganizerItemRecurrence::xrule_clear(QQmlListProperty<QDeclarativeOrganizerRecurrenceRule> *p)
1049{
1050 static_cast<QList<QDeclarativeOrganizerRecurrenceRule*>*>(p->data)->clear();
1051 emit qobject_cast<QDeclarativeOrganizerItemRecurrence*>(object: p->object)->exceptionRulesChanged();
1052}
1053
1054
1055/*!
1056 \qmltype Tag
1057 \instantiates QDeclarativeOrganizerItemTag
1058 \brief The Tag element contains the tag string of an organizer item.
1059 \inqmlmodule QtOrganizer
1060 \ingroup qml-organizer-details
1061
1062 The following fields are supported:
1063 \list
1064 \li Tag.FieldTag
1065 \endlist
1066
1067 \sa QOrganizerItemTag
1068 */
1069
1070/*!
1071 \qmlsignal Tag::onDetailChanged()
1072
1073 \sa Detail::onDetailChanged
1074*/
1075
1076QDeclarativeOrganizerItemTag::QDeclarativeOrganizerItemTag(QObject *parent)
1077 : QDeclarativeOrganizerItemDetail(parent)
1078{
1079 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1080 setDetail(QOrganizerItemTag());
1081}
1082
1083QDeclarativeOrganizerItemTag::DetailType QDeclarativeOrganizerItemTag::type() const
1084{
1085 return QDeclarativeOrganizerItemDetail::Tag;
1086}
1087
1088/*!
1089 \qmlproperty string Tag::tag
1090
1091 This property holds the tag string.
1092 */
1093void QDeclarativeOrganizerItemTag::setTag(const QString &newTag)
1094{
1095 if (newTag != tag()) {
1096 m_detail.setValue(field: QOrganizerItemTag::FieldTag, value: newTag);
1097 emit valueChanged();
1098 }
1099}
1100
1101QString QDeclarativeOrganizerItemTag::tag() const
1102{
1103 return m_detail.value(field: QOrganizerItemTag::FieldTag).toString();
1104}
1105
1106
1107/*!
1108 \qmltype Timestamp
1109 \instantiates QDeclarativeOrganizerItemTimestamp
1110 \brief The Timestamp element contains the created and last modified timestamp of an organizer item's creating date and time.
1111 \inqmlmodule QtOrganizer
1112 \ingroup qml-organizer-details
1113
1114 The following fields are supported:
1115 \list
1116 \li Timestamp.FieldCreated
1117 \li Timestamp.FieldLastModified
1118 \endlist
1119
1120 \sa QOrganizerItemTimestamp
1121 */
1122
1123/*!
1124 \qmlsignal Timestamp::onDetailChanged()
1125
1126 \sa Detail::onDetailChanged
1127*/
1128
1129QDeclarativeOrganizerItemTimestamp::QDeclarativeOrganizerItemTimestamp(QObject *parent)
1130 : QDeclarativeOrganizerItemDetail(parent)
1131{
1132 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1133 setDetail(QOrganizerItemTimestamp());
1134}
1135
1136QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemTimestamp::type() const
1137{
1138 return QDeclarativeOrganizerItemDetail::Timestamp;
1139}
1140
1141/*!
1142 \qmlproperty date Timestamp::created
1143
1144 This property holds the value of the item's creation date and time.
1145 */
1146void QDeclarativeOrganizerItemTimestamp::setCreated(const QDateTime &timestamp)
1147{
1148 if (timestamp != created()) {
1149 m_detail.setValue(field: QOrganizerItemTimestamp::FieldCreated, value: timestamp.toUTC());
1150 emit valueChanged();
1151 }
1152}
1153
1154QDateTime QDeclarativeOrganizerItemTimestamp::created() const
1155{
1156 return m_detail.value<QDateTime>(field: QOrganizerItemTimestamp::FieldCreated).toLocalTime();
1157}
1158
1159/*!
1160 \qmlproperty date Timestamp::lastModified
1161
1162 This property holds the value of the item's last modified date and time.
1163 */
1164void QDeclarativeOrganizerItemTimestamp::setLastModified(const QDateTime &timestamp)
1165{
1166 if (timestamp != lastModified()) {
1167 m_detail.setValue(field: QOrganizerItemTimestamp::FieldLastModified, value: timestamp.toUTC());
1168 emit valueChanged();
1169 }
1170}
1171
1172QDateTime QDeclarativeOrganizerItemTimestamp::lastModified() const
1173{
1174 return m_detail.value<QDateTime>(field: QOrganizerItemTimestamp::FieldLastModified).toLocalTime();
1175}
1176
1177
1178/*!
1179 \qmltype ItemType
1180 \instantiates QDeclarativeOrganizerItemType
1181 \brief The ItemType element contains the type of an organizer item.
1182 \inqmlmodule QtOrganizer
1183 \ingroup qml-organizer-details
1184
1185 The following fields are supported:
1186 \list
1187 \li ItemType.FieldType
1188 \endlist
1189
1190 \sa QOrganizerItemType
1191 */
1192
1193/*!
1194 \qmlsignal ItemType::onDetailChanged()
1195
1196 \sa Detail::onDetailChanged
1197*/
1198
1199QDeclarativeOrganizerItemType::QDeclarativeOrganizerItemType(QObject *parent)
1200 : QDeclarativeOrganizerItemDetail(parent)
1201{
1202 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1203 setDetail(QOrganizerItemType());
1204}
1205
1206QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemType::type() const
1207{
1208 return QDeclarativeOrganizerItemDetail::ItemType;
1209}
1210
1211/*!
1212 \qmlproperty enum ItemType::itemType
1213
1214 This property holds the type of the item. The value can be one of:
1215 \list
1216 \li ItemType.Event
1217 \li ItemType.EventOccurrence
1218 \li ItemType.Todo
1219 \li ItemType.TodoOccurrence
1220 \li ItemType.Note
1221 \li ItemType.Journal
1222 \li ItemType.Customized
1223 \endlist
1224 */
1225void QDeclarativeOrganizerItemType::setItemType(ItemType newType)
1226{
1227 if (newType != itemType()) {
1228 m_detail.setValue(field: QOrganizerItemType::FieldType, value: static_cast<QOrganizerItemType::ItemType>(newType));
1229 emit valueChanged();
1230 }
1231}
1232
1233QDeclarativeOrganizerItemType::ItemType QDeclarativeOrganizerItemType::itemType() const
1234{
1235 return static_cast<ItemType>(m_detail.value(field: QOrganizerItemType::FieldType).toInt());
1236}
1237
1238
1239/*!
1240 \qmltype JournalTime
1241 \instantiates QDeclarativeOrganizerJournalTime
1242 \brief The JournalTime element contains the entry date and time of a journal item.
1243 \inqmlmodule QtOrganizer
1244 \ingroup qml-organizer-details
1245
1246 The following fields are supported:
1247 \list
1248 \li JournalTime.FieldEntryDateTime
1249 \endlist
1250
1251 \sa QOrganizerJournalTime
1252 */
1253
1254/*!
1255 \qmlsignal JournalTime::onDetailChanged()
1256
1257 \sa Detail::onDetailChanged
1258*/
1259
1260QDeclarativeOrganizerJournalTime::QDeclarativeOrganizerJournalTime(QObject *parent)
1261 : QDeclarativeOrganizerItemDetail(parent)
1262{
1263 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1264 setDetail(QOrganizerJournalTime());
1265}
1266
1267QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerJournalTime::type() const
1268{
1269 return QDeclarativeOrganizerItemDetail::JournalTime;
1270}
1271
1272/*!
1273 \qmlproperty date JournalTime::entryDateTime
1274
1275 This property holds the entry date and time value of the journal.
1276 */
1277void QDeclarativeOrganizerJournalTime::setEntryDateTime(const QDateTime &datetime)
1278{
1279 if (datetime != entryDateTime()) {
1280 m_detail.setValue(field: QOrganizerJournalTime::FieldEntryDateTime, value: datetime.toUTC());
1281 emit valueChanged();
1282 }
1283}
1284QDateTime QDeclarativeOrganizerJournalTime::entryDateTime() const
1285{
1286 return m_detail.value<QDateTime>(field: QOrganizerJournalTime::FieldEntryDateTime).toLocalTime();
1287}
1288
1289
1290/*!
1291 \qmltype TodoProgress
1292 \instantiates QDeclarativeOrganizerTodoProgress
1293 \brief The TodoProgress element contains information about the progress of a todo item.
1294 \inqmlmodule QtOrganizer
1295 \ingroup qml-organizer-details
1296
1297 The following fields are supported:
1298 \list
1299 \li TodoProgress.FieldStatus
1300 \li TodoProgress.FieldPercentage
1301 \li TodoProgress.FieldFinishedDateTime
1302 \endlist
1303
1304 \sa QOrganizerTodoProgress
1305 */
1306
1307/*!
1308 \qmlsignal TodoProgress::onDetailChanged()
1309
1310 \sa Detail::onDetailChanged
1311*/
1312
1313QDeclarativeOrganizerTodoProgress::QDeclarativeOrganizerTodoProgress(QObject *parent)
1314 : QDeclarativeOrganizerItemDetail(parent)
1315{
1316 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1317 setDetail(QOrganizerTodoProgress());
1318}
1319
1320QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerTodoProgress::type() const
1321{
1322 return QDeclarativeOrganizerItemDetail::TodoProgress;
1323}
1324
1325/*!
1326 \qmlproperty int TodoProgress::percentageComplete
1327
1328 This property holds the value which contains the current completion percentage of the
1329 todo item.
1330 */
1331void QDeclarativeOrganizerTodoProgress::setPercentageComplete(int newPercentageComplete)
1332{
1333 if (newPercentageComplete != percentageComplete()) {
1334 if (newPercentageComplete >=0 && newPercentageComplete <= 100) {
1335 m_detail.setValue(field: QOrganizerTodoProgress::FieldPercentageComplete, value: newPercentageComplete);
1336 emit valueChanged();
1337 }
1338 }
1339}
1340
1341int QDeclarativeOrganizerTodoProgress::percentageComplete() const
1342{
1343 return m_detail.value<int>(field: QOrganizerTodoProgress::FieldPercentageComplete);
1344}
1345
1346/*!
1347 \qmlproperty date TodoProgress::finishedDateTime
1348
1349 This property holds the date time value which contains the date and time at which the
1350 todo item was completed.
1351 */
1352void QDeclarativeOrganizerTodoProgress::setFinishedDateTime(const QDateTime &datetime)
1353{
1354 if (datetime != finishedDateTime()) {
1355 m_detail.setValue(field: QOrganizerTodoProgress::FieldFinishedDateTime, value: datetime.toUTC());
1356 emit valueChanged();
1357 }
1358}
1359
1360QDateTime QDeclarativeOrganizerTodoProgress::finishedDateTime() const
1361{
1362 return m_detail.value<QDateTime>(field: QOrganizerTodoProgress::FieldFinishedDateTime).toLocalTime();
1363}
1364
1365/*!
1366 \qmlproperty enumeration TodoProgress::status
1367
1368 This property holds the value which describes the current completion status of the
1369 todo item. The value can be one of:
1370 \list
1371 \li TodoProgress.NotStarted
1372 \li TodoProgress.InProgress
1373 \li TodoProgress.Complete
1374 \endlist
1375 */
1376void QDeclarativeOrganizerTodoProgress::setStatus(QDeclarativeOrganizerTodoProgress::StatusType newStatus)
1377{
1378 if (newStatus != status()) {
1379 m_detail.setValue(field: QOrganizerTodoProgress::FieldStatus, value: (int) newStatus);
1380 emit valueChanged();
1381 }
1382}
1383
1384QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodoProgress::status() const
1385{
1386 return (StatusType) m_detail.value<int>(field: QOrganizerTodoProgress::FieldStatus);
1387}
1388
1389
1390/*!
1391 \qmltype TodoTime
1392 \instantiates QDeclarativeOrganizerTodoTime
1393 \brief The TodoTime element contains the start and due dates and times of a recurring todo series, or occurrence of an todo item.
1394 \inqmlmodule QtOrganizer
1395 \ingroup qml-organizer-details
1396
1397 The following fields are supported:
1398 \list
1399 \li TodoTime.FieldStartDateTime
1400 \li TodoTime.FieldDueDateTime
1401 \li TodoTime.FieldAllDay
1402 \endlist
1403
1404 \sa QOrganizerTodoTime
1405 */
1406
1407/*!
1408 \qmlsignal TodoTime::onDetailChanged()
1409
1410 \sa Detail::onDetailChanged
1411*/
1412
1413QDeclarativeOrganizerTodoTime::QDeclarativeOrganizerTodoTime(QObject *parent)
1414 : QDeclarativeOrganizerItemDetail(parent)
1415{
1416 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1417 setDetail(QOrganizerTodoTime());
1418}
1419
1420QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerTodoTime::type() const
1421{
1422 return QDeclarativeOrganizerItemDetail::TodoTime;
1423}
1424
1425/*!
1426 \qmlproperty date TodoTime::allDay
1427
1428 This property holds whether the time is significant in the start datetime.
1429 */
1430void QDeclarativeOrganizerTodoTime::setAllDay(bool allDay)
1431{
1432 if (allDay != isAllDay()) {
1433 m_detail.setValue(field: QOrganizerTodoTime::FieldAllDay, value: allDay);
1434 emit valueChanged();
1435 }
1436}
1437
1438bool QDeclarativeOrganizerTodoTime::isAllDay()
1439{
1440 return m_detail.value<bool>(field: QOrganizerTodoTime::FieldAllDay);
1441}
1442
1443/*!
1444 \qmlproperty date TodoTime::startDateTime
1445
1446 This property holds the start date and time value of the todo item.
1447 */
1448void QDeclarativeOrganizerTodoTime::setStartDateTime(const QDateTime &datetime)
1449{
1450 if (datetime != startDateTime()) {
1451 m_detail.setValue(field: QOrganizerTodoTime::FieldStartDateTime, value: datetime.toUTC());
1452 emit valueChanged();
1453 }
1454}
1455
1456QDateTime QDeclarativeOrganizerTodoTime::startDateTime() const
1457{
1458 return m_detail.value<QDateTime>(field: QOrganizerTodoTime::FieldStartDateTime).toLocalTime();
1459}
1460
1461/*!
1462 \qmlproperty date TodoTime::dueDateTime
1463
1464 This property holds the end date and time value of the todo item.
1465 */
1466void QDeclarativeOrganizerTodoTime::setDueDateTime(const QDateTime &dateTime)
1467{
1468 if (dateTime != dueDateTime()) {
1469 m_detail.setValue(field: QOrganizerTodoTime::FieldDueDateTime, value: dateTime.toUTC());
1470 emit valueChanged();
1471 }
1472}
1473
1474QDateTime QDeclarativeOrganizerTodoTime::dueDateTime() const
1475{
1476 return m_detail.value<QDateTime>(field: QOrganizerTodoTime::FieldDueDateTime).toLocalTime();
1477}
1478
1479
1480/*!
1481 \qmltype Reminder
1482 \instantiates QDeclarativeOrganizerItemReminder
1483 \brief The Reminder element contains information about when and how the user wants to reminded of the item.
1484 \inqmlmodule QtOrganizer
1485 \ingroup qml-organizer-details
1486
1487 The following fields are supported:
1488 \list
1489 \li Reminder.FieldRepetitionCount
1490 \li Reminder.FieldRepetitionDelay
1491 \li Reminder.FieldSecondsBeforeStart
1492 \endlist
1493
1494 \sa QOrganizerItemReminder
1495 */
1496
1497/*!
1498 \qmlsignal Reminder::onDetailChanged()
1499
1500 \sa Detail::onDetailChanged
1501*/
1502
1503QDeclarativeOrganizerItemReminder::QDeclarativeOrganizerItemReminder(QObject *parent)
1504 : QDeclarativeOrganizerItemDetail(parent)
1505{
1506 connect(asender: this, SIGNAL(reminderChanged()), SIGNAL(detailChanged()));
1507 setDetail(QOrganizerItemReminder());
1508}
1509
1510QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemReminder::type() const
1511{
1512 return QDeclarativeOrganizerItemDetail::Reminder;
1513}
1514
1515/*!
1516 \qmlproperty enumeration Reminder::reminderType
1517
1518 This property holds the reminder type of this reminder for an organizer item. The value can be one of:
1519 \list
1520 \li Reminder.NoReminder
1521 \li Reminder.VisualReminder
1522 \li Reminder.AudibleReminder
1523 \li Reminder.EmailReminder
1524 \endlist
1525 */
1526QDeclarativeOrganizerItemReminder::ReminderType QDeclarativeOrganizerItemReminder::reminderType() const
1527{
1528 if (m_detail.type() == QOrganizerItemDetail::TypeAudibleReminder)
1529 return QDeclarativeOrganizerItemReminder::AudibleReminder;
1530 else if (m_detail.type() == QOrganizerItemDetail::TypeEmailReminder)
1531 return QDeclarativeOrganizerItemReminder::EmailReminder;
1532 else if (m_detail.type() == QOrganizerItemDetail::TypeVisualReminder)
1533 return QDeclarativeOrganizerItemReminder::VisualReminder;
1534 else
1535 return QDeclarativeOrganizerItemReminder::NoReminder;
1536}
1537
1538/*!
1539 \qmlproperty int Reminder::repetitionCount
1540
1541 This property holds the number of times the user should be reminded of the item.
1542 */
1543void QDeclarativeOrganizerItemReminder::setRepetitionCount(int count)
1544{
1545 if (count != repetitionCount()) {
1546 m_detail.setValue(field: QOrganizerItemReminder::FieldRepetitionCount, value: count);
1547 emit reminderChanged();
1548 }
1549}
1550
1551int QDeclarativeOrganizerItemReminder::repetitionCount() const
1552{
1553 return m_detail.value<int>(field: QOrganizerItemReminder::FieldRepetitionCount);
1554}
1555
1556/*!
1557 \qmlproperty int Reminder::repetitionDelay
1558
1559 This property holds the delay (in seconds) between each repetition of the reminder.
1560 */
1561void QDeclarativeOrganizerItemReminder::setRepetitionDelay(int delaySeconds)
1562{
1563 if (delaySeconds != repetitionDelay()) {
1564 m_detail.setValue(field: QOrganizerItemReminder::FieldRepetitionDelay, value: delaySeconds);
1565 emit reminderChanged();
1566 }
1567}
1568
1569int QDeclarativeOrganizerItemReminder::repetitionDelay() const
1570{
1571 return m_detail.value<int>(field: QOrganizerItemReminder::FieldRepetitionDelay);
1572}
1573
1574/*!
1575 \qmlproperty int Reminder::secondsBeforeStart
1576
1577 This property holds the number of seconds prior to the activation of the item
1578 at which the user wants to be reminded of the item.
1579 */
1580void QDeclarativeOrganizerItemReminder::setSecondsBeforeStart(int seconds)
1581{
1582 if (seconds != secondsBeforeStart() || !m_detail.hasValue(field: QOrganizerItemReminder::FieldSecondsBeforeStart)) {
1583 m_detail.setValue(field: QOrganizerItemReminder::FieldSecondsBeforeStart, value: seconds);
1584 emit reminderChanged();
1585 }
1586}
1587
1588int QDeclarativeOrganizerItemReminder::secondsBeforeStart() const
1589{
1590 return m_detail.value<int>(field: QOrganizerItemReminder::FieldSecondsBeforeStart);
1591}
1592
1593
1594/*!
1595 \qmltype AudibleReminder
1596 \instantiates QDeclarativeOrganizerItemAudibleReminder
1597 \brief The AudibleReminder element contains information about an audible reminder of an item.
1598 \inqmlmodule QtOrganizer
1599 \ingroup qml-organizer-details
1600 \inherits Reminder
1601
1602 The following fields are supported:
1603 \list
1604 \li AudibleReminder.FieldRepetitionCount
1605 \li AudibleReminder.FieldRepetitionDelay
1606 \li AudibleReminder.FieldSecondsBeforeStart
1607 \li AudibleReminder.FieldDataUrl
1608 \endlist
1609
1610 \sa Reminder QOrganizerItemAudibleReminder
1611 */
1612
1613/*!
1614 \qmlsignal AudibleReminder::onDetailChanged()
1615
1616 \sa Detail::onDetailChanged
1617*/
1618
1619QDeclarativeOrganizerItemAudibleReminder::QDeclarativeOrganizerItemAudibleReminder(QObject *parent)
1620 : QDeclarativeOrganizerItemReminder(parent)
1621{
1622 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(reminderChanged()));
1623 setDetail(QOrganizerItemAudibleReminder());
1624}
1625
1626QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemAudibleReminder::type() const
1627{
1628 return QDeclarativeOrganizerItemDetail::AudibleReminder;
1629}
1630
1631/*!
1632 \qmlproperty url AudibleReminder::dataUrl
1633
1634 This property holds the url of the audible data to play.
1635 */
1636void QDeclarativeOrganizerItemAudibleReminder::setDataUrl(const QUrl &url)
1637{
1638 if (url != dataUrl()) {
1639 m_detail.setValue(field: QOrganizerItemAudibleReminder::FieldDataUrl, value: url);
1640 emit valueChanged();
1641 }
1642}
1643
1644QUrl QDeclarativeOrganizerItemAudibleReminder::dataUrl() const
1645{
1646 return m_detail.value<QUrl>(field: QOrganizerItemAudibleReminder::FieldDataUrl);
1647}
1648
1649
1650/*!
1651 \qmltype EmailReminder
1652 \instantiates QDeclarativeOrganizerItemEmailReminder
1653 \brief The EmailReminder element contains information about an email reminder of an item.
1654 \inqmlmodule QtOrganizer
1655 \ingroup qml-organizer-details
1656 \inherits Reminder
1657
1658 The following fields are supported:
1659 \list
1660 \li EmailReminder.FieldRepetitionCount
1661 \li EmailReminder.FieldRepetitionDelay
1662 \li EmailReminder.FieldSecondsBeforeStart
1663 \li EmailReminder.FieldSubject
1664 \li EmailReminder.FieldBody
1665 \li EmailReminder.FieldRecipients
1666 \li EmailReminder.FieldAttachments
1667 \endlist
1668
1669 \sa Reminder QOrganizerItemEmailReminder
1670 */
1671
1672/*!
1673 \qmlsignal EmailReminder::onDetailChanged()
1674
1675 \sa Detail::onDetailChanged
1676*/
1677
1678QDeclarativeOrganizerItemEmailReminder::QDeclarativeOrganizerItemEmailReminder(QObject *parent)
1679 : QDeclarativeOrganizerItemReminder(parent)
1680{
1681 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(reminderChanged()));
1682 setDetail(QOrganizerItemEmailReminder());
1683}
1684
1685QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemEmailReminder::type() const
1686{
1687 return QDeclarativeOrganizerItemDetail::EmailReminder;
1688}
1689
1690/*!
1691 \qmlproperty string EmailReminder::body
1692
1693 This property holds the body of the email.
1694 */
1695void QDeclarativeOrganizerItemEmailReminder::setBody(const QString &newBody)
1696{
1697 if (newBody != body()) {
1698 m_detail.setValue(field: QOrganizerItemEmailReminder::FieldBody, value: newBody);
1699 emit valueChanged();
1700 }
1701}
1702
1703QString QDeclarativeOrganizerItemEmailReminder::body() const
1704{
1705 return m_detail.value(field: QOrganizerItemEmailReminder::FieldBody).toString();
1706}
1707
1708/*!
1709 \qmlproperty string EmailReminder::subject
1710
1711 This property holds the subject of the email.
1712 */
1713void QDeclarativeOrganizerItemEmailReminder::setSubject(const QString &newSubject)
1714{
1715 if (newSubject != subject()) {
1716 m_detail.setValue(field: QOrganizerItemEmailReminder::FieldSubject, value: newSubject);
1717 emit valueChanged();
1718 }
1719}
1720
1721QString QDeclarativeOrganizerItemEmailReminder::subject() const
1722{
1723 return m_detail.value(field: QOrganizerItemEmailReminder::FieldSubject).toString();
1724}
1725
1726
1727/*!
1728 \qmlproperty list<string> EmailReminder::recipients
1729
1730 This property holds the list of recipients that the user wishes to be sent an email as part of the reminder.
1731 */
1732void QDeclarativeOrganizerItemEmailReminder::setRecipients(const QStringList &newRecipients)
1733{
1734 if (newRecipients != recipients()) {
1735 m_detail.setValue(field: QOrganizerItemEmailReminder::FieldRecipients, value: newRecipients);
1736 emit valueChanged();
1737 }
1738}
1739
1740QStringList QDeclarativeOrganizerItemEmailReminder::recipients() const
1741{
1742 return m_detail.value<QStringList>(field: QOrganizerItemEmailReminder::FieldRecipients);
1743}
1744
1745/*!
1746 \qmlproperty list<variant> EmailReminder::attachments
1747
1748 This property holds the attachments of the email.
1749 */
1750void QDeclarativeOrganizerItemEmailReminder::setAttachments(const QVariantList &newAttachments)
1751{
1752 if (newAttachments != attachments()) {
1753 m_detail.setValue(field: QOrganizerItemEmailReminder::FieldAttachments, value: newAttachments);
1754 emit valueChanged();
1755 }
1756}
1757
1758QVariantList QDeclarativeOrganizerItemEmailReminder::attachments()
1759{
1760 return m_detail.value<QVariantList>(field: QOrganizerItemEmailReminder::FieldAttachments);
1761}
1762
1763
1764/*!
1765 \qmltype VisualReminder
1766 \instantiates QDeclarativeOrganizerItemVisualReminder
1767 \brief The VisualReminder element contains information about a visual reminder of an item.
1768 \inqmlmodule QtOrganizer
1769 \ingroup qml-organizer-details
1770 \inherits Reminder
1771
1772 The following fields are supported:
1773 \list
1774 \li VisualReminder.FieldRepetitionCount
1775 \li VisualReminder.FieldRepetitionDelay
1776 \li VisualReminder.FieldSecondsBeforeStart
1777 \li VisualReminder.FieldDataUrl
1778 \li VisualReminder.FieldMessage
1779 \endlist
1780
1781 \sa Reminder QOrganizerItemVisualReminder
1782 */
1783
1784/*!
1785 \qmlsignal VisualReminder::onDetailChanged()
1786
1787 \sa Detail::onDetailChanged
1788*/
1789
1790QDeclarativeOrganizerItemVisualReminder::QDeclarativeOrganizerItemVisualReminder(QObject *parent)
1791 : QDeclarativeOrganizerItemReminder(parent)
1792{
1793 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(reminderChanged()));
1794 setDetail(QOrganizerItemVisualReminder());
1795}
1796
1797QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemVisualReminder::type() const
1798{
1799 return QDeclarativeOrganizerItemDetail::VisualReminder;
1800}
1801
1802/*!
1803 \qmlproperty string VisualReminder::message
1804
1805 This property holds the message which the user wishes to be displayed as part of the reminder.
1806 */
1807void QDeclarativeOrganizerItemVisualReminder::setMessage(const QString &msg)
1808{
1809 if (msg != message()) {
1810 m_detail.setValue(field: QOrganizerItemVisualReminder::FieldMessage, value: msg);
1811 emit valueChanged();
1812 }
1813}
1814
1815QString QDeclarativeOrganizerItemVisualReminder::message() const
1816{
1817 return m_detail.value<QString>(field: QOrganizerItemVisualReminder::FieldMessage);
1818}
1819
1820/*!
1821 \qmlproperty url VisualReminder::dataUrl
1822
1823 This property holds the url of the visual data which the user wishes to be displayed as part of the reminder.
1824 */
1825void QDeclarativeOrganizerItemVisualReminder::setDataUrl(const QUrl &url)
1826{
1827 if (url != dataUrl()) {
1828 m_detail.setValue(field: QOrganizerItemVisualReminder::FieldDataUrl, value: url);
1829 emit valueChanged();
1830 }
1831}
1832
1833QUrl QDeclarativeOrganizerItemVisualReminder::dataUrl() const
1834{
1835 return m_detail.value<QUrl>(field: QOrganizerItemVisualReminder::FieldDataUrl);
1836}
1837
1838
1839/*!
1840 \qmltype ExtendedDetail
1841 \instantiates QDeclarativeOrganizeritemExtendedDetail
1842 \brief The ExtendedDetail element contains a extended detail of an organizer item.
1843 \inqmlmodule QtOrganizer
1844 \ingroup qml-organizer-details
1845
1846 The following fields are supported:
1847 \list
1848 \li ExtendedDetail.FieldName
1849 \li ExtendedDetail.FieldData
1850 \endlist
1851
1852 \sa QOrganizerItemExtendedDetail
1853 */
1854
1855/*!
1856 \qmlsignal ExtendedDetail::onDetailChanged()
1857
1858 \sa Detail::onDetailChanged
1859*/
1860
1861QDeclarativeOrganizerItemExtendedDetail::QDeclarativeOrganizerItemExtendedDetail(QObject *parent)
1862 : QDeclarativeOrganizerItemDetail(parent)
1863{
1864 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1865 setDetail(QOrganizerItemExtendedDetail());
1866}
1867
1868QDeclarativeOrganizerItemExtendedDetail::DetailType QDeclarativeOrganizerItemExtendedDetail::type() const
1869{
1870 return QDeclarativeOrganizerItemDetail::ExtendedDetail;
1871}
1872
1873/*!
1874 \qmlproperty string ExtendedDetail::name
1875
1876 This property holds the name of the extended detail.
1877 */
1878void QDeclarativeOrganizerItemExtendedDetail::setName(const QString &newDetailName)
1879{
1880 if (newDetailName != name()) {
1881 m_detail.setValue(field: QOrganizerItemExtendedDetail::FieldName, value: newDetailName);
1882 emit valueChanged();
1883 }
1884}
1885
1886QString QDeclarativeOrganizerItemExtendedDetail::name() const
1887{
1888 return m_detail.value(field: QOrganizerItemExtendedDetail::FieldName).toString();
1889}
1890
1891/*!
1892 \qmlproperty variant ExtendedDetail::data
1893
1894 This property holds the data of the extended detail.
1895 */
1896void QDeclarativeOrganizerItemExtendedDetail::setData(const QVariant &newData)
1897{
1898 QVariant unboxedData(newData);
1899 if (newData.userType() == qMetaTypeId<QJSValue>()) {
1900 unboxedData = newData.value<QJSValue>().toVariant();
1901 }
1902
1903 if (unboxedData != data()) {
1904 setValue(field: QOrganizerItemExtendedDetail::FieldData, value: unboxedData);
1905 emit valueChanged();
1906 }
1907}
1908
1909QVariant QDeclarativeOrganizerItemExtendedDetail::data() const
1910{
1911 return m_detail.value(field: QOrganizerItemExtendedDetail::FieldData);
1912}
1913
1914/*!
1915 \qmltype EventAttendee
1916 \instantiates QDeclarativeOrganizerEventAttendee
1917 \brief The EventAttendee element contains information about an attendee of an event.
1918 \inqmlmodule QtOrganizer
1919 \ingroup qml-organizer-details
1920
1921 The following fields are supported:
1922 \list
1923 \li EventAttendee.FieldName
1924 \li EventAttendee.FieldEmailAddress
1925 \li EventAttendee.FieldAddendeeId
1926 \li EventAttendee.FieldParticipationStatus
1927 \li EventAttendee.FieldParticipationRole
1928 \endlist
1929
1930 \sa QOrganizerEventAttendee
1931 */
1932
1933/*!
1934 \qmlsignal EventAttendee::onDetailChanged()
1935
1936 \sa Detail::onDetailChanged
1937*/
1938
1939QDeclarativeOrganizerEventAttendee::QDeclarativeOrganizerEventAttendee(QObject *parent)
1940 : QDeclarativeOrganizerItemDetail(parent)
1941{
1942 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
1943 setDetail(QOrganizerEventAttendee());
1944}
1945
1946QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerEventAttendee::type() const
1947{
1948 return QDeclarativeOrganizerItemDetail::EventAttendee;
1949}
1950
1951/*!
1952 \qmlproperty variant EventAttendee::name
1953
1954 This property holds the name of the attendee.
1955 */
1956void QDeclarativeOrganizerEventAttendee::setName(const QString &newName)
1957{
1958 if (name() != newName) {
1959 m_detail.setValue(field: QOrganizerEventAttendee::FieldName, value: newName);
1960 emit valueChanged();
1961 }
1962}
1963
1964QString QDeclarativeOrganizerEventAttendee::name() const
1965{
1966 return m_detail.value(field: QOrganizerEventAttendee::FieldName).toString();
1967}
1968
1969/*!
1970 \qmlproperty variant EventAttendee::emailAddress
1971
1972 This property holds the email address of the attendee.
1973 */
1974void QDeclarativeOrganizerEventAttendee::setEmailAddress(const QString &newEmailAddress)
1975{
1976 if (emailAddress() != newEmailAddress) {
1977 m_detail.setValue(field: QOrganizerEventAttendee::FieldEmailAddress, value: newEmailAddress);
1978 emit valueChanged();
1979 }
1980}
1981
1982QString QDeclarativeOrganizerEventAttendee::emailAddress() const
1983{
1984 return m_detail.value(field: QOrganizerEventAttendee::FieldEmailAddress).toString();
1985}
1986
1987/*!
1988 \qmlproperty variant EventAttendee::participationStatus
1989
1990 This property holds the participation status of the attendee of the event. The value can be one of:
1991 \list
1992 \li EventAttendee.StatusUnknown
1993 \li EventAttendee.StatusAccepted
1994 \li EventAttendee.StatusDeclined
1995 \li EventAttendee.StatusTentative
1996 \li EventAttendee.StatusDelegated
1997 \li EventAttendee.StatusInProcess
1998 \li EventAttendee.StatusCompleted
1999 \endlist
2000 */
2001void QDeclarativeOrganizerEventAttendee::setParticipationStatus(ParticipationStatus status)
2002{
2003 if (participationStatus() != status) {
2004 m_detail.setValue(field: QOrganizerEventAttendee::FieldParticipationStatus, value: status);
2005 emit valueChanged();
2006 }
2007}
2008
2009QDeclarativeOrganizerEventAttendee::ParticipationStatus QDeclarativeOrganizerEventAttendee::participationStatus() const
2010{
2011 return static_cast<ParticipationStatus>(m_detail.value(field: QOrganizerEventAttendee::FieldParticipationStatus).toInt());
2012}
2013
2014/*!
2015 \qmlproperty variant EventAttendee::participationRole
2016
2017 This property holds the participation role of the attendee of the event.The value can be one of:
2018 \list
2019 \li EventAttendee.RoleUnknown
2020 \li EventAttendee.RoleOrganizer
2021 \li EventAttendee.RoleChairperson
2022 \li EventAttendee.RoleHost
2023 \li EventAttendee.RoleRequiredParticipant
2024 \li EventAttendee.RoleOptionalParticipant
2025 \li EventAttendee.RoleNonParticipant
2026 \endlist
2027 */
2028void QDeclarativeOrganizerEventAttendee::setParticipationRole(ParticipationRole role)
2029{
2030 if (participationRole() != role) {
2031 m_detail.setValue(field: QOrganizerEventAttendee::FieldParticipationRole, value: role);
2032 emit valueChanged();
2033 }
2034}
2035
2036QDeclarativeOrganizerEventAttendee::ParticipationRole QDeclarativeOrganizerEventAttendee::participationRole() const
2037{
2038 return static_cast<ParticipationRole>(m_detail.value(field: QOrganizerEventAttendee::FieldParticipationRole).toInt());
2039}
2040
2041/*!
2042 \qmlproperty variant EventAttendee::attendeeId
2043
2044 This property holds the unique identifier of the attendee.
2045 */
2046void QDeclarativeOrganizerEventAttendee::setAttendeeId(const QString &newAttendeeId)
2047{
2048 if (attendeeId() != newAttendeeId) {
2049 m_detail.setValue(field: QOrganizerEventAttendee::FieldAttendeeId, value: newAttendeeId);
2050 emit valueChanged();
2051 }
2052}
2053
2054QString QDeclarativeOrganizerEventAttendee::attendeeId() const
2055{
2056 return m_detail.value(field: QOrganizerEventAttendee::FieldAttendeeId).toString();
2057}
2058
2059/*!
2060 \qmltype EventRsvp
2061 \instantiates QDeclarativeOrganizerEventRsvp
2062 \brief The EventRsvp element contains Rsvp-information of an event.
2063 \inqmlmodule QtOrganizer
2064 \ingroup qml-organizer-details
2065
2066 EventRsvp detail contains user specific information about calendar event like
2067 participation status and role, information about response
2068 dates and information about organizer of the event. See more details
2069 from the properties themselves and the QOrganizerEventRsvp.
2070
2071 \sa QOrganizerEventRsvp
2072 */
2073
2074/*!
2075 \qmlsignal EventRsvp::onDetailChanged()
2076
2077 \sa Detail::onDetailChanged
2078*/
2079
2080QDeclarativeOrganizerEventRsvp::QDeclarativeOrganizerEventRsvp(QObject *parent)
2081 : QDeclarativeOrganizerItemDetail(parent)
2082{
2083 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
2084 setDetail(QOrganizerEventRsvp());
2085}
2086
2087QDeclarativeOrganizerEventRsvp::DetailType QDeclarativeOrganizerEventRsvp::type() const
2088{
2089 return QDeclarativeOrganizerItemDetail::EventRsvp;
2090}
2091
2092/*!
2093 \qmlmethod variant EventRsvp::value(field)
2094
2095 \sa Detail::value
2096 */
2097QVariant QDeclarativeOrganizerEventRsvp::value(int field) const
2098{
2099 switch (field) {
2100 case FieldResponseDeadline:
2101 {
2102 QDateTime date = responseDeadline();
2103 return date.isValid() ? date : QVariant();
2104 }
2105 case FieldResponseDate:
2106 {
2107 QDateTime date = responseDate();
2108 return date.isValid() ? date : QVariant();
2109 }
2110 default:
2111 {
2112 return m_detail.value(field);
2113 }
2114 }
2115}
2116
2117/*!
2118 \qmlmethod bool EventRsvp::setValue(field, value)
2119
2120 \sa Detail::setValue
2121 */
2122bool QDeclarativeOrganizerEventRsvp::setValue(int field, const QVariant &value)
2123{
2124 switch (field) {
2125 case FieldResponseDeadline:
2126 {
2127 if (value.canConvert<QDateTime>()) {
2128 setResponseDeadline(value.toDateTime());
2129 return true;
2130 }
2131 break;
2132 }
2133 case FieldResponseDate:
2134 {
2135 if (value.canConvert<QDateTime>()) {
2136 setResponseDate(value.toDateTime());
2137 return true;
2138 }
2139 break;
2140 }
2141 default:
2142 {
2143 if (m_detail.setValue(field, value))
2144 return true;
2145 }
2146 }
2147 return false;
2148}
2149
2150/*!
2151 \qmlproperty variant EventRsvp::participationStatus
2152
2153 This property holds the calendar user's participation status related to the event. See EventAttendee::participationStatus
2154 for more details.
2155
2156 \sa EventAttendee::participationStatus
2157 */
2158void QDeclarativeOrganizerEventRsvp::setParticipationStatus(QDeclarativeOrganizerEventAttendee::ParticipationStatus status)
2159{
2160 if (participationStatus() != status) {
2161 m_detail.setValue(field: QOrganizerEventRsvp::FieldParticipationStatus, value: status);
2162 emit valueChanged();
2163 }
2164}
2165
2166QDeclarativeOrganizerEventAttendee::ParticipationStatus QDeclarativeOrganizerEventRsvp::participationStatus() const
2167{
2168 return static_cast<QDeclarativeOrganizerEventAttendee::ParticipationStatus>(m_detail.value(field: QOrganizerEventRsvp::FieldParticipationStatus).toInt());
2169}
2170
2171/*!
2172 \qmlproperty variant EventRsvp::participationRole
2173
2174 This property holds the calendar user's participation role related to the event. See EventAttendee::participationRole
2175 for more details.
2176
2177 \sa EventAttendee::participationRole
2178 */
2179void QDeclarativeOrganizerEventRsvp::setParticipationRole(QDeclarativeOrganizerEventAttendee::ParticipationRole role)
2180{
2181 if (participationRole() != role) {
2182 m_detail.setValue(field: QOrganizerEventRsvp::FieldParticipationRole, value: role);
2183 emit valueChanged();
2184 }
2185}
2186
2187QDeclarativeOrganizerEventAttendee::ParticipationRole QDeclarativeOrganizerEventRsvp::participationRole() const
2188{
2189 return static_cast<QDeclarativeOrganizerEventAttendee::ParticipationRole>(m_detail.value(field: QOrganizerEventRsvp::FieldParticipationRole).toInt());
2190}
2191
2192/*!
2193 \qmlproperty variant EventRsvp::responseRequirement
2194
2195 This property holds the response requirement of the event. The value can be one of:
2196 \list
2197 \li EventRsvp.ResponseNotRequired
2198 \li EventRsvp.ResponseRequired
2199 \endlist
2200 */
2201void QDeclarativeOrganizerEventRsvp::setResponseRequirement(ResponseRequirement requirement)
2202{
2203 if (responseRequirement() != requirement) {
2204 m_detail.setValue(field: QOrganizerEventRsvp::FieldResponseRequirement, value: requirement);
2205 emit valueChanged();
2206 }
2207}
2208
2209QDeclarativeOrganizerEventRsvp::ResponseRequirement QDeclarativeOrganizerEventRsvp::responseRequirement() const
2210{
2211 return static_cast<ResponseRequirement>(m_detail.value(field: QOrganizerEventRsvp::FieldResponseRequirement).toInt());
2212}
2213
2214/*!
2215 \qmlproperty variant EventRsvp::responseDeadline
2216
2217 This property holds the last date for responding the event.
2218 */
2219void QDeclarativeOrganizerEventRsvp::setResponseDeadline(const QDateTime &date)
2220{
2221 if (responseDeadline() != date) {
2222 // If the value was likely set as a QDate, then assume that the time info can be ignored.
2223 // This is to ensure that dates like "2002-01-01" don't get interpretted as being
2224 // "2002-01-01T00:00:00+10:00" if the local timezone is GMT+10, and then being converted
2225 // to "2001-31-12T14:00:00Z" in UTC before having the (different) date "2001-31-12"
2226 // extracted for insertion into the FieldResponseDeadline value.
2227 if (date.timeSpec() == Qt::LocalTime && date.time() == QTime(0,0,0,0)) {
2228 m_detail.setValue(field: QOrganizerEventRsvp::FieldResponseDeadline, value: date.date());
2229 } else {
2230 m_detail.setValue(field: QOrganizerEventRsvp::FieldResponseDeadline, value: date.toUTC().date());
2231 }
2232 emit valueChanged();
2233 }
2234}
2235
2236QDateTime QDeclarativeOrganizerEventRsvp::responseDeadline() const
2237{
2238 QDateTime retDateTime(m_detail.value<QDate>(field: QOrganizerEventRsvp::FieldResponseDeadline), QTime(0, 0, 0, 0), Qt::UTC);
2239 return retDateTime;
2240}
2241
2242/*!
2243 \qmlproperty variant EventRsvp::responseDate
2244
2245 This property holds the date when user responded to the event.
2246 */
2247void QDeclarativeOrganizerEventRsvp::setResponseDate(const QDateTime &date)
2248{
2249 if (responseDate() != date) {
2250 // If the value was likely set as a QDate, then assume that the time info can be ignored.
2251 // This is to ensure that dates like "2002-01-01" don't get interpretted as being
2252 // "2002-01-01T00:00:00+10:00" if the local timezone is GMT+10, and then being converted
2253 // to "2001-31-12T14:00:00Z" in UTC before having the (different) date "2001-31-12"
2254 // extracted for insertion into the FieldResponseDate value.
2255 if (date.timeSpec() == Qt::LocalTime && date.time() == QTime(0,0,0,0)) {
2256 m_detail.setValue(field: QOrganizerEventRsvp::FieldResponseDate, value: date.date());
2257 } else {
2258 m_detail.setValue(field: QOrganizerEventRsvp::FieldResponseDate, value: date.toUTC().date());
2259 }
2260 emit valueChanged();
2261 }
2262}
2263
2264QDateTime QDeclarativeOrganizerEventRsvp::responseDate() const
2265{
2266 QDateTime retDateTime(m_detail.value<QDate>(field: QOrganizerEventRsvp::FieldResponseDate), QTime(0, 0, 0, 0), Qt::UTC);
2267 return retDateTime;
2268}
2269
2270/*!
2271 \qmlproperty variant EventRsvp::organizerName
2272
2273 This property holds organizer's name of the event.
2274 */
2275void QDeclarativeOrganizerEventRsvp::setOrganizerName(const QString &name)
2276{
2277 if (organizerName() != name) {
2278 m_detail.setValue(field: QOrganizerEventRsvp::FieldOrganizerName, value: name);
2279 emit valueChanged();
2280 }
2281}
2282
2283QString QDeclarativeOrganizerEventRsvp::organizerName() const
2284{
2285 return m_detail.value(field: QOrganizerEventRsvp::FieldOrganizerName).toString();
2286}
2287
2288/*!
2289 \qmlproperty variant EventRsvp::organizerEmail
2290
2291 This property holds organizer's email of the event.
2292 */
2293void QDeclarativeOrganizerEventRsvp::setOrganizerEmail(const QString &email)
2294{
2295 if (organizerEmail() != email) {
2296 m_detail.setValue(field: QOrganizerEventRsvp::FieldOrganizerEmail, value: email);
2297 emit valueChanged();
2298 }
2299}
2300
2301QString QDeclarativeOrganizerEventRsvp::organizerEmail() const
2302{
2303 return m_detail.value(field: QOrganizerEventRsvp::FieldOrganizerEmail).toString();
2304}
2305
2306/*!
2307 \qmltype Classification
2308 \instantiates QDeclarativeOrganizerItemClassification
2309 \brief The Classification element contains classification-information of an item.
2310 \inqmlmodule QtOrganizer
2311 \ingroup qml-organizer-details
2312
2313 The Classification detail contains classification related information. This can
2314 be used as a part of security model for the organizer.
2315
2316 \sa QOrganizerItemClassification
2317 */
2318
2319/*!
2320 \qmlsignal Classification::onDetailChanged()
2321
2322 \sa Detail::onDetailChanged
2323*/
2324
2325QDeclarativeOrganizerItemClassification::QDeclarativeOrganizerItemClassification(QObject *parent)
2326 : QDeclarativeOrganizerItemDetail(parent)
2327{
2328 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
2329 setDetail(QOrganizerItemClassification());
2330}
2331
2332QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemClassification::type() const
2333{
2334 return QDeclarativeOrganizerItemDetail::Classification;
2335}
2336
2337/*!
2338 \qmlproperty enumeration Classification::classification
2339
2340 This property holds the calendar item's classification related information. The value can be one of:
2341 \list
2342 \li Classification.AccessPublic
2343 \li Classification.AccessConfidential
2344 \li Classification.AccessPrivate
2345 \endlist
2346
2347 */
2348void QDeclarativeOrganizerItemClassification::setClassification(AccessClassification newClassification)
2349{
2350 if (classification() != newClassification) {
2351 m_detail.setValue(field: QOrganizerItemClassification::FieldClassification, value: newClassification);
2352 emit valueChanged();
2353 }
2354}
2355
2356QDeclarativeOrganizerItemClassification::AccessClassification QDeclarativeOrganizerItemClassification::classification() const
2357{
2358 return static_cast<AccessClassification>(m_detail.value(field: QOrganizerItemClassification::FieldClassification).toInt());
2359}
2360
2361
2362/*!
2363 \qmltype Version
2364 \instantiates QDeclarativeOrganizerItemVersion
2365 \brief The Version element contains versioning information of an organizer item.
2366 \inqmlmodule QtOrganizer
2367 \ingroup qml-organizer-details
2368
2369 \sa QOrganizerItemVersion
2370 */
2371
2372/*!
2373 \qmlsignal Version::onDetailChanged()
2374
2375 \sa Detail::onDetailChanged
2376*/
2377
2378QDeclarativeOrganizerItemVersion::QDeclarativeOrganizerItemVersion(QObject *parent)
2379 : QDeclarativeOrganizerItemDetail(parent)
2380{
2381 connect(asender: this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
2382 setDetail(QOrganizerItemVersion());
2383}
2384
2385QDeclarativeOrganizerItemDetail::DetailType QDeclarativeOrganizerItemVersion::type() const
2386{
2387 return QDeclarativeOrganizerItemDetail::Version;
2388}
2389
2390/*!
2391 \qmlproperty int Version::version
2392
2393 This property holds the integer version of an organizer item, which can be used as the sequence
2394 number as per iCalendar spec.
2395 */
2396void QDeclarativeOrganizerItemVersion::setVersion(int newVersion)
2397{
2398 if (version() != newVersion) {
2399 m_detail.setValue(field: QOrganizerItemVersion::FieldVersion, value: newVersion);
2400 emit valueChanged();
2401 }
2402}
2403
2404int QDeclarativeOrganizerItemVersion::version() const
2405{
2406 return m_detail.value(field: QOrganizerItemVersion::FieldVersion).toInt();
2407}
2408
2409/*!
2410 \qmlproperty string Version::extendedVersion
2411
2412 This property holds the extended version of an organizer item, which can be used to represent
2413 the version stored in the back-end.
2414 */
2415void QDeclarativeOrganizerItemVersion::setExtendedVersion(const QString &newExtendedVersion)
2416{
2417 if (extendedVersion() != newExtendedVersion) {
2418 m_detail.setValue(field: QOrganizerItemVersion::FieldExtendedVersion, value: newExtendedVersion);
2419 emit valueChanged();
2420 }
2421}
2422
2423QString QDeclarativeOrganizerItemVersion::extendedVersion() const
2424{
2425 QByteArray version = m_detail.value(field: QOrganizerItemVersion::FieldExtendedVersion).toByteArray();
2426 return QString::fromLatin1(str: version.constData(), size: version.length());
2427}
2428
2429
2430QDeclarativeOrganizerItemDetail *QDeclarativeOrganizerItemDetailFactory::createItemDetail(QDeclarativeOrganizerItemDetail::DetailType type)
2431{
2432 QDeclarativeOrganizerItemDetail *itemDetail;
2433 if (type == QDeclarativeOrganizerItemDetail::EventTime)
2434 itemDetail = new QDeclarativeOrganizerEventTime;
2435 else if (type == QDeclarativeOrganizerItemDetail::AudibleReminder)
2436 itemDetail = new QDeclarativeOrganizerItemAudibleReminder;
2437 else if (type == QDeclarativeOrganizerItemDetail::Comment)
2438 itemDetail = new QDeclarativeOrganizerItemComment;
2439 else if (type == QDeclarativeOrganizerItemDetail::Description)
2440 itemDetail = new QDeclarativeOrganizerItemDescription;
2441 else if (type == QDeclarativeOrganizerItemDetail::DisplayLabel)
2442 itemDetail = new QDeclarativeOrganizerItemDisplayLabel;
2443 else if (type == QDeclarativeOrganizerItemDetail::EmailReminder)
2444 itemDetail = new QDeclarativeOrganizerItemEmailReminder;
2445 else if (type == QDeclarativeOrganizerItemDetail::Guid)
2446 itemDetail = new QDeclarativeOrganizerItemGuid;
2447 else if (type == QDeclarativeOrganizerItemDetail::Location)
2448 itemDetail = new QDeclarativeOrganizerItemLocation;
2449 else if (type == QDeclarativeOrganizerItemDetail::Parent)
2450 itemDetail = new QDeclarativeOrganizerItemParent;
2451 else if (type == QDeclarativeOrganizerItemDetail::Priority)
2452 itemDetail = new QDeclarativeOrganizerItemPriority;
2453 else if (type == QDeclarativeOrganizerItemDetail::Recurrence)
2454 itemDetail = new QDeclarativeOrganizerItemRecurrence;
2455 else if (type == QDeclarativeOrganizerItemDetail::Reminder)
2456 itemDetail = new QDeclarativeOrganizerItemReminder;
2457 else if (type == QDeclarativeOrganizerItemDetail::Tag)
2458 itemDetail = new QDeclarativeOrganizerItemTag;
2459 else if (type == QDeclarativeOrganizerItemDetail::Timestamp)
2460 itemDetail = new QDeclarativeOrganizerItemTimestamp;
2461 else if (type == QDeclarativeOrganizerItemDetail::ItemType)
2462 itemDetail = new QDeclarativeOrganizerItemType;
2463 else if (type == QDeclarativeOrganizerItemDetail::VisualReminder)
2464 itemDetail = new QDeclarativeOrganizerItemVisualReminder;
2465 else if (type == QDeclarativeOrganizerItemDetail::JournalTime)
2466 itemDetail = new QDeclarativeOrganizerJournalTime;
2467 else if (type == QDeclarativeOrganizerItemDetail::TodoProgress)
2468 itemDetail = new QDeclarativeOrganizerTodoProgress;
2469 else if (type == QDeclarativeOrganizerItemDetail::TodoTime)
2470 itemDetail = new QDeclarativeOrganizerTodoTime;
2471 else if (type == QDeclarativeOrganizerItemDetail::ExtendedDetail)
2472 itemDetail = new QDeclarativeOrganizerItemExtendedDetail;
2473 else if (type == QDeclarativeOrganizerItemDetail::EventAttendee)
2474 itemDetail = new QDeclarativeOrganizerEventAttendee;
2475 else if (type == QDeclarativeOrganizerItemDetail::EventRsvp)
2476 itemDetail = new QDeclarativeOrganizerEventRsvp;
2477 else if (type == QDeclarativeOrganizerItemDetail::Classification)
2478 itemDetail = new QDeclarativeOrganizerItemClassification;
2479 else if (type == QDeclarativeOrganizerItemDetail::Version)
2480 itemDetail = new QDeclarativeOrganizerItemVersion;
2481 else
2482 itemDetail = new QDeclarativeOrganizerItemDetail;
2483 return itemDetail;
2484}
2485
2486#include "moc_qdeclarativeorganizeritemdetail_p.cpp"
2487
2488QT_END_NAMESPACE
2489

source code of qtpim/src/imports/organizer/qdeclarativeorganizeritemdetail.cpp