diff --git a/applets/timer/package/contents/ui/TimerView.qml b/applets/timer/package/contents/ui/TimerView.qml --- a/applets/timer/package/contents/ui/TimerView.qml +++ b/applets/timer/package/contents/ui/TimerView.qml @@ -23,7 +23,6 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 as QtExtra -import org.kde.plasma.private.timer 0.1 as TimerPlasmoid Item { id: main @@ -33,13 +32,6 @@ // display seconds in addition to hours and minutes (default: enabled) property bool showSeconds: plasmoid.configuration.showSeconds; - // show notification on timer completion (default: enabled) - property bool showNotification: plasmoid.configuration.showNotification; - - // run custom command on timer completion (default: disabled) - property bool runCommand: plasmoid.configuration.runCommand; - property string command: plasmoid.configuration.command; - property real digits: (showSeconds) ? 7 : 4.5; property int digitH: ((height / 2) * digits < width ? height : ((width - (digits - 1)) / digits) * 2); property int digitW: digitH / 2; @@ -49,35 +41,6 @@ imagePath: "widgets/timer" } - Timer { - id: t; - interval: 1000; - onTriggered: { - if (root.seconds != 0) { - root.seconds--; - } - if (root.seconds == 0) { - root.running = false; - - if (showNotification) { - root.createNotification(); - } - if (runCommand) { - TimerPlasmoid.Timer.runCommand(command); - } - saveTimer(); - } - } - repeat: true; - running: root.running; - } - - Timer { - id: delayedSaveTimer; - interval: 3000; - onTriggered: saveTimer(); - } - Column { anchors.centerIn: parent; Text { @@ -177,18 +140,12 @@ } } - function digitChanged() { - delayedSaveTimer.stop(); - delayedSaveTimer.start(); - } - function resetOpacity() { timerDigits.opacity = 1.0; } Component.onCompleted: { root.opacityNeedsReset.connect(resetOpacity); - root.digitHasChanged.connect(digitChanged); } } diff --git a/applets/timer/package/contents/ui/main.qml b/applets/timer/package/contents/ui/main.qml --- a/applets/timer/package/contents/ui/main.qml +++ b/applets/timer/package/contents/ui/main.qml @@ -22,13 +22,20 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 as QtExtra +import org.kde.plasma.private.timer 0.1 as TimerPlasmoid Item { id: root; property variant predefinedTimers: plasmoid.configuration.predefinedTimers; property int seconds : restoreToSeconds(plasmoid.configuration.running, plasmoid.configuration.savedAt, plasmoid.configuration.seconds); + // show notification on timer completion (default: enabled) + property bool showNotification: plasmoid.configuration.showNotification; + // run custom command on timer completion (default: disabled) + property bool runCommand: plasmoid.configuration.runCommand; + property string command: plasmoid.configuration.command; + // show title (can be customized in the settings dialog, default: disabled) property bool showTitle: plasmoid.configuration.showTitle; property string title: plasmoid.configuration.title; @@ -65,6 +72,40 @@ connectedSources: "org.freedesktop.Notifications" } + Timer { + id: t; + interval: 1000; + onTriggered: { + if (root.seconds != 0) { + root.seconds--; + } + if (root.seconds == 0) { + root.running = false; + + if (showNotification) { + root.createNotification(); + } + if (runCommand) { + TimerPlasmoid.Timer.runCommand(command); + } + saveTimer(); + } + } + repeat: true; + running: root.running; + } + + Timer { + id: delayedSaveTimer; + interval: 3000; + onTriggered: saveTimer(); + } + + function onDigitHasChanged() { + delayedSaveTimer.stop(); + delayedSaveTimer.start(); + } + function createNotification() { var service = notificationSource.serviceForSource("notification"); var operation = service.operationDescription("createNotification");