More thoroughly remove drag and drop to prevent the drop label from getting created

This commit is contained in:
Micah Lee 2021-11-14 16:00:00 -08:00
parent 293a24a48d
commit 36a2132887

View file

@ -185,6 +185,11 @@ class FileList(QtWidgets.QListWidget):
""" """
dragEnterEvent for dragging files and directories into the widget. 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: if event.mimeData().hasUrls:
self.setStyleSheet(self.common.gui.css["share_file_list_drag_enter"]) self.setStyleSheet(self.common.gui.css["share_file_list_drag_enter"])
count = len(event.mimeData().urls()) count = len(event.mimeData().urls())
@ -206,6 +211,11 @@ class FileList(QtWidgets.QListWidget):
""" """
dragLeaveEvent for dragging files and directories into the widget. 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.setStyleSheet(self.common.gui.css["share_file_list_drag_leave"])
self.drop_count.hide() self.drop_count.hide()
event.accept() event.accept()
@ -215,6 +225,11 @@ class FileList(QtWidgets.QListWidget):
""" """
dragMoveEvent for dragging files and directories into the widget. 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: if event.mimeData().hasUrls:
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)
event.accept() event.accept()