slightly more readable

This commit is contained in:
Aaron Seigo 2011-05-24 12:43:47 +02:00
parent 1eeceda235
commit 304f6f4344

View File

@ -175,7 +175,6 @@ void SigningPrivate::splitKeysByTrustLevel()
GpgME::Error error = m_gpgContext->startKeyListing("", true); GpgME::Error error = m_gpgContext->startKeyListing("", true);
while (!error) { // Loop 2 while (!error) { // Loop 2
GpgME::Key key = m_gpgContext->nextKey(error); GpgME::Key key = m_gpgContext->nextKey(error);
if (error) { if (error) {
break; break;
@ -186,17 +185,12 @@ void SigningPrivate::splitKeysByTrustLevel()
// If the key is disabled, expired, invalid or revoked, put it in the untrusted list // If the key is disabled, expired, invalid or revoked, put it in the untrusted list
if (key.isDisabled() || key.isExpired() || key.isInvalid() || key.isRevoked()) { if (key.isDisabled() || key.isExpired() || key.isInvalid() || key.isRevoked()) {
keys[CompletelyUntrusted].insert(data); keys[CompletelyUntrusted].insert(data);
continue; } else if (!keys[UltimatelyTrusted].contains(data)) {
}
// Ensure we are not processing twice the trusted KDE keys // Ensure we are not processing twice the trusted KDE keys
if (keys[UltimatelyTrusted].contains(data)) {
continue;
}
// The keys is new, valid and private: save it ! // The keys is new, valid and private: save it !
keys[SelfTrusted].insert(data); keys[SelfTrusted].insert(data);
} }
}
GpgME::KeyListResult lRes = m_gpgContext->endKeyListing(); GpgME::KeyListResult lRes = m_gpgContext->endKeyListing();
error = m_gpgContext->startKeyListing(""); error = m_gpgContext->startKeyListing("");
@ -604,7 +598,6 @@ QStringList Signing::keysByTrustLevel(TrustLevel trustLevel) const
TrustLevel Signing::trustLevelOf(const QString &keyID) const TrustLevel Signing::trustLevelOf(const QString &keyID) const
{ {
if (keyID.isEmpty()) { if (keyID.isEmpty()) {
return Plasma::UnverifiableTrust; return Plasma::UnverifiableTrust;
} }
@ -612,10 +605,10 @@ TrustLevel Signing::trustLevelOf(const QString &keyID) const
for (int i = (int)Plasma::UnverifiableTrust; i <= (int)Plasma::UltimatelyTrusted; ++i) { for (int i = (int)Plasma::UnverifiableTrust; i <= (int)Plasma::UltimatelyTrusted; ++i) {
QSet<QByteArray> tmp = d->keys[(Plasma::TrustLevel)i]; QSet<QByteArray> tmp = d->keys[(Plasma::TrustLevel)i];
foreach (QByteArray key, tmp) { foreach (QByteArray key, tmp) {
if (key.contains(keyID.toAscii().data())) if (key.contains(keyID.toAscii().data())) {
return (Plasma::TrustLevel)i; return (Plasma::TrustLevel)i;
} }
}
} }
return Plasma::UnverifiableTrust; return Plasma::UnverifiableTrust;