]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Make Qt 4.5's new "move tab" feature work in Dolphin. Up to now, tabs could be moved...
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 15 Apr 2009 21:50:50 +0000 (21:50 +0000)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 15 Apr 2009 21:50:50 +0000 (21:50 +0000)
Note that there's no need to call setActiveTab() because the active tab is the same before and after the move operation - only its index in the tab bar has changed.

BUG: 189641

svn path=/trunk/KDE/kdebase/apps/; revision=954556

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h

index e60d7662e5486e80443e3fbed7424c2f95b78b64..ba3ae27873ea1acd256b0ad6168dc750fc211e06 100644 (file)
@@ -960,6 +960,12 @@ void DolphinMainWindow::searchItems(const KUrl& url)
     m_activeViewContainer->setUrl(url);
 }
 
+void DolphinMainWindow::slotTabMoved(int from, int to)
+{
+    m_viewTab.move(from, to);
+    m_tabIndex = m_tabBar->currentIndex();
+}
+
 void DolphinMainWindow::init()
 {
     DolphinSettings& settings = DolphinSettings::instance();
@@ -1016,6 +1022,8 @@ void DolphinMainWindow::init()
            this, SLOT(slotWheelMoved(int)));
     connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
             this, SLOT(closeTab(int)));
+    connect(m_tabBar, SIGNAL(tabMoved(int, int)),
+            this, SLOT(slotTabMoved(int, int)));
 
     m_tabBar->blockSignals(true);  // signals get unblocked after at least 2 tabs are open
 
index 687eecddfefdf9eccc1333eb5d6b88ec4c68b739..5e1d27476bc1c10af8f1461f42f18046b93a2122 100644 (file)
@@ -375,6 +375,13 @@ private slots:
      */
     void searchItems(const KUrl& url);
 
+    /**
+     * Is connected to the QTabBar signal tabMoved(int from, int to).
+     * Reorders the list of tabs after a tab was moved in the tab bar
+     * and sets m_tabIndex to the new index of the current tab.
+     */
+    void slotTabMoved(int from, int to);
+
 private:
     DolphinMainWindow(int id);
     void init();