mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Emit "itemMiddleClicked" when Ctrl-clicking a view in single selection mode
When Ctrl can't cause a change in selection, so instead emit `itemMiddleClicked`. This way one can Ctrl-click a Place or folder in Folders panel to open it in a new tab, similar to what web browsers.
This commit is contained in:
parent
6dd67f6f63
commit
eb4b0fb480
|
@ -1550,8 +1550,9 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool controlPressed = modifiers & Qt::ControlModifier;
|
||||||
const bool shiftOrControlPressed = modifiers & Qt::ShiftModifier ||
|
const bool shiftOrControlPressed = modifiers & Qt::ShiftModifier ||
|
||||||
modifiers & Qt::ControlModifier;
|
controlPressed;
|
||||||
|
|
||||||
KItemListRubberBand* rubberBand = m_view->rubberBand();
|
KItemListRubberBand* rubberBand = m_view->rubberBand();
|
||||||
if (rubberBand->isActive()) {
|
if (rubberBand->isActive()) {
|
||||||
|
@ -1585,6 +1586,11 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
|
||||||
} else if (shiftOrControlPressed) {
|
} else if (shiftOrControlPressed) {
|
||||||
// The mouse click should only update the selection, not trigger the item
|
// The mouse click should only update the selection, not trigger the item
|
||||||
emitItemActivated = false;
|
emitItemActivated = false;
|
||||||
|
// When Ctrl-clicking an item when in single selection mode
|
||||||
|
// i.e. where Ctrl won't change the selection, pretend it was middle clicked
|
||||||
|
if (controlPressed && m_selectionBehavior == SingleSelection) {
|
||||||
|
Q_EMIT itemMiddleClicked(index);
|
||||||
|
}
|
||||||
} else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) {
|
} else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) {
|
||||||
if (touch) {
|
if (touch) {
|
||||||
emitItemActivated = true;
|
emitItemActivated = true;
|
||||||
|
|
Loading…
Reference in a new issue