summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}