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
1=== modified file 'content/overlay.js'
2--- content/overlay.js 2009-04-23 00:53:20 +0000
3+++ content/overlay.js 2009-06-07 18:55:05 +0000
4@@ -1,7 +1,7 @@
5 /*
6 * Overlay Javascript for thunderbird
7 *
8- * Copyright (c) 2009 Patrik Dufresne
9+ * Copyright (c) 2009 Patrik Dufresne & Ruben Verweij
10 */
11
12 /*
13@@ -87,7 +87,7 @@
14 var mms = Components.classes[mailSessionContractID]
15 .getService(Components.interfaces.nsIMsgMailSession);
16 mms.AddFolderListener(this, nsIFolderListener.added);
17-
18+
19 },
20
21 //////////////////////////////////////////////////////////////////////////////
22@@ -120,7 +120,7 @@
23 dump("MessengerNotifications::checkFolder\r\n");
24 // TODO at least until I come up with some kind of message queue that slowly
25 // displays messages, we ignore RSS feeds.
26-
27+
28 // We don't check certain folders because they don't contain useful stuff
29 if ((aFolder.flags & FLR_FLAG_TRASH) == FLR_FLAG_TRASH ||
30 (aFolder.flags & FLR_FLAG_JUNK) == FLR_FLAG_JUNK ||
31@@ -143,11 +143,11 @@
32 */
33 handleNewMailReceive : function handleNewMailReceive(folderName, subject, author)
34 {
35- dump("MessengerNotifications::handleNewMailReceive(" +
36+ dump("MessengerNotifications::handleNewMailReceive(" +
37 folderName + ", " + subject + ", " + author + " )\r\n");
38
39 if(!this.displayingMessage) {
40- var item = {'folderName': folderName, 'subject': subject,
41+ var item = {'folderName': folderName, 'subject': subject,
42 'author': author};
43 item.folderName;
44 item.subject;
45@@ -158,46 +158,49 @@
46 },
47
48 /**
49- * Build the notification message from mails in queue and display
50+ * Build the notification message from mails in queue and display
51 * it with notify OSD.
52 */
53 displayNotification : function displayNotification(){
54 this.displayingMessage = true;
55 try{
56-
57- if(this.mailQueue.length==1){
58+
59+ if(this.mailQueue.length == 1){
60
61 var subject = this.mailQueue[0].subject;
62 var author = this.mailQueue[0].author;
63
64 var summary = this.mBundle.GetStringFromName("mail.new.mail.summary");
65- var body = this.mBundle.formatStringFromName("mail.new.mails.body",
66+ var body = this.mBundle.formatStringFromName("mail.new.mails.body",
67 [subject, author], 2);
68 this.sendNotification(summary, body, "notification-message-email");
69
70- } else if (this.mailQueue.length>1
71- && this.mailQueue.length<3){
72+ } else {
73+ if(this.mailQueue.length == 2){
74
75 var body = "";
76- for(var index=0;index<this.mailQueue.length-1
77- && index<3;index++) {
78+ for(var index=0;index<2;index++) { // Due to the if statement we always have 2 elements
79 var subject = this.mailQueue[index].subject;
80 var author = this.mailQueue[index].author;
81- body += this.mBundle.formatStringFromName("mail.new.mails.body",
82- [subject, author]) + "\r\n\r\n";
83+ body += this.mBundle.formatStringFromName("mail.new.mails.body",[subject, author],2) + "\r\n";
84+ }
85 }
86- if(this.mailQueue.length>=3) {
87+ if(this.mailQueue.length>=3){
88+ var body = "";
89+ for(var index=0;index<2;index++) { // Only display the first two new mails, then display ...
90+ var subject = this.mailQueue[index].subject;
91+ var author = this.mailQueue[index].author;
92+ body += this.mBundle.formatStringFromName("mail.new.mails.body",[subject, author],2) + "\r\n";
93+ }
94 body += "...";
95 }
96
97- var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",
98+ var summary = this.mBundle.formatStringFromName("mail.new.mails.summary",
99 [this.mailQueue.length], 1);
100 this.sendNotification(summary, body, "notification-message-email");
101- }
102-
103- this.mailQueue = new Array(0);
104-
105- this.displayingMessage = false;
106+ }
107+ this.mailQueue = new Array(0);
108+ this.displayingMessage = false;
109 } catch(e){
110 this.displayingMessage = false;
111 Components.utils.reportError(e);
112@@ -209,7 +212,7 @@
113 * Send notification using 'notify-send' command line.
114 */
115 sendNotification : function sendNotification(summary, body, iconName) {
116-
117+ try {
118 dump("MessengerNotifications::sendNotification\r\n");
119 var file = Components.classes["@mozilla.org/file/local;1"].
120 createInstance(Components.interfaces.nsILocalFile);
121@@ -220,7 +223,13 @@
122 process.init(file);
123 var args = [utf8.encode(summary), utf8.encode(body), "-i", iconName];
124 process.run(false, args, args.length);
125-
126+ }catch(e){
127+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
128+ .getService(Components.interfaces.nsIPromptService);
129+ 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.");
130+ Components.utils.reportError(e);
131+ throw e;
132+ }
133 }
134 }
135
136@@ -231,7 +240,7 @@
137
138 function libnotifypopups_onLoad() {
139 libnotifypopups = new MessengerNotifications();
140- removeEventListener("load", libnotifypopups_onLoad, true);
141+ removeEventListener("load", libnotifypopups_onLoad, true);
142 }
143
144 addEventListener("load", libnotifypopups_onLoad, false);
145
146=== modified file 'install.rdf'
147--- install.rdf 2009-04-26 13:34:32 +0000
148+++ install.rdf 2009-06-07 18:55:05 +0000
149@@ -17,6 +17,7 @@
150 <em:name>Libnotify Popups</em:name>
151 <em:version>0.1.2</em:version>
152 <em:creator>Patrik Dufresne</em:creator>
153+ <em:contributor>Ruben Verweij</em:contributor>
154 <em:targetApplication>
155 <Description>
156 <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- firefox -->
157@@ -31,5 +32,6 @@
158 <em:maxVersion>2.0.0.*</em:maxVersion>
159 </Description>
160 </em:targetApplication>
161+<em:optionsURL>chrome://libnotifypopups/content/options.xul</em:optionsURL>
162 </Description>
163 </RDF>
164
165=== modified file 'locale/en-US/libnotifypopups.properties'
166--- locale/en-US/libnotifypopups.properties 2009-04-23 00:53:20 +0000
167+++ locale/en-US/libnotifypopups.properties 2009-06-07 12:20:55 +0000
168@@ -7,6 +7,6 @@
169 # Software Foundation; either version 2 of the License, or (at your option)
170 # any later version.
171
172-mail.new.mail.summary=New Mail received
173-mail.new.mails.summary=%1$S mails received
174+mail.new.mail.summary=New mail received
175+mail.new.mails.summary=%1$S new mails received
176 mail.new.mails.body=%1$S, from %2$S

Subscribers

People subscribed via source and target branches

to all changes: