Commit e75ab12f authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

unify switch layout

No code change, only whitespace changes.

SVN_SILENT
parent 5b14e435
......@@ -34,16 +34,21 @@ namespace Convert
QString toString(const KgpgKeyAlgo algorithm)
{
switch (algorithm)
{
case ALGO_RSA: return i18nc("Encryption algorithm", "RSA");
case ALGO_DSA: return i18nc("Encryption algorithm", "DSA");
case ALGO_ELGAMAL: return i18nc("Encryption algorithm", "ElGamal");
case ALGO_DSA_ELGAMAL: return i18nc("Encryption algorithm", "DSA & ElGamal");
case ALGO_RSA_RSA: return i18nc("Encryption algorithm RSA, Signing algorithm RSA", "RSA & RSA");
case ALGO_UNKNOWN:
default: return i18nc("Unknown algorithm", "Unknown");
}
switch (algorithm) {
case ALGO_RSA:
return i18nc("Encryption algorithm", "RSA");
case ALGO_DSA:
return i18nc("Encryption algorithm", "DSA");
case ALGO_ELGAMAL:
return i18nc("Encryption algorithm", "ElGamal");
case ALGO_DSA_ELGAMAL:
return i18nc("Encryption algorithm", "DSA & ElGamal");
case ALGO_RSA_RSA:
return i18nc("Encryption algorithm RSA, Signing algorithm RSA", "RSA & RSA");
case ALGO_UNKNOWN:
default:
return i18nc("Unknown algorithm", "Unknown");
}
}
QString toString(const gpgme_validity_t ownertrust)
......@@ -67,20 +72,29 @@ QString toString(const gpgme_validity_t ownertrust)
QString toString(const KgpgKeyTrust trust)
{
switch (trust)
{
case TRUST_INVALID: return i18nc("Invalid key", "Invalid");
case TRUST_DISABLED: return i18nc("Disabled key", "Disabled");
case TRUST_REVOKED: return i18n("Revoked");
case TRUST_EXPIRED: return i18nc("Expired key", "Expired");
case TRUST_UNDEFINED: return i18nc("Undefined key trust", "Undefined");
case TRUST_NONE: return i18nc("No trust in key", "None");
case TRUST_MARGINAL: return i18nc("Marginal trust in key", "Marginal");
case TRUST_FULL: return i18nc("Full trust in key", "Full");
case TRUST_ULTIMATE: return i18nc("Ultimate trust in key", "Ultimate");
case TRUST_UNKNOWN:
default: return i18nc("Unknown trust in key", "Unknown");
}
switch (trust) {
case TRUST_INVALID:
return i18nc("Invalid key", "Invalid");
case TRUST_DISABLED:
return i18nc("Disabled key", "Disabled");
case TRUST_REVOKED:
return i18n("Revoked");
case TRUST_EXPIRED:
return i18nc("Expired key", "Expired");
case TRUST_UNDEFINED:
return i18nc("Undefined key trust", "Undefined");
case TRUST_NONE:
return i18nc("No trust in key", "None");
case TRUST_MARGINAL:
return i18nc("Marginal trust in key", "Marginal");
case TRUST_FULL:
return i18nc("Full trust in key", "Full");
case TRUST_ULTIMATE:
return i18nc("Ultimate trust in key", "Ultimate");
case TRUST_UNKNOWN:
default:
return i18nc("Unknown trust in key", "Unknown");
}
}
QString toString(const KgpgCore::KgpgSubKeyType type)
......@@ -123,20 +137,30 @@ KgpgKeyAlgo toAlgo(const QString &s)
KgpgKeyTrust toTrust(const QChar &c)
{
switch (c.toAscii())
{
case 'o': return TRUST_UNKNOWN;
case 'i': return TRUST_INVALID;
case 'd': return TRUST_DISABLED;
case 'r': return TRUST_REVOKED;
case 'e': return TRUST_EXPIRED;
case 'q': return TRUST_UNDEFINED;
case 'n': return TRUST_NONE;
case 'm': return TRUST_MARGINAL;
case 'f': return TRUST_FULL;
case 'u': return TRUST_ULTIMATE;
default: return TRUST_UNKNOWN;
}
switch (c.toAscii()) {
case 'o':
return TRUST_UNKNOWN;
case 'i':
return TRUST_INVALID;
case 'd':
return TRUST_DISABLED;
case 'r':
return TRUST_REVOKED;
case 'e':
return TRUST_EXPIRED;
case 'q':
return TRUST_UNDEFINED;
case 'n':
return TRUST_NONE;
case 'm':
return TRUST_MARGINAL;
case 'f':
return TRUST_FULL;
case 'u':
return TRUST_ULTIMATE;
default:
return TRUST_UNKNOWN;
}
}
KgpgKeyTrust toTrust(const QString &s)
......@@ -166,36 +190,36 @@ KgpgSubKeyType toSubType(const QString& capString, bool upper)
foreach (const QChar &ch, capString) {
switch (ch.toAscii()) {
case 's':
case 'S':
if (upper != ch.isUpper())
continue;
ret |= SKT_SIGNATURE;
break;
case 'e':
case 'E':
if (upper != ch.isUpper())
continue;
ret |= SKT_ENCRYPTION;
break;
case 'a':
case 'A':
if (upper != ch.isUpper())
continue;
ret |= SKT_AUTHENTICATION;
break;
case 'c':
case 'C':
if (upper != ch.isUpper())
continue;
ret |= SKT_CERTIFICATION;
break;
case 'D': // disabled key
case '?': // unknown to GnuPG
case 's':
case 'S':
if (upper != ch.isUpper())
continue;
ret |= SKT_SIGNATURE;
break;
case 'e':
case 'E':
if (upper != ch.isUpper())
continue;
ret |= SKT_ENCRYPTION;
break;
case 'a':
case 'A':
if (upper != ch.isUpper())
continue;
ret |= SKT_AUTHENTICATION;
break;
case 'c':
case 'C':
if (upper != ch.isUpper())
continue;
default:
kDebug(2100) << "unknown capability letter" << ch
<< "in cap string" << capString;
ret |= SKT_CERTIFICATION;
break;
case 'D': // disabled key
case '?': // unknown to GnuPG
continue;
default:
kDebug(2100) << "unknown capability letter" << ch
<< "in cap string" << capString;
}
}
......
......@@ -222,29 +222,24 @@ void KgpgKeyInfo::displayKey()
m_comment->setTextFormat(Qt::PlainText);
}
switch (key->ownerTrust())
{
case GPGME_VALIDITY_NEVER:
m_owtrust->setCurrentIndex(1);
break;
case GPGME_VALIDITY_MARGINAL:
m_owtrust->setCurrentIndex(2);
break;
case GPGME_VALIDITY_FULL:
m_owtrust->setCurrentIndex(3);
break;
case GPGME_VALIDITY_ULTIMATE:
m_owtrust->setCurrentIndex(4);
break;
case GPGME_VALIDITY_UNDEFINED:
default:
m_owtrust->setCurrentIndex(0);
break;
}
switch (key->ownerTrust()) {
case GPGME_VALIDITY_NEVER:
m_owtrust->setCurrentIndex(1);
break;
case GPGME_VALIDITY_MARGINAL:
m_owtrust->setCurrentIndex(2);
break;
case GPGME_VALIDITY_FULL:
m_owtrust->setCurrentIndex(3);
break;
case GPGME_VALIDITY_ULTIMATE:
m_owtrust->setCurrentIndex(4);
break;
case GPGME_VALIDITY_UNDEFINED:
default:
m_owtrust->setCurrentIndex(0);
break;
}
if (!key->valid())
m_disable->setChecked(true);
......
......@@ -96,18 +96,18 @@ GroupEditProxyModel::data(const QModelIndex &index, int role) const
KGpgNode *nd = m_model->nodeForIndex(mapToSource(index));
switch (index.column()) {
case 0:
if (role == Qt::ToolTipRole)
return nd->getNameComment();
else
return nd->getName();
case 1:
return nd->getEmail();
case 2:
if (role == Qt::ToolTipRole)
return nd->toKeyNode()->getBeautifiedFingerprint();
else
return nd->getId().right(8);
case 0:
if (role == Qt::ToolTipRole)
return nd->getNameComment();
else
return nd->getName();
case 1:
return nd->getEmail();
case 2:
if (role == Qt::ToolTipRole)
return nd->toKeyNode()->getBeautifiedFingerprint();
else
return nd->getId().right(8);
}
return QVariant();
......@@ -136,9 +136,13 @@ GroupEditProxyModel::headerData(int section, Qt::Orientation orientation, int ro
return QVariant();
switch (section) {
case 0: return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1: return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2: return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default: return QVariant();
case 0:
return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1:
return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2:
return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default:
return QVariant();
}
}
......@@ -149,10 +149,14 @@ SelectKeyProxyModel::headerData(int section, Qt::Orientation orientation, int ro
return QVariant();
switch (section) {
case 0: return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1: return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2: return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default: return QVariant();
case 0:
return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1:
return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2:
return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default:
return QVariant();
}
}
......@@ -254,10 +258,15 @@ SelectSecretKeyProxyModel::headerData(int section, Qt::Orientation orientation,
return QVariant();
switch (section) {
case 0: return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1: return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2: return m_model->headerData(KEYCOLUMN_EXPIR, orientation, role);
case 3: return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default: return QVariant();
case 0:
return m_model->headerData(KEYCOLUMN_NAME, orientation, role);
case 1:
return m_model->headerData(KEYCOLUMN_EMAIL, orientation, role);
case 2:
return m_model->headerData(KEYCOLUMN_EXPIR, orientation, role);
case 3:
return m_model->headerData(KEYCOLUMN_ID, orientation, role);
default:
return QVariant();
}
}
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