Merge lp:~ruben-verweij/libnotify-mozilla/devel into lp:~ikus060-renamed/libnotify-mozilla/trunk

Proposed by Ruben Verweij
Status: Merged
Merged at revision: 8
Proposed branch: lp:~ruben-verweij/libnotify-mozilla/devel
Merge into: lp:~ikus060-renamed/libnotify-mozilla/trunk
Diff against target: 115 lines
2 files modified
content/options.xul (+3/-3)
content/overlay.js (+15/-6)
To merge this branch: bzr merge lp:~ruben-verweij/libnotify-mozilla/devel
Reviewer Review Type Date Requested Status
Ruben Verweij (community) Approve
Review via email: mp+7884@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ruben Verweij (ruben-verweij) wrote :

I have adjusted it to display the account name and to pass the category to notify-send.

Revision history for this message
Ruben Verweij (ruben-verweij) wrote :

> I have adjusted it to display the account name and to pass the category to
> notify-send.

Also it check if the preference libnotifypopups.showFolder exists, and creates it if it doesn't.

Revision history for this message
Ruben Verweij (ruben-verweij) wrote :

Several bugfixes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'content/options.xul'
2--- content/options.xul 2009-06-18 16:56:14 +0000
3+++ content/options.xul 2009-09-26 17:35:18 +0000
4@@ -19,7 +19,7 @@
5
6 <script type="application/x-javascript">
7 <![CDATA[
8- function sendNotification(summary, body, iconName) {
9+ function sendNotification(summary, body, iconName, category) {
10 try {
11 dump("MessengerNotifications::sendNotification\r\n");
12 var file = Components.classes["@mozilla.org/file/local;1"].
13@@ -29,7 +29,7 @@
14 var process = Components.classes["@mozilla.org/process/util;1"]
15 .createInstance(Components.interfaces.nsIProcess);
16 process.init(file);
17- var args = [summary, body, "-i", iconName];
18+ var args = [summary, body, "-i", iconName, "-c", category];
19 process.run(false, args, args.length);
20 }catch(e){
21 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
22@@ -54,7 +54,7 @@
23 <checkbox preference="pref_symbol" id="symbol"/>
24 </hbox>
25 <hbox align="center">
26- <button label="Send test notification" oncommand="sendNotification('Test Notification', 'From Libnotify Popups', 'notification-message-email');"/>
27+ <button label="Send test notification" oncommand="sendNotification('Test Notification', 'From Libnotify Popups', 'notification-message-email', 'email.arrived');"/>
28 </hbox>
29 </prefpane>
30
31
32=== modified file 'content/overlay.js'
33--- content/overlay.js 2009-06-18 16:56:14 +0000
34+++ content/overlay.js 2009-09-26 17:35:18 +0000
35@@ -87,6 +87,13 @@
36 var mms = Components.classes[mailSessionContractID]
37 .getService(Components.interfaces.nsIMsgMailSession);
38 mms.AddFolderListener(this, nsIFolderListener.added);
39+
40+ // Check if libnotifypopups.showFolder exists
41+ var prefs = Components.classes["@mozilla.org/preferences-service;1"]
42+ .getService(Components.interfaces.nsIPrefService);
43+ if(!prefs.prefHasUserValue("libnotifypopups.showFolder")){
44+ prefs.setBoolPref("libnotifypopups.showFolder", false);
45+ }
46
47 },
48
49@@ -183,7 +190,7 @@
50 var body = this.mBundle.formatStringFromName("mail.new.mails.body",
51 [subject, author], 2);
52 }
53- this.sendNotification(summary, body, "notification-message-email");
54+ this.sendNotification(summary, body, "notification-message-email", "email.arrived");
55
56 } else {
57 if(this.mailQueue.length != 0){
58@@ -193,7 +200,7 @@
59 for(var index=0;index<2;index++) { // Due to the if statement we always have 2 elements
60 var subject = this.mailQueue[index].subject;
61 var author = this.mailQueue[index].author;
62- var folder = this.mailQueue[index].folder;
63+ var folder = this.mailQueue[index].folderName;
64 if(showFolder){
65 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",
66 [subject, author, folder], 3) + "\r\n";
67@@ -208,7 +215,7 @@
68 for(var index=0;index<2;index++) { // Only display the first two new mails, then display ...
69 var subject = this.mailQueue[index].subject;
70 var author = this.mailQueue[index].author;
71- var folder = this.mailQueue[index].folder;
72+ var folder = this.mailQueue[index].folderName;
73 if(showFolder){
74 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",
75 [subject, author, folder], 3) + "\r\n";
76@@ -222,12 +229,13 @@
77
78 var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",
79 [this.mailQueue.length], 1);
80- this.sendNotification(summary, body, "notification-message-email");
81+ this.sendNotification(summary, body, "notification-message-email", "email.arrived");
82 }
83 }
84 this.mailQueue = new Array(0);
85 this.displayingMessage = false;
86 } catch(e){
87+ this.mailQueue = new Array(0);
88 this.displayingMessage = false;
89 Components.utils.reportError(e);
90 throw e;
91@@ -237,7 +245,7 @@
92 /**
93 * Send notification using 'notify-send' command line.
94 */
95- sendNotification : function sendNotification(summary, body, iconName) {
96+ sendNotification : function sendNotification(summary, body, iconName, category) {
97 try {
98 dump("MessengerNotifications::sendNotification\r\n");
99 var file = Components.classes["@mozilla.org/file/local;1"].
100@@ -247,7 +255,7 @@
101 var process = Components.classes["@mozilla.org/process/util;1"]
102 .createInstance(Components.interfaces.nsIProcess);
103 process.init(file);
104- var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName];
105+ var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName, "-c", category];
106 process.run(false, args, args.length);
107 }catch(e){
108 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
109@@ -256,6 +264,7 @@
110 Components.utils.reportError(e);
111 throw e;
112 }
113+
114 }
115 }
116

Subscribers

People subscribed via source and target branches

to all changes: