57 lines
2.4 KiB
Diff
57 lines
2.4 KiB
Diff
From c0276440ee8ca26cf79a08a1a4ac2ce12425c10b Mon Sep 17 00:00:00 2001
|
|
From: Martin Klapetek <mklapetek@kde.org>
|
|
Date: Thu, 28 May 2015 17:32:55 +0200
|
|
Subject: [PATCH 4/5] [notifications] Optimize sending the notification data a
|
|
bit
|
|
|
|
According to Kai:
|
|
|
|
"object literal is more performant
|
|
same with [] vs new Array()
|
|
also you should avoid putting the keys in ""
|
|
{"foo": bar} is also less performant than {foo: bar} :)"
|
|
|
|
And so I did to his bidding.
|
|
|
|
Reviewed-by: Kai Uwe Broulik
|
|
---
|
|
applets/notifications/package/contents/ui/Jobs.qml | 22 +++++++++++-----------
|
|
1 file changed, 11 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/applets/notifications/package/contents/ui/Jobs.qml b/applets/notifications/package/contents/ui/Jobs.qml
|
|
index 5d68cfecef1a10c564aab508d9ea0e7cc6203b53..669d0bde600c0b50197b3df06ef7cdf466042e8a 100644
|
|
--- a/applets/notifications/package/contents/ui/Jobs.qml
|
|
+++ b/applets/notifications/package/contents/ui/Jobs.qml
|
|
@@ -80,17 +80,17 @@ Column {
|
|
summary = infoMessage ? i18nc("the job, which can be anything, failed to complete", "%1: Failed", infoMessage) : i18n("Job Failed")
|
|
}
|
|
|
|
- var op = [];
|
|
- op["source"] = source;
|
|
- op["appIcon"] = runningJobs[source]["appIconName"];
|
|
- op["appName"] = runningJobs[source]["appName"];
|
|
- op["summary"] = summary;
|
|
- op["body"] = errorText || message;
|
|
- op["isPersistent"] = true;
|
|
- op["expireTimeout"] = 6000;
|
|
- op["urgency"] = 0;
|
|
- op["configurable"] = false;
|
|
- 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")
|
|
+ var op = {
|
|
+ appIcon: runningJobs[source].appIconName,
|
|
+ appName: runningJobs[source].appName,
|
|
+ summary: summary,
|
|
+ body: errorText || message,
|
|
+ isPersistent: true,
|
|
+ expireTimeout: 6000,
|
|
+ urgency: 0,
|
|
+ configurable: false,
|
|
+ actions: !error && UrlHelper.isUrlValid(message) ? ["jobUrl#" + message, i18n("Open...")] : []
|
|
+ }; // If the actionId contains "jobUrl#", it tries to open the "id" value (which is "message")
|
|
|
|
notifications.createNotification(op);
|
|
|
|
--
|
|
2.4.1
|
|
|