diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-09-19 09:44:02 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-21 11:59:50 +0000 |
commit | af814158b101418adad4f9a21d3b2303620b0396 (patch) | |
tree | 500c5028fbb2410044b5c710ffcc1151bc4a5259 /wizards | |
parent | e7760d428bc82ccfcae14f1907b78f9f1013b88c (diff) |
tdf#94351: Web Wizard multiselection doesn't work
Call getSelectedFiles instead of getFiles+adapt behavior so it deals
with an array of files with their full path
Change-Id: I21b6c32dea85460461925a9b44dac195d79b7eac
Reviewed-on: https://gerrit.libreoffice.org/18714
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/com/sun/star/wizards/common/SystemDialog.py | 2 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/web/WWD_Events.py | 28 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/web/WebWizardConst.py | 2 |
3 files changed, 8 insertions, 24 deletions
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py index dc0b3f4f2125..e1bb6bfda37f 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.py +++ b/wizards/com/sun/star/wizards/common/SystemDialog.py @@ -113,7 +113,7 @@ class SystemDialog(object): self.systemDialog.setMultiSelectionMode(multiSelect) self.systemDialog.setDisplayDirectory(self.subst(displayDirectory)) if self.execute(self.systemDialog): - return self.systemDialog.getFiles() + return self.systemDialog.getSelectedFiles() except Exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py index c5dc75e8566b..03f2e12d712f 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.py +++ b/wizards/com/sun/star/wizards/web/WWD_Events.py @@ -894,39 +894,23 @@ class WWD_Events(WWD_Startup): def loadDocuments(self): offset = self.parent.selectedDoc[0] + 1 if (len(self.parent.selectedDoc) > 0) else self.parent.getDocsCount() - ''' - if the user chose one file, the list starts at 0, - if he chose more than one, the first entry is a directory name, - all the others are filenames. - ''' - if len(self.files) > 1: - start = 1 - else: - start = 0 - #Number of documents failed to validate. failed = 0 # store the directory - if start == 1: - self.parent.settings.cp_DefaultSession.cp_InDirectory = self.files[0] - else: - self.parent.settings.cp_DefaultSession.cp_InDirectory = \ - FileAccess.getParentDir(self.files[0]) + self.parent.settings.cp_DefaultSession.cp_InDirectory = \ + FileAccess.getParentDir(self.files[0]) ''' Here i go through each file, and validate it. If its ok, I add it to the ListModel/ConfigSet ''' - for i in range(start, len(self.files)): + for i in range(0, len(self.files)): doc = CGDocument() doc.setRoot(self.parent.settings) - if start == 0: - doc.cp_URL = self.files[i] - else: - doc.cp_URL = FileAccess.connectURLs(self.files[0], self.files[i]) + doc.cp_URL = self.files[i] ''' so - i check each document and if it is ok I add it. @@ -935,14 +919,14 @@ class WWD_Events(WWD_Startup): done in the checkDocument(...) method ''' if self.parent.checkDocument(doc, self.task, self.xC): - index = offset + i - failed - start + index = offset + i - failed self.parent.settings.cp_DefaultSession.cp_Content.cp_Documents.add(index, doc) else: failed += 1 # if any documents where added, # set the first one to be the current-selected document. - if len(self.files) > start + failed: + if len(self.files) > failed: self.parent.setSelectedDoc([offset]) # update the ui... diff --git a/wizards/com/sun/star/wizards/web/WebWizardConst.py b/wizards/com/sun/star/wizards/web/WebWizardConst.py index f6a2282dc9f7..363ecd80d05a 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardConst.py +++ b/wizards/com/sun/star/wizards/web/WebWizardConst.py @@ -55,4 +55,4 @@ TASK_FINISH = "t_fin" when the user adds more than this number of documents to the list, a status dialog opens. ''' -MIN_ADD_FILES_FOR_DIALOG = 2 +MIN_ADD_FILES_FOR_DIALOG = 1 |