summaryrefslogtreecommitdiffstats
path: root/plugins/declarative/organizer/qdeclarativeorganizeritem.cpp
blob: 0b1aa14c63e8079bea49d366d92f7374bf0ec8f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qdeclarativeorganizeritemdetail_p.h"
#include "qdeclarativeorganizeritem_p.h"
#include "qdeclarativeorganizeritemmetaobject_p.h"
#include "qdeclarativeorganizermodel_p.h"

/*!
    \qmlclass OrganizerItem QDeclarativeOrganizerItem

    \brief The OrganizerItem element represents the in-memory version of a calendar organizer item,
  and has no tie to a specific backend calendar store.

    \ingroup qml-organizer
    \since Mobility 1.1

  A OrganizerItem has a number of mandatory details. Different subclasses of OrganizerItem
  (i.e., Event, EventOccurrence, Journal, Todo, TodoOccurrence, Note) may have more mandatory details.

    If some of the organizer item details are non-unique, all of this type of detail values
    can be accessed by dynamic properties. For example, there are 3 comment details stored in
    an event item, they can be accessed by event.comments property, which holds a list of
    all comment details. If the dynamic property does not exist (for unique details), an undefined
    value is returned. The list of dynamic detail properties depends on the engine implementations.

  \sa Event, EventOccurrence, Journal, Todo, TodoOccurrence, Note, {QOrganizerManager}, {QOrganizerItem}

  The OrganizerItem element is part of the \bold{QtMobility.organizer 1.1} module.
*/




QDeclarativeOrganizerItem::QDeclarativeOrganizerItem(QObject *parent)
    :QObject(parent),
    d(new QDeclarativeOrganizerItemMetaObject(this, QOrganizerItem()))
{
    d->setMetaObject(QDeclarativeOrganizerItem::staticMetaObject);
    connect(this, SIGNAL(itemChanged()), SLOT(setModified()));
}


QDeclarativeOrganizerItem::QDeclarativeOrganizerItem(const QOrganizerItem& item, const QMap<QString, QOrganizerItemDetailDefinition>& defs, QObject *parent)
    :QObject(parent),
    d(new QDeclarativeOrganizerItemMetaObject(this, item))
{
    d->setMetaObject(QDeclarativeOrganizerItem::staticMetaObject);
    setDetailDefinitions(defs);
    connect(this, SIGNAL(itemChanged()), SLOT(setModified()));
}

QDeclarativeOrganizerItem::~QDeclarativeOrganizerItem()
{
    delete d;
}

void QDeclarativeOrganizerItem::setDetailDefinitions(const QMap<QString, QOrganizerItemDetailDefinition>& defs)
{
    d->m_defs = defs;
}

QMap<QString, QOrganizerItemDetailDefinition> QDeclarativeOrganizerItem::detailDefinitions() const
{
    return d->m_defs;
}

void QDeclarativeOrganizerItem::setItem(const QOrganizerItem& item)
{
   d->setItem(item);
   emit itemChanged ();
   d->m_modified = false;
}

QOrganizerItem QDeclarativeOrganizerItem::item() const
{
    return d->item();
}


/*!
  \qmlproperty string OrganizerItem::itemId
  \since Mobility 1.1

   This property holds the id of the OrganizerItem object.
   This property is read only.
  */
QString QDeclarativeOrganizerItem::itemId() const
{
    return d->itemId();
}

/*!
  \qmlproperty string OrganizerItem::manager
  \since Mobility 1.1

  This property holds the manager uri which the \l OrganizerItem object comes from.
  */
QString QDeclarativeOrganizerItem::manager() const
{
    return d->m_item.id().managerUri();
}

/*!
  \qmlproperty bool OrganizerItem::modified
  \since Mobility 1.1

   This property holds the dirty flag of the OrganizerItem object.
   If the OrganizerItem has been changed, returns true, otherwise returns false.

   \sa OrganizerItem::save
  */
bool QDeclarativeOrganizerItem::modified() const
{
    return d->m_modified;
}

/*!
  \qmlproperty bool OrganizerItem::isFloatingTime
  \since Mobility 1.1

   This property indicates whether the organizer item created with floating date time.
   A floating time will always appear with the same value regardless of what time zone the user is in.
   A non-floating (absolute) time represents the same time regardless of the time zone,
   but will appear to change in value if the user's time zone changes.
   This property is read only.

  */
