summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp54
-rw-r--r--src/bookmarks/bookmarksmanager.h2
2 files changed, 25 insertions, 31 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index df6bc54b..b3354c57 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -335,18 +335,8 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
{
if (bookmarkToolBar)
{
- KBookmarkGroup toolBarGroup = m_manager->toolbar();
- if (toolBarGroup.isNull())
- return;
-
bookmarkToolBar->clear();
-
- KBookmark bookmark = toolBarGroup.first();
- while (!bookmark.isNull())
- {
- bookmarkToolBar->addAction(fillBookmarkBar(bookmark));
- bookmark = toolBarGroup.next(bookmark);
- }
+ fillBookmarkBar(bookmarkToolBar);
}
}
}
@@ -393,28 +383,32 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
}
-KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark)
+void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar)
{
- if (bookmark.isGroup())
- {
- KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this);
- menuAction->setDelayed(false);
- new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address());
+ KBookmarkGroup root = m_manager->toolbar();
+ if(root.isNull())
+ return;
- return menuAction;
- }
-
- if(bookmark.isSeparator())
- {
- KAction *a = new KBookmarkAction(bookmark, m_owner, this);
- a->setText("");
- a->setIcon(QIcon());
- a->setSeparator(true);
- return a;
- }
- else
+ for(KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
{
- return new KBookmarkAction(bookmark, m_owner, this);
+ if (bookmark.isGroup())
+ {
+ KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this);
+ menuAction->setDelayed(false);
+ new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address());
+
+ toolBar->addAction(menuAction);
+ }
+
+ else if(bookmark.isSeparator())
+ {
+ toolBar->addSeparator();
+ }
+
+ else
+ {
+ toolBar->addAction(new KBookmarkAction(bookmark, m_owner, this));
+ }
}
}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 8d09e122..38726724 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -262,7 +262,7 @@ public slots:
private:
- KAction *fillBookmarkBar(const KBookmark &bookmark);
+ void fillBookmarkBar(KToolBar *toolBar);
QString titleForBookmarkUrl(const KBookmark &bookmark, QString url);
KBookmarkManager *m_manager;