D12094: Modify "Find" button to be a toggle, tracking state across tabs & split views
Scott Harvey
noreply at phabricator.kde.org
Wed Apr 11 03:18:02 BST 2018
sharvey added a comment.
In D12094#244048 <https://phabricator.kde.org/D12094#244048>, @ngraham wrote:
> In fact, why //do// we need two of these to implement the feature?
Because they're separate actions, as seen by the `KActionMenu` system. One item (`toggle_find`) operates the taskbar button, which toggles the search status for a view on and off. The second item (`open_find`) //only// sets the search mode to `true`, and in the process, forces the focus to the search input bar. As we want a keyboard shortcut to act differently than the taskbar button (they were originally linked), they need to be separated.
The taskbar button is set up as a `KToggleAction`, which means it changes state with each activation (the visual state can also be changed manually, without triggering the linked action). The keyboard shortcut is a `QAction`, which does not have any toggle functionality. It just triggers a block of code when executed; it's got no concept of "on" or "off".
Either operation, be it a `KToggleAction` or a `QAction`, gets identified internally by a specific "action code" (for lack of a better term). This is where we get `toggle_find` and `open_find` as two distinct items. They're both in the application's overall set of controls, aliased as `actionCollection()` in this case.
The two items can absolutely have different labels or icons. At the moment, they're identical, and that's probably not ideal. How to differentiate between them is something for more discussion.
REPOSITORY
R318 Dolphin
REVISION DETAIL
https://phabricator.kde.org/D12094
To: sharvey, ngraham, elvisangelaccio, #dolphin
Cc: rkflx, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180411/207dc65e/attachment.htm>
More information about the kfm-devel
mailing list