bool QDeclarativeOrganizerItem::isFloatingTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
    case QDeclarativeOrganizerItem::EventOccurrence:
        return d->m_item.detail<QOrganizerEventTime>().startDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Todo:
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return d->m_item.detail<QOrganizerTodoTime>().startDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Journal:
        return d->m_item.detail<QOrganizerJournalTime>().entryDateTime().timeSpec() == Qt::LocalTime;
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    return d->m_item.detail<QOrganizerItemTimestamp>().created().timeSpec() == Qt::LocalTime;
}

/*!
  \qmlproperty date OrganizerItem::itemStartTime
  \since Mobility 1.1

   This property holds the start date time of the OrganizerItem object.
   For differrent organizer item type, the return value is differrent, too.

   \sa QDeclarativeOrganizerItem::OrganizerItemType
  */
QDateTime QDeclarativeOrganizerItem::itemStartTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
        return static_cast<const QDeclarativeOrganizerEvent*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::EventOccurrence:
        return static_cast<const QDeclarativeOrganizerEventOccurrence*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::Todo:
        return static_cast<const QDeclarativeOrganizerTodo*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return static_cast<const QDeclarativeOrganizerTodoOccurrence*>(this)->startDateTime();
    case QDeclarativeOrganizerItem::Journal:
        return static_cast<const QDeclarativeOrganizerJournal*>(this)->dateTime();
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    return item().detail<QOrganizerItemTimestamp>().created().toLocalTime();
}

/*!
  \qmlproperty date OrganizerItem::itemEndTime
  \since Mobility 1.1

   This property holds the end date time of the OrganizerItem object.
   For different organizer item type, the return value is different, too.

   \sa QDeclarativeOrganizerItem::OrganizerItemType
  */

QDateTime QDeclarativeOrganizerItem::itemEndTime() const
{
    switch (itemType()) {
    case QDeclarativeOrganizerItem::Event:
        return static_cast<const QDeclarativeOrganizerEvent*>(this)->endDateTime();
    case QDeclarativeOrganizerItem::EventOccurrence:
        return static_cast<const QDeclarativeOrganizerEventOccurrence*>(this)->endDateTime();
    case QDeclarativeOrganizerItem::Todo:
        return static_cast<const QDeclarativeOrganizerTodo*>(this)->dueDateTime();
    case QDeclarativeOrganizerItem::TodoOccurrence:
        return static_cast<const QDeclarativeOrganizerTodoOccurrence*>(this)->dueDateTime();
    case QDeclarativeOrganizerItem::Journal:
        //there is no end time for journal item,  make it 30mins later for display purpose
        return static_cast<const QDeclarativeOrganizerJournal*>(this)->dateTime().addSecs(60*30);
    case QDeclarativeOrganizerItem::Note:
    default:
        break;
    }
    //there is no end time for note or customized items,  make it 30mins later for display purpose
    return item().detail<QOrganizerItemTimestamp>().created().toLocalTime().addSecs(60*30);
}


void QDeclarativeOrganizerItem::setModified()
{
    d->m_modified = true;
}

/*!
  \qmlmethod Detail OrganizerItem::detail(name)
  \since Mobility 1.1

    This method returns an \l Detail object which detail name is \a name.
  */
QVariant QDeclarativeOrganizerItem::detail(const QString& name)
{
    return d->detail(name);
}

/*!
    \qmlproperty list<Detail> OrganizerItem::details
    \since Mobility 1.1

    This property holds the list of \l Detail elements that the organizer item has.
*/
QDeclarativeListProperty<QDeclarativeOrganizerItemDetail> QDeclarativeOrganizerItem::details()
{
    return d->details(QString()).value< QDeclarativeListProperty<QDeclarativeOrganizerItemDetail> >();
}

/*!
  \qmlmethod list<Detail> OrganizerItem::details(name)
  \since Mobility 1.1

    This method returns a list of details which detail name is \a name.
  */
QVariant QDeclarativeOrganizerItem::details(const QString& name)
{
    return d->details(name);
}

