diff options
| author | Peter Penz <[email protected]> | 2011-09-04 17:40:44 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-04 17:41:15 +0200 |
| commit | 7a91492cff931c0c4e0d38dd0aee77d9dcb29373 (patch) | |
| tree | 97c0e00397f95c673ff5dc3a4cf0dcb79a0134df /src/views/dolphinview.cpp | |
| parent | 8266e456a10670fe5ef855680d61e0b6ab0d6292 (diff) | |
Improved drag and drop support
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 53171966c..200de7904 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -22,10 +22,12 @@ #include <QAbstractItemView> #include <QApplication> +#include <QBoxLayout> #include <QClipboard> +#include <QDropEvent> +#include <QGraphicsSceneDragDropEvent> #include <QKeyEvent> #include <QItemSelection> -#include <QBoxLayout> #include <QTimer> #include <QScrollBar> @@ -60,6 +62,7 @@ #include "dolphin_detailsmodesettings.h" #include "dolphin_generalsettings.h" #include "dolphinitemlistcontainer.h" +#include "draganddrophelper.h" #include "renamedialog.h" #include "settings/dolphinsettings.h" #include "viewmodecontroller.h" @@ -172,6 +175,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : connect(controller, SIGNAL(itemExpansionToggleClicked(int)), this, SLOT(slotItemExpansionToggleClicked(int))); connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); + connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); KItemListSelectionManager* selectionManager = controller->selectionManager(); connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)), @@ -776,6 +780,19 @@ void DolphinView::slotItemUnhovered(int index) emit requestItemInfo(KFileItem()); } +void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event) +{ + const KFileItem destItem = fileItemModel()->fileItem(index); + + QDropEvent dropEvent(event->pos().toPoint(), + event->possibleActions(), + event->mimeData(), + event->buttons(), + event->modifiers()); + + DragAndDropHelper::dropUrls(destItem, url(), &dropEvent, this); +} + void DolphinView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous) { const int currentCount = current.count(); |
