┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/draganddrophelper.h
diff options
context:
space:
mode:
authorJin Liu <[email protected]>2024-02-17 11:14:46 +0000
committerJin Liu <[email protected]>2024-02-17 11:14:46 +0000
commitc9c3531c0b6da07de8f90761a3d799ace62f8e89 (patch)
treee03fa5263d491c31cabf3cad429adf2297f768d2 /src/views/draganddrophelper.h
parentcda139ccab2c78ac71a9f2aad286cbe1ace46734 (diff)
Improve DnD handling in read-only dirs
1. Places panel and tabbar update drag status in read-only dir 2. Don't create drop job in readonly directories
Diffstat (limited to 'src/views/draganddrophelper.h')
-rw-r--r--src/views/draganddrophelper.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h
index 656cefe1b..0eee34a3d 100644
--- a/src/views/draganddrophelper.h
+++ b/src/views/draganddrophelper.h
@@ -10,6 +10,8 @@
#include "dolphin_export.h"
+#include <KFileItem>
+
#include <QList>
#include <QString>
#include <QUrl>
@@ -41,6 +43,34 @@ public:
static KIO::DropJob *dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window);
/**
+ * Checks if the destination supports dropping.
+ *
+ * @param destUrl URL of the item destination.
+ * @return True if the destination is a directory and is writable, or it's a desktop file.
+ * False otherwise.
+ */
+ static bool supportsDropping(const QUrl &destUrl);
+
+ /**
+ * Checks if the destination supports dropping.
+ *
+ * @param destItem The item destination.
+ * @return True if the destination is a directory and is writable, or it's a desktop file.
+ * False otherwise.
+ */
+ static bool supportsDropping(const KFileItem &destItem);
+
+ /**
+ * Updates the drop action according to whether the destination supports dropping.
+ * If supportsDropping(destUrl), set dropAction = proposedAction. Otherwise, set
+ * dropAction = Qt::IgnoreAction.
+ *
+ * @param event Drop event.
+ * @param destUrl Destination URL.
+ */
+ static void updateDropAction(QDropEvent *event, const QUrl &destUrl);
+
+ /**
* @return True if destUrl is contained in the urls parameter.
*/
static bool urlListMatchesUrl(const QList<QUrl> &urls, const QUrl &destUrl);