diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-08-23 00:36:13 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-08-23 00:36:13 +0200 |
commit | 675dc346a698fecb60e65cf099ef123129a014a7 (patch) | |
tree | 531f4b65c62b409e0e438503072b969145467174 /src/bookmarks/bookmarkstoolbar.cpp | |
parent | Merge commit 'refs/merge-requests/189' of git://gitorious.org/rekonq/mainline... (diff) | |
parent | Useless include (diff) | |
download | rekonq-675dc346a698fecb60e65cf099ef123129a014a7.tar.xz |
Merge commit 'refs/merge-requests/190' of git://gitorious.org/rekonq/mainline into m190
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 68529bd1..ddb70a65 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -167,6 +167,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); @@ -190,6 +192,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); |