summaryrefslogtreecommitdiffstats
path: root/examples/qmlorganizer/contents/DayView.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qmlorganizer/contents/DayView.qml')
-rw-r--r--examples/qmlorganizer/contents/DayView.qml208
1 files changed, 137 insertions, 71 deletions
diff --git a/examples/qmlorganizer/contents/DayView.qml b/examples/qmlorganizer/contents/DayView.qml
index 806770f5e8..8adcbcd204 100644
--- a/examples/qmlorganizer/contents/DayView.qml
+++ b/examples/qmlorganizer/contents/DayView.qml
@@ -39,78 +39,144 @@
****************************************************************************/
import Qt 4.7
-
import QtMobility.organizer 1.1
-Rectangle
+Flickable
{
- id:dayView
- property variant itemIds:calendar.organizer.itemIds(calendar.currentDate, new Date(calendar.year, calendar.month, calendar.day+1))
-
- anchors.fill: parent
-
-
- Repeater {
- model : ListModel {
- ListElement {hour : "0:00"}
- ListElement {hour : "1:00"}
- ListElement {hour : "2:00"}
- ListElement {hour : "3:00"}
- ListElement {hour : "4:00"}
- ListElement {hour : "5:00"}
- ListElement {hour : "6:00"}
- ListElement {hour : "7:00"}
- ListElement {hour : "8:00"}
- ListElement {hour : "9:00"}
- ListElement {hour : "10:00"}
- ListElement {hour : "11:00"}
- ListElement {hour : "12:00"}
- ListElement {hour : "13:00"}
- ListElement {hour : "14:00"}
- ListElement {hour : "15:00"}
- ListElement {hour : "16:00"}
- ListElement {hour : "17:00"}
- ListElement {hour : "18:00"}
- ListElement {hour : "19:00"}
- ListElement {hour : "20:00"}
- ListElement {hour : "21:00"}
- ListElement {hour : "22:00"}
- ListElement {hour : "23:00"}
- }
-
- Rectangle {
- width : dayView.width
- height : dayView.height / 24
- y:index * height
- Column {
- Rectangle {
- height : 1
- width : dayView.width
- color : "lightsteelblue"
- }
- Text {
- text: hour
- color : "steelblue"
- font.pointSize: 12
- }
- }
- }
- }
-
- Repeater {
- model:itemIds
- ItemView {
- property int timePos: (startTime/(24*60))*dayView.height
- focus: true
- width:dayView.width - 50
- height: endTime< startTime ? 30: dayView.height * (endTime - startTime)/(24*60)
- x: dayView.x + 50
- y: dayView.y + timePos
-
-
- opacity : dayView.opacity * 0.8
- itemId: modelData
-
- }
- }
+ Rectangle {
+ id : dayView
+
+ anchors.fill : parent
+ opacity : parent.opacity
+ color: "#9eaf30"
+ gradient: Gradient {
+ GradientStop {
+ position: 0.00;
+ color: "#9eaf30";
+ }
+ GradientStop {
+ position: 0.89;
+ color: "#ffffff";
+ }
+ }
+
+ ListView {
+ id : hourList
+ model : hourModel
+ anchors.fill: parent
+ clip: true
+ focus: true
+ opacity : parent.opacity
+
+ delegate : hourDelegate
+ highlight: hourHighlight
+ preferredHighlightBegin: hourList.height * 0.5
+ preferredHighlightEnd: preferredHighlightBegin
+ highlightFollowsCurrentItem : true
+ highlightMoveSpeed : 2000
+ keyNavigationWraps : true
+
+ onCurrentIndexChanged : {
+ if (timelineView.opacity > 0) {
+ calendar.currentDate = new Date(timelineView.year, timelineView.month, currentIndex + 1);
+ monthList.currentIndex = timelineView.month;
+ currentIndex = timelineView.day - 1;
+ }
+ }
+
+ }
+ Component {
+ id: hourHighlight
+ Rectangle {
+ width: hourList.width;
+ height: hourList.height /7 ;
+ color: "lightsteelblue" ;radius: 5
+ }
+ }
+
+ Component {
+ id: hourDelegate
+
+
+ Item {
+ width : hourList.width
+ height : childrenRect.height
+ property int rowIndex : index
+ id:hourDelegateInstanceItem
+
+ Column {
+ // Draw a line under the previous Hour list tiem
+ Rectangle {
+ height : 1
+ width : hourList.width
+ color : "black"
+ }
+
+ Text {
+ // text: hour
+ text: index + ":00"
+ }
+
+
+ // List all, if any, of the events within this hour.
+ Repeater {
+
+ focus: true
+
+ // Simple fetch ALL events on this day...and we will filter them by hour.
+ model: calendar.organizer.items? calendar.organizer.itemIds(new Date(calendar.year, calendar.month, calendar.day)
+ , new Date(calendar.year, calendar.month, calendar.day+1))
+ : 0
+
+ Row {
+ spacing: 4
+ Text {
+ id: itemText
+ clip: true
+ focus: true
+ property OrganizerItem oi: calendar.organizer.item(modelData)
+
+ // Only display a link when the event starts within this hour......
+ text: (hourDelegateInstanceItem.rowIndex == Qt.formatTime(oi.itemStartTime, "hh")) ? "<a href=\"#\">" + oi.displayLabel + "</a>":""
+ onLinkActivated: {
+ //detailsView.isNewItem = false;
+ detailsView.item = oi;
+ calendar.state = "DetailsView";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ ListModel {
+ id : hourModel
+ ListElement {hour : "0:00"}
+ ListElement {hour : "1:00"}
+ ListElement {hour : "2:00"}
+ ListElement {hour : "3:00"}
+ ListElement {hour : "4:00"}
+ ListElement {hour : "5:00"}
+ ListElement {hour : "6:00"}
+ ListElement {hour : "7:00"}
+ ListElement {hour : "8:00"}
+ ListElement {hour : "9:00"}
+ ListElement {hour : "10:00"}
+ ListElement {hour : "11:00"}
+ ListElement {hour : "12:00"}
+ ListElement {hour : "13:00"}
+ ListElement {hour : "14:00"}
+ ListElement {hour : "15:00"}
+ ListElement {hour : "16:00"}
+ ListElement {hour : "17:00"}
+ ListElement {hour : "18:00"}
+ ListElement {hour : "19:00"}
+ ListElement {hour : "20:00"}
+ ListElement {hour : "21:00"}
+ ListElement {hour : "22:00"}
+ ListElement {hour : "23:00"}
+ }
+ }
}