summaryrefslogtreecommitdiff
path: root/rockwork/qml/NotificationsPage.qml
blob: 3942ecfd1ca7eea5152f1864a13c658e430ed141 (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
import QtQuick 2.0
import Sailfish.Silica 1.0
import RockPool 1.0

Page {
    id: root

    property var pebble: null

    SilicaFlickable {
        id: flickable
        anchors.fill: parent
        contentHeight: column.height
        PageHeader {
            title: qsTr("Notifications")
        }
        Column {

            anchors.fill: parent
            anchors.topMargin: units.gu(1)



            Item {
                width: parent.width
                implicitHeight: infoLabel.height

                Label {
                    id: infoLabel
                    anchors {
                        left: parent.left
                        right: parent.right
                        margins: units.gu(2)
                    }

                    wrapMode: Text.WordWrap
                    text: i18n.tr("Entries here will be added as notifications appear on the phone. Selected notifications will be shown on your Pebble smartwatch.")
                }
            }


            ListView {
                width: parent.width
                //Layout.fillHeight: true
                clip: true
                model: root.pebble.notifications

                delegate: ListItem {
                    Item {
                        Rectangle {
                            //SlotsLayout.position: SlotsLayout.Leading;
                            height: units.gu(5)
                            width: height
                            color: {
                                // Add some hacks for known icons
                                switch (model.icon) {
                                case "calendar":
                                    return "orange";
                                case "settings":
                                    return "grey";
                                case "dialog-question-symbolic":
                                    return "red";
                                case "alarm-clock":
                                    return "purple";
                                case "gpm-battery-050":
                                    return "green";
                                }
                                return "black"
                            }
                            //                        source: Image {
                            //                            height: parent.height
                            //                            width: parent.width
                            //                            source: model.icon.indexOf("/") === 0 ? "file://" + model.icon : ""
                            //                        }
                            Label {
                                text: model.name
                            }

                            IconButton {
                                anchors.fill: parent
                                anchors.margins: units.gu(.5)
                                icon.source: model.icon.indexOf("/") !== 0 ? model.icon : ""
                                //color: "white"
                            }
                        }

                        Switch {
                            checked: model.enabled
                            // SlotsLayout.position: SlotsLayout.Trailing;
                            onClicked: {
                                root.pebble.setNotificationFilter(model.name, checked)
                            }
                        }
                    }
                }
            }
        }
    }
}