Closed Bug 474619 Opened 16 years ago Closed 16 years ago

Handle multiple selections more intelligently in new download manager

Categories

(SeaMonkey :: Download & File Handling, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.0b2

People

(Reporter: kairo, Assigned: InvisibleSmiley)

References

Details

Attachments

(2 files, 2 obsolete files)

The first version of the new toolkit-based download manager UI doesn't work on multiple selections for any other command than copy source URL. We should be able to handle it on at least some other commands as well.
test_multi_select.xul has tests for those actions, so needs to be adjusted if we do that.
Attached patch proposed patch (obsolete) — Splinter Review
This adds support for multiple selections to: - play/pause/resume/retry - stop/cancel/remove and adapts the test. Notes: - Only consistent selections enable a command, i.e. all selected items must fulfill the same requirements as a single selected download had to fulfill before. - Due to the above, the command enabling for the changed commands is now mostly using the negation of the old logic to find a way to escape the loop. - First I wanted to let the code handle inconsistent selections (which would also have allowed to break early from the checking loops) but KaiRo convinced me on IRC that we shouldn't do/allow something that might contravene the user's expectations. The user can still use column sorting to group similar downloads and select those.
Assignee: nobody → jh
Status: NEW → ASSIGNED
Attachment #395149 - Flags: review?(neil)
Comment on attachment 395149 [details] [diff] [review] proposed patch >+ m_selIdx.push(row) Nit: missing ; >+ if (dldata.state == nsIDownloadManager.DOWNLOAD_CANCELED || >+ dldata.state == nsIDownloadManager.DOWNLOAD_FAILED) >+ continue; >+ if (!dldata.resumable || >+ !((dldata.isActive || >+ dldata.state == nsIDownloadManager.DOWNLOAD_PAUSED))) >+ return false; I'd prefer these two to be combined if possible i.e. if (state != CANCELED && state != FAILED && (!resumable || (!isActive && state != paused))) >+ if (!dldata.isActive || >+ dldata.state == nsIDownloadManager.DOWNLOAD_PAUSED || >+ !dldata.resumable) Nit: needs one space more indentation on the continuation lines > var m_selIdx = []; > if (selectionCount) { > m_selIdx = []; Whoops ;-) >+ var rmDlids = []; // removeDownload alters the selection, delay execution It might be worth making selItemData an array of the row data, since that's what we actually use everywhere. Any remaining consumers of selItemData could probably then be simply converted to selItemData[0]. (Does restart not alter the selection?)
Attached patch patch v2 (obsolete) — Splinter Review
(In reply to comment #4) > Does restart not alter the selection? I guess you mean "retry"... You are right, it calls removeDownload so needs the same handling. Surprisingly "cancel" also needs special handling. I don't know why but without it strange things happen (testcase: start some larger downloads, e.g. Eclipse and OpenOffice, selected both and press Space and Del as needed to cycle the states).
Attachment #395149 - Attachment is obsolete: true
Attachment #395362 - Flags: review?(neil)
Attachment #395149 - Flags: review?(neil)
Attachment #395362 - Flags: review?(neil) → review-
Comment on attachment 395362 [details] [diff] [review] patch v2 Sorry, you misunderstood - selItemData[] should have the actual dldata objects so that you don't have to fetch them again or cache them or such like.
(In reply to comment #6) > (From update of attachment 395362 [details] [diff] [review]) > Sorry, you misunderstood - selItemData[] should have the actual dldata objects > so that you don't have to fetch them again or cache them or such like. That makes a lot of sense, actually... :-) Obviously I also accessed the wrong data through selItemData[0] before.
Attachment #395362 - Attachment is obsolete: true
Attachment #395588 - Flags: review?(neil)
Attachment #395588 - Flags: review?(neil) → review+
Summary: Handle multiple selections more intelligent in new download manager → Handle multiple selections more intelligently in new download manager
Attachment #395588 - Flags: superreview?(neil)
Attachment #395588 - Flags: superreview?(neil) → superreview+
Keywords: checkin-needed
Attachment #395588 - Attachment description: patch v3 → patch v3 [Checkin: Comment 8]
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.0b2
(In reply to comment #8) Needs an additional positive follow-up: { TEST-UNEXPECTED-PASS | ... | All downloads removed - got 0, expected 0 } ;->
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 395882 [details] [diff] [review] fix (enable) test [Checkin: Comment 11] http://hg.mozilla.org/comm-central/rev/7f233fe1983a (forwarding previous Neil's review)
Attachment #395882 - Attachment description: fix (enable) test → fix (enable) test [Checkin: Comment 11]
Attachment #395882 - Flags: review?(neil) → review+
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: