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
parent 2368c4ee
......@@ -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);
......
Markdown is supported
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