From kde-commits Sun Apr 18 22:37:05 2010 From: Eike Hein Date: Sun, 18 Apr 2010 22:37:05 +0000 To: kde-commits Subject: extragear/utils/yakuake Message-Id: <20100418223705.60ACEAC89D () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127163008503472 SVN commit 1116239 by hein: Make tabs draggable and closeable my middle-mouse. Patch by Timur Antipin, thanks! M +3 -0 ChangeLog M +8 -5 app/tabbar.cpp --- trunk/extragear/utils/yakuake/ChangeLog #1116238:1116239 @@ -10,6 +10,9 @@ notification is now used for announcing that Yakuake was started success- fully, rather than the passive popup in the top-left desktop corner used with older versions of the KDE platform. +* Middle-clicking a tab closes it now, consistent with many other KDE apps. +* Tabs can now also be dragged using middle-mouse, again for consistency + with many other KDE apps. Changes in 2.9.6: --- trunk/extragear/utils/yakuake/app/tabbar.cpp #1116238:1116239 @@ -445,10 +445,10 @@ if (index == -1) return; - if (event->button() == Qt::LeftButton) + if (event->button() == Qt::LeftButton || event->button() == Qt::MidButton) { m_startPos = event->pos(); - if (index != m_tabs.indexOf(m_selectedSessionId)) + if (index != m_tabs.indexOf(m_selectedSessionId) || event->button() == Qt::MidButton) { m_mousePressed = true; m_mousePressedIndex = index; @@ -466,10 +466,13 @@ int index = tabAt(event->x()); - if (event->button() == Qt::LeftButton && index != m_tabs.indexOf(m_selectedSessionId)) + if (m_mousePressed && m_mousePressedIndex == index) { - if (m_mousePressed && m_mousePressedIndex == index) + if (event->button() == Qt::LeftButton && index != m_tabs.indexOf(m_selectedSessionId)) emit tabSelected(m_tabs.at(index)); + + if (event->button() == Qt::MidButton) + emit tabClosed(m_tabs.at(index)); } m_mousePressed = false; @@ -479,7 +482,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event) { - if (!m_startPos.isNull() && (event->buttons() & Qt::LeftButton)) + if (!m_startPos.isNull() && ((event->buttons() & Qt::LeftButton) || (event->buttons() & Qt::MidButton))) { int distance = (event->pos() - m_startPos).manhattanLength();