diff options
Diffstat (limited to 'src/bookmarks/bookmarksmanager.cpp')
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index b5c90616..d0062ae1 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -418,45 +418,44 @@ KBookmarkGroup BookmarkProvider::rootGroup() } -QString BookmarkProvider::titleForBookmarkUrl(QString url) +QList<KBookmark> BookmarkProvider::find(QString text) { - QString title = ""; + QList<KBookmark> list; KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); if (bookGroup.isNull()) { - return title; + return list; } - KBookmark bookmark = bookGroup.first(); - while (!bookmark.isNull() && title.isEmpty()) + KBookmark bookmark = bookGroup.first(); + while (!bookmark.isNull()) { - title = titleForBookmarkUrl(bookmark, url); + list = find(list, bookmark, text); bookmark = bookGroup.next(bookmark); } - return title; + return list; } -QString BookmarkProvider::titleForBookmarkUrl(const KBookmark &bookmark, QString url) +QList<KBookmark> BookmarkProvider::find(QList<KBookmark> list, const KBookmark &bookmark, QString text) { - QString title = ""; if (bookmark.isGroup()) { KBookmarkGroup group = bookmark.toGroup(); KBookmark bm = group.first(); - while (!bm.isNull() && title.isEmpty()) + while (!bm.isNull()) { - title = titleForBookmarkUrl(bm, url); // it is .bookfolder + list = find(list, bm, text); // it is .bookfolder bm = group.next(bm); } } - else if (!bookmark.isSeparator() && bookmark.url() == url) + else if (bookmark.url().url().contains(text) || bookmark.fullText().contains(text)) { - title = bookmark.fullText(); + list << bookmark; } - return title; + return list; } |