[Libreoffice-commits] core.git: wizards/com

Julien Nabet serval2412 at yahoo.fr
Mon Sep 21 05:00:19 PDT 2015


 wizards/com/sun/star/wizards/common/SystemDialog.py |    2 -
 wizards/com/sun/star/wizards/web/WWD_Events.py      |   28 ++++----------------
 wizards/com/sun/star/wizards/web/WebWizardConst.py  |    2 -
 3 files changed, 8 insertions(+), 24 deletions(-)

New commits:
commit af814158b101418adad4f9a21d3b2303620b0396
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Sep 19 09:44:02 2015 +0200

    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 at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index dc0b3f4..e1bb6bf 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 c5dc75e..03f2e12 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 f6a2282..363ecd8 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


More information about the Libreoffice-commits mailing list