]> cloud.milkyroute.net Git - dolphin.git/commitdiff
The mouse wheel now works on Dolphin's tabs (to switch tabs), like just about every...
authorShaun Reich <shaun.reich@kdemail.net>
Thu, 29 Jan 2009 23:44:20 +0000 (23:44 +0000)
committerShaun Reich <shaun.reich@kdemail.net>
Thu, 29 Jan 2009 23:44:20 +0000 (23:44 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=918498

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index 70c28786929970fce6ef6947d6b13c5465046884..077005c0fe49df1ede96cd9b6a437933918ac4b1 100644 (file)
@@ -266,6 +266,18 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
     emit selectionChanged(selection);
 }
 
+void DolphinMainWindow::slotWheelMoved(int wheeldelta) 
+{
+    if (wheeldelta > 0)
+    {  
+       //Non-negative, wheel is going forwards, so the tab goes backwards (focuses left)
+       activatePrevTab();
+    } else
+    {  
+       activateNextTab();
+    }
+}
+
 void DolphinMainWindow::slotRequestItemInfo(const KFileItem& item)
 {
     emit requestItemInfo(item);
@@ -896,6 +908,9 @@ void DolphinMainWindow::init()
             this, SLOT(openNewTab()));
     connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
             this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
+    connect(m_tabBar, SIGNAL(wheelDelta(int)), 
+           this, SLOT(slotWheelMoved(int)));
+           
     m_tabBar->blockSignals(true);  // signals get unblocked after at least 2 tabs are open
 
     QWidget* centralWidget = new QWidget(this);
index d65a7acffae1e7ff1562d4ba2aafefd0e7808c76..f9eb5ccede3ed72ed5681709da278a20b03f1dcd 100644 (file)
@@ -282,6 +282,13 @@ private slots:
      */
     void slotSelectionChanged(const KFileItemList& selection);
 
+    /**
+     * Wheel event, receives it's degree of movement (int).
+     * we look to see if it's negative (backwards) or positive (forwards).
+     * Enables changing of tabs via mouse wheel.
+     */
+    void slotWheelMoved(int wheeldelta);
+
     /** Emits the signal requestItemInfo(). */
     void slotRequestItemInfo(const KFileItem&);
 
@@ -342,6 +349,7 @@ private slots:
      */
     void closeTab(int index);
 
+   
     /**
      * Opens a context menu for the tab with the index \a index
      * on the position \a pos.