#include <QGraphicsView>
#include <QMimeData>
#include <QTimer>
+#include <QAccessible>
KItemListController::KItemListController(KItemModelBase* model, KItemListView* view, QObject* parent) :
QObject(parent),
- m_singleClickActivation(KGlobalSettings::singleClick()),
+ m_singleClickActivationEnforced(false),
m_selectionTogglePressed(false),
m_clearSelectionIfItemsAreNotDragged(false),
m_selectionBehavior(NoSelection),
return m_autoActivationTimer->interval();
}
-void KItemListController::setSingleClickActivation(bool singleClick)
+void KItemListController::setSingleClickActivationEnforced(bool singleClick)
{
- m_singleClickActivation = singleClick;
+ m_singleClickActivationEnforced = singleClick;
}
-bool KItemListController::singleClickActivation() const
+bool KItemListController::singleClickActivationEnforced() const
{
- return m_singleClickActivation;
+ return m_singleClickActivationEnforced;
}
bool KItemListController::showEvent(QShowEvent* event)
default:
m_keyboardManager->addKeys(event->text());
+ // Make sure unconsumed events get propagated up the chain. #302329
+ event->ignore();
return false;
}
return;
}
- if (m_model->supportsDropping(index)) {
+ /* m_view->isUnderMouse() fixes a bug in the Folder-View-Panel and in the
+ * Places-Panel.
+ *
+ * Bug: When you drag a file onto a Folder-View-Item or a Places-Item and
+ * then move away before the auto-activation timeout triggers, than the
+ * item still becomes activated/expanded.
+ *
+ * See Bug 293200 and 305783
+ */
+ if (m_model->supportsDropping(index) && m_view->isUnderMouse()) {
if (m_view->supportsItemExpanding() && m_model->isExpandable(index)) {
const bool expanded = m_model->isExpanded(index);
m_model->setExpanded(index, !expanded);
} else if (shiftOrControlPressed) {
// The mouse click should only update the selection, not trigger the item
emitItemActivated = false;
- } else if (!m_singleClickActivation) {
+ } else if (!(KGlobalSettings::singleClick() || m_singleClickActivationEnforced)) {
emitItemActivated = false;
}
if (emitItemActivated) {
}
}
- bool emitItemActivated = !m_singleClickActivation &&
+ bool emitItemActivated = !(KGlobalSettings::singleClick() || m_singleClickActivationEnforced) &&
(event->button() & Qt::LeftButton) &&
index >= 0 && index < m_model->count();
if (emitItemActivated) {
emit itemDropEvent(m_view->itemAt(pos), event);
}
+ QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropEnd);
+
return true;
}
drag->setHotSpot(hotSpot);
drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::CopyAction);
+ QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropStart);
}
KItemListWidget* KItemListController::hoveredWidget() const