summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegabigbug <megabigbug@arrakis.(none)>2010-03-29 23:20:37 +0200
committermegabigbug <megabigbug@arrakis.(none)>2010-03-29 23:20:37 +0200
commitb1f39e13b1d2199b2f8a9bef3c213715a36dd146 (patch)
treedc82962c8d2325bcd6211fe14b2abfd72ab00c02 /src
parentdetect if user type an url and order the results accordingly (diff)
downloadrekonq-b1f39e13b1d2199b2f8a9bef3c213715a36dd146.tar.xz
add title for bookmarks in the list
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp50
-rw-r--r--src/bookmarks/bookmarksmanager.h4
-rw-r--r--src/urlbar/urlresolver.cpp3
3 files changed, 55 insertions, 2 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;
+}
+
+
+
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 18ff3ef0..ace06e95 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -219,6 +219,8 @@ public:
*/
KCompletion *completionObject() const;
+ QString titleForBookmarkUrl(QString url);
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -245,8 +247,10 @@ public slots:
*/
void slotBookmarksChanged(const QString &group, const QString &caller);
+
private:
KAction *fillBookmarkBar(const KBookmark &bookmark);
+ QString titleForBookmarkUrl(const KBookmark &bookmark, QString url);
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 3f87b989..cb61ad95 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -195,9 +195,10 @@ UrlSearchList UrlResolver::bookmarksResolution()
QStringList bookmarkResults = bookmarkCompletion->substringCompletion(_urlString);
Q_FOREACH(const QString &s, bookmarkResults)
{
- UrlSearchItem it( s, QString(), QString("rating") );
+ UrlSearchItem it( s, Application::bookmarkProvider()->titleForBookmarkUrl(s), QString("rating") );
list << it;
}
+
return list;
}