2
* Copyright 2012 Marco Martin <mart@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Library General Public License as
6
* published by the Free Software Foundation; either version 2, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Library General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
import org.kde.plasma.core 0.1 as PlasmaCore
22
import org.kde.plasma.components 0.1 as PlasmaComponents
23
import org.kde.locale 0.1 as KLocale
24
import org.kde.plasma.mobilecomponents 0.1 as MobileComponents
25
import QtMultimediaKit 1.1
29
property int minimumWidth: row.implicitWidth + 4
30
property int minimumHeight: theme.smallMediumIconSize
32
property variant dateTime
34
function twoDigitString(number)
36
return number < 10 ? "0"+number : number
43
PlasmaCore.DataSource {
47
connectedSources: ["Local"]
48
onDataChanged: dateTime = new Date(data["Local"]["DateTime"])
51
PlasmaCore.DataSource {
53
engine: "org.kde.alarms"
55
connectedSources: sources
59
var dialog = dialogComponent.createObject(root)
60
dialog.alarmData = data
72
PlasmaComponents.CommonDialog {
74
property variant alarmData
76
audio.source = alarmData["audioFile"]
77
if (alarmData["audioFile"] != "") {
82
titleText: i18n("Alarm")
84
width: theme.defaultFont.mSize.width * 30
85
height: Math.max(implicitHeight, theme.defaultFont.mSize.height * 8)
86
PlasmaComponents.Label {
87
text: dialog.alarmData["message"]
89
horizontalAlignment: Text.AlignHCenter
90
verticalAlignment: Text.AlignVCenter
92
PlasmaComponents.Label {
93
text: i18n("Alarm for %1", locale.formatDateTime(dialog.alarmData["dateTime"]))
95
horizontalAlignment: Text.AlignHCenter
96
verticalAlignment: Text.AlignVCenter
99
buttonTexts: [i18n("Dismiss"), i18n("Snooze")]
101
function performAlarmAction(operationName, id) {
102
var service = alarmsSource.serviceForSource("")
103
var operation = service.operationDescription(operationName)
106
if (operationName == "defer") {
107
operation["Minutes"] = 5
110
service.startOperationCall(operation)
114
performAlarmAction("dismiss", dialog.alarmData["id"])
115
} else if (index == 1) {
116
performAlarmAction("defer", dialog.alarmData["id"])
123
performAlarmAction("defer", dialog.alarmData["id"])
133
imagePath: "widgets/configuration-icons"
139
enabled: alarmsSource.sources.length > 0
141
onClicked: plasmoid.runApplication("active-alarms")
145
anchors.centerIn: parent
146
height: parent.height - 8
147
MobileComponents.TextEffects {
149
effect: MobileComponents.TextEffects.TexturedText
150
pixelSize: parent.height
151
anchors.verticalCenter: parent.verticalCenter
152
text: twoDigitString(dateTime.getHours()) + ":" + twoDigitString(dateTime.getMinutes())
156
svg: PlasmaCore.Svg {imagePath: "icons/korgac"}
158
height: parent.height
160
visible: alarmsSource.sources.length > 0