diff options
author | Yoann Laissus <yoann.laissus@gmail.com> | 2010-08-22 14:09:41 +0200 |
---|---|---|
committer | Yoann Laissus <yoann.laissus@gmail.com> | 2010-08-22 14:09:41 +0200 |
commit | c18a4bf0e5561ec97ef299a0992f267905021c66 (patch) | |
tree | 175dad967c505246892de49ca03bc3a6a7deacd8 /src/bookmarks/bookmarkstoolbar.cpp | |
parent | rekonq 0.5.80 AKA 0.6 beta (diff) | |
download | rekonq-c18a4bf0e5561ec97ef299a0992f267905021c66.tar.xz |
- Move the BK bar context menu slot and connection to BookmarkContextMenu
- The context menu now works without selected bookmark in the BK bar
Diffstat (limited to 'src/bookmarks/bookmarkstoolbar.cpp')
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 64e9c3b9..bc307965 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -166,6 +166,8 @@ BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent) , m_dropAction(0) , m_filled(false) { + toolBar->setContextMenuPolicy(Qt::CustomContextMenu); + connect(toolBar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &))); connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu())); toolBar->setAcceptDrops(true); toolBar->installEventFilter(this); @@ -189,6 +191,20 @@ KToolBar* BookmarkToolBar::toolBar() } +void BookmarkToolBar::contextMenu(const QPoint &point) +{ + KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface*>(toolBar()->actionAt(point)); + KBookmark bookmark; + if (action) + bookmark = action->bookmark(); + + BookmarksContextMenu menu(bookmark, + Application::bookmarkProvider()->bookmarkManager(), + Application::bookmarkProvider()->bookmarkOwner()); + menu.exec(toolBar()->mapToGlobal(point)); +} + + void BookmarkToolBar::menuDisplayed() { qApp->installEventFilter(this); |