]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontroller.cpp
Folders Panel: Activate folders on single-click
[dolphin.git] / src / kitemviews / kitemlistcontroller.cpp
index 7798fc364df5d57cfab67271f6d07f927b4708cf..220748be70770b27e75517847c2410c14f1f54e5 100644 (file)
@@ -41,6 +41,7 @@
 
 KItemListController::KItemListController(QObject* parent) :
     QObject(parent),
+    m_singleClickActivation(KGlobalSettings::singleClick()),
     m_selectionTogglePressed(false),
     m_selectionBehavior(NoSelection),
     m_model(0),
@@ -142,6 +143,16 @@ int KItemListController::autoActivationDelay() const
     return m_autoActivationTimer->interval();
 }
 
+void KItemListController::setSingleClickActivation(bool singleClick)
+{
+    m_singleClickActivation = singleClick;
+}
+
+bool KItemListController::singleClickActivation() const
+{
+    return m_singleClickActivation;
+}
+
 bool KItemListController::showEvent(QShowEvent* event)
 {
     Q_UNUSED(event);
@@ -577,7 +588,7 @@ bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, con
             } else if (shiftOrControlPressed) {
                 // The mouse click should only update the selection, not trigger the item
                 emitItemActivated = false;
-            } else if (!KGlobalSettings::singleClick()) {
+            } else if (!m_singleClickActivation) {
                 emitItemActivated = false;
             }
             if (emitItemActivated) {
@@ -598,7 +609,7 @@ bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event,
     const QPointF pos = transform.map(event->pos());
     const int index = m_view->itemAt(pos);
 
-    bool emitItemActivated = !KGlobalSettings::singleClick() &&
+    bool emitItemActivated = !m_singleClickActivation &&
                              (event->button() & Qt::LeftButton) &&
                              index >= 0 && index < m_model->count();
     if (emitItemActivated) {
@@ -914,7 +925,7 @@ void KItemListController::startDragging()
     const QPixmap pixmap = m_view->createDragPixmap(selectedItems);
     drag->setPixmap(pixmap);
 
-    drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::IgnoreAction);
+    drag->exec(Qt::CopyAction);
 }
 
 KItemListWidget* KItemListController::hoveredWidget() const