Commit e001135e authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Add Icon for UID helper to formatting

This should return a general Icon to show for a specific
UID to indicate its validity status.
parent 7e19bcc3
......@@ -50,6 +50,7 @@
#include <QDateTime>
#include <QTextDocument> // for Qt::escape
#include <QLocale>
#include <QIcon>
using namespace GpgME;
using namespace Kleo;
......@@ -757,3 +758,22 @@ QString Formatting::summaryLine(const Key &key)
{
return keyToString(key) + QStringLiteral(" (%1 - %2)").arg(key.shortKeyID()).arg(displayName(key.protocol()));
}
// Icon for certificate selection indication
QIcon Formatting::iconForUid(const UserID &uid)
{
switch (uid.validity()) {
case UserID::Ultimate:
return QIcon::fromTheme(QStringLiteral("emblem-favorite"));
case UserID::Full:
return QIcon::fromTheme(QStringLiteral("emblem-success"));
case UserID::Marginal:
return QIcon::fromTheme(QStringLiteral("emblem-information"));
case UserID::Never:
return QIcon::fromTheme(QStringLiteral("emblem-error"));
case UserID::Undefined:
case UserID::Unknown:
default:
return QIcon::fromTheme(QStringLiteral("emblem-warning"));
}
}
......@@ -38,6 +38,7 @@
class QString;
class QStringList;
class QDate;
class QIcon;
namespace GpgME
{
......@@ -125,6 +126,8 @@ QString importMetaData(const GpgME::Import &import, const QStringList &sources);
QString formatOverview(const GpgME::Key &key);
QString usageString(const GpgME::Subkey &subkey);
QString summaryLine(const GpgME::Key &key);
QIcon iconForUid(const GpgME::UserID &uid);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment