]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix regression: Allow dragging items on a tab
authorPeter Penz <peter.penz19@gmail.com>
Fri, 27 Jan 2012 20:52:29 +0000 (21:52 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 27 Jan 2012 21:02:42 +0000 (22:02 +0100)
BUG: 292505
FIXED-IN: 4.8.1

src/dolphinmainwindow.cpp
src/views/dolphinview.cpp
src/views/dolphinview.h

index 60fded6312815557dff35239c2084c595b81ae12..3654ed6c969bfb76f41993babc3f9f9182edcc9e 100644 (file)
@@ -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);
     }
 }
 
index 83d80012cbca8c36b8da3dfa489a5894c218f45c..539fcaaccebd4dafc2336904fc3868aebc03f441 100644 (file)
@@ -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)
index a6b8fe3aee1e09653d87e90b9f0e0d2fe61c1a8e..197a41046dce694b2ddc3933383d34e611fa65b4 100644 (file)
@@ -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.