Commit b6e8d6a9 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

support passing drag and drop through portal

uses helpers form kcoreaddons
parent 608d59f9
Pipeline #203490 failed with stage
in 41 seconds
......@@ -391,7 +391,9 @@ struct DocumentViewPrivate {
}
mDrag = new QDrag(q);
const auto itemList = KFileItemList({q->document()->url()});
mDrag->setMimeData(MimeTypeUtils::selectionMimeData(itemList, MimeTypeUtils::DropTarget));
auto *mimeData = MimeTypeUtils::selectionMimeData(itemList, MimeTypeUtils::DropTarget);
KUrlMimeData::exportUrlsToPortal(mimeData);
mDrag->setMimeData(mimeData);
if (q->document()->isModified()) {
setDragPixmap(QPixmap::fromImage(q->document()->image()));
......@@ -1109,7 +1111,7 @@ void DocumentView::dropEvent(QGraphicsSceneDragDropEvent *event)
{
QGraphicsWidget::dropEvent(event);
// Since we're capturing drops in View mode, we only support one url
const QUrl url = event->mimeData()->urls().first();
const QUrl url = KUrlMimeData::urlsFromMimeData(event->mimeData()).first();
if (UrlUtils::urlIsDirectory(url)) {
Q_EMIT openDirUrlRequested(url);
} else {
......
......@@ -727,7 +727,9 @@ void ThumbnailView::startDrag(Qt::DropActions)
}
auto drag = new QDrag(this);
drag->setMimeData(MimeTypeUtils::selectionMimeData(selectedFiles, MimeTypeUtils::DropTarget));
auto *mimeData = MimeTypeUtils::selectionMimeData(selectedFiles, MimeTypeUtils::DropTarget);
KUrlMimeData::exportUrlsToPortal(mimeData);
drag->setMimeData(mimeData);
d->initDragPixmap(drag, indexes);
drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::CopyAction);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment