summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp38
-rw-r--r--src/bookmarks/bookmarksmanager.h5
2 files changed, 43 insertions, 0 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index d9612607..bba9dd77 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -593,3 +593,41 @@ void BookmarkProvider::slotPanelChanged()
panel->startLoadFoldedState();
}
}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
+{
+ KBookmark found;
+
+ KBookmarkGroup root = rootGroup();
+ if (root.isNull())
+ {
+ return found;
+ }
+
+ return bookmarkForUrl(root, url);
+}
+
+
+KBookmark BookmarkProvider::bookmarkForUrl(const KBookmark &bookmark, const KUrl &url)
+{
+ KBookmark found;
+
+ if (bookmark.isGroup())
+ {
+ KBookmarkGroup group = bookmark.toGroup();
+ KBookmark bookmark = group.first();
+
+ while (!bookmark.isNull() && found.isNull())
+ {
+ found = bookmarkForUrl(bookmark, url);
+ bookmark = group.next(bookmark);
+ }
+ }
+ else if (!bookmark.isSeparator() && bookmark.url() == url)
+ {
+ found = bookmark;
+ }
+
+ return found;
+}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 72ea1c3c..eeb5391d 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -271,6 +271,8 @@ public:
void registerBookmarkPanel(BookmarksPanel *panel);
void removeBookmarkPanel(BookmarksPanel *panel);
+ KBookmark bookmarkForUrl(const KUrl &url);
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -305,6 +307,9 @@ private slots:
private:
QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
+ QString titleForBookmarkUrl(const KBookmark &bookmark, const QString &url);
+ KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
+
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
KActionCollection *m_actionCollection;