/*!
    \qmlmethod OrganizerItem::addComment(comment)
    \since Mobility 1.1

    Addes a \a comment for the organizer item.

    \sa OrganizerItem::clearComments()
*/
void QDeclarativeOrganizerItem::addComment(const QString& comment)
{
    d->m_item.addComment(comment);
    emit itemChanged();
}

/*!
    \qmlmethod OrganizerItem::clearComments()
    \since Mobility 1.1

    Removes all comments from the organizer item.

    \sa OrganizerItem::addComment()
*/
void QDeclarativeOrganizerItem::clearComments()
{
    d->m_item.clearComments();
    emit itemChanged();
}

/*!
    \qmlmethod bool OrganizerItem::removeDetail(detail)
    \since Mobility 1.1

    Removes given \a detail from the organizer item. If the detail is not removable, returns false.

    \sa Detail::removable
*/
bool QDeclarativeOrganizerItem::removeDetail(QDeclarativeOrganizerItemDetail* detail)
{
    if (detail->removable()) {
        d->m_details.removeAll(detail);
        emit itemChanged();
        return true;
    }
    return false;

}

/*!
    \qmlmethod bool OrganizerItem::addDetail(detail)
    \since Mobility 1.1

    Adds the given organizer item \a detail to the organizer item, returns true if successful, otherwise returns false.

    \note: If the \a detail has been added into the same organizer item before, this operation will be ignored,
    so if you want to add a \a detail multiple times, the \a detail should be copied before calling this function.
*/
bool QDeclarativeOrganizerItem::addDetail(QDeclarativeOrganizerItemDetail* detail)
{
    if (detail) {
        if (!d->m_details.contains(detail)) {
            d->m_details.append(detail);
            emit itemChanged();
        }
        return true;
    }
    return false;
}

/*!
    \qmlmethod OrganizerItem::clearDetails()
    \since Mobility 1.1

    Removes all details from the organizer item.

    \sa OrganizerItem::removeDetail()
*/
void QDeclarativeOrganizerItem::clearDetails()
{
    d->m_item.clearDetails();
    d->m_details.clear();
    emit itemChanged();
}

/*!
    \qmlmethod OrganizerItem::save()
    \since Mobility 1.1

    Saves this OrganizerItem if the item has been modified.

    \sa  OrganizerItem::modified
*/
void QDeclarativeOrganizerItem::save()
{
    if (modified()) {
        QDeclarativeOrganizerModel* model = qobject_cast<QDeclarativeOrganizerModel*>(parent());
        if (model) {
            model->saveItem(this);
        }
    }
}

/*!
    \qmlproperty string OrganizerItem::type
    \since Mobility 1.1

    This property holds the type name of the organizer item.
    This property is read only.
*/
QString QDeclarativeOrganizerItem::type() const
{
    return d->m_item.type();
}

QDeclarativeOrganizerItem::OrganizerItemType QDeclarativeOrganizerItem::itemType() const
{
    if (d->m_item.type() == QOrganizerItemType::TypeEvent)
        return QDeclarativeOrganizerItem::Event;
    else if (d->m_item.type() == QOrganizerItemType::TypeEventOccurrence)
        return QDeclarativeOrganizerItem::EventOccurrence;
    else if (d->m_item.type() == QOrganizerItemType::TypeTodo)
        return QDeclarativeOrganizerItem::Todo;
    else if (d->m_item.type() == QOrganizerItemType::TypeTodoOccurrence)
        return QDeclarativeOrganizerItem::TodoOccurrence;
    else if (d->m_item.type() == QOrganizerItemType::TypeJournal)
        return QDeclarativeOrganizerItem::Journal;
    else if (d->m_item.type() == QOrganizerItemType::TypeNote)
        return QDeclarativeOrganizerItem::Note;
    return QDeclarativeOrganizerItem::Customized;
}

/*!
    \qmlproperty string OrganizerItem::displayLabel
    \since Mobility 1.1

    This property holds the display label of the organizer item.
*/
QString QDeclarativeOrganizerItem::displayLabel() const
{
    QDeclarativeOrganizerItemDisplayLabel* dl = d->detail<QDeclarativeOrganizerItemDisplayLabel>();
    if (dl)
        return dl->label();
    return QString();
}

