2
* Copyright 2012 Canonical Ltd.
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.
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.
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/>.
18
import Ubuntu.Components 0.1
19
import Ubuntu.Components.ListItems 0.1
20
import Ubuntu.Components.Popups 0.1
26
objectName: "mainView"
43
height: childrenRect.height
49
objectName: "alarm_message"
57
objectName: "alarm_date"
58
text: alarm.date.toString()
65
objectName: "alarm_enabled"
66
checked: alarm.enabled
68
if (checked != alarm.enabled)
69
alarm.enabled = checked;
76
values: ["OneTime", "Daily", "Weekly"]
78
if (alarm.type == Alarm.OneTime)
80
else if (alarm.type == Alarm.Repeating) {
81
if (alarm.daysOfWeek === Alarm.Daily)
87
onSelectedIndexChanged: {
88
switch (selectedIndex) {
90
alarm.type = Alarm.OneTime;
93
alarm.type = Alarm.Repeating;
94
alarm.daysOfWeek = Alarm.Daily;
97
alarm.type = Alarm.Repeating;
107
visible: recurence.selectedIndex == 2
109
PopupUtils.open(Qt.resolvedUrl("AlarmDays.qml"), days, {"alarm": alarm});
111
function getValues() {
113
if (alarm.daysOfWeek & Alarm.Monday) v.push("Monday");
114
if (alarm.daysOfWeek & Alarm.Tuesday) v.push("Tuesday");
115
if (alarm.daysOfWeek & Alarm.Wednesday) v.push("Wednesday");
116
if (alarm.daysOfWeek & Alarm.Thursday) v.push("Thursday");
117
if (alarm.daysOfWeek & Alarm.Friday) v.push("Friday");
118
if (alarm.daysOfWeek & Alarm.Saturday) v.push("Saturday");
119
if (alarm.daysOfWeek & Alarm.Sunday) v.push("Sunday");
125
text: "Save result="+alarm.error
129
alarm.message = message.text
130
alarm.date = new Date(date.text)
132
if (alarm.error == Alarm.NoError) alarm.reset();
143
topMargin: layout.height
151
checked: model.enabled
153
if (checked != model.enabled) {
154
model.enabled = checked;
160
var data = alarmModel.get(index);
164
var data = alarmModel.get(index);
165
alarm.message = data.message;
166
alarm.date = data.date;
167
alarm.type = data.type;
168
alarm.daysOfWeek = data.daysOfWeek;
169
alarm.enabled = data.enabled;