From a4553c9747365fdd96d7c4a24b80fb74a31a9d05 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 27 Jan 2012 21:52:29 +0100 Subject: [PATCH] Fix regression: Allow dragging items on a tab BUG: 292505 FIXED-IN: 4.8.1 --- src/dolphinmainwindow.cpp | 7 ++++--- src/views/dolphinview.cpp | 17 ++++++----------- src/views/dolphinview.h | 13 +------------ 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 60fded631..3654ed6c9 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -41,6 +41,7 @@ #include "statusbar/dolphinstatusbar.h" #include "views/dolphinviewactionhandler.h" #include "views/dolphinremoteencoding.h" +#include "views/draganddrophelper.h" #include "views/viewproperties.h" #ifndef Q_OS_WIN @@ -1327,9 +1328,9 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event) const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); if (!urls.isEmpty() && tab != -1) { const ViewTab& viewTab = m_viewTab[tab]; - const KUrl destPath = viewTab.isPrimaryViewActive ? viewTab.primaryView->url() : viewTab.secondaryView->url(); - Q_UNUSED(destPath); - //DragAndDropHelper::instance().dropUrls(KFileItem(), destPath, event, m_tabBar); + const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view() + : viewTab.secondaryView->view(); + DragAndDropHelper::dropUrls(view->rootItem(), event); } } diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 83d80012c..539fcaacc 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -863,16 +863,6 @@ void DolphinView::emitSelectionChangedSignal() emit selectionChanged(selectedItems()); } -void DolphinView::dropUrls(const KFileItem& destItem, - const KUrl& destPath, - QDropEvent* event) -{ - Q_UNUSED(destItem); - Q_UNUSED(destPath); - markPastedUrlsAsSelected(event->mimeData()); - //DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this); -} - void DolphinView::updateSorting(DolphinView::Sorting sorting) { ViewProperties props(url()); @@ -969,7 +959,12 @@ bool DolphinView::hasSelection() const KFileItem DolphinView::rootItem() const { - return m_dirLister->rootItem(); + KFileItem item = m_dirLister->rootItem(); + if (item.isNull()) { + // The directory has not been loaded yet + item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url()); + } + return item; } void DolphinView::observeCreatedItem(const KUrl& url) diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index a6b8fe3ae..197a41046 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -336,9 +336,7 @@ public: bool hasSelection() const; /** - * Returns the root item which represents the current URL. Note that the returned - * item can be null (KFileItem::isNull() will return true) in case that the directory - * has not been loaded. + * Returns the root item which represents the current URL. */ KFileItem rootItem() const; @@ -580,15 +578,6 @@ private slots: */ void emitSelectionChangedSignal(); - /** - * Drops dragged URLs to the destination path \a destPath. If - * the URLs are dropped above an item inside the destination path, - * the item is indicated by \a destItem. - */ - void dropUrls(const KFileItem& destItem, - const KUrl& destPath, - QDropEvent* event); - /** * Updates the view properties of the current URL to the * sorting given by \a sorting. -- 2.47.3