void QDeclarativeOrganizerItem::setDisplayLabel(const QString& label)
{
    QDeclarativeOrganizerItemDisplayLabel* dl = d->detail<QDeclarativeOrganizerItemDisplayLabel>();
    if (dl)
        dl->setLabel(label);
}

/*!
    \qmlproperty string OrganizerItem::description
    \since Mobility 1.1

    This property holds the description text of the organizer item.
*/
QString QDeclarativeOrganizerItem::description() const
{
    QDeclarativeOrganizerItemDescription* desc = d->detail<QDeclarativeOrganizerItemDescription>();
    if (desc)
        return desc->description();
    return QString();
}

void QDeclarativeOrganizerItem::setDescription(const QString& description)
{
    QDeclarativeOrganizerItemDescription* desc = d->detail<QDeclarativeOrganizerItemDescription>();
    if (desc)
        desc->setDescription(description);
}

/*!
    \qmlproperty string OrganizerItem::guid
    \since Mobility 1.1

    This property holds the GUID string of the organizer item.
*/
QString QDeclarativeOrganizerItem::guid() const
{
    QDeclarativeOrganizerItemGuid* id = d->detail<QDeclarativeOrganizerItemGuid>();
    if (id)
        return id->guid();
    return QString();
}
void QDeclarativeOrganizerItem::setGuid(const QString& guid)
{
    QDeclarativeOrganizerItemGuid* id = d->detail<QDeclarativeOrganizerItemGuid>();
    if (id)
        id->setGuid(guid);
}

/*!
    \qmlproperty bool OrganizerItem::isOccurrence
    \since Mobility 1.1

    If this OrganizerItem is an occurrence item, returns true, otherwise returns false.

    This is a read only property.
*/
bool QDeclarativeOrganizerItem::isOccurrence() const
{
      return itemType() == QDeclarativeOrganizerItem::EventOccurrence || itemType() == QDeclarativeOrganizerItem::TodoOccurrence;
}
///////////////////////QDeclarativeOrganizerEvent////////////////////////////////////

/*!
    \qmlclass Event QDeclarativeOrganizerEvent

    \brief The Event element provides an event in time which may reoccur.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, EventOccurrence, Journal, Todo, TodoOccurrence, Note, {QOrganizerEvent}

  The Event element is part of the \bold{QtMobility.organizer 1.1} module.
*/
QDeclarativeOrganizerEvent::QDeclarativeOrganizerEvent(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerEvent());
    d->setMetaObject(QDeclarativeOrganizerEvent::staticMetaObject);
    connect(this, SIGNAL(valueChanged()), SIGNAL(itemChanged()));
}

/*!
  \qmlproperty date Event::startDateTime
  \since Mobility 1.1

  This property holds the start date time of the event.
  */
void QDeclarativeOrganizerEvent::setStartDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        time->setStartDateTime(datetime);
}

QDateTime QDeclarativeOrganizerEvent::startDateTime() const
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        return time->startDateTime();
    return QDateTime();
}

/*!
  \qmlproperty date Event::endDateTime
  \since Mobility 1.1

  This property holds the end date time of the event.
  */

void QDeclarativeOrganizerEvent::setEndDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        time->setEndDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEvent::endDateTime() const
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        return time->endDateTime();
    return QDateTime();
}

/*!
  \qmlproperty bool Event::allDay
  \since Mobility 1.1

  This property indicates whether the time-of-day component of the event's start date-time or end date-time is
  insignificant. If allDay is true, the time-of-day component is considered insignificant, and the event will
  be an all-day item.
  */
void QDeclarativeOrganizerEvent::setAllDay(bool allDay)
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        time->setAllDay(allDay);
}
bool QDeclarativeOrganizerEvent::isAllDay() const
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    return time->isAllDay();
}

/*!
  \qmlproperty enumeration Event::priority
  \since Mobility 1.1

  This property holds the priority of the event. The value can be one of:
  \list
  \o Priority.Unknown
  \o Priority.Highest
  \o Priority.ExtremelyHigh
  \o Priority.VeryHigh
  \o Priority.High
  \o Priority.Medium
  \o Priority.Low
  \o Priority.VeryLow
  \o Priority.ExtremelyLow
  \o Priority.Lowest
  \endlist
  \sa Priority
  */
