mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Use Icons for password strength (#9844)
--------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
parent
6a9ed21079
commit
ac6654c532
3
COPYING
3
COPYING
@ -240,6 +240,9 @@ Files: share/icons/application/scalable/actions/application-exit.svg
|
||||
share/icons/application/scalable/status/dialog-information.svg
|
||||
share/icons/application/scalable/status/dialog-warning.svg
|
||||
share/icons/application/scalable/status/security-high.svg
|
||||
share/icons/application/scalable/actions/lock-open-alert.svg
|
||||
share/icons/application/scalable/actions/lock-open.svg
|
||||
share/icons/application/scalable/actions/lock.svg
|
||||
Copyright: 2019 Austin Andrews <http://templarian.com/>
|
||||
License: SIL OPEN FONT LICENSE Version 1.1
|
||||
Comment: Taken from Material Design icon set (https://github.com/templarian/MaterialDesign/)
|
||||
|
@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><path d="M22.326 14.864h-2.652v-12h2.652v12m0 5h-2.652v-3h2.652v3Z" style="fill-rule:nonzero" transform="matrix(1.13122 0 0 1 -1.2557 2.1364)"/><path d="M18 8c1.097 0 2 .903 2 2v10c0 1.097-.903 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.097.903-2 2-2h9V6c0-1.646-1.354-3-3-3S9 4.354 9 6H7c0-2.743 2.257-5 5-5s5 2.257 5 5v2h1m-6 9c1.097 0 2-.903 2-2s-.903-2-2-2-2 .903-2 2 .903 2 2 2Z" style="fill-rule:nonzero" transform="translate(-1)"/></svg>
|
After Width: | Height: | Size: 600 B |
1
share/icons/application/scalable/actions/lock-open.svg
Normal file
1
share/icons/application/scalable/actions/lock-open.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,0 14,15A2,2 0 0,0 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17Z" /></svg>
|
After Width: | Height: | Size: 300 B |
1
share/icons/application/scalable/actions/lock.svg
Normal file
1
share/icons/application/scalable/actions/lock.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z" /></svg>
|
After Width: | Height: | Size: 314 B |
@ -55,6 +55,9 @@
|
||||
<file>application/scalable/actions/hibp.svg</file>
|
||||
<file>application/scalable/actions/lock-question.svg</file>
|
||||
<file>application/scalable/actions/keyboard-shortcuts.svg</file>
|
||||
<file>application/scalable/actions/lock.svg</file>
|
||||
<file>application/scalable/actions/lock-open.svg</file>
|
||||
<file>application/scalable/actions/lock-open-alert.svg</file>
|
||||
<file>application/scalable/actions/message-close.svg</file>
|
||||
<file>application/scalable/actions/move-down.svg</file>
|
||||
<file>application/scalable/actions/move-up.svg</file>
|
||||
|
@ -9060,29 +9060,14 @@ This option is deprecated, use --set-key-file instead.</source>
|
||||
<source>Hover over reason to show additional details. Double-click entries to edit.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bad</source>
|
||||
<comment>Password quality</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bad — password must be changed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Poor</source>
|
||||
<comment>Password quality</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Poor — password should be changed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Weak</source>
|
||||
<comment>Password quality</comment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Weak — consider changing the password</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -297,24 +297,30 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
|
||||
break;
|
||||
case PasswordStrength:
|
||||
if (!entry->password().isEmpty() && !entry->excludeFromReports()) {
|
||||
QString iconName = "lock-question";
|
||||
StateColorPalette statePalette;
|
||||
QColor color = statePalette.color(StateColorPalette::Error);
|
||||
|
||||
switch (entry->passwordHealth()->quality()) {
|
||||
case PasswordHealth::Quality::Bad:
|
||||
case PasswordHealth::Quality::Poor:
|
||||
iconName = "lock-open-alert";
|
||||
color = statePalette.color(StateColorPalette::HealthCritical);
|
||||
break;
|
||||
case PasswordHealth::Quality::Weak:
|
||||
iconName = "lock-open";
|
||||
color = statePalette.color(StateColorPalette::HealthBad);
|
||||
break;
|
||||
case PasswordHealth::Quality::Good:
|
||||
case PasswordHealth::Quality::Excellent:
|
||||
iconName = "lock";
|
||||
color = statePalette.color(StateColorPalette::HealthExcellent);
|
||||
break;
|
||||
}
|
||||
|
||||
return color;
|
||||
if (color.isValid()) {
|
||||
return icons()->icon(iconName, true, color);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -165,31 +165,32 @@ void ReportsWidgetHealthcheck::addHealthRow(QSharedPointer<PasswordHealth> healt
|
||||
Entry* entry,
|
||||
bool excluded)
|
||||
{
|
||||
QString descr, tip;
|
||||
QString tip;
|
||||
QString iconName = "lock-question";
|
||||
QColor qualityColor;
|
||||
StateColorPalette statePalette;
|
||||
const auto quality = health->quality();
|
||||
switch (quality) {
|
||||
case PasswordHealth::Quality::Bad:
|
||||
descr = tr("Bad", "Password quality");
|
||||
tip = tr("Bad — password must be changed");
|
||||
iconName = "lock-open-alert";
|
||||
qualityColor = statePalette.color(StateColorPalette::HealthCritical);
|
||||
break;
|
||||
|
||||
case PasswordHealth::Quality::Poor:
|
||||
descr = tr("Poor", "Password quality");
|
||||
tip = tr("Poor — password should be changed");
|
||||
iconName = "lock-open-alert";
|
||||
qualityColor = statePalette.color(StateColorPalette::HealthBad);
|
||||
break;
|
||||
|
||||
case PasswordHealth::Quality::Weak:
|
||||
descr = tr("Weak", "Password quality");
|
||||
tip = tr("Weak — consider changing the password");
|
||||
iconName = "lock-open";
|
||||
qualityColor = statePalette.color(StateColorPalette::HealthWeak);
|
||||
break;
|
||||
|
||||
case PasswordHealth::Quality::Good:
|
||||
case PasswordHealth::Quality::Excellent:
|
||||
iconName = "lock";
|
||||
qualityColor = statePalette.color(StateColorPalette::HealthOk);
|
||||
break;
|
||||
}
|
||||
@ -203,7 +204,7 @@ void ReportsWidgetHealthcheck::addHealthRow(QSharedPointer<PasswordHealth> healt
|
||||
}
|
||||
|
||||
auto row = QList<QStandardItem*>();
|
||||
row << new QStandardItem(descr);
|
||||
row << new QStandardItem(Icons::instance()->icon(iconName, true, qualityColor), "");
|
||||
row << new QStandardItem(Icons::entryIconPixmap(entry), title);
|
||||
row << new QStandardItem(Icons::groupIconPixmap(group), group->hierarchy().join("/"));
|
||||
row << new QStandardItem(QString::number(health->score()));
|
||||
@ -214,7 +215,6 @@ void ReportsWidgetHealthcheck::addHealthRow(QSharedPointer<PasswordHealth> healt
|
||||
// invisible, it's just for screen readers etc.
|
||||
QBrush brush(qualityColor);
|
||||
row[0]->setForeground(brush);
|
||||
row[0]->setBackground(brush);
|
||||
|
||||
// Set tooltips
|
||||
row[0]->setToolTip(tip);
|
||||
|
Loading…
Reference in New Issue
Block a user