- 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
- 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 {
- // open a context menu which offers the following actions:
- // - Move Here
- // - Copy Here
- // - Link Here
- // - Cancel
-
- KMenu popup(this);
-
- QString seq = QKeySequence(Qt::ShiftModifier).toString();
- seq.chop(1); // chop superfluous '+'
- QAction* moveAction = popup.addAction(KIcon("goto-page"),
- i18n("&Move Here") + '\t' + seq);
-
- seq = QKeySequence(Qt::ControlModifier).toString();
- seq.chop(1);
- QAction* copyAction = popup.addAction(KIcon("edit-copy"),
- i18n("&Copy Here") + '\t' + seq);
-
- seq = QKeySequence(Qt::ControlModifier + Qt::ShiftModifier).toString();
- seq.chop(1);
- QAction* linkAction = popup.addAction(KIcon("www"),
- i18n("&Link Here") + '\t' + seq);
-
- popup.addSeparator();
- popup.addAction(KIcon("process-stop"), i18n("Cancel"));
-
- QAction* activatedAction = popup.exec(QCursor::pos());
- if (activatedAction == moveAction) {
- action = Qt::MoveAction;
- } else if (activatedAction == copyAction) {
- action = Qt::CopyAction;
- } else if (activatedAction == linkAction) {
- action = Qt::LinkAction;
- } else {
- return;
- }
- }
-
- switch (action) {
- case Qt::MoveAction:
- moveUrls(urls, destination);
- break;
-
- case Qt::CopyAction:
- copyUrls(urls, destination);
- break;
-
- case Qt::LinkAction:
- linkUrls(urls, destination);
- break;
-
- default:
- break;
- }
+ DolphinDropController dropController(this);
+ connect(&dropController, SIGNAL(doingOperation(KonqFileUndoManager::CommandType)),
+ this, SLOT(slotDoingOperation(KonqFileUndoManager::CommandType)));
+ dropController.dropUrls(urls, destination);