┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemmodelbase.h
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2017-04-21 13:16:05 +0200
committerElvis Angelaccio <[email protected]>2017-06-11 19:11:56 +0200
commitc85ca114553c198af79eedacdb6b40ac4cab20e0 (patch)
tree4c06fb54e331eddeb9ae8786c42c6c2c9d9625aa /src/kitemviews/kitemmodelbase.h
parent5246e19a400c305bfa3bfc5e5bfb739b3b07fbf3 (diff)
Ignore drops-onto-items from invalid places items
If the QMimeData object created by PlacesItemModel doesn't have any url set (e.g. when dragging unmounted devices), it is detected by the resulting DropJob as "drop raw data" because the mimeData has one format set (the internalMimeType() used for dragging between places items). This results in a crash because the DropJob schedules a PasteJob, but in the meantime the QDrag from Dolphin ends and deletes the mimeData object that was passed to the paste job. The fix is to prevent the DropJob in the first place. We can introduce a new internal mimetype that we use to blacklist drops-onto-items (while still allowing drops-between-items). This way PlacesItemModel can set the blacklist flag if the mimeData is being created without urls. BUG: 373005 FIXED-IN: 17.04.3 Test Plan: Drag and drop an unmounted device to another place item or the DolphinView, doesn't crash anymore. Dropping the unmounted device between two places item still works. Differential Revision: https://phabricator.kde.org/D5535
Diffstat (limited to 'src/kitemviews/kitemmodelbase.h')
-rw-r--r--src/kitemviews/kitemmodelbase.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h
index bd5ca1d65..45ad1f61a 100644
--- a/src/kitemviews/kitemmodelbase.h
+++ b/src/kitemviews/kitemmodelbase.h
@@ -172,6 +172,16 @@ public:
// decision whether it accepts the drop?
virtual bool supportsDropping(int index) const;
+ /**
+ * @return An internal mimetype to signal that an itemDropEvent() should be rejected by
+ * the receiving model.
+ *
+ * This mimeType can be used in createMimeData() to notify that the
+ * drop-onto-items events should be ignored, while the drop-between-items
+ * ones should be still accepted.
+ */
+ QString blacklistItemDropEventMimeType() const;
+
signals:
/**
* Is emitted if one or more items have been inserted. Each item-range consists