Disable drag and drop in flatpak

This commit is contained in:
Micah Lee 2021-11-14 15:08:06 -08:00
parent 94c588d0ce
commit bfce4b005c
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@
"gui_add_files": "Add Files", "gui_add_files": "Add Files",
"gui_add_folder": "Add Folder", "gui_add_folder": "Add Folder",
"gui_remove": "Remove", "gui_remove": "Remove",
"gui_dragdrop_sandbox_flatpak": "To make the Flatpak sandbox more secure, drag and drop is not supported. Use the Add Files and Add Folder buttons to browse for files instead.",
"gui_file_selection_remove_all": "Remove All", "gui_file_selection_remove_all": "Remove All",
"gui_choose_items": "Choose", "gui_choose_items": "Choose",
"gui_share_start_server": "Start sharing", "gui_share_start_server": "Start sharing",

View File

@ -243,6 +243,13 @@ class FileList(QtWidgets.QListWidget):
""" """
Add a file or directory to this widget. Add a file or directory to this widget.
""" """
# Drag and drop doesn't work in Flatpak, because of the sandbox
if self.common.platform == "Linux" and os.path.exists("/app/manifest.json"):
Alert(
self.common, strings._("gui_dragdrop_sandbox_flatpak").format(filename)
)
return
filenames = [] filenames = []
for index in range(self.count()): for index in range(self.count()):
filenames.append(self.item(index).filename) filenames.append(self.item(index).filename)