]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphintabwidget.cpp
React on the redirection signal from DolphinView to properly update the tab and windo...
[dolphin.git] / src / dolphintabwidget.cpp
index 4bb70b4eab62a75151b1f07a9b509113583cd9f6..76d4b8d48d48b49a7d1f4585d53d95c3e667992b 100644 (file)
@@ -213,12 +213,7 @@ void DolphinTabWidget::closeTab(const int index)
     }
 
     DolphinTabPage* tabPage = tabPageAt(index);
-    if (tabPage->splitViewEnabled()) {
-        emit rememberClosedTab(tabPage->primaryViewContainer()->url(),
-                               tabPage->secondaryViewContainer()->url());
-    } else {
-        emit rememberClosedTab(tabPage->primaryViewContainer()->url(), KUrl());
-    }
+    emit rememberClosedTab(tabPage->activeViewContainer()->url(), tabPage->saveState());
 
     removeTab(index);
     tabPage->deleteLater();
@@ -249,6 +244,12 @@ void DolphinTabWidget::slotPlacesPanelVisibilityChanged(bool visible)
     }
 }
 
+void DolphinTabWidget::restoreClosedTab(const QByteArray& state)
+{
+    openNewActivatedTab();
+    currentTabPage()->restoreState(state);
+}
+
 void DolphinTabWidget::detachTab(int index)
 {
     Q_ASSERT(index >= 0);
@@ -294,12 +295,19 @@ void DolphinTabWidget::tabUrlChanged(const KUrl& url)
     if (index >= 0) {
         tabBar()->setTabText(index, tabName(url));
         tabBar()->setTabIcon(index, KIcon(KMimeType::iconNameForUrl(url)));
+
+        // Emit the currentUrlChanged signal if the url of the current tab has been changed.
+        if (index == currentIndex()) {
+            emit currentUrlChanged(url);
+        }
     }
 }
 
 void DolphinTabWidget::currentTabChanged(int index)
 {
-    emit activeViewChanged(tabPageAt(index)->activeViewContainer());
+    DolphinViewContainer* viewContainer = tabPageAt(index)->activeViewContainer();
+    emit activeViewChanged(viewContainer);
+    emit currentUrlChanged(viewContainer->url());
 }
 
 void DolphinTabWidget::tabInserted(int index)