mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-29 01:06:16 -05:00
Make it possible to select multiple folders by using non-native QFileDialog
This commit is contained in:
parent
d3eeda887b
commit
b35e3b76d5
@ -225,10 +225,20 @@ class FileSelection(QtWidgets.QVBoxLayout):
|
||||
"""
|
||||
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):
|
||||
|
@ -24,7 +24,7 @@
|
||||
"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",
|
||||
|
@ -21,7 +21,7 @@
|
||||
"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",
|
||||
|
Loading…
Reference in New Issue
Block a user