diff options
author | ck <qt-info@nokia.com> | 2009-12-14 16:55:53 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2009-12-14 16:55:53 (GMT) |
commit | 91f03a835150984fb4a2accf1246327e3d82e1fe (patch) | |
tree | bc346c47f77ca4261126d74830908a8d7a92657d /tools/assistant | |
parent | bff37a821728615d5b1c766d1fbcb80bdccfb9fd (diff) | |
download | Qt-91f03a835150984fb4a2accf1246327e3d82e1fe.zip Qt-91f03a835150984fb4a2accf1246327e3d82e1fe.tar.gz Qt-91f03a835150984fb4a2accf1246327e3d82e1fe.tar.bz2 |
qhelpgenerator: Don't insert identical indices.
Reviewed-by: kh1
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/lib/qhelpgenerator.cpp | 14 |
1 files 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<QHelpDataIndexItem> &keywords, int i = 0; d->query->exec(QLatin1String("BEGIN")); - foreach (QHelpDataIndexItem itm, keywords) { + QSet<QString> 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<QHelpDataIndexItem> &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; } |