Verified Commit d7afe96d authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Revert "Revert "Add possibility to filter out invalid keys""

This reverts commit aeb2f056 but
does it in a way that it still works with older GPGME Versions.
parent 7f434f37
Pipeline #39632 canceled with stage
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
mIsOpenPGP(DoesNotMatter), mIsOpenPGP(DoesNotMatter),
mWasValidated(DoesNotMatter), mWasValidated(DoesNotMatter),
mIsDeVs(DoesNotMatter), mIsDeVs(DoesNotMatter),
mBad(DoesNotMatter),
mOwnerTrust(LevelDoesNotMatter), mOwnerTrust(LevelDoesNotMatter),
mOwnerTrustReferenceLevel(Key::Unknown), mOwnerTrustReferenceLevel(Key::Unknown),
mValidity(LevelDoesNotMatter), mValidity(LevelDoesNotMatter),
...@@ -78,6 +79,7 @@ public: ...@@ -78,6 +79,7 @@ public:
TriState mIsOpenPGP; TriState mIsOpenPGP;
TriState mWasValidated; TriState mWasValidated;
TriState mIsDeVs; TriState mIsDeVs;
TriState mBad;
LevelState mOwnerTrust; LevelState mOwnerTrust;
GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel; GpgME::Key::OwnerTrust mOwnerTrustReferenceLevel;
...@@ -135,6 +137,11 @@ bool DefaultKeyFilter::matches(const Key &key, MatchContexts contexts) const ...@@ -135,6 +137,11 @@ bool DefaultKeyFilter::matches(const Key &key, MatchContexts contexts) const
bool(Formatting::uidsHaveFullValidity(key) && Formatting::isKeyDeVs(key)) != bool(d_ptr->mIsDeVs == Set)) { bool(Formatting::uidsHaveFullValidity(key) && Formatting::isKeyDeVs(key)) != bool(d_ptr->mIsDeVs == Set)) {
return false; return false;
} }
if (d_ptr->mBad != DoesNotMatter &&
/* This is similar to GPGME::Key::isBad which was introduced in GPGME 1.13.0 */
bool(key.isNull() || key.isRevoked() || key.isExpired() || key.isDisabled() || key.isInvalid()) != bool(d_ptr->mBad == Set)) {
return false;
}
switch (d_ptr->mOwnerTrust) { switch (d_ptr->mOwnerTrust) {
default: default:
case LevelDoesNotMatter: case LevelDoesNotMatter:
...@@ -348,6 +355,11 @@ void DefaultKeyFilter::setIsDeVs(DefaultKeyFilter::TriState value) const ...@@ -348,6 +355,11 @@ void DefaultKeyFilter::setIsDeVs(DefaultKeyFilter::TriState value) const
d_ptr->mIsDeVs = value; d_ptr->mIsDeVs = value;
} }
void DefaultKeyFilter::setIsBad(DefaultKeyFilter::TriState value) const
{
d_ptr->mBad = value;
}
QColor DefaultKeyFilter::fgColor() const QColor DefaultKeyFilter::fgColor() const
{ {
return d_ptr->mFgColor; return d_ptr->mFgColor;
...@@ -497,3 +509,8 @@ DefaultKeyFilter::TriState DefaultKeyFilter::isDeVS() const ...@@ -497,3 +509,8 @@ DefaultKeyFilter::TriState DefaultKeyFilter::isDeVS() const
{ {
return d_ptr->mIsDeVs; return d_ptr->mIsDeVs;
} }
DefaultKeyFilter::TriState DefaultKeyFilter::isBad() const
{
return d_ptr->mBad;
}
...@@ -87,6 +87,7 @@ public: ...@@ -87,6 +87,7 @@ public:
TriState isOpenPGP() const; TriState isOpenPGP() const;
TriState wasValidated() const; TriState wasValidated() const;
TriState isDeVS() const; TriState isDeVS() const;
TriState isBad() const;
LevelState ownerTrust() const; LevelState ownerTrust() const;
GpgME::Key::OwnerTrust ownerTrustReferenceLevel() const; GpgME::Key::OwnerTrust ownerTrustReferenceLevel() const;
...@@ -112,6 +113,7 @@ public: ...@@ -112,6 +113,7 @@ public:
void setIsOpenPGP(const TriState) const; void setIsOpenPGP(const TriState) const;
void setWasValidated(const TriState) const; void setWasValidated(const TriState) const;
void setIsDeVs(const TriState) const; void setIsDeVs(const TriState) const;
void setIsBad(const TriState) const;
void setOwnerTrust(const LevelState) const; void setOwnerTrust(const LevelState) const;
void setOwnerTrustReferenceLevel(const GpgME::Key::OwnerTrust) const; void setOwnerTrustReferenceLevel(const GpgME::Key::OwnerTrust) const;
......
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