Commit f9656e75 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa
Browse files

Make folderview understand application/x-kde-dndextract.

The code was copied almost as-is from Dolphin's implementation. It
should now be possible to drag and drop files from any archive opened
in Ark to folderview.

It previously worked with some archive types due to a weird code path
in Ark which should not exist.

PS: Fredrik, I ended up using pathOrUrl() because I can't pass KUrl
via DBus.

Reviewed-by: Fredrik Höglund

CCMAIL: fredrik@kde.org
BUG: 189322
FIXED-IN: 4.6.4

(cherry picked from commit d37a244a)
parent 3f9a1f53
......@@ -2027,7 +2027,8 @@ void IconView::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void IconView::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
bool accepted = KUrl::List::canDecode(event->mimeData());
const bool accepted = KUrl::List::canDecode(event->mimeData()) ||
event->mimeData()->hasFormat(QLatin1String("application/x-kde-dndextract"));
event->setAccepted(accepted);
m_hoverDrag = accepted;
}
......@@ -2193,11 +2194,26 @@ void IconView::dropEvent(QGraphicsSceneDragDropEvent *event)
}
if (!item.isNull()) {
QDropEvent ev(event->screenPos(), event->possibleActions(), event->mimeData(),
const QMimeData *mimeData = event->mimeData();
QDropEvent ev(event->screenPos(), event->possibleActions(), mimeData,
event->buttons(), event->modifiers());
ev.setDropAction(event->dropAction());
//kDebug() << "dropping to" << m_url << "with" << view() << event->modifiers();
if (mimeData->hasFormat(QLatin1String("application/x-kde-dndextract"))) {
const QString remoteDBusClient = mimeData->data(QLatin1String("application/x-kde-dndextract"));
QDBusMessage message =
QDBusMessage::createMethodCall(remoteDBusClient, QLatin1String("/DndExtract"),
QLatin1String("org.kde.DndExtract"),
QLatin1String("extractSelectedFilesTo"));
message.setArguments(QVariantList() << m_dirModel->dirLister()->url().pathOrUrl());
QDBusConnection::sessionBus().call(message);
return;
}
// If we're dropping on the view itself
QList<QAction *> userActions;
if (!m_hoveredIndex.isValid()) {
......
Markdown is supported
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