From ab800c577a37db53c2b2566c7b850eea90938ee2 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 14 Nov 2021 16:00:00 -0800 Subject: [PATCH] More thoroughly remove drag and drop to prevent the drop label from getting created --- desktop/src/onionshare/tab/mode/file_selection.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/desktop/src/onionshare/tab/mode/file_selection.py b/desktop/src/onionshare/tab/mode/file_selection.py index 5cf58c70..ea80de53 100644 --- a/desktop/src/onionshare/tab/mode/file_selection.py +++ b/desktop/src/onionshare/tab/mode/file_selection.py @@ -185,6 +185,11 @@ class FileList(QtWidgets.QListWidget): """ dragEnterEvent for dragging files and directories into the 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"): + event.ignore() + return + if event.mimeData().hasUrls: self.setStyleSheet(self.common.gui.css["share_file_list_drag_enter"]) count = len(event.mimeData().urls()) @@ -206,6 +211,11 @@ class FileList(QtWidgets.QListWidget): """ dragLeaveEvent for dragging files and directories into the 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"): + event.ignore() + return + self.setStyleSheet(self.common.gui.css["share_file_list_drag_leave"]) self.drop_count.hide() event.accept() @@ -215,6 +225,11 @@ class FileList(QtWidgets.QListWidget): """ dragMoveEvent for dragging files and directories into the 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"): + event.ignore() + return + if event.mimeData().hasUrls: event.setDropAction(QtCore.Qt.CopyAction) event.accept()