[Libreoffice-commits] core.git: fpicker/source
Julien Nabet
serval2412 at yahoo.fr
Tue Jul 28 23:54:37 PDT 2015
fpicker/source/aqua/SalAquaFilePicker.mm | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
New commits:
commit c00760b1379023d8b45f54c0282051fcc7a240dd
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Mon Jul 13 12:42:42 2015 +0200
getFiles: truncate to 1 file only (aqua part)
Change-Id: I815954ec812e799d580b4a1fd85261329cfe5ec0
Reviewed-on: https://gerrit.libreoffice.org/16987
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm
index 97bc5ed..4313818 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.mm
+++ b/fpicker/source/aqua/SalAquaFilePicker.mm
@@ -335,8 +335,13 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno::
long nFiles = [files count];
SAL_INFO("fpicker.aqua", "# of items: " << nFiles);
- uno::Sequence< rtl::OUString > aSelectedFiles(nFiles > 1 ? nFiles + 1 : nFiles);
+ // multiselection doesn't really work
+ // so just retrieve the first url
+ if (nFiles > 1)
+ nFiles = 1;
+ uno::Sequence< rtl::OUString > aSelectedFiles(nFiles);
+
for(long nIndex = 0; nIndex < nFiles; nIndex += 1)
{
NSURL *url = [files objectAtIndex:nIndex];
@@ -365,23 +370,10 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getFiles() throw( uno::
OSL_TRACE("handling %s", [[url description] UTF8String]);
InfoType info = FULLPATH;
- if (nFiles > 1) {
- //just get the file's name (only in OpenDialog)
- info = FILENAME;
- }
- OUString sFileOrDirURL = [url OUStringForInfo:info];
-
- //get the directory information, only on the first file processed
- if (nIndex == 0) {
- OUString sDirectoryURL = [url OUStringForInfo:PATHWITHOUTLASTCOMPONENT];
- if (nFiles > 1) {
- aSelectedFiles[0] = OUString(sDirectoryURL);
- }
- }
+ OUString sFileOrDirURL = [url OUStringForInfo:info];
- short nSequenceIndex = nFiles > 1 ? nIndex + 1 : nIndex;
- aSelectedFiles[nSequenceIndex] = sFileOrDirURL;
+ aSelectedFiles[nIndex] = sFileOrDirURL;
OSL_TRACE("Returned file in getFiles: \"%s\".", OUStringToOString(sFileOrDirURL, RTL_TEXTENCODING_UTF8).getStr());
}
More information about the Libreoffice-commits
mailing list