X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/609ce0929289f3e26eb1898b184c7dafbf7bcac2..13b2fc55704fbc734cd4f9cbae56cfc2ef3ec0ce:/src/dolphindropcontroller.cpp diff --git a/src/dolphindropcontroller.cpp b/src/dolphindropcontroller.cpp index 6e7ec37ba..4fecbe626 100644 --- a/src/dolphindropcontroller.cpp +++ b/src/dolphindropcontroller.cpp @@ -29,6 +29,7 @@ // TODO replace with KonqOperations::doDrop [or move doDrop code into this class] // Note that this means changing the DolphinDropController controller usage // to "create with new and let it autodelete" instead of on stack, since doDrop is async. +// NOTE: let's wait for KDirModel::dropEvent first. DolphinDropController::DolphinDropController(QWidget* parentWidget) : QObject(parentWidget), m_parentWidget(parentWidget) @@ -45,20 +46,23 @@ void DolphinDropController::dropUrls(const KUrl::List& urls, kDebug() << "Source" << urls; kDebug() << "Destination:" << destination; + if (destination.protocol() == "trash") { + KonqOperations::del(m_parentWidget, KonqOperations::TRASH, urls); + return; + } + Qt::DropAction action = Qt::CopyAction; Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers(); const bool shiftPressed = modifier & Qt::ShiftModifier; const bool controlPressed = modifier & Qt::ControlModifier; - if (shiftPressed && controlPressed) { - // shortcut for 'Link Here' is used + const bool altPressed = modifier & Qt::AltModifier; + if ((shiftPressed && controlPressed) || altPressed) { action = Qt::LinkAction; - } else if (shiftPressed) { - // shortcut for 'Move Here' is used - action = Qt::MoveAction; } else if (controlPressed) { - // shortcut for 'Copy Here' is used action = Qt::CopyAction; + } else if (shiftPressed) { + action = Qt::MoveAction; } else { // open a context menu which offers the following actions: // - Move Here @@ -82,7 +86,7 @@ void DolphinDropController::dropUrls(const KUrl::List& urls, seq = QKeySequence(Qt::ControlModifier + Qt::ShiftModifier).toString(); seq.chop(1); - QAction* linkAction = popup.addAction(KIcon("insert-link"), + QAction* linkAction = popup.addAction(KIcon("edit-link"), i18nc("@action:inmenu", "&Link Here\t%1", seq)); @@ -104,17 +108,17 @@ void DolphinDropController::dropUrls(const KUrl::List& urls, switch (action) { case Qt::MoveAction: KonqOperations::copy(m_parentWidget, KonqOperations::MOVE, urls, destination); - emit doingOperation(KonqFileUndoManager::MOVE); + emit doingOperation(KIO::FileUndoManager::Move); break; case Qt::CopyAction: KonqOperations::copy(m_parentWidget, KonqOperations::COPY, urls, destination); - emit doingOperation(KonqFileUndoManager::COPY); + emit doingOperation(KIO::FileUndoManager::Copy); break; case Qt::LinkAction: KonqOperations::copy(m_parentWidget, KonqOperations::LINK, urls, destination); - emit doingOperation(KonqFileUndoManager::LINK); + emit doingOperation(KIO::FileUndoManager::Link); break; default: