~nik90/ubuntu-clock-app/sync-clock-backend

« back to all changes in this revision

Viewing changes to alarm/AlarmDays.qml

  • Committer: Nekhelesh Ramananthan
  • Date: 2013-09-27 08:38:15 UTC
  • mfrom: (200.1.4 trunk)
  • Revision ID: krnekhelesh@gmail.com-20130927083815-mu1n8e5wlp2to930
merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 0.1
 
19
import Ubuntu.Components.Popups 0.1
 
20
import Ubuntu.Components.ListItems 0.1
 
21
 
 
22
Dialog {
 
23
    id:root
 
24
 
 
25
    property var alarm
 
26
 
 
27
    title: "Choose days"
 
28
 
 
29
    ListModel {
 
30
        id: daysModel
 
31
        ListElement {
 
32
            day: "Monday"
 
33
            flag: Alarm.Monday
 
34
        }
 
35
        ListElement {
 
36
            day: "Tuesday"
 
37
            flag: Alarm.Tuesday
 
38
        }
 
39
        ListElement {
 
40
            day: "Wednesday"
 
41
            flag: Alarm.Wednesday
 
42
        }
 
43
        ListElement {
 
44
            day: "Thursday"
 
45
            flag: Alarm.Thursday
 
46
        }
 
47
        ListElement {
 
48
            day: "Friday"
 
49
            flag: Alarm.Friday
 
50
        }
 
51
        ListElement {
 
52
            day: "Saturday"
 
53
            flag: Alarm.Saturday
 
54
        }
 
55
        ListElement {
 
56
            day: "Sunday"
 
57
            flag: Alarm.Sunday
 
58
        }
 
59
    }
 
60
 
 
61
    Column {
 
62
        anchors { left: contents.left; top: contents.top; right: contents.right }
 
63
        height: childrenRect.height
 
64
        Repeater {
 
65
            model: daysModel
 
66
            Standard {
 
67
                Label {
 
68
                    text: day
 
69
                    anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(1) }
 
70
                    color: Theme.palette.normal.baseText
 
71
                }
 
72
 
 
73
                control: Switch {
 
74
                    checked: (alarm.daysOfWeek & flag) == flag
 
75
                    onCheckedChanged: {
 
76
                        if (checked)
 
77
                            alarm.daysOfWeek |= flag;
 
78
                        else
 
79
                            alarm.daysOfWeek &= ~flag;
 
80
                    }
 
81
                }
 
82
            }
 
83
        }
 
84
    }
 
85
 
 
86
    Button {
 
87
        text: "Done"
 
88
        onClicked: PopupUtils.close(root);
 
89
    }
 
90
}