From b8ef5ebca1662526e994815d6e044652ce7ccf4a Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Thu, 12 Jul 2012 00:27:53 +0200 Subject: Re-implement dropping of files on folders in the Places Panel. This resolves a regression caused by the Places Panel rewrite. There is a small glitch left when reordering items (dragging below the last or above the first item only shows the drop indicator when first dragging out of the item and then back), but I prefer not to fix this glitch right now because this would require a more intrusive change, and I do not want to risk regressions because is not much time left to fix them before 4.9.0 is released. Thanks to Peter Penz for providing some advice about this issue. BUG: 302557 FIXED-IN: 4.9.0 (cherry picked from commit f4c960025167b7c7e04e1290ac9d9fee03a9b62d) --- src/panels/places/placespanel.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/panels/places/placespanel.cpp') diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 64de516fa..429c5399a 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -93,6 +93,7 @@ void PlacesPanel::showEvent(QShowEvent* event) connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); + connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*))); KItemListContainer* container = new KItemListContainer(m_controller, this); container->setEnabledFrame(false); @@ -253,7 +254,23 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event) { - m_model->dropMimeData(index, event->mimeData()); + if (index < 0) { + return; + } + + KUrl destUrl = m_model->placesItem(index)->url(); + QDropEvent dropEvent(event->pos().toPoint(), + event->possibleActions(), + event->mimeData(), + event->buttons(), + event->modifiers()); + + DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent); +} + +void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event) +{ + m_model->dropMimeDataBefore(index, event->mimeData()); } void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent) -- cgit v1.3