Multiselection needs work?
Michael Meeks
michael.meeks at collabora.com
Tue Jun 30 12:54:12 PDT 2015
Hi Julien,
On Tue, 2015-06-30 at 12:13 -0700, julien2412 wrote:
> Giving a try to tdf#92404, I didn't reproduce the problem when I selected 2
> files but I noticed that only 1 file was added on the interface.
> Searching a bit, I found it was because list of files was always truncated
> to first element
Good =) you're using the wrong API method.
> 699 uno::Sequence<OUString> SAL_CALL SalGtkFilePicker::getFiles() throw(
> uno::RuntimeException, std::exception )
> 700 {
> 701 // no member access => no mutex needed
> 702
> 703 uno::Sequence< OUString > aFiles = getSelectedFiles();
> 704 /*
> 705 The previous multiselection API design was completely broken
> 706 and unimplementable for some hetrogenous pseudo-URIs eg.
> search:
> 707 Thus crop unconditionally to a single selection.
> 708 */
> 709 aFiles.realloc (1);
> 710 return aFiles;
> 711 }
The semantics here were -impossibly- awful - multi-selection used to
have a first-base-url and then relative URL fragments in slots 1->N on
top of it which was just busted.
You want to use the XFileSelection2 (or whatever - or was it 3 ?)
method that has a sensible API ;-) I assume 'getSelectedFiles'.
> Git log history about this realloc gives this:
IIRC I was involved in that change with mba back in the day =)
> http://opengrok.libreoffice.org/xref/core/offapi/com/sun/star/ui/dialogs/XFilePicker.idl#77
> 85 <p>If the dialog is in execution mode and multiple files are
> selected
> 86 an empty sequence will be returned.</p>
> ...
> 98 <li>Multi-selection is enabled:
> 99 If only one file is selected, the first entry
> 100 of the sequence contains the complete path/filename
> in URL format.
> 101 If multiple files are selected, the first entry of
> the sequence contains
> 102 the path in URL format, and the other entries
> contains the names of the selected
> 103 files without path information.</li>
>
> opposite description!
We should fix the description =) the basic problem is that some paths
like 'recent files' or whatever we can't play this above trick.
The method should be marked deprecated in the API with a reference to
XFilePicker2 =)
> Did I miss something or there's a pb here and this part needs some rework
> (beginning with a description in idl of what we really expect from
> getFiles)?
Yep - so good catch, the IDL needs fixing. I'd bin the bit about
multi-selection.
Thanks !
Michael.
--
michael.meeks at collabora.com <><, Pseudo Engineer, itinerant idiot
More information about the LibreOffice
mailing list