~frankencode/ubuntu-calendar-app/data-service

« back to all changes in this revision

Viewing changes to calendar.qml

  • Committer: Frank Mertens
  • Date: 2013-03-26 00:37:48 UTC
  • Revision ID: frank@cyblogic.de-20130326003748-w3tx4rlussxhpu1v
Extended the database model by an events category and added a basic diary view.

The events category allows to use section headers.
The basic diary view uses the standard Ubuntu component ListItem.Standard to show
the events of the current day.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        onSelectedTabIndexChanged: monthView.gotoNextMonth(selectedTabIndex)
28
28
    }
29
29
 
 
30
    Rectangle {
 
31
        anchors.top: monthView.top
 
32
        anchors.left: monthView.left
 
33
        anchors.right: monthView.right
 
34
        height: monthView.visibleHeight
 
35
        color: "white"
 
36
    }
 
37
 
30
38
    MonthView {
31
39
        id: monthView
32
40
        onMonthStartChanged: tabs.selectedTabIndex = monthStart.getMonth()
35
43
 
36
44
    EventView {
37
45
        id: eventView
 
46
 
38
47
        property real minY: pageArea.y + monthView.compressedHeight
39
48
        property real maxY: pageArea.y + monthView.height
 
49
 
40
50
        y: maxY
41
51
        width: mainView.width
42
 
        height: parent.height - monthView.compressedHeight
 
52
        height: parent.height - monthView.compressedHeight - monthView.y
 
53
 
43
54
        currentDayStart: monthView.currentDayStart
 
55
        expanded: !monthView.compressed
 
56
 
44
57
        Component.onCompleted: {
45
58
            incrementCurrentDay.connect(monthView.incrementCurrentDay)
46
59
            decrementCurrentDay.connect(monthView.decrementCurrentDay)
47
60
        }
48
 
        MouseArea {
49
 
            id: drawer
50
 
            property bool compression: true
51
 
            anchors.fill: parent
52
 
            drag {
53
 
                axis: Drag.YAxis
54
 
                target: eventView
55
 
                minimumY: monthView.y + monthView.compressedHeight
56
 
                maximumY: monthView.y + monthView.height
57
 
                onActiveChanged: {
58
 
                    if (compression) {
59
 
                        if (drag.active) {
60
 
                            monthView.compressed = true
61
 
                        }
62
 
                        else {
63
 
                            yBehavior.enabled = true
64
 
                            eventView.y =  Qt.binding(function() { return eventView.minY })
65
 
                            compression = false
66
 
                        }
67
 
                    }
68
 
                    else {
69
 
                        if (drag.active) {}
70
 
                        else{
71
 
                            eventView.y =  Qt.binding(function() { return eventView.maxY })
72
 
                            monthView.compressed = false
73
 
                            compression = true
74
 
                        }
75
 
                    }
76
 
                }
77
 
            }
78
 
        }
 
61
 
 
62
        onCompressRequest: {
 
63
            monthView.compressed = true
 
64
        }
 
65
        onCompressComplete: {
 
66
            yBehavior.enabled = true
 
67
            y = Qt.binding(function() { return eventView.minY })
 
68
        }
 
69
        onExpandRequest: {
 
70
        }
 
71
        onExpandComplete: {
 
72
            monthView.compressed = false
 
73
            y = Qt.binding(function() { return eventView.maxY })
 
74
        }
 
75
 
79
76
        Behavior on y {
80
77
            id: yBehavior
81
78
            enabled: false