diff options
| author | Yoann Laissus <yoann.laissus@gmail.com> | 2011-11-26 16:46:54 +0100 | 
|---|---|---|
| committer | Yoann Laissus <yoann.laissus@gmail.com> | 2011-11-26 16:46:54 +0100 | 
| commit | 962bfaeaac33591f0337e217f8f3aa312a0304e3 (patch) | |
| tree | e2a3a30559213a309d752992347ce55edbb37c88 /src | |
| parent | remove unneeded include in websnap.cpp (diff) | |
| parent | GCI Task: Middle Click a Bookmark Folder to Open Folder in New Tabs (diff) | |
| download | rekonq-962bfaeaac33591f0337e217f8f3aa312a0304e3.tar.xz | |
Merge branch 'bkGroupMidClick'
Diffstat (limited to 'src')
| -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; | 
