From 33eea8c9293b061d4483f17b7070c823ae8e001c Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 5 Jan 2012 20:41:59 +0100 Subject: Folders Panel: Activate folders on single-click Even if double-click is used as default setting, the folders panel should open folders with a single-click. BUG: 289971 FIXED-IN: 4.8.0 --- src/kitemviews/kitemlistcontroller.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/kitemviews/kitemlistcontroller.cpp') diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 026c245f5..220748be7 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -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) { -- cgit v1.3