summaryrefslogtreecommitdiff
path: root/src/bookmarks/bookmarkstoolbar.cpp
diff options
context:
space:
mode:
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);