void QDeclarativeOrganizerEvent::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
    QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
    if (priority)
        priority->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEvent::priority() const
{
    QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
    if (priority)
        return priority->priority();
    return QDeclarativeOrganizerItemPriority::Unknown;
}

/*!
  \qmlproperty string Event::location
  \since Mobility 1.1

  This property holds the label of the location at which the event occurs.
  */
QString QDeclarativeOrganizerEvent::location() const
{
    QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
    if (loc)
        return loc->label();
    return QString();
}
void QDeclarativeOrganizerEvent::setLocation(const QString& newLocation)
{
    QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
    if (loc)
        loc->setLabel(newLocation);
}

/*!
  \qmlproperty Recurrence Event::recurrence
  \since Mobility 1.1

  This property holds the recurrence element of the event item.
  */
QDeclarativeOrganizerItemRecurrence* QDeclarativeOrganizerEvent::recurrence()
{
    QDeclarativeOrganizerItemDetail* detail = d->detail(QDeclarativeOrganizerItemRecurrence::DetailName).value<QDeclarativeOrganizerItemDetail*>();
    return static_cast<QDeclarativeOrganizerItemRecurrence*>(detail);
}


///////////////////////////QDeclarativeOrganizerEventOccurrence////////////////////////////
/*!
    \qmlclass EventOccurrence QDeclarativeOrganizerEventOccurrence

    \brief The EventOccurrence element provides an occurrence of an event.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, Event, Journal, Todo, TodoOccurrence, Note, {QOrganizerEventOccurrence}

  The EventOccurrence element is part of the \bold{QtMobility.organizer 1.1} module.
*/

QDeclarativeOrganizerEventOccurrence::QDeclarativeOrganizerEventOccurrence(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerEventOccurrence());
    d->setMetaObject(QDeclarativeOrganizerEventOccurrence::staticMetaObject);
    connect(this, SIGNAL(valueChanged()), SIGNAL(itemChanged()));
}

/*!
  \qmlproperty date EventOccurrence::originalDate
  \since Mobility 1.1

  This property holds the date at which the occurrence was originally going to occur.
  */
void QDeclarativeOrganizerEventOccurrence::setOriginalDate(const QDate& date)
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        parent->setOriginalDate(date);
}

QDate QDeclarativeOrganizerEventOccurrence::originalDate() const
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        return parent->originalDate();
    return QDate();
}

/*!
  \qmlproperty date EventOccurrence::startDateTime
  \since Mobility 1.1

  This property holds the start date time of the event occurrence.
  */
void QDeclarativeOrganizerEventOccurrence::setStartDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        time->setStartDateTime(datetime);
}

QDateTime QDeclarativeOrganizerEventOccurrence::startDateTime() const
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    return time->startDateTime();
}

/*!
  \qmlproperty int EventOccurrence::parentId
  \since Mobility 1.1

  This property holds the id of the event which is this occurrence's parent.
  */
void QDeclarativeOrganizerEventOccurrence::setParentId(const QString& pid)
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        parent->setParentId(pid);
}

QString QDeclarativeOrganizerEventOccurrence::parentId() const
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        return parent->parentId();
    return QString();
}


/*!
  \qmlproperty date EventOccurrence::endDateTime
  \since Mobility 1.1

  This property holds the date time at which the event occurrence ends.
  */
void QDeclarativeOrganizerEventOccurrence::setEndDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    if (time)
        time->setEndDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEventOccurrence::endDateTime() const
{
    QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
    return time->endDateTime();
}

/*!
  \qmlproperty enumeration EventOccurrence::priority
  \since Mobility 1.1

  This property holds the priority of the event occurrence. The value can be one of:
  \list
  \o Priority.Unknown
  \o Priority.Highest
  \o Priority.ExtremelyHigh
  \o Priority.VeryHigh
  \o Priority.High
  \o Priority.Medium
  \o Priority.Low
  \o Priority.VeryLow
  \o Priority.ExtremelyLow
  \o Priority.Lowest
  \endlist
  \sa Priority
  */
