diff options
-rw-r--r-- | src/bookmarks/bookmarkscontextmenu.cpp | 11 | ||||
-rw-r--r-- | src/bookmarks/bookmarkscontextmenu.h | 8 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 9 |
3 files changed, 19 insertions, 9 deletions
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 <KBookmarkManager> -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<KBookmarkActionInterface*>(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)); } |