diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-01-28 15:58:37 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-01-28 15:58:37 +0100 |
commit | d467ccf90fb3e8c851db97c44f551aeaa9fa289f (patch) | |
tree | 3f5e572c43101d680d20abcd6ffaabb7a3248aa7 /src/bookmarks.cpp | |
parent | updated TODO (diff) | |
download | rekonq-d467ccf90fb3e8c851db97c44f551aeaa9fa289f.tar.xz |
New BookmarkBar!! 1st version, Yeah!!
Diffstat (limited to 'src/bookmarks.cpp')
-rw-r--r-- | src/bookmarks.cpp | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index a736e378..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,28 +56,52 @@ QString OwnBookMarks::currentTitle() const } -//--------------------------------------------------------------------------------------------------------------------- +// ------------------------------------------------------------------------------------------------------ -BookmarksMenu::BookmarksMenu(KMainWindow *parent, KBookmarkManager *manager) - : 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( manager , m_owner, this, m_ac ); } -//--------------------------------------------------------------------------------------------------------------------- - - -BookmarksLine::BookmarksLine(KBookmarkManager *manager, KToolBar *toolbar) +void BookmarksProvider::provideBmToolbar(KToolBar* toolbar) { - KBookmarkGroup toolbarGroup = manager->toolbar(); + toolbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); + KBookmarkGroup toolbarGroup = m_manager->toolbar(); KBookmark bm = toolbarGroup.first(); while(!bm.isNull()) { - // TODO append bm to toolbar + 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; +} + |