From 090ce0fe679386a426df25b1f0702a002af3a2c0 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 23 Apr 2011 14:26:42 +0200 Subject: Null action for root bk folder in the bar --- src/bookmarks/bookmarkscontextmenu.cpp | 11 ++++++----- src/bookmarks/bookmarkscontextmenu.h | 8 ++++++-- src/bookmarks/bookmarkstoolbar.cpp | 9 +++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp index 25cb9f24..1def2592 100644 --- a/src/bookmarks/bookmarkscontextmenu.cpp +++ b/src/bookmarks/bookmarkscontextmenu.cpp @@ -36,9 +36,10 @@ #include -BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent) +BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, bool nullForced, QWidget *parent) : KBookmarkContextMenu(bookmark, manager, owner, parent) , m_bmOwner(owner) + , m_nullForced(nullForced) { } @@ -132,17 +133,17 @@ void BookmarksContextMenu::addNullActions() void BookmarksContextMenu::addActions() { - if (bookmark().isGroup()) + if (bookmark().isNull() || m_nullForced) { - addFolderActions(); + addNullActions(); } else if (bookmark().isSeparator()) { addSeparatorActions(); } - else if (bookmark().isNull()) + else if (bookmark().isGroup()) { - addNullActions(); + addFolderActions(); } else { diff --git a/src/bookmarks/bookmarkscontextmenu.h b/src/bookmarks/bookmarkscontextmenu.h index 416416ef..34ef66e0 100644 --- a/src/bookmarks/bookmarkscontextmenu.h +++ b/src/bookmarks/bookmarkscontextmenu.h @@ -36,8 +36,11 @@ class BookmarkOwner; class BookmarksContextMenu : public KBookmarkContextMenu { public: - BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent = 0); - + BookmarksContextMenu(const KBookmark &bookmark, + KBookmarkManager *manager, + BookmarkOwner *owner, + bool nullForced = false, + QWidget *parent = 0); virtual void addActions(); private: @@ -47,6 +50,7 @@ private: void addNullActions(); BookmarkOwner *m_bmOwner; + bool m_nullForced; }; #endif // BOOKMARKS_CONTEXT_MENU_H diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 57d56fff..1f1e38c3 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -189,13 +189,18 @@ KToolBar* BookmarkToolBar::toolBar() void BookmarkToolBar::contextMenu(const QPoint &point) { KBookmarkActionInterface *action = dynamic_cast(toolBar()->actionAt(point)); - KBookmark bookmark; + KBookmark bookmark = rApp->bookmarkProvider()->bookmarkManager()->toolbar(); + bool nullAction = true; if (action) + { bookmark = action->bookmark(); + nullAction = false; + } BookmarksContextMenu menu(bookmark, rApp->bookmarkProvider()->bookmarkManager(), - rApp->bookmarkProvider()->bookmarkOwner()); + rApp->bookmarkProvider()->bookmarkOwner(), + nullAction); menu.exec(toolBar()->mapToGlobal(point)); } -- cgit v1.2.1