From 91f03a835150984fb4a2accf1246327e3d82e1fe Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 14 Dec 2009 17:55:53 +0100 Subject: qhelpgenerator: Don't insert identical indices. Reviewed-by: kh1 --- tools/assistant/lib/qhelpgenerator.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp index 8f1b780..3adf7ac 100644 --- a/tools/assistant/lib/qhelpgenerator.cpp +++ b/tools/assistant/lib/qhelpgenerator.cpp @@ -707,7 +707,17 @@ bool QHelpGenerator::insertKeywords(const QList &keywords, int i = 0; d->query->exec(QLatin1String("BEGIN")); - foreach (QHelpDataIndexItem itm, keywords) { + QSet indices; + foreach (const QHelpDataIndexItem &itm, keywords) { + + /* + * Identical ids make no sense and just confuse the Assistant user, + * so we ignore all repetitions. + */ + if (indices.contains(itm.identifier)) + continue; + indices.insert(itm.identifier); + pos = itm.reference.indexOf(QLatin1Char('#')); fileName = itm.reference.left(pos); if (pos > -1) @@ -753,7 +763,7 @@ bool QHelpGenerator::insertKeywords(const QList &keywords, d->query->exec(QLatin1String("COMMIT")); d->query->exec(QLatin1String("SELECT COUNT(Id) FROM IndexTable")); - if (d->query->next() && d->query->value(0).toInt() >= keywords.count()) + if (d->query->next() && d->query->value(0).toInt() >= indices.count()) return true; return false; } -- cgit v0.12