diff options
author | megabigbug <megabigbug@arrakis.(none)> | 2010-03-29 23:20:37 +0200 |
---|---|---|
committer | megabigbug <megabigbug@arrakis.(none)> | 2010-03-29 23:20:37 +0200 |
commit | b1f39e13b1d2199b2f8a9bef3c213715a36dd146 (patch) | |
tree | dc82962c8d2325bcd6211fe14b2abfd72ab00c02 /src/bookmarks/bookmarksmanager.cpp | |
parent | detect if user type an url and order the results accordingly (diff) | |
download | rekonq-b1f39e13b1d2199b2f8a9bef3c213715a36dd146.tar.xz |
add title for bookmarks in the list
Diffstat (limited to 'src/bookmarks/bookmarksmanager.cpp')
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 89e39ef8..9c3201e6 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -294,7 +294,7 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark) } else { - m_completion->addItem(bookmark.url().path()); + m_completion->addItem(bookmark.url().url()); return new KBookmarkAction(bookmark, m_owner, this); } } @@ -309,3 +309,51 @@ KCompletion *BookmarkProvider::completionObject() const { return m_completion; } + + + + + +QString BookmarkProvider::titleForBookmarkUrl(QString url) +{ + QString title = ""; + KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup(); + if (bookGroup.isNull()) + { + return title; + } + + KBookmark bookmark = bookGroup.first(); + while (!bookmark.isNull() && title.isEmpty()) + { + title = titleForBookmarkUrl(bookmark, url); + bookmark = bookGroup.next(bookmark); + } + + return title; +} + + +QString BookmarkProvider::titleForBookmarkUrl(const KBookmark &bookmark, QString url) +{ + QString title = ""; + if (bookmark.isGroup()) + { + KBookmarkGroup group = bookmark.toGroup(); + KBookmark bm = group.first(); + while (!bm.isNull() && title.isEmpty()) + { + title = titleForBookmarkUrl(bm, url); // it is .bookfolder + bm = group.next(bm); + } + } + else if(!bookmark.isSeparator() && bookmark.url()==url) + { + title = bookmark.fullText(); + } + + return title; +} + + + |