From 4f1d8943d6bae8d03aef81cdc9689acc60008a0e Mon Sep 17 00:00:00 2001 From: Adam Crowder Date: Thu, 9 Jul 2020 16:43:26 -0700 Subject: [PATCH 1/2] fix slot detection on yubikeys Signed-off-by: Adam Crowder --- src/keys/drivers/YubiKey.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keys/drivers/YubiKey.cpp b/src/keys/drivers/YubiKey.cpp index d64452f3..7feeec89 100644 --- a/src/keys/drivers/YubiKey.cpp +++ b/src/keys/drivers/YubiKey.cpp @@ -176,7 +176,7 @@ void YubiKey::findValidKeys() bool wouldBlock; QList> ykSlots; for (int slot = 1; slot <= 2; ++slot) { - auto config = (i == 1 ? CONFIG1_VALID : CONFIG2_VALID); + auto config = (slot == 1 ? CONFIG1_VALID : CONFIG2_VALID); if (!(ykds_touch_level(st) & config)) { // Slot is not configured continue; From 2fe74c294774aeb2a2b32f55fe7ae4096d067215 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Fri, 10 Jul 2020 13:29:49 +0200 Subject: [PATCH 2/2] Reset icon theme name before calling QIcon::fromTheme(). qt5ct randomly resets the active Qt icon theme to "", resulting in empty or wrong icons. See https://sourceforge.net/p/qt5ct/tickets/80/ Fixes #4963 --- src/core/Resources.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/Resources.cpp b/src/core/Resources.cpp index ad1ff5fa..2f99c934 100644 --- a/src/core/Resources.cpp +++ b/src/core/Resources.cpp @@ -153,6 +153,15 @@ QIcon Resources::icon(const QString& name, bool recolor, const QColor& overrideC return icon; } + // Resetting the application theme name before calling QIcon::fromTheme() is required for hacky + // QPA platform themes such as qt5ct, which randomly mess with the configured icon theme. + // If we do not reset the theme name here, it will become empty at some point, causing + // Qt to look for icons at the user-level and global default locations. + // + // See issue #4963: https://github.com/keepassxreboot/keepassxc/issues/4963 + // and qt5ct issue #80: https://sourceforge.net/p/qt5ct/tickets/80/ + QIcon::setThemeName("application"); + icon = QIcon::fromTheme(name); if (getMainWindow() && recolor) { QImage img = icon.pixmap(128, 128).toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);