Closed
Bug 260818
Opened 21 years ago
Closed 21 years ago
Pop up an alert when a download finishes
Categories
(SeaMonkey :: Download & File Handling, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.8alpha5
People
(Reporter: csthomas, Assigned: csthomas)
Details
Attachments
(4 files, 4 obsolete files)
|
2.24 KB,
text/plain
|
Details | |
|
25.16 KB,
patch
|
timeless
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
|
4.02 KB,
patch
|
timeless
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
|
25.11 KB,
patch
|
Details | Diff | Splinter Review |
Mailnews shows a visual alert when new mail arrives. Presently, seamonkey can
only play a sound (see bug 16498) or do nothing. We should show an alert
similar to the mailnews alert when a download finishes.
Firefox currently does this. Are you suggesting a backport of this functionality
or were you not aware it existed?
| Assignee | ||
Comment 2•21 years ago
|
||
Comment 3•21 years ago
|
||
+ //we know prefs is not null and we got the pref branch
+ // alertPref (initialized to 0, if it changed, prefs are working)
please be consistent with spaces after the // - file style is a space.
+ if (NS_SUCCEEDED(rv))
+ {
style of this file is:
if (NS_SUCCEEDED(rv)) {
+ NS_ENSURE_SUCCESS(rv, rv);
no, you cannot do that. see the comment below:
// can't do an early return; have to break reference cycle below
+ rv =
alertsService->ShowAlertNotification("http://ctho.ath.cx/moztree/mozilla/themes/modern/messenger/icons/new-mail-alert.png",
finishedTitle, finishedText, PR_TRUE,
you aren't suggesting checkin this in as-is here, do you? :)
| Assignee | ||
Comment 4•21 years ago
|
||
Do we want to play a sound too with the alert? Mailnews does. It would be
fairly easy to add.
(In reply to comment #3)
> no, you cannot do that. see the comment below:
> // can't do an early return; have to break reference cycle below
Fixed.
>
alertsService->ShowAlertNotification("http://ctho.ath.cx/moztree/mozilla/themes/modern/messenger/icons/new-mail-alert.png",
> finishedTitle, finishedText, PR_TRUE,
>
> you aren't suggesting checkin this in as-is here, do you? :)
This way I can do a "download finished icon of the day" thing by rotating the
image on my server ;).
The frontend changes in this patch are not done yet (I have to clean it up,
move the JS to a separate file, etc.)
| Assignee | ||
Updated•21 years ago
|
Attachment #159679 -
Attachment is obsolete: true
| Assignee | ||
Comment 6•21 years ago
|
||
| Assignee | ||
Updated•21 years ago
|
Attachment #159814 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #159814 -
Flags: review?(jag)
| Assignee | ||
Updated•21 years ago
|
Attachment #159815 -
Flags: superreview?(jag)
Attachment #159815 -
Flags: review?(neil.parkwaycc.co.uk)
| Assignee | ||
Comment 7•21 years ago
|
||
content/communicator/pref/pref-keynav.xul
(prefwindow/resources/content/pref-keynav.xul)
+ content/communicator/pref/pref-download.js
(prefwindow/resources/content/pref-download.js)
I fixed the indentation there on my local copy.
| Assignee | ||
Updated•21 years ago
|
Whiteboard: r?
| Assignee | ||
Comment 8•21 years ago
|
||
Patch browser-prefs.js, fix the whitespace.
| Assignee | ||
Comment 9•21 years ago
|
||
Should I track the alerts in mDownloadManager so it only has one up at a time?
I considered doing it in nsDownload, but that wouldn't have actually worked. I
just tested, and it's quite slow when you have a lot of alerts sliding up and
down simultaneously.
Comment 10•21 years ago
|
||
Comment on attachment 159908 [details] [diff] [review]
slightly revised patch
I like this patch in general, but nitpicky as I am:
I think I'd prefer it if you just moved the GetCharPref for the sound_url
inside |if (NS_SUCCEEDED(rv) && playSound)| on the GetBoolPref for the
download_sound, and left the |if (!soundStr.IsEmpty())| as it is, instead of
having this rather strange dependency between prefBranch not being null and
playSound being true. Yes, I understand the code, and yes, the comment helps,
but really, there's no need for the comment if you rearrange the code a little
as suggested. B.t.w., use PR_FALSE, not 0, to set the showAlert bool to false.
I understand the need for the do { } while (0); there, it's clever, but boy is
that ugly. I wish I could think of a more elegant way to do that. I guess you
could put the stuff inside the |if (NS_SUCCEEDED(rv))| in a helper function
with two PRUnichar** params... Or just go ahead and nest.
+ const PRUnichar *strings[] ={ mDisplayName.get() };
Add a space between = and {
+ <stringbundle id="bundle_prefutilities"
+
src="chrome://communicator/locale/pref/prefutilities.properties"/>
Why are you adding that? Oh, I see, choosesoundurl, which you seem to have
replaced with an entity in pref-download.dtd. So you can undo your change to
prefutilities.properties.
+<!ENTITY doNothing2.accesskey "N">
Hmm? Unused?
+<!ENTITY playSound.accesskey "S">
+<!ENTITY showAlert.accesskey "A">
Typically those would be interleaved with the associated labels, see the rest
of that file.
| Assignee | ||
Comment 11•21 years ago
|
||
(In reply to comment #10)
> could put the stuff inside the |if (NS_SUCCEEDED(rv))| in a helper function
> with two PRUnichar** params... Or just go ahead and nest.
I didn't need to pass any parameters.
Attachment #159815 -
Attachment is obsolete: true
Attachment #159908 -
Attachment is obsolete: true
| Assignee | ||
Updated•21 years ago
|
Attachment #159815 -
Flags: superreview?(jag)
Attachment #159815 -
Flags: review?(neil.parkwaycc.co.uk)
| Assignee | ||
Updated•21 years ago
|
Attachment #160277 -
Flags: superreview?(jag)
Attachment #160277 -
Flags: review?(dean_tessman)
| Assignee | ||
Updated•21 years ago
|
Attachment #159814 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #159814 -
Flags: superreview?(jag)
Attachment #159814 -
Flags: review?(jag)
Attachment #159814 -
Flags: review?(dean_tessman)
Comment 12•21 years ago
|
||
Ah, yeah, of course. Nice, clean, I like it. Waiting for r=, then I'll sr=.
| Assignee | ||
Updated•21 years ago
|
Whiteboard: r? → r?, active
| Assignee | ||
Updated•21 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8alpha5
Attachment #160277 -
Flags: review?(dean_tessman) → review+
| Assignee | ||
Comment 13•21 years ago
|
||
Timeless suggested I ask for a cvs repository copy of
http://lxr.mozilla.org/seamonkey/source/mailnews/base/prefs/resources/content/pref-notifications.js#5
to pref-download.js, and then patch against that.
Comment 14•21 years ago
|
||
Comment on attachment 159814 [details]
pref-download.js
perhaps this should be a cvs repository copy + diff for download changes.
> // if we don't have the alert service, hide the pref UI for using alerts to notify on new mail
> // see bug #158711
comment should be fixed to say download completion instead of new mail
> var fp = Components.classes["@mozilla.org/filepicker;1"]
> .createInstance(nsIFilePicker);
it'd be nice if the .'s were in the same column ...
> var ioService = Components.classes["@mozilla.org/network/io-service;1"]
> .getService(Components.interfaces.nsIIOService);
and here
| Assignee | ||
Comment 15•21 years ago
|
||
<timeless> chris: could you post a (cvs)diff between mail and your version?
| Assignee | ||
Updated•21 years ago
|
Attachment #161063 -
Flags: superreview?(jag)
Attachment #161063 -
Flags: review?(timeless)
Attachment #161063 -
Flags: review?(timeless) → review+
| Assignee | ||
Updated•21 years ago
|
Attachment #159814 -
Flags: superreview?(jag)
Attachment #159814 -
Flags: review?(dean_tessman)
Updated•21 years ago
|
Attachment #161063 -
Flags: superreview?(jag) → superreview+
Comment 16•21 years ago
|
||
Comment on attachment 160277 [details] [diff] [review]
re-revised patch
+ nsCOMPtr<nsIPrefBranch> prefBranch;
if (prefs) {
- nsCOMPtr<nsIPrefBranch> prefBranch;
that prefBranch is only needed inside |if (prefs)|, I think it's a left-over
from a previous iteration.
PRBool playSound is only needed inside |if (prefBranch)|. Try to restrict
declarations to the smallest scope possible, it allows humans reading the code
to keep track of fewer variables (no pun intended).
Fix those two nits, and sr=jag
Attachment #160277 -
Flags: superreview?(jag) → superreview+
| Assignee | ||
Comment 17•21 years ago
|
||
| Assignee | ||
Updated•21 years ago
|
Whiteboard: r?, active → active
Comment 18•21 years ago
|
||
I went to do this move, and notice there's an .xul file by the same name right
next to it, and based on the other contents of both the source and destination
directories, they appear to come in pairs. Do both files need to be moved?
Comment 19•21 years ago
|
||
(In reply to comment #18)
>Do both files need to be moved?
I don't think you want too do that, Dave ;-)
pref-downloads.xul already exists, so we only need to create pref-downloads.js
Comment 20•21 years ago
|
||
OK, for the record, what's the source and destination directories for the cvs copy?
I see the source in comment 13, but I don't see the destination here. It was
told to me on IRC a few days ago, but I can't find the transcript. It should be
on the bug anyway, just for posterity.
| Assignee | ||
Comment 21•21 years ago
|
||
(In reply to comment #20)
> OK, for the record, what's the source and destination directories for the cvs
copy?
>
> I see the source in comment 13, but I don't see the destination here. It was
> told to me on IRC a few days ago, but I can't find the transcript. It should be
> on the bug anyway, just for posterity.
Source:
mailnews/base/prefs/resources/content/pref-notifications.js
Dest:
xpfe/components/prefwindow/resources/content/pref-download.js
Comment 22•21 years ago
|
||
OK, file copy/tag removal completed.
| Assignee | ||
Updated•21 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•21 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Updated•21 years ago
|
Status: REOPENED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•21 years ago
|
Whiteboard: active
I've verified that this works on Windows XP using build 2004-10-19-04 with the
Seamonkey trunk.
Saved links from:
* Save target as
* Files that were prompted from a page
* Regular clicking
Tested sounds as well.
Windows 9x architectures may be different -- if they work here, great, if not,
file a separate spin-off bug.
Status: RESOLVED → VERIFIED
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•