keepassxc icon indicating copy to clipboard operation
keepassxc copied to clipboard

Add database name and color options for unlock view

Open techninja1008 opened this issue 1 year ago • 10 comments

Fixes #10783.

Adds two database configuration options (stored as public custom data) that allow a short summary text to be displayed on the database unlock screen. The user can specify both the message and an optional color which, if set, causes the summary to be displayed on a colored background with an appropriately contrasting text color.

The summary message is stored in KPXC_PUBLIC_SUMMARY and the color is stored in KPXC_PUBLIC_COLOR.

Screenshots

kpxc4 kpxc3 kpxc2 kpxc1

Testing strategy

I have extensively performed manual testing with different values of both the message (empty, short text, long text etc) and color (empty, varying colors, invalid colors etc). I've also tested opening/closing the database, starting keepassxc after it was the last DB opened etc to approach the unlock UI from different code paths.

Type of change

  • ✅ New feature (change that adds functionality)

techninja1008 avatar May 27 '24 18:05 techninja1008

You should use the Qt color picker, see example here:

https://github.com/keepassxreboot/keepassxc/blob/9aa040604ae6f5848570c0528d477aa59bee2f0a/src/gui/entry/EditEntryWidget.cpp#L1654-L1687

droidmonkey avatar May 27 '24 19:05 droidmonkey

I've added a "Pick color..." button that uses QColorDialog.

image

techninja1008 avatar May 27 '24 20:05 techninja1008

@droidmonkey let me know if there is anything else you need to make this mergeable.

techninja1008 avatar May 30 '24 20:05 techninja1008

Seemed fine on first pass good work

droidmonkey avatar May 30 '24 21:05 droidmonkey

I made a ton of improvements and am trying to settle on one of the three views for the color. I like the middle one the best (it is the current one in the code):

image

image

image

I changed the summary to be the database name and streamlined it into the main text on the unlock screen. If the name or color are not set then the unlock screen looks like it does before this change.

droidmonkey avatar Jun 02 '24 03:06 droidmonkey

I quite like both the second and third ones, however I still quite like the original banner style and how in your face it was

techninja1008 avatar Jun 02 '24 09:06 techninja1008

The original was ok, but looked like our warning/error banner to be honest. I wouldn't personally use this feature with the original look, but with the 2nd or 3rd I would. I also wanted to separate the database name from the color since some people would want one or the other. I'll let @phoerious weigh in before I make any more changes.

droidmonkey avatar Jun 02 '24 10:06 droidmonkey

If the goal is to make it easier to distinguish DBs from the unlock screen, how about showing the icon of the root collection? IMHO that'll work better for that particular purpose than a description, and it's less in-your-face than the big (IMHO aggressive) colour patches shown above.

FWIW, on OSes that support this the main DB icon could even be put in the file metadata so it shows in the Finder/Explorer/WhatEver.

RJVB avatar Aug 26 '24 13:08 RJVB

That is a non-starter, it would expose internal data. However picking one of our standard icons as the "database icon" is not a bad idea if people don't want to use the color option.

droidmonkey avatar Aug 26 '24 15:08 droidmonkey

On Monday August 26 2024 08:29:38 Jonathan White wrote:

That is a non-starter, it would expose internal data

exposing the icon? There must be a way to store it (or an additional one) without exposing anything sensitive?!

RJVB avatar Aug 26 '24 16:08 RJVB

OK, I added support for setting a database icon (choosing from the set of default icons only):

image

image

image

droidmonkey avatar Sep 02 '24 20:09 droidmonkey

@phoerious whatcha think?

droidmonkey avatar Sep 02 '24 20:09 droidmonkey

OK, I added support for setting a database icon (choosing from the set of default icons only):

Looks a lot better, and as I thought the DB icon should be a great help. Is there a structural reason why you only support default icons, or is that just a "let's start with that and leave custom icons for later"?

RJVB avatar Sep 02 '24 21:09 RJVB

The difference is between storing a number outside the encrypted data and storing a binary blob which constitutes the custom icon.

droidmonkey avatar Sep 02 '24 21:09 droidmonkey

The difference is between storing a number outside the encrypted data and storing a binary blob which constitutes the custom icon.

So it should be technically possible to extend this by adding a way to define "custom default icons", at some point. I don't want to make a big deal out of this but I do think that being limited to a selection of default icons would quickly annoy me...

RJVB avatar Sep 02 '24 22:09 RJVB