]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placespanel.cpp
Further preperations for drag & drop support in the places panel
[dolphin.git] / src / panels / places / placespanel.cpp
index ccf9d8cffc11783cbaf18f5e027976004a65d5f4..deef429358b055ba128f78c54cf31a57f1a51b20 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "placespanel.h"
 
-#include <KConfigGroup>
 #include <KDebug>
 #include <KDirNotify>
 #include <KIcon>
@@ -44,6 +43,7 @@
 #include "placesitemlistwidget.h"
 #include "placesitemmodel.h"
 #include <views/draganddrophelper.h>
+#include <QGraphicsSceneDragDropEvent>
 #include <QVBoxLayout>
 #include <QShowEvent>
 
@@ -89,6 +89,7 @@ void PlacesPanel::showEvent(QShowEvent* event)
         connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
         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*)));
 
         KItemListContainer* container = new KItemListContainer(m_controller, this);
         container->setEnabledFrame(false);
@@ -157,8 +158,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
     } else {
         if (item->url() == KUrl("trash:/")) {
             emptyTrashAction = menu.addAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
-            KConfig trashConfig("trashrc", KConfig::SimpleConfig);
-            emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
+            emptyTrashAction->setEnabled(item->icon() == "user-trash-full");
             menu.addSeparator();
         }
         addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry..."));
@@ -254,6 +254,11 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos)
     selectClosestItem();
 }
 
+void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
+{
+    m_model->dropMimeData(index, event->mimeData());
+}
+
 void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent)
 {
     Q_UNUSED(parent);