-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Lock selected database" action on toolbar #6652
Add "Lock selected database" action on toolbar #6652
Conversation
Nice, good icon too |
I'd place the "lock all" button next to the "lock current" button, or maybe as a dropdown option. So main button would lock the current DB, and dropdown → Lock All would lock everything.
|
Hmmmmm that is not a bad idea. I do like consolidating it into a drop down. But is the default action lock all or lock current? |
I am not quite sure if it's worth changing the toolbar to add a drop down just for that (why should add entry, delete entry, change entry separate then?), also the "lock all" position is to keep it consistent with the interface overview, but if we decide to change it I'm ok with it |
Add/edit/delete are completely different actions, even if related. Lock current and lock all are both lock actions.
Then the question is what makes more sense: group the "current DB actions" (open/save/lock), or group the "lock actions" (lock current/lock all). My non-dropdown idea was to group all of them on the left: [Open][Save][Lock Current][Lock All]. I admit the Toolbar section in the User Guide will need to be updated, but it will need to be updated anyway. If we go with the drop-down, I'd argue for lock current to be the default:
Anyway, the final decision is up to @droidmonkey . |
We have a drop down choice for the Auto-Type button, which I just noticed you are missing in your toolbar. This might be because you are either running Wayland or didn't build the autotype plugin. A drop down button is rather trivial to setup, you can use the Auto-Type one in code as reference. |
I have started working on the dropdown change and the issue I've encountered is that if the current database is already locked the button is disabled resulting in the dropdown menu being disabled too. As far as I know, this behaviour can't be changed without an override to the QToolButton class. So the possible solutions are:
|
The other icons aren't disabled when the DB is locked, so it probably has something to do with how the button is connected. So another option is disconnect it when the DB is locked, and reconnect when unlocked (or when switching tabs). Or just replace it with the lock-all button when the current DB is locked. But the solution I would prefer is don't show tabs of locked DBs. When the current DB is locked, close its tab. That way, the UI immediately switches to the next unlocked tab, which gives a visual indication that there are still unlocked DBs, and allows to quickly and conveniently close the next DB by the clicking the same button again (without even moving the mouse). The question is, would this affect how multiple DBs are unlocked? If you had 2-3 DBs open, and you lock-all, and close KPXC then launch it again, do you get 2-3 tabs of locked DBs? If you had 10 or 15 DBs that you worked with recently (even not open at the same time), would you get 10-15 tabs when you launch KPXC? |
Hmm, yes, this conflicts with #5427. @droidmonkey , thoughts? Maybe close the tabs in the main UI in this PR, but still keep the last few recents in the unlock widget in #5427? I'd rather not change the default to "lock all", at least, for the reasons I listed earlier. Another option: leave the button (and drop-down) disabled if the current tab is locked, but switch to the next unlocked tab when locking. |
Locking databases does NOT close them. This behavior definitely shouldn't change. |
Ok. Then I vote for this:
Once the tab is switched, the button should be automatically re-enabled, and drop-down will be accessible. Normally you'd only switch back to a locked tab to unlock it. Other than that, you keep working with the unlocked tabs, where the button is enabled. |
I have changed the code to automatically switch to an open tab when a database is locked (if available). I also have updated the menu, moved the action "Lock Databases" from "Tools" (as it did not seem appropriate) to "Database) and added the lock single database action to the menu. recording.mp4 |
Looks nice. Just maybe change "Lock Databases" to "Lock All Databases", to contrast it more with "Lock selected database". When you hover over the main button, does it show "Lock selected database" in a tooltip? Also, the capitalization is inconsistent. Looking at the rest of the menu, this should be "Lock Selected Database". |
I have changed the strings as suggested |
LGTM. The rest is up to @droidmonkey . |
7d16853
to
c5c7cd2
Compare
I've been testing this for over a week now without a problem. The option of locking just a single DB is something I've always missed in KeepassXC, so THANK YOU for the work. |
c5c7cd2
to
078e37c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6652 +/- ##
===========================================
+ Coverage 64.22% 64.26% +0.04%
===========================================
Files 336 336
Lines 42377 42411 +34
===========================================
+ Hits 27214 27252 +38
+ Misses 15163 15159 -4 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
078e37c
to
938eda2
Compare
This works great, ready for merge. |
938eda2
to
84a078f
Compare
84a078f
to
6eab926
Compare
Closes keepassxreboot#6445 Switch tab when locking a database and move Lock Database actions to the Database section of the toolbar.
6eab926
to
883effa
Compare
This feature allows locking a single database using an icon in the toolbar.
Also the "Lock databases" icon is changed to make it more clear that its going to lock all databases.
Closes #6445
The main reason behind this change is allowing to lock a single database when having multiple databases open (without closing it), as described in the issue above.
I wanted to update the translations (change the "Lock databases" string into "Lock all databases" to make the description less confusing and add the "Lock selected databases" string for translations) but I am not quite sure how to do it (the update script seems to fail).
Screenshots
Testing strategy
This is basically an UI change (existing code was used) so it should be already covered by tests.
Type of change