[Libreoffice-commits] core.git: fpicker/source offapi/com vcl/unx

Julien Nabet serval2412 at yahoo.fr
Sun Jul 12 23:57:53 PDT 2015


 fpicker/source/win32/filepicker/VistaFilePicker.cxx |    6 +++++-
 offapi/com/sun/star/ui/dialogs/XFilePicker.idl      |    5 ++---
 vcl/unx/kde4/KDE4FilePicker.cxx                     |    9 ++++++---
 3 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit d11b244bf9b9115f5384d6ff43bdffc7f1289d71
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Jul 12 00:57:16 2015 +0200

    getFiles: truncate to 1 file only
    
    See http://nabble.documentfoundation.org/Multiselection-needs-work-td4153207.html
    for details
    
    Change-Id: I7f855a067349381e2567bd15a8daa56aad412774
    Reviewed-on: https://gerrit.libreoffice.org/16959
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 4774857..1270079 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -261,7 +261,11 @@ css::uno::Sequence< OUString > SAL_CALL VistaFilePicker::getFiles()
 
     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::BLOCKED);
 
-    const  css::uno::Sequence< OUString > lFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES, css::uno::Sequence< OUString >());
+    css::uno::Sequence< OUString > lFiles = rRequest->getArgumentOrDefault(PROP_SELECTED_FILES, css::uno::Sequence< OUString >());
+    // multiselection doesn't really work
+    // so just retrieve the first url
+    if (lFiles.getLength() > 1)
+        lFiles.realloc(1);
     m_lLastFiles = lFiles;
     return lFiles;
 }
diff --git a/offapi/com/sun/star/ui/dialogs/XFilePicker.idl b/offapi/com/sun/star/ui/dialogs/XFilePicker.idl
index 1a7fa05..7552854 100644
--- a/offapi/com/sun/star/ui/dialogs/XFilePicker.idl
+++ b/offapi/com/sun/star/ui/dialogs/XFilePicker.idl
@@ -96,9 +96,8 @@ published interface XFilePicker: com::sun::star::ui::dialogs::XExecutableDialog
                 <li>Multi-selection is enabled:
                 If only one file is selected, the first entry
                 of the sequence contains the complete path/filename in URL format.
-                If multiple files are selected, the first entry of the sequence contains
-                the path in URL format, and the other entries contains the names of the selected
-                files without path information.</li>
+                If multiple files are selected, only the first entry is retrieved with
+                the path in URL format.</li>
             </ol>
 
             <br/>
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index a638955..9477732 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -336,9 +336,12 @@ uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles()
 
     KUrl::List urls = _dialog->selectedUrls();
     uno::Sequence< OUString > seq( urls.size());
-    int i = 0;
-    foreach( const KUrl& url, urls )
-        seq[ i++ ]= toOUString( url.url());
+    // multiselection doesn't really work
+    // so just retrieve the first url
+    if (seq.getLength() > 1)
+        seq.realloc(1);
+    if (seq.getLength() == 1)
+        seq[0] = urls.front();
     return seq;
 }
 


More information about the Libreoffice-commits mailing list