summaryrefslogtreecommitdiff
path: root/src/bookmarks/bookmarkstoolbar.cpp
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2010-08-22 14:09:41 +0200
committerYoann Laissus <yoann.laissus@gmail.com>2010-08-22 14:09:41 +0200
commitc18a4bf0e5561ec97ef299a0992f267905021c66 (patch)
tree175dad967c505246892de49ca03bc3a6a7deacd8 /src/bookmarks/bookmarkstoolbar.cpp
parentrekonq 0.5.80 AKA 0.6 beta (diff)
downloadrekonq-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.cpp16
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);