summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorPäivi Rajala <paivi.rajala@nokia.com>2012-02-22 14:04:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-29 12:52:25 +0100
commit36d4c74dc7efa30b1b21161b0b78d6fa89814e79 (patch)
tree14e9232f1e30c9a420a39faa83f941de5db96efd /examples
parent7d410b31c1ea8e75c82ed6057cc623c19175ee5d (diff)
Organizer recurrence support, QML API and examples
Initial implementation of recurring item support. Previously QML API did not handle occurrences at all. This initial implementation should be optimized in the future. Added QML tests for generating occurrences and for handling occurrences in OrganizerModel. Updated QML examples to handle recurring events. Change-Id: Iabdee320c8b082ce923becb6b16ecca83f3c1662 Reviewed-by: Päivi Rajala <paivi.rajala@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/calendardemo/src/calendardemo.h4
-rw-r--r--examples/qmlorganizer/contents/DayView.qml5
-rw-r--r--examples/qmlorganizer/contents/DetailsView.qml10
-rw-r--r--examples/qmlorganizer/contents/TimelineView.qml5
-rw-r--r--examples/qmlorganizer/contents/WeekView.qml5
-rw-r--r--examples/qmlorganizer/organizer.qml33
-rw-r--r--examples/qmlorganizerlistview/content/EventEditor.qml2
7 files changed, 53 insertions, 11 deletions
diff --git a/examples/calendardemo/src/calendardemo.h b/examples/calendardemo/src/calendardemo.h
index 5b77cf6aa..1f2f82f17 100644
--- a/examples/calendardemo/src/calendardemo.h
+++ b/examples/calendardemo/src/calendardemo.h
@@ -44,7 +44,7 @@
#include <QMainWindow>
#include <QDate>
#include <qorganizeritemsaverequest.h>
-#include <qorganizeritemremoverequest.h>
+#include <qorganizeritemremovebyidrequest.h>
QTORGANIZER_BEGIN_NAMESPACE
class QOrganizerManager;
@@ -124,7 +124,7 @@ private:
QAction *m_switchViewAction;
QOrganizerItemSaveRequest m_saveReq;
- QOrganizerItemRemoveRequest m_remReq;
+ QOrganizerItemRemoveByIdRequest m_remReq;
QProgressDialog *m_progressDlg;
};
diff --git a/examples/qmlorganizer/contents/DayView.qml b/examples/qmlorganizer/contents/DayView.qml
index a029a92df..08e44b578 100644
--- a/examples/qmlorganizer/contents/DayView.qml
+++ b/examples/qmlorganizer/contents/DayView.qml
@@ -140,7 +140,10 @@ Flickable
onLinkActivated: {
detailsView.isNewItem = false;
detailsView.item = modelData;
- calendar.state = "DetailsView";
+ if (detailsView.item.itemType == Type.EventOccurrence || detailsView.item.itemType == Type.TodoOccurrence)
+ calendar.state = "OccurrenceDialogView";
+ else
+ calendar.state = "DetailsView";
}
}
Rectangle {
diff --git a/examples/qmlorganizer/contents/DetailsView.qml b/examples/qmlorganizer/contents/DetailsView.qml
index 6ca9315e7..3c269f574 100644
--- a/examples/qmlorganizer/contents/DetailsView.qml
+++ b/examples/qmlorganizer/contents/DetailsView.qml
@@ -56,10 +56,10 @@ Rectangle
if (detailsView.opacity == 1) {
// Initialize empty item
if (isNewItem) {
- if (item.itemType == Type.Event) {
+ if (item.itemType == Type.Event || item.itemType == Type.EventOccurrence) {
item.startDateTime = new Date (calendar.year, calendar.month, calendar.day, 12);
item.endDateTime = new Date (calendar.year, calendar.month, calendar.day, 13);
- } else if (item.itemType == Type.Todo) {
+ } else if (item.itemType == Type.Todo || item.itemType == Type.TodoOccurrence) {
item.startDateTime = new Date (calendar.year, calendar.month, calendar.day, 12);
item.dueDateTime = new Date (calendar.year, calendar.month, calendar.day, 13);
}
@@ -70,7 +70,7 @@ Rectangle
emptyRecurrenceRule.limit = null;
// Initialize UI
- if (item.itemType == Type.Event) {
+ if (item.itemType == Type.Event || item.itemType == Type.EventOccurrence) {
customLabelRow.setValue(item.displayLabel);
customStartDateRow.dateTimeRoller.setDateTime(item.startDateTime);
customEndDateRow.dateTimeRoller.setDateTime(item.endDateTime);
@@ -81,7 +81,7 @@ Rectangle
customRsvpParticipationStatusRow.value = item.details(Detail.EventRsvp).length ?
item.detail(Detail.EventRsvp).participationStatus :
EventAttendee.StatusUnknown;
- } else if (item.itemType == Type.Todo) {
+ } else if (item.itemType == Type.Todo || item.itemType == Type.TodoOccurrence) {
todoCustomLabelRow.setValue(item.displayLabel);
todoCustomDueDateRow.dateTimeRoller.setDateTime(detailsView.item.dueDateTime);
todoCustomDescriptionRow.setValue(item.description);
@@ -159,7 +159,7 @@ Rectangle
//anchors { top: parent.top; left: saveButton.right }
width: parent.width / 2
onClicked: {
- calendar.organizer.removeItem(item.itemId);
+ calendar.organizer.removeItem(item);
calendar.state = "DayView";
}
}
diff --git a/examples/qmlorganizer/contents/TimelineView.qml b/examples/qmlorganizer/contents/TimelineView.qml
index 2b9aa8524..6312ce16d 100644
--- a/examples/qmlorganizer/contents/TimelineView.qml
+++ b/examples/qmlorganizer/contents/TimelineView.qml
@@ -140,7 +140,10 @@ Rectangle {
onLinkActivated: {
detailsView.isNewItem = false
detailsView.item = modelData;
- calendar.state = "DetailsView";
+ if (detailsView.item.itemType == Type.EventOccurrence || detailsView.item.itemType == Type.TodoOccurrence)
+ calendar.state = "OccurrenceDialogView";
+ else
+ calendar.state = "DetailsView";
}
}
}
diff --git a/examples/qmlorganizer/contents/WeekView.qml b/examples/qmlorganizer/contents/WeekView.qml
index fb9f21495..e8bf7c598 100644
--- a/examples/qmlorganizer/contents/WeekView.qml
+++ b/examples/qmlorganizer/contents/WeekView.qml
@@ -100,7 +100,10 @@ Rectangle
onLinkActivated: {
detailsView.isNewItem = false;
detailsView.item = modelData;
- calendar.state = "DetailsView";
+ if (detailsView.item.itemType == Type.EventOccurrence || detailsView.item.itemType == Type.TodoOccurrence)
+ calendar.state = "OccurrenceDialogView";
+ else
+ calendar.state = "DetailsView";
}
}
}
diff --git a/examples/qmlorganizer/organizer.qml b/examples/qmlorganizer/organizer.qml
index 40f0c08bf..496c3bc0a 100644
--- a/examples/qmlorganizer/organizer.qml
+++ b/examples/qmlorganizer/organizer.qml
@@ -97,6 +97,15 @@ Rectangle {
if (managerName == "memory")
organizer.importItems(Qt.resolvedUrl("contents/test.ics"));
}
+ onItemsFetched: {
+ // this is for occurrenceDialog
+ console.log("QML --- ITEMS FETCHED" + fetchedItems[0].displayLabel + fetchedItems[0].itemStartTime);
+ if (fetchedItems.length == 1) {
+ detailsView.isNewItem = false;
+ detailsView.item = fetchedItems[0];
+ calendar.state = "DetailsView";
+ }
+ }
}
InfoBar {
@@ -163,6 +172,7 @@ Rectangle {
PropertyChanges { target: statusBar; opacity: 0; }
},
State {name: "AddNewItemSelectView"; PropertyChanges { target: addNewItemview; opacity: 0.8; }},
+ State {name: "OccurrenceDialogView"; PropertyChanges { target: occurrenceDialog; opacity: 0.8; }},
State {name: "CollectionManagerView"; PropertyChanges { target: collectionManagerView; opacity: 1; }},
State {
name: "CollectionEditorView";
@@ -278,6 +288,29 @@ Rectangle {
}
}
+ SelectionView {
+ id: occurrenceDialog;
+ //title: "This is a recurring item. Open this instance or whole series?"
+ title: "Recurring item"
+
+ model: VisualItemModel {
+ Button {
+ text: "Open this instance"
+ width: addNewItemview.width / 2
+ onClicked: {
+ calendar.state = "DetailsView";
+ }
+ }
+ Button {
+ text: "Open whole series"
+ width: addNewItemview.width / 2
+ onClicked: {
+ var parentDetail = detailsView.item.detail(Detail.Parent);
+ organizer.fetchItems([parentDetail.parentId]);
+ }
+ }
+ }
+ }
CollectionManagerView {
id: collectionManagerView;
}
diff --git a/examples/qmlorganizerlistview/content/EventEditor.qml b/examples/qmlorganizerlistview/content/EventEditor.qml
index 4ae61b31f..5bb183411 100644
--- a/examples/qmlorganizerlistview/content/EventEditor.qml
+++ b/examples/qmlorganizerlistview/content/EventEditor.qml
@@ -133,7 +133,7 @@ Rectangle {
onClicked: {
organizerApplication.state = "EventListView"
- organizer.removeItem(eventItem.itemId)
+ organizer.removeItem(eventItem)
}
}