aboutsummaryrefslogtreecommitdiffstats
path: root/mobility/organizer/qml/OverviewPage.qml
blob: 4f4f4edd30a6b5cdda9ecffe6a78ae2b9a0e7753 (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

import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.1

Page {
    id: overviewPage
    anchors.margins: UiConstants.DefaultMargin
    orientationLock: PageOrientation.LockPortrait

    Label {
        anchors.centerIn: parent
        text: "No tasks"
        visible: manager.todos.length == 0
    }

    Flickable {
        anchors.fill: parent
        clip: true

        flickableDirection: Flickable.VerticalFlick
        contentHeight: todoButtons.height
        contentWidth: todoButtons.width

        ButtonColumn {
            id: todoButtons

            // On N9 it seems that displayWidth keeps pointing to the larger
            // side of the screen, even in portrait mode...
            width: screen.displayHeight - 2 * UiConstants.DefaultMargin

            Repeater {
                model: manager.todos
                Button {
                    text: modelData
                    onClicked: {
                        manager.editExistingTodo(index)
                        pageStack.push(Qt.createComponent("TodoEdit.qml"))
                    }
                }
            }
        }
    }

    tools: ToolBarLayout {
        id: mainTools
        ToolButton {
            text: "Add Task"
            onClicked: {
                manager.editNewTodo() // Prepare new todo info
                pageStack.push(Qt.createComponent("TodoEdit.qml"))
            }
        }
    }

}