~ubuntu-clock-dev/ubuntu-clock-app/reboot-packaging

« back to all changes in this revision

Viewing changes to app/alarm/EditAlarmPage.qml

  • Committer: Nekhelesh Ramananthan
  • Date: 2014-07-29 12:00:28 UTC
  • mto: (37.1.1 reboot)
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: krnekhelesh@gmail.com-20140729120028-821ujpa5c9li7w5a
Remove hardcoded time format in the settings page and follow the user locale

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
Page {
27
27
    id: _addAlarmPage
28
 
    objectName: "AddAlarmPage"
29
28
 
30
29
    // Property to determine if this is a new/saved alarm
31
30
    property bool isNewAlarm: true
48
47
 
49
48
        actions: Action {
50
49
            iconName: "ok"
51
 
            objectName: "saveAlarmAction"
52
50
            text: i18n.tr("Alarm")
53
51
            onTriggered: {
54
52
                if(isNewAlarm) {
90
88
        _alarm.date = tempAlarm.date
91
89
    }
92
90
 
93
 
    // Function to delete a saved alarm
94
 
    function deleteAlarm() {
95
 
        tempAlarm = alarmModel.get(alarmIndex)
96
 
        tempAlarm.cancel()
97
 
 
98
 
        if(validateAlarm(tempAlarm)) {
99
 
            mainStack.pop()
100
 
        }
101
 
    }
102
 
 
103
91
    // Function to update a saved alarm
104
92
    function updateAlarm() {
105
93
        tempAlarm = alarmModel.get(alarmIndex)
161
149
    Column {
162
150
        id: _alarmColumn
163
151
 
164
 
        width: parent.width
165
 
        anchors.top: parent.top
 
152
        anchors.fill: parent
166
153
 
167
154
        DatePicker {
168
155
            id: _timePicker
184
171
 
185
172
        SubtitledListItem {
186
173
            id: _alarmRepeat
187
 
            objectName: "alarmRepeat"
188
174
 
189
175
            text: i18n.tr("Repeat")
190
176
            subText: alarmUtils.format_day_string(_alarm.daysOfWeek)
194
180
 
195
181
        SubtitledListItem {
196
182
            id: _alarmLabel
197
 
            objectName: "alarmLabel"
198
183
 
199
184
            text: i18n.tr("Label")
200
185
            subText: _alarm.message
204
189
 
205
190
        SubtitledListItem {
206
191
            id: _alarmSound
207
 
            objectName: "alarmSound"
208
192
            /*
209
193
              #TODO: Add support for choosing new alarm sound when indicator-
210
194
              datetime supports custom alarm sounds
215
199
                                      {"alarmSound": _alarmSound})
216
200
        }
217
201
    }
218
 
 
219
 
    Button {
220
 
        id: _deleteAlarmButton
221
 
 
222
 
        anchors {
223
 
            top: _alarmColumn.bottom
224
 
            topMargin: units.gu(3)
225
 
            horizontalCenter: parent.horizontalCenter
226
 
        }
227
 
 
228
 
        width: units.gu(17)
229
 
        height: units.gu(4)
230
 
 
231
 
        visible: !isNewAlarm
232
 
 
233
 
        color: "Red"
234
 
        text: i18n.tr("Delete alarm")
235
 
 
236
 
        onClicked: {
237
 
            _addAlarmPage.deleteAlarm()
238
 
        }
239
 
    }
240
202
}