Snap: fix theming#3028
Snap: fix theming#3028joshirio wants to merge 20 commits intokeepassxreboot:release/2.4.2from joshirio:develop
Conversation
Previously, extracting the XML from a database was done with the `saveXml` attribute in the `KeePass2Reader` class. This had several unfortunate consequences: * The `KdbxReader` class had to import the `KdbxXmlWriter` class in order to perform the export (bad separation of concerns); * The CLI database unlocking logic had to be duplicated only for the `Extract` command; * The `xmlData` had to be stored in the `KeePass2Reader` as a temporary result. * Lots of `setSaveXml` functions were implemented only to trickle down this functionality. Also, the naming of the `saveXml` variable was not really helpful to understand it's role. Overall, this change will make it easier to maintain and expand the CLI database unlocking logic (for example, adding a `--no-password` option as requested in #1873) It also opens to door to other types of extraction/exporting (for example exporting to CSV, as requested in #2572)
This is useful when keepassxc is minimized/hidden to the tray, and all the plumbing is already in place from the lock icon button in the main window UI.
Code snippets are now marked as cpp so that GitHub highlights them correctly.
This implements support for SHA-256 and SHA-512 hash algorithms when generating TOTP codes. These algorithms are specified by RFC6238. The implementation is compatible with Google's OTP URL format, as well as with the KeeOTP plugin for KeePass. The implementation is not wired into the GUI, as the main project developer expressed strong negative sentiment about adding more options there. It is possible to configure codes by putting the appropriate string into the entry's otp property, or using another program with a less opinionated UI and a compatible on-disk format.
Use GTK3 file chooser, correct cursor theme when available and system's font settings
|
So this change bundles the gtk platform plugin for Qt and then enforces it's use with the gtk launcher? It also maintains the look and feel by enforcing the fusion style? Seems like a win win to me! |
|
Yes that is the end effect of this. But let me explain a bit what and why it is done. However there this official gtk3 platform theme, which despite its name, does not affect the style directly. It just improves a little bit the integration with GTK based desktop environments by using the native GTK3 based file chooser dialogs and the font settings. The default snap Qt file chooser dialog is wird and not user friendly because it lacks bookmarks and opens a default directory inside the snap tree which most users are not interested in and have difficulties to navigate to the real home folder. Now, because of some unknown changes done by snapcraft or core18 base, that caused the issue #2966 in the first place, we have to manually force the fusion style now with And lastly, to make this even more hacky, Qt enables platform themes or style plugins though the |
|
Added commit to fix database locking, see #3027 |
|
desktop must be a new plug because I would have added it in the past. This is probably functionality that was provided by core at some point and migrated into the desktop plug. I am also probably talking out my butt, but when it comes to snaps anything is possible™! Hmmm, just looked it up, it was released in snapd 2.28 back in Oct 2017. I am ready to merge this into 2.4.2 for testing. |
Use GTK3 file chooser, correct cursor theme when available and system's font settings
|
Actually I tested your build on Ubuntu 18.04 and found that the icons shown in the application are totally wrong. The password generator icon is not used and the lock database icon isn't either. I think we need to restrict this solution a little further, its almost like a shotgun blast when we need a sniper. |
|
Could you fix the trailing space just for the sake of consistency? Thanks! |
|
Oh no, I might have to close this PR because you didn't create it off a branch. Do not submit a PR against develop. And definitely don't merge in develop. |
|
Please resubmit with your changes in a branch that is based off of release/2.4.2 |
|
Sure, did a couple of mistakes. |
|
About the theming. I guess the icons are the result of the gtk3 qt platform theme plugin, so not sure what we can do about it. At this point I'm questioning this approach as it causes a lot of troubles. I could re-propose this PR again against the 2.4.2 branch. Eventually snap, once mature enough, will hopefully fix the mouse cursor and other theming/integration issues. |
|
I think we can just block some of the gtk icon themes from being staged and prevent overwriting our desired theming |
|
After trying to selectively disable the icon theme only, without affecting the other integration, I have to say it's not possible because KeepassXC uses icons directly from the theme like: It could be possible to hack a custom icon theme and then specify the standard path like documented by Qt, but too much of a hassle IMHO: https://doc.qt.io/qt-5/qicon.html#fromTheme BTW this affects all linux builds of keepassxc, so it's a much bigger issue, for example the appimage is using the default adwaita icon theme, which for example is missing the lock database icon: It makes sense to use standard icons for common actions that are supported by all icon themes like, new, edit delete and then to ship and specify custom icons for specific actions like database locking and password generation. This doesn't affect Windows and macOS because this icon theme integration is only available on Linux. So to conclude, the snap-gtk3 integration would work well, but because of the way keepassxc loads icons from theme it will always have unexpected results on Linux based environments (Mint, flatpak, snap, deepin, fedora, etc), because each theme is different with different supported actions. Maybe this could be considered for future work when refreshing the app icon set. |
|
Oh yeah, duh 😀 please do wrap it with the build type snap ifdef |





Use GTK3 file chooser, correct cursor theme when available and system's font settings
Type of change
Description and Context
Should fix issue #2966.
Based on this snapcraft forum post.
This PR improves the snap theme integration, now based on GTK3. The default Qt theme (fusion) remains unchanged, instead now the app uses the native GTK3 file chooser, cursor theme (if included in the
gtk-common-themessnap) and the desktop environment font settings.EDIT: forgot to add: snapcraft.yaml was moved into the snap/ folder alsongside the required files. Snapcraft and build.snapcraft.io automatically also look into the snap folder to find the snapcraft.yaml.
This is just a proposal to hopefully fix the theming issues on snap for good, but as we already experienced, with snaps anything can change and break. So I understand if this approach goes too far and keepassxc prefers to wait for the
officialQt/GTK desktop integration snapcraft support, but at this time it's the best we can currently achieve with snap technology and offer end users a better experience.Screenshots
Testing strategy
Ubuntu 18.04, 19.04, Mint 19.1
Checklist:
-DWITH_ASAN=ON. [REQUIRED]