]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Allow to drop files above a tab. Thanks to Todd for the patch.
authorPeter Penz <peter.penz19@gmail.com>
Tue, 23 Feb 2010 07:26:02 +0000 (07:26 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 23 Feb 2010 07:26:02 +0000 (07:26 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1094746

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index e68fab99768a02a4bb92a3e2335e950013abe583..d358ad7330b2d6becfef992ccc41c233e026c7cb 100644 (file)
@@ -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
 
index ca8daa94819394514ba975831ee6da332cb1faca..6c2089fcf10b73aeb18863494f6b10dedb528f4e 100644 (file)
@@ -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.