Closed
Bug 121122
Opened 23 years ago
Closed 22 years ago
nsIFilePicker should allow picking multiple files
Categories
(SeaMonkey :: UI Design, defect)
SeaMonkey
UI Design
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla1.2alpha
People
(Reporter: bzbarsky, Assigned: sspitzer)
References
Details
(Keywords: arch, helpwanted)
Attachments
(1 file, 9 obsolete files)
16.69 KB,
patch
|
sspitzer
:
review+
Bienvenu
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
We should be able to ask the filepicker interface for a list of files, not just
one file. This would be useful in several places.
![]() |
Reporter | |
Updated•23 years ago
|
Updated•23 years ago
|
Severity: normal → enhancement
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 2•23 years ago
|
||
This bug is marked as blocking bug 43015 which currently:
- has 47 votes
- has a target milestone of 0.9.9 (I guess this will slip soon)
- is a dependency of Bug 92997 "Bugs that make Mozilla advocacy harder"
This is inconsistent with marking this bug "future". Perhaps this inconsistency
should be fixed, either by adjusting this bug or the other bugs as appropriate?
![]() |
Reporter | |
Comment 3•23 years ago
|
||
1) Though fixing this bug would allow fixing bug 43015 in a fairly easy way, bug
43015 can possibly be solved without fixing this bug.
2) This is an architecture change of a scope that is, in my opinion,
inappropriate for pre-1.0 work at this point.
3) The target of bug 43015 is unrealistic, imo, but that's an issue to take up
with the developer who's working on that bug.
Comment 4•23 years ago
|
||
Boris, could you add comments to 43015 about how you think it might be solved
without this bug being fixed?
![]() |
Reporter | |
Comment 5•23 years ago
|
||
If I had any decent ideas I would have commented....
Comment 6•23 years ago
|
||
Isn't it the future already?
IMHO this kind of change will have an impact over every user of nsIFilePicker
(tried to count them, but could not find an easy way to do it), in mozilla and
any mozilla based application, therefor it will always be an high risk change
and always easy to postpone.
My suggestion is to implement this change in two phase. The first will be to
change the IDL of nsIFilePicker an make all necesery adjustments for the
current functionality. The second phase will be to implement the actual multi
selection. After the implementation of the first phase it will be easier to
contribute solutions for the different platforms.
Another (uglier but easier) way of dealing with this bug can be to define a
new interface nsIMultiFilePicker which imlements this functionality.
In any way this bug can't be an enhancment. It is the root cause for bug 43015
which is a real UI bug (72 votes and rising).
![]() |
Reporter | |
Comment 7•23 years ago
|
||
> Isn't it the future already?
No. ;)
This is not being put off because it is risky or anything, but rather because
it's a lot of work and no one has the time to do it so far. Making the IDL
change is trivial, but until we have an implementation for at least one of our
platforms, what's the point of doing it? It'll just make it look like the
functionality exists when in fact it does not...
Adding helpwanted keyword, since I (or bryner) can make this work in the XP
filepicker but someone else will likely need to do the Windows/Mac/OS2 ones....
Keywords: helpwanted
Comment 8•23 years ago
|
||
marking 4xp and nominating for moz1.2 (as per the dependencies which some people
in mailnews would like to have and which is mostfreq [37 dups])
Since this is available in 4.x (for all platforms that I can test) this is not
an "enhancement" -- upping to normal since a normal bug depends on this. I
*would* say minor (workaround is: select one file at a time, multiple times) but
there seems to be a legitamite claim that there are certain instances where
multiple file-pickers are either not feasible, or not possible.
None of this means the bug will be fixed any faster, but it might just get on
some people's radars
Severity: enhancement → minor
Keywords: 4xp,
mozilla1.2
Updated•23 years ago
|
Target Milestone: Future → mozilla1.2alpha
Assignee | ||
Comment 9•22 years ago
|
||
Assignee | ||
Comment 10•22 years ago
|
||
I'm going to take this from bryner, since I need it for #43015 and I have a
patch (at least for windows).
My plan is to stub out the implementations on other platforms, so that
modeOpenMultiple acts like modeOpen until those platforms get fixed (by people
who know those platforms better than me.)
I'll work on cleaning up my unclean patch tomorrow.
Assignee: bryner → sspitzer
Status: ASSIGNED → NEW
![]() |
Reporter | |
Comment 11•22 years ago
|
||
As I mentioned in email, I feel that nsISimpleEnumerator is a better choice than
nsISupportsArray for the file and url lists. For one thing, if we ever want to
freeze nsIFilePicker we will likely need to eliminate its use of
nsISupportsArray.... For another, I can see of no use for the lists other than
to iterate over them as this patch does.
NS_NewArrayEnumerator is probably the simplest way to go here.
Comment 12•22 years ago
|
||
ditto for what boris said. nsISimpleEnumerator is the way to go.
oh, and can you please not include GetFileURLs in your patch - I'm trying to
reduced dependencies by not supporting urls in the file picker. See bug 102013.
Assignee | ||
Comment 13•22 years ago
|
||
heeding bz's and alecf's advice.
next steps:
1) stub out other platfoms
2) fix mailnews js to use enumerator
3) don't use nsIFileURL (per alecf)
Attachment #97929 -
Attachment is obsolete: true
Assignee | ||
Comment 14•22 years ago
|
||
includes fix for #43015
Attachment #98010 -
Attachment is obsolete: true
Assignee | ||
Comment 15•22 years ago
|
||
accepting. now to:
1) stub out other platfoms
2) don't use nsIFileURLs (per alecf)
hoping to make it for 1.2
Severity: minor → normal
Status: NEW → ASSIGNED
Assignee | ||
Comment 16•22 years ago
|
||
now to stub other platforms, do some cleanup, and then get reviews.
Attachment #98158 -
Attachment is obsolete: true
Comment 17•22 years ago
|
||
seth, I think you want to be using ioService.getURLSpecFromFile - instead of
creating the URI object yourself and then retrieving the spec.
Assignee | ||
Comment 18•22 years ago
|
||
still need to test...
Attachment #98163 -
Attachment is obsolete: true
Assignee | ||
Comment 19•22 years ago
|
||
Attachment #98171 -
Attachment is obsolete: true
Assignee | ||
Comment 20•22 years ago
|
||
Can I get some r/sr reviewing from you guys for
http://bugzilla.mozilla.org/show_bug.cgi?id=121122?
Here's what I have:
1) nsIFilePicker has new attribute, nsISimpleEnumerator files, and a new
mode: modeOpenMultiple
2) base impl (shared by beos, os2, mac) fakes GetFiles() to create an
enumerator for the one file [those platforms, and the xp file picker] don't
support this yet.
3) the platform impls and the xp file picker currently treat modeOpenMultiple
as modeOpen (this makes the base impl GetFiles() work)
4) the windows implementation overrides GetFiles() and does the right thing
5) compose js fixed to use the new mode.
This bug (37 dups, the top most dupped bug in mailnews that hasn't been fixed)
is wanted for 1.2
Once the fix is reviewed and finished, I'll log a bug on the widget owners to
override GetFiles() and support multiple file picking.
Note, with this patch, we have one less js dependency on the "readonly
attribute nsIFileURL fileURL" in nsIFilePicker.
I'll also log a cleanup bug on this:
readonly attribute nsILocalFile file;
readonly attribute nsISimpleEnumerator files;
we should use files for both, no matter the mode. Or maybe remove "file" and
add a helper, "firstFile" or something. I haven't thought it out yet.
Assignee | ||
Comment 21•22 years ago
|
||
platform specific bugs:
http://bugzilla.mozilla.org/show_bug.cgi?id=167149 [mac]
http://bugzilla.mozilla.org/show_bug.cgi?id=167150 [os/2]
http://bugzilla.mozilla.org/show_bug.cgi?id=167151 [cocoa]
for the xp file picker:
http://bugzilla.mozilla.org/show_bug.cgi?id=167152 [xpfilepicker]
Assignee | ||
Comment 22•22 years ago
|
||
alecf suggested I post to n.p.m.xpfe for help wanted about the xpfilepicker.
news://news.mozilla.org:119/alb0td$glb1@ripley.netscape.com
Comment 23•22 years ago
|
||
Why we need both mFile and mFiles? For backward compatibility?
Assignee | ||
Comment 24•22 years ago
|
||
>Why we need both mFile and mFiles? For backward compatibility?
see http://bugzilla.mozilla.org/show_bug.cgi?id=121122#c20
"I'll also log a cleanup bug on this:
readonly attribute nsILocalFile file;
readonly attribute nsISimpleEnumerator files;"
Until that's cleaned up, we need both.
Comment 25•22 years ago
|
||
http://bugzilla.mozilla.org/show_bug.cgi?id=121122#c20
"we should use files for both, no matter the mode. Or maybe remove "file" and
add a helper, "firstFile" or something. I haven't thought it out yet"
That's good idea. BeOS filePicker implementation already gets and saves list of
file entries (that's API for native FilePanel)- (only that it has restriction
for selection number set), and till now it used for mFileOpen just
"List->ElementAt(0);"
Only bug in BeOS part of patch i found is typo - mMode = modeOpenMultiple
@@ -80,7 +80,7 @@
node_flavors = B_DIRECTORY_NODE;
panel_mode = B_OPEN_PANEL;
}
- else if (mMode == modeOpen) {
+ else if (mMode == modeOpen || mMode = modeOpenMultiple) {
node_flavors = B_FILE_NODE;
panel_mode = B_OPEN_PANEL;
}
should be comparison ==, not assignment =
Assignee | ||
Comment 26•22 years ago
|
||
that for the = vs == catch, new patch coming.
forgot to log the [beos] bug:
see http://bugzilla.mozilla.org/show_bug.cgi?id=167200
Assignee | ||
Comment 27•22 years ago
|
||
"that for the = vs == catch, new patch coming."
thanks for catch, I mean.
Assignee | ||
Comment 28•22 years ago
|
||
wait, I forgot to attach them implementation for nsFilePicker.js
Attachment #98172 -
Attachment is obsolete: true
Assignee | ||
Comment 29•22 years ago
|
||
Attachment #98217 -
Attachment is obsolete: true
![]() |
Reporter | |
Comment 30•22 years ago
|
||
The impl of the "files" getter in nsFilePicker.js needs to return an enumerator,
not an array... Or does XPConnect automagically deal here?
Assignee | ||
Comment 31•22 years ago
|
||
Attachment #98228 -
Attachment is obsolete: true
Assignee | ||
Comment 32•22 years ago
|
||
"The impl of the "files" getter in nsFilePicker.js needs to return an
enumerator, not an array... Or does XPConnect automagically deal here?"
I attached the wrong patch, sorry bz. see the latest patch.
![]() |
Reporter | |
Comment 33•22 years ago
|
||
Comment on attachment 98231 [details] [diff] [review]
patch
Windows code:
+ fileStr += current;
Does the dirname include the trailing '\' then?
This part of the code could be more efficient if it cached the strlen() result
and used nsDependentCStrings instead of nsCAutoStrings (and just passed
"dirName + currentFile" to InitWithNativePath). I don't know whether we care
about not scanning the file strings twice multiple (3) times.
The single-file case assumes that the string still has two trailing nulls, even
though the filename and dir are a single chunk. Is that correct? (seems
logical, but...)
filepicker.js:
+ mHasMore: true,
Wouldn't it make more sense to init this to "false" and set to true when mFile
is set?
Other than those two items, looks great!
Assignee | ||
Comment 34•22 years ago
|
||
>+ fileStr += current;
>Does the dirname include the trailing '\' then?
yes, so I added a comment explaining that.
>The single-file case assumes that the string still has two trailing nulls, even
>though the filename and dir are a single chunk. Is that correct? (seems
>logical, but...)
yes, it is correct.
new patch that covers the other issues coming...
Assignee | ||
Comment 35•22 years ago
|
||
Attachment #98231 -
Attachment is obsolete: true
Comment 36•22 years ago
|
||
Comment on attachment 98247 [details] [diff] [review]
patch
sr=bienvenu
Attachment #98247 -
Flags: superreview+
![]() |
Reporter | |
Comment 37•22 years ago
|
||
Comment on attachment 98247 [details] [diff] [review]
patch
sr=bzbarsky if you add that comment about the '\' on the dirName
![]() |
Reporter | |
Comment 38•22 years ago
|
||
ugh. more collisions... ;) r=me then.
Assignee | ||
Comment 39•22 years ago
|
||
Comment on attachment 98247 [details] [diff] [review]
patch
r=bz
note to bz:
+ // dirName contains a trailing slash
+ rv = file->InitWithNativePath(nsDependentCString(dirName) +
nsDependentCString(current));
+ NS_ENSURE_SUCCESS(rv,rv);
Attachment #98247 -
Flags: review+
Comment 40•22 years ago
|
||
Comment on attachment 98247 [details] [diff] [review]
patch
a=asa (on behalf of drivers) for checkin to 1.2a
Attachment #98247 -
Flags: approval+
Assignee | ||
Comment 41•22 years ago
|
||
fixed.
now we need all the other widgets (and xpfilepicker) to be fixed.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 42•22 years ago
|
||
sping off bug about removing some of the attributes and just
using "nsISimpleEnumerator files" is bug 167282
Comment 43•22 years ago
|
||
As i noticed, this patch/bug was intended to allow multiple attachments in
mailnews, but it will be good to open multiple local files from FilePicker in
browser too (in tabs or windows - depending on user settings). But i suspect
that it is topic for another bug.
Assignee | ||
Comment 44•22 years ago
|
||
"As i noticed, this patch/bug was intended to allow multiple attachments in
mailnews, but it will be good to open multiple local files from FilePicker in
browser too (in tabs or windows - depending on user settings). But i suspect
that it is topic for another bug."
that's doable now, but it will only work on windows until the various platforms
implement support for modeOpenMultiple.
If there are browser bugs where multiple file open makes sense, feel free to log
those RFEs.
Comment 45•22 years ago
|
||
Seth, can you explain me how can i test those modifications.
I implemented OpenMultiple handling in beos/nsFilePicker recently (instead
stub), changed *.js for mailnews, recompiled, but cannot see any option in
MailNews GUI which allows that feature :).
Comment 46•22 years ago
|
||
To test in mail, open a mail compose window (Ctrl+M). Click the attach button.
Select more than one file and click ok. If you are able to do this and see
both files in the attachment pane of this window, then it worked. Before this
fix, you could only select one file at a time.
Comment 47•22 years ago
|
||
added patch for BeOS:
http://bugzilla.mozilla.org/attachment.cgi?id=99180&action=view.
"- currently in this patch multipleOpen and Open in BeOS nsFilePicker are
exclusive, but i had version where even for multipleOpen first list item was
assigned also to mFile. Maybe that approach was better?"
Comment 48•22 years ago
|
||
rs vrfy. works fine for me in mail compose on win2k (2002.09.18.08 comm trunk).
filed bug 169539 for browser case.
Status: RESOLVED → VERIFIED
Comment 49•22 years ago
|
||
Ok, but what about Linux version of this bug?
![]() |
Reporter | |
Comment 50•22 years ago
|
||
That's bug 167152; has a detailed description of what needs to be done and a
first-cut patch.
Updated•20 years ago
|
Product: Core → Mozilla Application Suite
You need to log in
before you can comment on or make changes to this bug.
Description
•