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: not available
Proposed branch: lp://staging/~ruben-verweij/libnotify-mozilla/devel
Merge into: lp://staging/~ikus060-renamed/libnotify-mozilla/trunk
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~ruben-verweij/libnotify-mozilla/devel
Reviewer Review Type Date Requested Status
ikus060 Approve
Review via email: mp+7168@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Ruben Verweij (ruben-verweij) wrote :

Hi Patrick!

I have added the following functions:
- fixed wrong queue behaviour
- display error if notify-bin isn't installed
- display preview notification in preferences

Could you please give me feedback and merge the code into trunk if it is okay?

Regards,

Ruben

10. By Ruben Verweij

Fixed 'received 0 new mails'-bug and 'string has no properties' bug

Revision history for this message
ikus060 (ikus060-renamed) wrote :

> Hi Patrick!
>
> I have added the following functions:
> - fixed wrong queue behaviour
great !
> - display error if notify-bin isn't installed
Perfect ...
> - display preview notification in preferences
I guess there is something missing. I only get an empty window. And I don't see anything related to it in your commit.

> Could you please give me feedback and merge the code into trunk if it is okay?
>
> Regards,
>
> Ruben

11. By Ruben Verweij

Forgot to add content/options.xul file

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

Sorry, I forgot to add the file. It is fixed in revision 11. ;)

ikus060 schreef:
>> Hi Patrick!
>>
>> I have added the following functions:
>> - fixed wrong queue behaviour
>>
> great !
>
>> - display error if notify-bin isn't installed
>>
> Perfect ...
>
>> - display preview notification in preferences
>>
> I guess there is something missing. I only get an empty window. And I don't see anything related to it in your commit.
>
>
>
>> Could you please give me feedback and merge the code into trunk if it is okay?
>>
>> Regards,
>>
>> Ruben
>>

12. By Ruben Verweij

Added the option to display the account name

Revision history for this message
ikus060 (ikus060-renamed) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'content/overlay.js'
--- content/overlay.js 2009-04-23 00:53:20 +0000
+++ content/overlay.js 2009-06-07 18:55:05 +0000
@@ -1,7 +1,7 @@
1/*1/*
2 * Overlay Javascript for thunderbird2 * Overlay Javascript for thunderbird
3 *3 *
4 * Copyright (c) 2009 Patrik Dufresne4 * Copyright (c) 2009 Patrik Dufresne & Ruben Verweij
5 */5 */
66
7/*7/*
@@ -87,7 +87,7 @@
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 90
91 },91 },
9292
93 //////////////////////////////////////////////////////////////////////////////93 //////////////////////////////////////////////////////////////////////////////
@@ -120,7 +120,7 @@
120 dump("MessengerNotifications::checkFolder\r\n");120 dump("MessengerNotifications::checkFolder\r\n");
121 // TODO at least until I come up with some kind of message queue that slowly121 // TODO at least until I come up with some kind of message queue that slowly
122 // displays messages, we ignore RSS feeds.122 // displays messages, we ignore RSS feeds.
123 123
124 // We don't check certain folders because they don't contain useful stuff124 // We don't check certain folders because they don't contain useful stuff
125 if ((aFolder.flags & FLR_FLAG_TRASH) == FLR_FLAG_TRASH ||125 if ((aFolder.flags & FLR_FLAG_TRASH) == FLR_FLAG_TRASH ||
126 (aFolder.flags & FLR_FLAG_JUNK) == FLR_FLAG_JUNK ||126 (aFolder.flags & FLR_FLAG_JUNK) == FLR_FLAG_JUNK ||
@@ -143,11 +143,11 @@
143 */143 */
144 handleNewMailReceive : function handleNewMailReceive(folderName, subject, author)144 handleNewMailReceive : function handleNewMailReceive(folderName, subject, author)
145 {145 {
146 dump("MessengerNotifications::handleNewMailReceive(" + 146 dump("MessengerNotifications::handleNewMailReceive(" +
147 folderName + ", " + subject + ", " + author + " )\r\n");147 folderName + ", " + subject + ", " + author + " )\r\n");
148148
149 if(!this.displayingMessage) {149 if(!this.displayingMessage) {
150 var item = {'folderName': folderName, 'subject': subject, 150 var item = {'folderName': folderName, 'subject': subject,
151 'author': author};151 'author': author};
152 item.folderName;152 item.folderName;
153 item.subject;153 item.subject;
@@ -158,46 +158,49 @@
158 },158 },
159159
160 /**160 /**
161 * Build the notification message from mails in queue and display 161 * Build the notification message from mails in queue and display
162 * it with notify OSD.162 * it with notify OSD.
163 */163 */
164 displayNotification : function displayNotification(){164 displayNotification : function displayNotification(){
165 this.displayingMessage = true;165 this.displayingMessage = true;
166 try{166 try{
167 167
168 if(this.mailQueue.length==1){ 168 if(this.mailQueue.length == 1){
169169
170 var subject = this.mailQueue[0].subject;170 var subject = this.mailQueue[0].subject;
171 var author = this.mailQueue[0].author;171 var author = this.mailQueue[0].author;
172172
173 var summary = this.mBundle.GetStringFromName("mail.new.mail.summary");173 var summary = this.mBundle.GetStringFromName("mail.new.mail.summary");
174 var body = this.mBundle.formatStringFromName("mail.new.mails.body", 174 var body = this.mBundle.formatStringFromName("mail.new.mails.body",
175 [subject, author], 2);175 [subject, author], 2);
176 this.sendNotification(summary, body, "notification-message-email");176 this.sendNotification(summary, body, "notification-message-email");
177177
178 } else if (this.mailQueue.length>1 178 } else {
179 && this.mailQueue.length<3){179 if(this.mailQueue.length == 2){
180180
181 var body = "";181 var body = "";
182 for(var index=0;index<this.mailQueue.length-1 182 for(var index=0;index<2;index++) { // Due to the if statement we always have 2 elements
183 && index<3;index++) {
184 var subject = this.mailQueue[index].subject;183 var subject = this.mailQueue[index].subject;
185 var author = this.mailQueue[index].author;184 var author = this.mailQueue[index].author;
186 body += this.mBundle.formatStringFromName("mail.new.mails.body", 185 body += this.mBundle.formatStringFromName("mail.new.mails.body",[subject, author],2) + "\r\n";
187 [subject, author]) + "\r\n\r\n";186 }
188 }187 }
189 if(this.mailQueue.length>=3) {188 if(this.mailQueue.length>=3){
189 var body = "";
190 for(var index=0;index<2;index++) { // Only display the first two new mails, then display ...
191 var subject = this.mailQueue[index].subject;
192 var author = this.mailQueue[index].author;
193 body += this.mBundle.formatStringFromName("mail.new.mails.body",[subject, author],2) + "\r\n";
194 }
190 body += "...";195 body += "...";
191 }196 }
192197
193 var summary = this.mBundle.formatStringFromName("mail.new.mails.summary", 198 var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",
194 [this.mailQueue.length], 1);199 [this.mailQueue.length], 1);
195 this.sendNotification(summary, body, "notification-message-email");200 this.sendNotification(summary, body, "notification-message-email");
196 }201 }
197202 this.mailQueue = new Array(0);
198 this.mailQueue = new Array(0);203 this.displayingMessage = false;
199
200 this.displayingMessage = false;
201 } catch(e){204 } catch(e){
202 this.displayingMessage = false;205 this.displayingMessage = false;
203 Components.utils.reportError(e);206 Components.utils.reportError(e);
@@ -209,7 +212,7 @@
209 * Send notification using 'notify-send' command line.212 * Send notification using 'notify-send' command line.
210 */213 */
211 sendNotification : function sendNotification(summary, body, iconName) {214 sendNotification : function sendNotification(summary, body, iconName) {
212 215 try {
213 dump("MessengerNotifications::sendNotification\r\n");216 dump("MessengerNotifications::sendNotification\r\n");
214 var file = Components.classes["@mozilla.org/file/local;1"].217 var file = Components.classes["@mozilla.org/file/local;1"].
215 createInstance(Components.interfaces.nsILocalFile);218 createInstance(Components.interfaces.nsILocalFile);
@@ -220,7 +223,13 @@
220 process.init(file);223 process.init(file);
221 var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName];224 var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName];
222 process.run(false, args, args.length);225 process.run(false, args, args.length);
223226 }catch(e){
227 var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
228 .getService(Components.interfaces.nsIPromptService);
229 prompts.alert(null, "Dependency error", "To see notifications via libnotify, the libnotify-bin package needs to be installed. Please install this package via System->Administration->Synaptic Package Manager.");
230 Components.utils.reportError(e);
231 throw e;
232 }
224 }233 }
225}234}
226235
@@ -231,7 +240,7 @@
231240
232function libnotifypopups_onLoad() {241function libnotifypopups_onLoad() {
233 libnotifypopups = new MessengerNotifications();242 libnotifypopups = new MessengerNotifications();
234 removeEventListener("load", libnotifypopups_onLoad, true); 243 removeEventListener("load", libnotifypopups_onLoad, true);
235}244}
236245
237addEventListener("load", libnotifypopups_onLoad, false);246addEventListener("load", libnotifypopups_onLoad, false);
238247
=== modified file 'install.rdf'
--- install.rdf 2009-04-26 13:34:32 +0000
+++ install.rdf 2009-06-07 18:55:05 +0000
@@ -17,6 +17,7 @@
17 <em:name>Libnotify Popups</em:name>17 <em:name>Libnotify Popups</em:name>
18 <em:version>0.1.2</em:version>18 <em:version>0.1.2</em:version>
19 <em:creator>Patrik Dufresne</em:creator>19 <em:creator>Patrik Dufresne</em:creator>
20 <em:contributor>Ruben Verweij</em:contributor>
20 <em:targetApplication>21 <em:targetApplication>
21 <Description>22 <Description>
22 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->23 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
@@ -31,5 +32,6 @@
31 <em:maxVersion>2.0.0.*</em:maxVersion>32 <em:maxVersion>2.0.0.*</em:maxVersion>
32 </Description>33 </Description>
33 </em:targetApplication>34 </em:targetApplication>
35<em:optionsURL>chrome://libnotifypopups/content/options.xul</em:optionsURL>
34 </Description>36 </Description>
35</RDF>37</RDF>
3638
=== modified file 'locale/en-US/libnotifypopups.properties'
--- locale/en-US/libnotifypopups.properties 2009-04-23 00:53:20 +0000
+++ locale/en-US/libnotifypopups.properties 2009-06-07 12:20:55 +0000
@@ -7,6 +7,6 @@
7# Software Foundation; either version 2 of the License, or (at your option)7# Software Foundation; either version 2 of the License, or (at your option)
8# any later version.8# any later version.
99
10mail.new.mail.summary=New Mail received10mail.new.mail.summary=New mail received
11mail.new.mails.summary=%1$S mails received11mail.new.mails.summary=%1$S new mails received
12mail.new.mails.body=%1$S, from %2$S12mail.new.mails.body=%1$S, from %2$S

Subscribers

People subscribed via source and target branches

to all changes: