Bug 344640 - ArchiveView connects clicked and doubleClicked to complex, KGlobalSettings::singleClick() branching triggers
Summary: ArchiveView connects clicked and doubleClicked to complex, KGlobalSettings::s...
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Raphael Kubo da Costa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-27 21:23 UTC by Thomas Lübking
Modified: 2015-06-06 17:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 15.07.80
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Lübking 2015-02-27 21:23:33 UTC
should just connect QAbstractItemView::​activated(const QModelIndex & index)

There's also talk that the QApplication::keyboardModifiers() test fails, see
https://forum.kde.org/viewtopic.php?f=66&t=125148&start=15

Reproducible: Always
Comment 1 Ragnar Thomsen 2015-05-31 10:11:38 UTC
Git commit f36cc4de55b54d971e60c3bcd2ede668e94426c7 by Ragnar Thomsen.
Committed on 31/05/2015 at 09:42.
Pushed by rthomsen into branch 'frameworks'.

Only open preview when clicking files if CTRL or SHIFT is not pressed

Add a slotClicked() slot and connect it to the clicked() signal of the
QTreeView. The slot only calls slotPreviewWithInternalViewer() if CTRL
or SHIFT is not pressed simultaneously. This fixes selection of multiple
files and also enables deselection of a file by holding CTRL and
clicking it. This is more consistent with the usual behavior of desktop
applications.
FIXED-IN: 15.07.80

M  +11   -3    part/part.cpp
M  +1    -0    part/part.h

http://commits.kde.org/ark/f36cc4de55b54d971e60c3bcd2ede668e94426c7
Comment 2 Thomas Lübking 2015-05-31 10:33:52 UTC
Notice that the cause for the reported bug was already fixed by http://quickgit.kde.org/?p=ark.git&a=commit&h=8fc15207c00aadeb3cee58ab68e443a7966291df - I didn't try but could expect that http://commits.kde.org/ark/f36cc4de55b54d971e60c3bcd2ede668e94426c7 might be a regression (hardcoding selection behavior, also notice comments on failing modifiier tests in the slot)

Linking the item activation does not only cover "activation by enter key" but should also not fire on selection.
Comment 3 Ragnar Thomsen 2015-05-31 12:21:16 UTC
Well, before my commit f36cc4de55b54d971e60c3bcd2ede668e94426c7, selecting multiple files using CTRL or SHIFT keys was broken since the preview window was opened whether or not these keys were being pressed. Do you have a proposal for a different approach to solve this issue?
Comment 4 Thomas Lübking 2015-06-03 00:04:09 UTC
Ok, sorry - my bad.

The actual problem is that QAbstractItemView (nearly*) unconditionally emits activated when the mouse is released, ie. you *cannot* select an item with the mouse without activating it (i'm not sure whether that's intentional or a bug in Qt5)

Since the return (but not enter) key is covered by m_previewAction the only change that should possibly happen (unless Qt is "fixed") would be to only connect "clicked"

   "if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0L, this))"

and connect doubleClicked() otherwise to mimic the system behavior.


---
* the logics in qabstractitemview are rather odd - it queries the style for single click behavior and passes it State_Selected as QStyleOption::state, what would eg. allow the style to "return false" if the item was selected (so a deselection would not cause an activation) or vv., but it completely ignores whether the user is currently performing a multi/extended selection.
Comment 5 Ragnar Thomsen 2015-06-03 10:54:56 UTC
I'm sorry I still don't see what your actual proposal is. You propose to connect the activated() signal instead of the clicked() signal to slotPreviewWithInternalViewer()?
What about the keyboard modifiers? Is the handling of them ok now?
Comment 6 Thomas Lübking 2015-06-03 11:11:00 UTC
connecting activated would be "correct*" but QAbstractItemView emits it even while selecting items (where I think this might be a Qt bug, but that doesn't matter atm.)


What I suggest IN ADDITION TO http://commits.kde.org/ark/f36cc4de55b54d971e60c3bcd2ede668e94426c7  is to connect doubleClicked instead of clicked
   "if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0L, this))"
to align to the general activation behavior (ie. when ppl. open by doubleclick in dolphin, ark should open by doubleclick as well)


The modifier handling is ok now (nor would I see where this approach could still fail)

* in that it would then generically cover what kind of modifiers impact seletion on the target system
Comment 7 Ragnar Thomsen 2015-06-06 17:37:20 UTC
Git commit 3be423874236303c6a9c7ee6d9a09e500c6b34c2 by Ragnar Thomsen.
Committed on 06/06/2015 at 17:26.
Pushed by rthomsen into branch 'frameworks'.

Adhere to workspace's single-click/double-click setting

In the QTreeView, connect either clicked()  or doubleClicked() to the
clicked() slot, depending on whether the StyleHint
QStyle::SH_ItemView_ActivateItemOnSingleClick is set.

This makes Ark follow the workspace's single-click/double-click setting,
e.g. when the user has configured double-click to open files, Ark will
also open the preview when double-clicking entries in the archive
instead of using single-click unconditionally.

M  +7    -2    part/part.cpp

http://commits.kde.org/ark/3be423874236303c6a9c7ee6d9a09e500c6b34c2