diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-06-10 15:26:40 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-06-11 16:22:03 +0200 |
commit | 03f666103d80f7a0c79150dae2367079b80e50a6 (patch) | |
tree | b716ea0674236984aabd17dd80afadebed0b1c62 /vcl | |
parent | f235df85447f1d159b70d8ace4d2849cf782abe6 (diff) |
fix and simplify getting files from the KDE4 file dialog
- Fix multiple selection handling.
- The "double click selection KDE4 bug" does not exist (anymore?) as far
as I can tell.
- Apparently it's not true that multiselect needs the first item in the list
to be the directory.
- KFileDialog can already give full URLs.
Change-Id: I5bb651902fb6c1d75af40b78bf32c79b004b7358
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/kde4/KDE4FilePicker.cxx | 47 |
1 files changed, 5 insertions, 42 deletions
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx index 4be3b9ae8942..01493d067965 100644 --- a/vcl/unx/kde4/KDE4FilePicker.cxx +++ b/vcl/unx/kde4/KDE4FilePicker.cxx @@ -218,48 +218,11 @@ OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles() throw( uno::RuntimeException ) { - QStringList rawFiles = _dialog->selectedFiles(); - QStringList files; - - // Workaround for the double click selection KDE4 bug - // kde file picker returns the file and directories for selectedFiles() - // when a file is double clicked - // make a true list of files - const QString dir = KUrl(rawFiles[0]).directory(); - - bool singleFile = true; - if (rawFiles.size() > 1) - { - singleFile = false; - //for multi file sequences, oo expects the first param to be the directory - //can't treat all cases like multi file because in some instances (inserting image) - //oo WANTS only one entry in the final list - files.append(dir); - } - - for (sal_uInt16 i = 0; i < rawFiles.size(); ++i) - { - // if the raw file is not the base directory (see above kde bug) - // we add the file to list of avail files - if ((dir + "/") != ( rawFiles[i])) - { - QString filename = KUrl(rawFiles[i]).fileName(); - - if (singleFile) - filename.prepend(dir + "/"); - files.append(filename); - } - } - - // add all files and leading directory to outgoing OO sequence - uno::Sequence< OUString > seq(files.size()); - for (int i = 0; i < files.size(); ++i) - { - OUString aFile(toOUString(files[i])), aURL; - osl_getFileURLFromSystemPath(aFile.pData, &aURL.pData ); - seq[i] = aURL; - } - + KUrl::List urls = _dialog->selectedUrls(); + uno::Sequence< OUString > seq( urls.size()); + int i = 0; + foreach( const KUrl& url, urls ) + seq[ i++ ]= toOUString( url.url()); return seq; } |