-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Copy Password button when text is selected
When the user chooses to copy the password for an entry to the clipboard, previously there was logic to check if text was selected, and if so, that text was instead copied to the clipboard. That made sense if (a) the user invoked the Copy Password action via its keyboard shortcut, and (b) that keyboard shortcut was configured (as per default) to be Ctrl-C, i.e. the same as the system action for copy-to-clipboard. However, it made no sense if the user invoked that action in some other way, for example by clicking the corresponding toolbar button. It also made no sense in the case that the Copy Password action had some other keyboard shortcut assigned. Also, if some other action had Ctrl-C assigned, the logic would not kick in then. Fix all of the above by modifying the keyboard shortcut logic to intervene precisely in the case where a shortcut is pressed that matches the system copy-to-clipboard shortcut; only in that case do we now check if text is selected and if so copy that to the clipboard instead of the action we would otherwise take. Add a test case to TestGui.cpp. Fixes #10734. Also, relatedly: - Change the global ActionCollection object to be owned by the global MainWindow object, instead of being a singleton. This clarifies the fact that it represents the set of actions that belong to the main window. - Change the ActionCollection API to support adding an action and setting a default keyboard shortcut for it at the same time. In MainWindow, take advantage of that to eliminate some repeated mentions of each action. - Other small changes to the ActionCollection API. - Change ActionCollection to store the default keyboard shortcut for each action in a map (QHash) instead of a property on the QAction. This seemed to be a bit nicer (and typesafe) since we had to introduce this map for another reason (i.e. to store the set of QShortcut instances in case the action had a shortcut that clashes with the system copy action). - Minor code cleanups.
- Loading branch information
Showing
9 changed files
with
327 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.