summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2012-06-11 17:29:12 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2012-06-11 17:54:31 (GMT)
commit2d252cf08c51866a6acebe705db11b29941691bf (patch)
treee9186ac696dcc4b02400f998ba26f000a1a3403e
parenta3b0cb755ff08721a3b9e2c25d4aaf655fb40804 (diff)
fix key comparison returning wrong values
This fixes a regression introduced in 4.8.2 with commit 2a100ae8d203107d17e438f67f65d26a4949cccc when trying to fix bug 292405. BUGS:298465,301618 CCBUG:292405
-rw-r--r--core/KGpgKeyNode.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/KGpgKeyNode.cpp b/core/KGpgKeyNode.cpp
index 78a12c5..ea04698 100644
--- a/core/KGpgKeyNode.cpp
+++ b/core/KGpgKeyNode.cpp
@@ -334,14 +334,16 @@ bool
KGpgKeyNode::compareId(const QString &other) const
{
if (other.length() == m_key->fullId().length())
- return other.compare(m_key->fullId(), Qt::CaseInsensitive);
+ return (other.compare(m_key->fullId(), Qt::CaseInsensitive) == 0);
if (other.length() == m_key->fingerprint().length())
- return other.compare(m_key->fingerprint(), Qt::CaseInsensitive);
+ return (other.compare(m_key->fingerprint(), Qt::CaseInsensitive) == 0);
- return other.right(m_key->fullId().length()).compare(
- m_key->fullId().right(other.length()),
- Qt::CaseInsensitive);
+ const QString comId = m_key->fullId().isEmpty() ? m_key->fingerprint() : m_key->fullId();
+
+ return (other.right(comId.length()).compare(
+ comId.right(other.length()),
+ Qt::CaseInsensitive) == 0);
}
void