void QDeclarativeOrganizerEventOccurrence::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
    QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
    if (priority)
        priority->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEventOccurrence::priority() const
{
    QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
    if (priority)
        return priority->priority();
    return QDeclarativeOrganizerItemPriority::Unknown;
}

/*!
  \qmlproperty string EventOccurrence::location

  This property holds the label of the location at which the event occurrence is held.
  */
QString QDeclarativeOrganizerEventOccurrence::location() const
{
    QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
    if (loc)
        return loc->label();
    return QString();
}
void QDeclarativeOrganizerEventOccurrence::setLocation(const QString& newLocation)
{
    QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
    if (loc)
        loc->setLabel(newLocation);
}
////////////////////////////////QDeclarativeOrganizerJournal////////////////////////////////////

/*!
    \qmlclass Journal QDeclarativeOrganizerJournal

    \brief The Journal element provides a journal which is associated with a particular point in time.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, Event, EventOccurrence, Todo, TodoOccurrence, Note, {QOrganizerJournal}

  The Journal element is part of the \bold{QtMobility.organizer 1.1} module.
*/

QDeclarativeOrganizerJournal::QDeclarativeOrganizerJournal(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerJournal());
    d->setMetaObject(QDeclarativeOrganizerJournal::staticMetaObject);
    connect(this, SIGNAL(valueChanged()), SIGNAL(itemChanged()));
}

/*!
  \qmlproperty date Journal::dateTime
  \since Mobility 1.1

  This property holds the date time associated with this journal.
  */
void QDeclarativeOrganizerJournal::setDateTime(const QDateTime& dt)
{
    QDeclarativeOrganizerJournalTime* time = d->detail<QDeclarativeOrganizerJournalTime>();
    if (time)
        time->setEntryDateTime(dt);
}

QDateTime QDeclarativeOrganizerJournal::dateTime() const
{
    QDeclarativeOrganizerJournalTime* time = d->detail<QDeclarativeOrganizerJournalTime>();
    if (time)
        return time->entryDateTime();
    return QDateTime();
}

////////////////////QDeclarativeOrganizerNote////////////////////////
/*!
    \qmlclass Note QDeclarativeOrganizerNote

    \brief The Note element provides a note which is not associated with any particular point in time.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, Event, EventOccurrence, Journal, Todo, TodoOccurrence, {QOrganizerNote}

  The Note element is part of the \bold{QtMobility.organizer 1.1} module.
*/


QDeclarativeOrganizerNote::QDeclarativeOrganizerNote(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerNote());

    d->setMetaObject(QDeclarativeOrganizerNote::staticMetaObject);
}

//////////////////////QDeclarativeOrganizerTodo////////////////////////////////
/*!
    \qmlclass Todo QDeclarativeOrganizerTodo

    \brief The Todo element provides a task which should be completed.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, Event, EventOccurrence, Journal, TodoOccurrence, Note, {QOrganizerTodo}

  The Todo element is part of the \bold{QtMobility.organizer 1.1} module.
*/

QDeclarativeOrganizerTodo::QDeclarativeOrganizerTodo(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerTodo());
    d->setMetaObject(QDeclarativeOrganizerTodo::staticMetaObject);
    connect(this, SIGNAL(valueChanged()), SIGNAL(itemChanged()));
}

/*!
  \qmlproperty Recurrence Todo::recurrence
  \since Mobility 1.1

  This property holds the recurrence element of the todo item.
  */
QDeclarativeOrganizerItemRecurrence* QDeclarativeOrganizerTodo::recurrence()
{
    QDeclarativeOrganizerItemDetail* detail = d->detail(QDeclarativeOrganizerItemRecurrence::DetailName).value<QDeclarativeOrganizerItemDetail*>();
    return static_cast<QDeclarativeOrganizerItemRecurrence*>(detail);
}

/*!
  \qmlproperty date Todo::startDateTime
  \since Mobility 1.1

  This property holds the date time at which the task should be started.
  */
void QDeclarativeOrganizerTodo::setStartDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        time->setStartDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodo::startDateTime() const
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        return time->startDateTime();
    return QDateTime();
}

