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

Proposed by Ruben Verweij
Status: Merged
Merged at revision: 8
Proposed branch: lp://staging/~ruben-verweij/libnotify-mozilla/devel
Merge into: lp://staging/~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://staging/~ruben-verweij/libnotify-mozilla/devel
Reviewer Review Type Date Requested Status
Ruben Verweij (community) Approve
Review via email: mp+7884@code.staging.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
=== modified file 'content/options.xul'
--- content/options.xul 2009-06-18 16:56:14 +0000
+++ content/options.xul 2009-09-26 17:35:18 +0000
@@ -19,7 +19,7 @@
1919
20 <script type="application/x-javascript">20 <script type="application/x-javascript">
21 <![CDATA[21 <![CDATA[
22 function sendNotification(summary, body, iconName) {22 function sendNotification(summary, body, iconName, category) {
23 try {23 try {
24 dump("MessengerNotifications::sendNotification\r\n");24 dump("MessengerNotifications::sendNotification\r\n");
25 var file = Components.classes["@mozilla.org/file/local;1"].25 var file = Components.classes["@mozilla.org/file/local;1"].
@@ -29,7 +29,7 @@
29 var process = Components.classes["@mozilla.org/process/util;1"]29 var process = Components.classes["@mozilla.org/process/util;1"]
30 .createInstance(Components.interfaces.nsIProcess);30 .createInstance(Components.interfaces.nsIProcess);
31 process.init(file);31 process.init(file);
32 var args = [summary, body, "-i", iconName];32 var args = [summary, body, "-i", iconName, "-c", category];
33 process.run(false, args, args.length);33 process.run(false, args, args.length);
34 }catch(e){34 }catch(e){
35 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]35 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
@@ -54,7 +54,7 @@
54 <checkbox preference="pref_symbol" id="symbol"/>54 <checkbox preference="pref_symbol" id="symbol"/>
55 </hbox>55 </hbox>
56<hbox align="center">56<hbox align="center">
57 <button label="Send test notification" oncommand="sendNotification('Test Notification', 'From Libnotify Popups', 'notification-message-email');"/>57 <button label="Send test notification" oncommand="sendNotification('Test Notification', 'From Libnotify Popups', 'notification-message-email', 'email.arrived');"/>
58 </hbox>58 </hbox>
59</prefpane>59</prefpane>
6060
6161
=== modified file 'content/overlay.js'
--- content/overlay.js 2009-06-18 16:56:14 +0000
+++ content/overlay.js 2009-09-26 17:35:18 +0000
@@ -87,6 +87,13 @@
87 var mms = Components.classes[mailSessionContractID]87 var mms = Components.classes[mailSessionContractID]
88 .getService(Components.interfaces.nsIMsgMailSession);88 .getService(Components.interfaces.nsIMsgMailSession);
89 mms.AddFolderListener(this, nsIFolderListener.added);89 mms.AddFolderListener(this, nsIFolderListener.added);
90
91 // Check if libnotifypopups.showFolder exists
92 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
93 .getService(Components.interfaces.nsIPrefService);
94 if(!prefs.prefHasUserValue("libnotifypopups.showFolder")){
95 prefs.setBoolPref("libnotifypopups.showFolder", false);
96 }
9097
91 },98 },
9299
@@ -183,7 +190,7 @@
183 var body = this.mBundle.formatStringFromName("mail.new.mails.body",190 var body = this.mBundle.formatStringFromName("mail.new.mails.body",
184 [subject, author], 2);191 [subject, author], 2);
185 }192 }
186 this.sendNotification(summary, body, "notification-message-email");193 this.sendNotification(summary, body, "notification-message-email", "email.arrived");
187194
188 } else {195 } else {
189 if(this.mailQueue.length != 0){196 if(this.mailQueue.length != 0){
@@ -193,7 +200,7 @@
193 for(var index=0;index<2;index++) { // Due to the if statement we always have 2 elements200 for(var index=0;index<2;index++) { // Due to the if statement we always have 2 elements
194 var subject = this.mailQueue[index].subject;201 var subject = this.mailQueue[index].subject;
195 var author = this.mailQueue[index].author;202 var author = this.mailQueue[index].author;
196 var folder = this.mailQueue[index].folder;203 var folder = this.mailQueue[index].folderName;
197 if(showFolder){204 if(showFolder){
198 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",205 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",
199 [subject, author, folder], 3) + "\r\n";206 [subject, author, folder], 3) + "\r\n";
@@ -208,7 +215,7 @@
208 for(var index=0;index<2;index++) { // Only display the first two new mails, then display ...215 for(var index=0;index<2;index++) { // Only display the first two new mails, then display ...
209 var subject = this.mailQueue[index].subject;216 var subject = this.mailQueue[index].subject;
210 var author = this.mailQueue[index].author;217 var author = this.mailQueue[index].author;
211 var folder = this.mailQueue[index].folder;218 var folder = this.mailQueue[index].folderName;
212 if(showFolder){219 if(showFolder){
213 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",220 body += this.mBundle.formatStringFromName("mail.new.mails.bodyWithFolder",
214 [subject, author, folder], 3) + "\r\n";221 [subject, author, folder], 3) + "\r\n";
@@ -222,12 +229,13 @@
222229
223 var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",230 var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",
224 [this.mailQueue.length], 1);231 [this.mailQueue.length], 1);
225 this.sendNotification(summary, body, "notification-message-email");232 this.sendNotification(summary, body, "notification-message-email", "email.arrived");
226 }233 }
227 }234 }
228 this.mailQueue = new Array(0);235 this.mailQueue = new Array(0);
229 this.displayingMessage = false;236 this.displayingMessage = false;
230 } catch(e){237 } catch(e){
238 this.mailQueue = new Array(0);
231 this.displayingMessage = false;239 this.displayingMessage = false;
232 Components.utils.reportError(e);240 Components.utils.reportError(e);
233 throw e;241 throw e;
@@ -237,7 +245,7 @@
237 /**245 /**
238 * Send notification using 'notify-send' command line.246 * Send notification using 'notify-send' command line.
239 */247 */
240 sendNotification : function sendNotification(summary, body, iconName) {248 sendNotification : function sendNotification(summary, body, iconName, category) {
241 try {249 try {
242 dump("MessengerNotifications::sendNotification\r\n");250 dump("MessengerNotifications::sendNotification\r\n");
243 var file = Components.classes["@mozilla.org/file/local;1"].251 var file = Components.classes["@mozilla.org/file/local;1"].
@@ -247,7 +255,7 @@
247 var process = Components.classes["@mozilla.org/process/util;1"]255 var process = Components.classes["@mozilla.org/process/util;1"]
248 .createInstance(Components.interfaces.nsIProcess);256 .createInstance(Components.interfaces.nsIProcess);
249 process.init(file);257 process.init(file);
250 var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName];258 var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName, "-c", category];
251 process.run(false, args, args.length);259 process.run(false, args, args.length);
252 }catch(e){260 }catch(e){
253 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]261 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
@@ -256,6 +264,7 @@
256 Components.utils.reportError(e);264 Components.utils.reportError(e);
257 throw e;265 throw e;
258 }266 }
267
259 }268 }
260}269}
261270

Subscribers

People subscribed via source and target branches

to all changes: