From: Peter Penz Date: Tue, 23 Feb 2010 07:26:02 +0000 (+0000) Subject: Allow to drop files above a tab. Thanks to Todd for the patch. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/0c71d25a6fa427a17f8e9e9849154631b48b96e6 Allow to drop files above a tab. Thanks to Todd for the patch. svn path=/trunk/KDE/kdebase/apps/; revision=1094746 --- diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index e68fab997..d358ad733 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1139,6 +1139,16 @@ void DolphinMainWindow::handleUrl(const KUrl& url) } } +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(); + DragAndDropHelper::instance().dropUrls(KFileItem(), destPath, event, m_tabBar); + } +} + void DolphinMainWindow::slotCaptionStatFinished(KJob* job) { m_captionStatJob = 0; @@ -1227,6 +1237,8 @@ void DolphinMainWindow::init() this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(slotTabMoved(int, int))); + connect(m_tabBar, SIGNAL(receivedDropEvent(int, QDropEvent*)), + this, SLOT(tabDropEvent(int, QDropEvent*))); m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index ca8daa948..6c2089fcf 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -429,6 +429,12 @@ private slots: */ void slotCaptionStatFinished(KJob* job); + /** + * Is connected to the KTabBar signal receivedDropEvent. + * Allows dragging and dropping files onto tabs. + */ + void tabDropEvent(int tab, QDropEvent* event); + /** * Is invoked when the write state of a folder has been changed and * enables/disables the "Create New..." menu entry.