X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/2704b3693f86b31ac033597c63898c3aef16edf7..48b58f830a585b773435c9af5ee2fe8f0c7c641d:/src/dolphintabpage.cpp diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index e6440af5e..342d6f6de 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,17 +72,13 @@ bool DolphinTabPage::splitViewEnabled() const return m_splitViewEnabled; } -void DolphinTabPage::setSplitViewEnabled(bool enabled, bool stash /*= false*/) +void DolphinTabPage::setSplitViewEnabled(bool enabled, const QUrl &secondaryUrl) { if (m_splitViewEnabled != enabled) { m_splitViewEnabled = enabled; - QUrl url; + if (enabled) { - if (stash) { - url = QUrl("stash:/"); - } else { - url = m_primaryViewContainer->url(); - } + const QUrl& url = (secondaryUrl.isEmpty()) ? m_primaryViewContainer->url() : secondaryUrl; m_secondaryViewContainer = createViewContainer(url); const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible(); @@ -290,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();