Git commit 0cf2812bcaf9d3f8f36768a1dd481b08b89d6e4c by Rolf Eike Beer. Committed on 31/05/2014 at 17:57. Pushed by dakon into branch 'master'. prefer size of first non-expired encryption subkey M +10 -2 core/kgpgkey.cpp http://commits.kde.org/kgpg/0cf2812bcaf9d3f8f36768a1dd481b08b89d6e4c diff --git a/core/kgpgkey.cpp b/core/kgpgkey.cpp index fa940c9..13a0dd8 100644 --- a/core/kgpgkey.cpp +++ b/core/kgpgkey.cpp @@ -277,13 +277,21 @@ uint KgpgKey::size() const = uint KgpgKey::encryptionSize() const { + const KgpgKeySub *enc =3D NULL; // Get the first encryption subkey for (int i =3D 0; i < d->gpgsublist->count(); ++i) { - KgpgKeySub temp =3D d->gpgsublist->at(i); + const KgpgKeySub &temp =3D d->gpgsublist->at(i); if (temp.type() & SKT_ENCRYPTION) { - return temp.size(); + // if the first encryption subkey is expired + // check if there is one that is not + if (temp.trust() > TRUST_EXPIRED) + return temp.size(); + if (enc =3D=3D NULL) + enc =3D &temp; } } + if (enc !=3D NULL) + return enc->size(); return 0; } =20