summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2017-05-22 16:11:06 -0700
committerMicah Lee <micah@micahflee.com>2017-05-22 16:11:06 -0700
commitde4739e4581d33cc111d8ec994574b0f714c20b2 (patch)
tree1b48d033fb815c69444f5021dbfbfc30a0eaff4b
parentf01bd30263675d4a50da5257ccb9d9c4b5d7dc6c (diff)
parente828b2f9cdf85b597c3ca244033f2df6b74ae82c (diff)
downloadonionshare-de4739e4581d33cc111d8ec994574b0f714c20b2.tar.gz
onionshare-de4739e4581d33cc111d8ec994574b0f714c20b2.zip
Merge branch 'mig5-select_multiple_folders'
-rw-r--r--onionshare_gui/file_selection.py36
-rw-r--r--share/locale/en.json4
-rw-r--r--share/locale/fr.json4
3 files changed, 31 insertions, 13 deletions
diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py
index 2ebbbb75..f24c61ea 100644
--- a/onionshare_gui/file_selection.py
+++ b/onionshare_gui/file_selection.py
@@ -214,21 +214,39 @@ class FileSelection(QtWidgets.QVBoxLayout):
"""
Add files button clicked.
"""
- filenames = QtWidgets.QFileDialog.getOpenFileNames(
- caption=strings._('gui_choose_files', True), options=QtWidgets.QFileDialog.ReadOnly)
- if filenames:
- for filename in filenames[0]:
- self.file_list.add_file(filename)
+ file_dialog = QtWidgets.QFileDialog(caption=strings._('gui_choose_files', True))
+ file_dialog.setFileMode(QtWidgets.QFileDialog.ExistingFiles)
+ file_dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
+ file_dialog.setOption(QtWidgets.QFileDialog.ReadOnly, True)
+ tree_view = file_dialog.findChild(QtWidgets.QTreeView)
+ tree_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+ list_view = file_dialog.findChild(QtWidgets.QListView, "listView")
+ list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+
+ if file_dialog.exec_() == QtWidgets.QDialog.Accepted:
+ for filename in file_dialog.selectedFiles():
+ self.file_list.add_file(filename)
+
self.update()
def add_dir(self):
"""
Add folder button clicked.
"""
- filename = QtWidgets.QFileDialog.getExistingDirectory(
- caption=strings._('gui_choose_folder', True), options=QtWidgets.QFileDialog.ReadOnly)
- if filename:
- self.file_list.add_file(str(filename))
+ file_dialog = QtWidgets.QFileDialog(caption=strings._('gui_choose_folder', True))
+ file_dialog.setFileMode(QtWidgets.QFileDialog.Directory)
+ file_dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
+ file_dialog.setOption(QtWidgets.QFileDialog.ReadOnly, True)
+ file_dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)
+ tree_view = file_dialog.findChild(QtWidgets.QTreeView)
+ tree_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+ list_view = file_dialog.findChild(QtWidgets.QListView, "listView")
+ list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
+
+ if file_dialog.exec_() == QtWidgets.QDialog.Accepted:
+ for filename in file_dialog.selectedFiles():
+ self.file_list.add_file(filename)
+
self.update()
def delete_file(self):
diff --git a/share/locale/en.json b/share/locale/en.json
index 701b067c..754993a2 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -24,10 +24,10 @@
"help_filename": "List of files or folders to share",
"gui_drag_and_drop": "Drag and drop\nfiles here",
"gui_add_files": "Add Files",
- "gui_add_folder": "Add Folder",
+ "gui_add_folder": "Add Folders",
"gui_delete": "Delete",
"gui_choose_files": "Choose files",
- "gui_choose_folder": "Choose folder",
+ "gui_choose_folder": "Choose folders",
"gui_start_server": "Start Sharing",
"gui_stop_server": "Stop Sharing",
"gui_copy_url": "Copy URL",
diff --git a/share/locale/fr.json b/share/locale/fr.json
index ce9cfa15..7197f9dc 100644
--- a/share/locale/fr.json
+++ b/share/locale/fr.json
@@ -21,10 +21,10 @@
"help_filename": "Liste des fichiers ou dossiers à partager",
"gui_drag_and_drop": "Glissez déposez\nles fichiers ici",
"gui_add_files": "Ajouter des fichiers",
- "gui_add_folder": "Ajouter un dossier",
+ "gui_add_folder": "Ajouter des dossiers",
"gui_delete": "Supprimer",
"gui_choose_files": "Sélectionnez des fichiers",
- "gui_choose_folder": "Sélectionnez un dossier",
+ "gui_choose_folder": "Sélectionnez des dossiers",
"gui_start_server": "Démarrer le serveur",
"gui_stop_server": "Arrêter le serveur",
"gui_copy_url": "Copier URL",