From 68eb9a0e8d576d32276c47e1839b9490c10cb9d6 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 26 Nov 2011 16:43:12 +0100 Subject: =?UTF-8?q?GCI=20Task:=20Middle=20Click=20a=20Bookmark=20Folder=20?= =?UTF-8?q?to=20Open=20Folder=20in=20New=20Tabs=20Made=20by=20H=C3=BCseyin?= =?UTF-8?q?=20Zengin,=20GCI=20student.=20Thanks=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REVIEW: 103206 REVIEWED-BY: me --- src/bookmarks/bookmarkstoolbar.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 23af65c2..5fc76561 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -506,7 +506,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) QMouseEvent *mouseEvent = static_cast(event); // These events need to be handled only for Bookmark actions and not the bar - if (watched != toolBar() && mouseEvent && mouseEvent->button() != Qt::MidButton) + if (watched != toolBar() && mouseEvent) { switch (event->type()) { @@ -515,7 +515,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) QPoint pos = toolBar()->mapFromGlobal(QCursor::pos()); KBookmarkActionInterface *action = dynamic_cast(toolBar()->actionAt(pos)); - if (action) + if (action && mouseEvent->button() != Qt::MidButton) { m_dragAction = toolBar()->actionAt(pos); m_startDragPos = pos; @@ -539,14 +539,22 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) case QEvent::MouseButtonRelease: { - int distance = (toolBar()->mapFromGlobal(QCursor::pos()) - m_startDragPos).manhattanLength(); - KBookmarkActionInterface *action = dynamic_cast(toolBar()->actionAt(m_startDragPos)); + QPoint destPos = toolBar()->mapFromGlobal(QCursor::pos()); + int distance = (destPos - m_startDragPos).manhattanLength(); + KBookmarkActionInterface *action = dynamic_cast(toolBar()->actionAt(destPos)); - if (action && action->bookmark().isGroup() && distance < QApplication::startDragDistance()) + if (action && action->bookmark().isGroup()) { - KBookmarkActionMenu *menu = dynamic_cast(toolBar()->actionAt(m_startDragPos)); - QPoint actionPos = toolBar()->mapToGlobal(toolBar()->widgetForAction(menu)->pos()); - menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + toolBar()->widgetForAction(menu)->height())); + if (mouseEvent->button() == Qt::MidButton) + { + rApp->bookmarkProvider()->bookmarkOwner()->openBookmarkFolder(action->bookmark()); + } + else if (distance < QApplication::startDragDistance()) + { + KBookmarkActionMenu *menu = dynamic_cast(toolBar()->actionAt(m_startDragPos)); + QPoint actionPos = toolBar()->mapToGlobal(toolBar()->widgetForAction(menu)->pos()); + menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + toolBar()->widgetForAction(menu)->height())); + } } } break; -- cgit v1.2.1