summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2017-12-13 10:20:02 +0100
committerAndre Heinecke <[email protected]>2017-12-13 10:20:02 +0100
commitc85bc8ebbe8594be9309e3e8a0945a5dbb90828c (patch)
treeaed20dce7ba2c2f452c9e62dcb6683cc828e84aa
parent2368c4ee2929ca3833a804dd1d78ff3bdb6160ab (diff)
Combine Name and EMail parts for S/MIME Uids
If the EMail of a userid is empty but the next userid has an email merge these two userids together in a single row in the UID table. This is very common as GPGME parses the Name and EMail into different UserIDs. GnuPG-Bug-Id: 3611
-rw-r--r--src/dialogs/certificatedetailswidget.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/dialogs/certificatedetailswidget.cpp b/src/dialogs/certificatedetailswidget.cpp
index f871bd8..0c7fe8a 100644
--- a/src/dialogs/certificatedetailswidget.cpp
+++ b/src/dialogs/certificatedetailswidget.cpp
@@ -135,11 +135,25 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
ui.userIDTable->setHeaderLabels(headers);
const auto uids = key.userIDs();
- for (const auto &uid : uids) {
+ for (unsigned int i = 0; i < uids.size(); ++i) {
+ const auto &uid = uids[i];
auto item = new QTreeWidgetItem;
const QString toolTip = tofuTooltipString(uid);
item->setData(0, Qt::UserRole, QVariant::fromValue(uid));
- item->setData(0, Qt::DisplayRole, Kleo::Formatting::prettyEMail(uid));
+
+ auto pMail = Kleo::Formatting::prettyEMail(uid);
+ if (!isOpenPGP && pMail.isEmpty()) {
+ // S/MIME UserIDs are sometimes split, with one userID
+ // containing the name another the Mail, we merge these
+ // UID's into a single item.
+
+ if (i + 1 < uids.size()) {
+ pMail = Kleo::Formatting::prettyEMail(uids[i + 1]);
+ // skip next uid
+ ++i;
+ }
+ }
+ item->setData(0, Qt::DisplayRole, pMail);
item->setData(0, Qt::ToolTipRole, toolTip);
item->setData(1, Qt::DisplayRole, Kleo::Formatting::prettyName(uid));
item->setData(1, Qt::ToolTipRole, toolTip);