diff options
author | Yoann Laissus <yoann.laissus@gmail.com> | 2011-11-26 16:43:12 +0100 |
---|---|---|
committer | Yoann Laissus <yoann.laissus@gmail.com> | 2011-11-26 16:43:12 +0100 |
commit | 68eb9a0e8d576d32276c47e1839b9490c10cb9d6 (patch) | |
tree | 2e172bea9c395bf8357413b6c293eaf100cb45cb /src/bookmarks | |
parent | Clean up webview contextual && tools menu (diff) | |
download | rekonq-68eb9a0e8d576d32276c47e1839b9490c10cb9d6.tar.xz |
GCI Task: Middle Click a Bookmark Folder to Open Folder in New Tabs
Made by Hüseyin Zengin, GCI student. Thanks !
REVIEW: 103206
REVIEWED-BY: me
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
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<QMouseEvent *>(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<KBookmarkActionInterface *>(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<KBookmarkActionInterface *>(toolBar()->actionAt(m_startDragPos)); + QPoint destPos = toolBar()->mapFromGlobal(QCursor::pos()); + int distance = (destPos - m_startDragPos).manhattanLength(); + KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(toolBar()->actionAt(destPos)); - if (action && action->bookmark().isGroup() && distance < QApplication::startDragDistance()) + if (action && action->bookmark().isGroup()) { - KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(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<KBookmarkActionMenu *>(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; |