From 8021b32b5288de901ec2c1defb3712211598925a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 24 Aug 2010 13:06:02 +0200 Subject: Awesome bar: support for multiple word search. Also support searches starting by i (without messing with the for urls) and page titles with characters such as '<' or '>'. --- src/bookmarks/bookmarkprovider.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/bookmarks/bookmarkprovider.cpp') diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index f07c5164..ec02ed31 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -253,9 +253,21 @@ void BookmarkProvider::find(QList *list, const KBookmark &bookmark, c for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm)) find(list, bm, text); } - else if (bookmark.url().url().contains(text) || bookmark.fullText().contains(text)) + else { - *list << bookmark; + QStringList words = text.split(" "); + bool matches = true; + foreach (const QString &word, words) + { + if (!bookmark.url().url().contains(word, Qt::CaseInsensitive) + && !bookmark.fullText().contains(word, Qt::CaseInsensitive)) + { + matches = false; + break; + } + } + if (matches) + *list << bookmark; } } -- cgit v1.2.1