plasma5-workspace/0003-notifications-Make-sure-the-Open.-button-on-finished.patch

57 lines
2.6 KiB
Diff

From 36bd67d2d9d9e74fda52343ae7ccc5b41e5b4498 Mon Sep 17 00:00:00 2001
From: Martin Klapetek <mklapetek@kde.org>
Date: Thu, 28 May 2015 17:31:15 +0200
Subject: [PATCH 3/5] [notifications] Make sure the "Open..." button on
finished jobs still work
With the previous patch, now everything has "notification N" source
name, so there's needed another way to detect that it's a job's
notification.
Reviewed-by: Kai Uwe Broulik
---
applets/notifications/package/contents/ui/Jobs.qml | 2 +-
applets/notifications/package/contents/ui/Notifications.qml | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/applets/notifications/package/contents/ui/Jobs.qml b/applets/notifications/package/contents/ui/Jobs.qml
index d16a55d9b26f966f8a5ed80439bdb780c2a8e7bf..5d68cfecef1a10c564aab508d9ea0e7cc6203b53 100644
--- a/applets/notifications/package/contents/ui/Jobs.qml
+++ b/applets/notifications/package/contents/ui/Jobs.qml
@@ -90,7 +90,7 @@ Column {
op["expireTimeout"] = 6000;
op["urgency"] = 0;
op["configurable"] = false;
- op["actions"] = !error && UrlHelper.isUrlValid(message) ? [message, i18n("Open...")] : []; // If the source contains "Job", it tries to open the "id" value (which is "message")
+ op["actions"] = !error && UrlHelper.isUrlValid(message) ? ["jobUrl#" + message, i18n("Open...")] : []; // If the source contains "Job", it tries to open the "id" value (which is "message")
notifications.createNotification(op);
diff --git a/applets/notifications/package/contents/ui/Notifications.qml b/applets/notifications/package/contents/ui/Notifications.qml
index 5571a7608c9ece18e5475bb80c5fb2accf905b6b..13be7d49a14ebbe5399a7f0bf333862f545671a2 100644
--- a/applets/notifications/package/contents/ui/Notifications.qml
+++ b/applets/notifications/package/contents/ui/Notifications.qml
@@ -80,15 +80,16 @@ Column {
function executeAction(source, id) {
//try to use the service
- if (source.indexOf("notification") !== -1) {
+ if (id.indexOf("jobUrl#") === -1) {
var service = notificationsSource.serviceForSource(source)
var op = service.operationDescription("invokeAction")
op["actionId"] = id
service.startOperationCall(op)
//try to open the id as url
- } else if (source.indexOf("Job") !== -1) {
- Qt.openUrlExternally(id)
+ } else if (id.indexOf("jobUrl#") !== -1) {
+ Qt.openUrlExternally(id.slice(7));
+ notificationPositioner.closePopup(source);
}
}
--
2.4.1