/*!
  \qmlproperty date Todo::dueDateTime
  \since Mobility 1.1

  This property holds the date time by which the task should be completed.
  */
void QDeclarativeOrganizerTodo::setDueDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        time->setDueDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodo::dueDateTime() const
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        return time->dueDateTime();
    return QDateTime();
}

/*!
  \qmlproperty bool Todo::allDay
  \since Mobility 1.1

  This property indicates whether the time-of-day component of the Todo's start date-time or due date-time is
  insignificant. If allDay is true, the time-of-day component is considered insignificant, and the todo will
  be an all-day item.
  */
void QDeclarativeOrganizerTodo::setAllDay(bool allDay)
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        time->setAllDay(allDay);
}

bool QDeclarativeOrganizerTodo::isAllDay() const
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        return time->isAllDay();
    return false;
}

/*!
  \qmlproperty enumeration Todo::priority
  \since Mobility 1.1

  This property holds the priority of the todo item. The value can be one of:
  \list
  \o Priority.Unknown
  \o Priority.Highest
  \o Priority.ExtremelyHigh
  \o Priority.VeryHigh
  \o Priority.High
  \o Priority.Medium
  \o Priority.Low
  \o Priority.VeryLow
  \o Priority.ExtremelyLow
  \o Priority.Lowest
  \endlist
  \sa Priority
  */
void QDeclarativeOrganizerTodo::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
    QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
    if (pri)
        pri->setPriority(value);
}

QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodo::priority() const
{
    QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
    if (pri)
        return pri->priority();
    return QDeclarativeOrganizerItemPriority::Unknown;
}

/*!
  \qmlproperty int Todo::progressPercentage
  \since Mobility 1.1

  This property holds the percentage of progress completed on the task described by the todo item.
  */
void QDeclarativeOrganizerTodo::setProgressPercentage(int percentage)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setPercentageComplete(percentage);
}

int QDeclarativeOrganizerTodo::progressPercentage() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->percentageComplete();
    return 0;
}


/*!
  \qmlproperty enumeration Todo::status
  \since Mobility 1.1

  This property holds the progress status of the task described by the todo. The value can be one of:
  \list
  \o TodoProgress.NotStarted
  \o TodoProgress.InProgress
  \o TodoProgress.Complete
  \endlist
  \sa TodoProgress
  */
void QDeclarativeOrganizerTodo::setStatus(QDeclarativeOrganizerTodoProgress::StatusType value)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setStatus(value);
}

QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodo::status() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->status();
    return QDeclarativeOrganizerTodoProgress::NotStarted;
}

/*!
  \qmlproperty date Todo::finishedDateTime
  \since Mobility 1.1

  This property holds the date and time at which the task was completed, if known.
  */
void QDeclarativeOrganizerTodo::setFinishedDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setFinishedDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodo::finishedDateTime() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->finishedDateTime();
    return QDateTime();
}

//////////////////////////QDeclarativeOrganizerTodoOccurrence////////////////////////////////
/*!
    \qmlclass TodoOccurrence QDeclarativeOrganizerTodoOccurrence

    \brief The TodoOccurrence element provides an occurrence of an event.

    \ingroup qml-organizer
    \since Mobility 1.1

    \sa OrganizerItem, Event, EventOccurrence, Journal, Todo, Note, {QOrganizerTodoOccurrence}

  The TodoOccurrence element is part of the \bold{QtMobility.organizer 1.1} module.
*/
QDeclarativeOrganizerTodoOccurrence::QDeclarativeOrganizerTodoOccurrence(QObject *parent)
    :QDeclarativeOrganizerItem(parent)
{
    setItem (QOrganizerTodoOccurrence());
    d->setMetaObject(QDeclarativeOrganizerTodoOccurrence::staticMetaObject);

    connect(this, SIGNAL(valueChanged()), SIGNAL(itemChanged()));
}

/*!
  \qmlproperty date TodoOccurrence::startDateTime
  \since Mobility 1.1

  This property holds the date time at which the task should be started.
  */
void QDeclarativeOrganizerTodoOccurrence::setStartDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        time->setStartDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodoOccurrence::startDateTime() const
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        return time->startDateTime();
    return QDateTime();
}
/*!
  \qmlproperty date TodoOccurrence::dueDateTime
  \since Mobility 1.1

  This property holds the date time by which the task should be completed.
  */
