X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/e7f6a1010ac07dfddaaa75a372dbeaa6d0352731..78c8b36dd84a94916835d702ea4a9e8eda65e8ef:/src/dolphintabpage.cpp?ds=sidebyside diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 9d239fdfc..a96c8b6a3 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -19,8 +19,8 @@ #include "dolphintabpage.h" -#include "dolphinviewcontainer.h" #include "dolphin_generalsettings.h" +#include "dolphinviewcontainer.h" #include #include @@ -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 /*= QUrl()*/) +void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; @@ -93,6 +94,7 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled, QUrl secondaryUrl /*= QUr // If the primary view is active, we have to swap the pointers // because the secondary view will be the new primary view. qSwap(m_primaryViewContainer, m_secondaryViewContainer); + m_primaryViewActive = false; } m_primaryViewContainer->setActive(true); view->close(); @@ -286,17 +288,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();