return nullptr;
}
- if (supportsDropping(destUrl)) {
+ // TODO: remove this check once Qt is fixed so that it doesn't emit a QDropEvent on Wayland
+ // when we called QDragMoveEvent::ignore()
+ // https://codereview.qt-project.org/c/qt/qtwayland/+/541750
+ KFileItem item(destUrl);
+ // KFileItem(QUrl) only stat local URLs, so we always allow dropping on non-local URLs
+ if (!item.isLocalFile() || supportsDropping(item)) {
// Drop into a directory or a desktop-file
KIO::DropJob *job = KIO::drop(event, destUrl);
KJobWidgets::setWindow(job, window);
return nullptr;
}
-bool DragAndDropHelper::supportsDropping(const QUrl &destUrl)
-{
- KFileItem item(destUrl);
- return supportsDropping(item);
-}
-
bool DragAndDropHelper::supportsDropping(const KFileItem &destItem)
{
return (destItem.isDir() && destItem.isWritable()) || destItem.isDesktopFile();
event->setDropAction(Qt::IgnoreAction);
event->ignore();
}
- if (supportsDropping(destUrl)) {
+ KFileItem item(destUrl);
+ if (!item.isLocalFile() || supportsDropping(item)) {
event->setDropAction(event->proposedAction());
event->accept();
} else {
*/
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.
*