mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-06-08 15:02:41 -04:00
Ignore system icon theme, always use our own icons
With the Material Design icons, any other icons brought in through the system icon theme will look inconsistent. Also remove the KEEPASSXC_IGNORE_ICON_THEME environment variable (which was introduced during development of the new icons to disable the system icon theme and is thus no longer needed). Fixes #475
This commit is contained in:
parent
94b45ea16f
commit
97b034dbcb
9 changed files with 13 additions and 30 deletions
|
@ -133,7 +133,7 @@ QIcon FilePath::trayIconUnlocked()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon FilePath::icon(const QString& category, const QString& name, bool fromTheme)
|
QIcon FilePath::icon(const QString& category, const QString& name)
|
||||||
{
|
{
|
||||||
QString combinedName = category + "/" + name;
|
QString combinedName = category + "/" + name;
|
||||||
|
|
||||||
|
@ -143,10 +143,6 @@ QIcon FilePath::icon(const QString& category, const QString& name, bool fromThem
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromTheme && !getenv("KEEPASSXC_IGNORE_ICON_THEME")) {
|
|
||||||
icon = QIcon::fromTheme(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
const QList<int> pngSizes = {16, 22, 24, 32, 48, 64, 128};
|
const QList<int> pngSizes = {16, 22, 24, 32, 48, 64, 128};
|
||||||
QString filename;
|
QString filename;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
QIcon trayIcon();
|
QIcon trayIcon();
|
||||||
QIcon trayIconLocked();
|
QIcon trayIconLocked();
|
||||||
QIcon trayIconUnlocked();
|
QIcon trayIconUnlocked();
|
||||||
QIcon icon(const QString& category, const QString& name, bool fromTheme = true);
|
QIcon icon(const QString& category, const QString& name);
|
||||||
QIcon onOffIcon(const QString& category, const QString& name);
|
QIcon onOffIcon(const QString& category, const QString& name);
|
||||||
|
|
||||||
static FilePath* instance();
|
static FilePath* instance();
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace FdoSecrets
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return tr("Unlock to show");
|
return tr("Unlock to show");
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("object-locked"), true);
|
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("object-locked"));
|
||||||
case Qt::FontRole: {
|
case Qt::FontRole: {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setItalic(true);
|
font.setItalic(true);
|
||||||
|
@ -165,7 +165,7 @@ namespace FdoSecrets
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return tr("None");
|
return tr("None");
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("paint-none"), true);
|
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("paint-none"));
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace
|
||||||
|
|
||||||
// unlock/lock
|
// unlock/lock
|
||||||
m_lockAct = new QAction(tr("Unlock database"), this);
|
m_lockAct = new QAction(tr("Unlock database"), this);
|
||||||
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked"), false));
|
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked")));
|
||||||
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
||||||
connect(m_lockAct, &QAction::triggered, this, [this]() {
|
connect(m_lockAct, &QAction::triggered, this, [this]() {
|
||||||
if (!m_dbWidget) {
|
if (!m_dbWidget) {
|
||||||
|
@ -133,14 +133,13 @@ namespace
|
||||||
}
|
}
|
||||||
connect(m_dbWidget, &DatabaseWidget::databaseLocked, this, [this]() {
|
connect(m_dbWidget, &DatabaseWidget::databaseLocked, this, [this]() {
|
||||||
m_lockAct->setText(tr("Unlock database"));
|
m_lockAct->setText(tr("Unlock database"));
|
||||||
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked"), false));
|
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked")));
|
||||||
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
||||||
m_dbSettingsAct->setEnabled(false);
|
m_dbSettingsAct->setEnabled(false);
|
||||||
});
|
});
|
||||||
connect(m_dbWidget, &DatabaseWidget::databaseUnlocked, this, [this]() {
|
connect(m_dbWidget, &DatabaseWidget::databaseUnlocked, this, [this]() {
|
||||||
m_lockAct->setText(tr("Lock database"));
|
m_lockAct->setText(tr("Lock database"));
|
||||||
m_lockAct->setIcon(
|
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-unlocked")));
|
||||||
filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-unlocked"), false));
|
|
||||||
m_lockAct->setToolTip(tr("Lock database"));
|
m_lockAct->setToolTip(tr("Lock database"));
|
||||||
m_dbSettingsAct->setEnabled(true);
|
m_dbSettingsAct->setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -94,7 +94,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
|
||||||
QAction *closeAction = new QAction(q);
|
QAction *closeAction = new QAction(q);
|
||||||
closeAction->setText(KMessageWidget::tr("&Close"));
|
closeAction->setText(KMessageWidget::tr("&Close"));
|
||||||
closeAction->setToolTip(KMessageWidget::tr("Close message"));
|
closeAction->setToolTip(KMessageWidget::tr("Close message"));
|
||||||
closeAction->setIcon(FilePath::instance()->icon("actions", "message-close", false));
|
closeAction->setIcon(FilePath::instance()->icon("actions", "message-close"));
|
||||||
|
|
||||||
QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));
|
QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,7 @@ LineEdit::LineEdit(QWidget* parent)
|
||||||
QString iconNameDirected =
|
QString iconNameDirected =
|
||||||
QString("edit-clear-locationbar-").append((layoutDirection() == Qt::LeftToRight) ? "rtl" : "ltr");
|
QString("edit-clear-locationbar-").append((layoutDirection() == Qt::LeftToRight) ? "rtl" : "ltr");
|
||||||
|
|
||||||
QIcon icon;
|
const auto icon = filePath()->icon("actions", iconNameDirected);
|
||||||
if (!getenv("KEEPASSXC_IGNORE_ICON_THEME")) {
|
|
||||||
icon = QIcon::fromTheme(iconNameDirected);
|
|
||||||
if (icon.isNull()) {
|
|
||||||
icon = QIcon::fromTheme("edit-clear");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (icon.isNull()) {
|
|
||||||
icon = filePath()->icon("actions", iconNameDirected);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_clearButton->setIcon(icon);
|
m_clearButton->setIcon(icon);
|
||||||
m_clearButton->setCursor(Qt::ArrowCursor);
|
m_clearButton->setCursor(Qt::ArrowCursor);
|
||||||
|
|
|
@ -74,7 +74,7 @@ QWidget* PasswordEditWidget::componentEditWidget()
|
||||||
m_compEditWidget = new QWidget();
|
m_compEditWidget = new QWidget();
|
||||||
m_compUi->setupUi(m_compEditWidget);
|
m_compUi->setupUi(m_compEditWidget);
|
||||||
m_compUi->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
m_compUi->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||||
m_compUi->passwordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
|
m_compUi->passwordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator"));
|
||||||
m_compUi->repeatPasswordEdit->enableVerifyMode(m_compUi->enterPasswordEdit);
|
m_compUi->repeatPasswordEdit->enableVerifyMode(m_compUi->enterPasswordEdit);
|
||||||
|
|
||||||
connect(m_compUi->togglePasswordButton,
|
connect(m_compUi->togglePasswordButton,
|
||||||
|
|
|
@ -37,7 +37,7 @@ EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent)
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||||
m_ui->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
|
m_ui->togglePasswordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator"));
|
||||||
|
|
||||||
m_ui->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
|
m_ui->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
m_ui->passwordGenerator->hide();
|
m_ui->passwordGenerator->hide();
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
# 3. Create the icons:
|
# 3. Create the icons:
|
||||||
# $ bash ../../utils/makeicons.sh ~/src/MaterialDesign
|
# $ bash ../../utils/makeicons.sh ~/src/MaterialDesign
|
||||||
#
|
#
|
||||||
# 4. Re-build KeePassXC:
|
# 4. Re-build and run KeePassXC:
|
||||||
# $ cd ~/keepassxc/build
|
# $ cd ~/keepassxc/build
|
||||||
# $ make keepassxc
|
# $ make keepassxc && src/keepassxc
|
||||||
#
|
|
||||||
# 5. Check icons by disabling the OS icon theme:
|
|
||||||
# $ KEEPASSXC_IGNORE_ICON_THEME=1 src/keepassxc
|
|
||||||
#
|
#
|
||||||
# Material icons: https://materialdesignicons.com/
|
# Material icons: https://materialdesignicons.com/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue