diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:38:36 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-02-15 15:38:36 +0100 |
commit | 93562769c23827a1a6ddec63816ac7edbdeb98f6 (patch) | |
tree | 15d226ee3dae2da99eef768461e4e239d874be1b /src/bookmarks.cpp | |
parent | BrowserApplication --> Application (diff) | |
parent | Preliminary flash support (diff) | |
download | rekonq-93562769c23827a1a6ddec63816ac7edbdeb98f6.tar.xz |
Merge branch 'master' into mainwindow
Diffstat (limited to 'src/bookmarks.cpp')
-rw-r--r-- | src/bookmarks.cpp | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index 3cb65e38..584b2689 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -26,6 +26,7 @@ // KDE Includes #include <KMimeType> +#include <KMenu> OwnBookMarks::OwnBookMarks(KMainWindow *parent) : QObject(parent) @@ -55,17 +56,52 @@ QString OwnBookMarks::currentTitle() const } -//--------------------------------------------------------------------------------------------------------------------- +// ------------------------------------------------------------------------------------------------------ -BookmarksMenu::BookmarksMenu(KMainWindow *parent) - : KMenu(parent) - , m_owner( new OwnBookMarks( parent ) ) +BookmarksProvider::BookmarksProvider(KMainWindow* parent) + : m_parent(parent) + , m_owner(new OwnBookMarks(parent)) { KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() ); - m_ac = new KActionCollection( this ); +} + - m_menu = new KBookmarkMenu( m_manager , m_owner, this, m_ac ); +void BookmarksProvider::provideBmToolbar(KToolBar* toolbar) +{ + toolbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); + KBookmarkGroup toolbarGroup = m_manager->toolbar(); + KBookmark bm = toolbarGroup.first(); + while(!bm.isNull()) + { + if(bm.isGroup()) + { + // do nothing! + } + else + { + if(bm.isSeparator()) + { + toolbar->addSeparator(); + } + else + { + KAction *a = new KBookmarkAction(bm, m_owner, m_ac); + toolbar->addAction(a); + } + } + // go ahead! + bm = toolbarGroup.next(bm); + } } + + +KMenu *BookmarksProvider::bookmarksMenu() +{ + KMenu *bmMenu = new KMenu(m_parent); + new KBookmarkMenu( m_manager, m_owner, bmMenu, m_ac ); + return bmMenu; +} + |