]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphintabpage.cpp
Merge branch 'Applications/17.12'
[dolphin.git] / src / dolphintabpage.cpp
index 0ed5fd2f276af0309e271c8a586e9303429f313d..1d3a6f08c91af5b26345ee5c5fd2e16e20787367 100644 (file)
@@ -28,7 +28,8 @@
 DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, QWidget* parent) :
     QWidget(parent),
     m_primaryViewActive(true),
-    m_splitViewEnabled(false)
+    m_splitViewEnabled(false),
+    m_active(true)
 {
     QVBoxLayout* layout = new QVBoxLayout(this);
     layout->setSpacing(0);
@@ -71,7 +72,7 @@ bool DolphinTabPage::splitViewEnabled() const
     return m_splitViewEnabled;
 }
 
-void DolphinTabPage::setSplitViewEnabled(bool enabled, QUrl secondaryUrl)
+void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl)
 {
     if (m_splitViewEnabled != enabled) {
         m_splitViewEnabled = enabled;
@@ -286,17 +287,31 @@ void DolphinTabPage::restoreStateV1(const QByteArray& state)
     m_splitter->restoreState(splitterState);
 }
 
+void DolphinTabPage::setActive(bool active)
+{
+    if (active) {
+        m_active = active;
+    } else {
+        // we should bypass changing active view in split mode
+        m_active = !m_splitViewEnabled;
+    }
+    // we want view to fire activated when goes from false to true
+    activeViewContainer()->setActive(active);
+}
+
 void DolphinTabPage::slotViewActivated()
 {
     const DolphinView* oldActiveView = activeViewContainer()->view();
 
     // Set the view, which was active before, to inactive
-    // and update the active view type.
-    if (m_splitViewEnabled) {
-        activeViewContainer()->setActive(false);
-        m_primaryViewActive = !m_primaryViewActive;
-    } else {
-        m_primaryViewActive = true;
+    // and update the active view type, if tab is active
+    if (m_active) {
+        if (m_splitViewEnabled) {
+            activeViewContainer()->setActive(false);
+            m_primaryViewActive = !m_primaryViewActive;
+        } else {
+            m_primaryViewActive = true;
+        }
     }
 
     const DolphinView* newActiveView = activeViewContainer()->view();