void QDeclarativeOrganizerTodoOccurrence::setDueDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        time->setDueDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodoOccurrence::dueDateTime() const
{
    QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
    if (time)
        return time->dueDateTime();
    return QDateTime();
}

/*!
  \qmlproperty enumeration TodoOccurrence::priority
  \since Mobility 1.1

  This property holds the priority of the todo occurrence. The value can be one of:
  \list
  \o Priority.Unknown
  \o Priority.Highest
  \o Priority.ExtremelyHigh
  \o Priority.VeryHigh
  \o Priority.High
  \o Priority.Medium
  \o Priority.Low
  \o Priority.VeryLow
  \o Priority.ExtremelyLow
  \o Priority.Lowest
  \endlist
  \sa Priority
  */
void QDeclarativeOrganizerTodoOccurrence::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
    QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
    if (pri)
        pri->setPriority(value);
}

QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodoOccurrence::priority() const
{
    QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
    if (pri)
        return pri->priority();
    return QDeclarativeOrganizerItemPriority::Unknown;
}

/*!
  \qmlproperty int TodoOccurrence::progressPercentage
  \since Mobility 1.1

  This property holds the percentage of progress completed on the task described by the todo item.
  */
void QDeclarativeOrganizerTodoOccurrence::setProgressPercentage(int percentage)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setPercentageComplete(percentage);
}

int QDeclarativeOrganizerTodoOccurrence::progressPercentage() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->percentageComplete();
    return 0;
}

/*!
  \qmlproperty enumeration TodoOccurrence::status
  \since Mobility 1.1

  This property holds the progress status of the task described by the todo occurrence. The value can be one of:
  \list
  \o TodoProgress.NotStarted
  \o TodoProgress.InProgress
  \o TodoProgress.Complete
  \endlist
  \sa TodoProgress
  */
void QDeclarativeOrganizerTodoOccurrence::setStatus(QDeclarativeOrganizerTodoProgress::StatusType value)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setStatus(value);
}

QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodoOccurrence::status() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->status();
    return QDeclarativeOrganizerTodoProgress::NotStarted;
}

/*!
  \qmlproperty date TodoOccurrence::finishedDateTime
  \since Mobility 1.1

  This property holds the date and time at which the task was completed, if known.
  */
void QDeclarativeOrganizerTodoOccurrence::setFinishedDateTime(const QDateTime& datetime)
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        progress->setFinishedDateTime(datetime);
}

QDateTime QDeclarativeOrganizerTodoOccurrence::finishedDateTime() const
{
    QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
    if (progress)
        return progress->finishedDateTime();
    return QDateTime();
}

/*!
  \qmlproperty int TodoOccurrence::parentId
  \since Mobility 1.1

  This property holds the id of the todo which is this occurrence's parent.
  */
void QDeclarativeOrganizerTodoOccurrence::setParentId(const QString& pid)
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        parent->setParentId(pid);
}

QString QDeclarativeOrganizerTodoOccurrence::parentId() const
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        return parent->parentId();
    return QString();
}
/*!
  \qmlproperty date TodoOccurrence::originalDate
  \since Mobility 1.1

  This property holds the date at which the occurrence was originally going to occur.
  */
void QDeclarativeOrganizerTodoOccurrence::setOriginalDate(const QDate& date)
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        parent->setOriginalDate(date);
}

QDate QDeclarativeOrganizerTodoOccurrence::originalDate() const
{
    QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
    if (parent)
        return parent->originalDate();
    return QDate();
}

Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerEvent::ItemName, "event");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerEvent::ItemGroupName, "events");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerEventOccurrence::ItemName, "eventOccurrence");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerEventOccurrence::ItemGroupName, "eventOccurrences");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerJournal::ItemName, "journal");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerJournal::ItemGroupName, "journals");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerNote::ItemName, "note");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerNote::ItemGroupName, "notes");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerTodo::ItemName, "todo");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerTodo::ItemGroupName, "todos");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerTodoOccurrence::ItemName, "todoOccurrence");
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerTodoOccurrence::ItemGroupName, "todoOccurrences");