diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-27 21:38:05 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-27 21:38:05 +0200 |
commit | e37d07dc6c74c752202bbd44f7089ae6ecab2f72 (patch) | |
tree | fdd0c57b929a960fef8be1397f0867efbc7ddd4b | |
parent | 19dd65e5d2012834c2f4ebd808f2154ba01dea93 (diff) | |
download | bugzilla-triage-e37d07dc6c74c752202bbd44f7089ae6ecab2f72.tar.gz |
Move notifications to prompts where it belongs.
-rw-r--r-- | lib/prompts.js | 37 | ||||
-rw-r--r-- | lib/util.js | 33 |
2 files changed, 36 insertions, 34 deletions
diff --git a/lib/prompts.js b/lib/prompts.js index bf37818..bb42c39 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -109,4 +109,39 @@ exports.promptFileOpenPicker = function promptFilePicker (win) { return fp.file.path } return null; -};
\ No newline at end of file +}; + +/** + * Show a system notification with the given message + * + * @param msg String or Object with a message to be shown in a default + * notification or object with properties title, icon, and body + * @param callback Function called when user clicks on the notification (optional) + * @return None + */ +exports.notification = function notification(msg) { + var body = msg; + var title = "Bugzilla Notification"; + var icon = null; + var textClickable = false; + + if (typeof(msg) === "object") { + body = msg.body; + if ("title" in msg) { + title = msg.title; + } + if ("icon" in msg) { + icon = msg.icon; + } + } + try { + var classObj = Cc["@mozilla.org/alerts-service;1"]; + var alertService = classObj.getService(Ci.nsIAlertsService); + + alertService.showAlertNotification(icon, title, body); + return true; + } catch (e) { + console.error("Unable to display notification:", msg); + return false; + } +}; diff --git a/lib/util.js b/lib/util.js index 77b7fac..0ab44ce 100644 --- a/lib/util.js +++ b/lib/util.js @@ -68,39 +68,6 @@ exports.getBugNo = function getBugNo(url) { }; /** - * Show a system notification with the given message - * - * @param String or Object with a message to be shown in a default - * notification or object with properties title, icon, and body - * @return None - */ -exports.notification = function notification(msg) { - var body = msg; - var title = "Bugzilla Notification"; - var icon = null; - - if (typeof(msg) === "object") { - body = msg.body; - if ("title" in msg) { - title = msg.title; - } - if ("icon" in msg) { - icon = msg.icon; - } - } - try { - var classObj = Cc["@mozilla.org/alerts-service;1"]; - var alertService = classObj.getService(Ci.nsIAlertsService); - - alertService.showAlertNotification(icon, title, body); - return true; - } catch (e) { - console.error("Unable to display notification:", msg); - return false; - } -}; - -/** * format date to be in ISO format (just day part) * * @param date |