diff options
| author | Akseli Lahtinen <[email protected]> | 2024-11-28 10:46:33 +0000 |
|---|---|---|
| committer | Akseli Lahtinen <[email protected]> | 2024-11-28 10:46:33 +0000 |
| commit | 6c7c04718b573ed9c382e289c361acbe6bd456b9 (patch) | |
| tree | be43b935696df109ea5d3373a19b00e8d83018f2 /src/dolphintabpage.cpp | |
| parent | 78cd13dd5e95910a5270da69ee776edb528a58b9 (diff) | |
DolphinTabPage: Update container view url on redirection
On url redirect, we should check which container url is being changed
and then update it accordingly. This makes sure the tab name is
updated.
We also should not disconnect redirection on view activation
since the redirection might be used by the other split.
The disconnection is done in `setSplitViewEnabled` instead.
This allows us to update the tab name every time the url changes,
even inside a splitview where the split which name is changed is
not active.
BUG:496414
Diffstat (limited to 'src/dolphintabpage.cpp')
| -rw-r--r-- | src/dolphintabpage.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 1aacf4351..dbc1ff147 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -45,6 +45,7 @@ DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, m_splitViewEnabled = true; const QUrl &url = secondaryUrl.isValid() ? secondaryUrl : primaryUrl; m_secondaryViewContainer = createViewContainer(url); + connect(m_secondaryViewContainer->view(), &DolphinView::redirection, this, &DolphinTabPage::slotViewUrlRedirection); m_splitter->addWidget(m_secondaryViewContainer); m_secondaryViewContainer->show(); } @@ -88,6 +89,7 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled, Animated animated, const secondaryNavigator = m_navigatorsWidget->secondaryUrlNavigator(); } m_secondaryViewContainer->connectUrlNavigator(secondaryNavigator); + connect(m_secondaryViewContainer->view(), &DolphinView::redirection, this, &DolphinTabPage::slotViewUrlRedirection); m_navigatorsWidget->setSecondaryNavigatorVisible(true); m_navigatorsWidget->followViewContainersGeometry(m_primaryViewContainer, m_secondaryViewContainer); @@ -104,6 +106,7 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled, Animated animated, const } else { m_navigatorsWidget->setSecondaryNavigatorVisible(false); m_secondaryViewContainer->disconnectUrlNavigator(); + disconnect(m_secondaryViewContainer->view(), &DolphinView::redirection, this, &DolphinTabPage::slotViewUrlRedirection); DolphinViewContainer *view; if (GeneralSettings::closeActiveSplitView()) { @@ -427,17 +430,24 @@ void DolphinTabPage::slotViewActivated() } disconnect(oldActiveView, &DolphinView::urlChanged, this, &DolphinTabPage::activeViewUrlChanged); - disconnect(oldActiveView, &DolphinView::redirection, this, &DolphinTabPage::slotViewUrlRedirection); connect(newActiveView, &DolphinView::urlChanged, this, &DolphinTabPage::activeViewUrlChanged); - connect(newActiveView, &DolphinView::redirection, this, &DolphinTabPage::slotViewUrlRedirection); Q_EMIT activeViewChanged(activeViewContainer()); Q_EMIT activeViewUrlChanged(activeViewContainer()->url()); } void DolphinTabPage::slotViewUrlRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - Q_UNUSED(oldUrl) - + // Make sure the url of the view is updated. BUG:496414 + if (splitViewEnabled()) { + if (primaryViewContainer()->view()->url() == oldUrl) { + primaryViewContainer()->view()->setUrl(newUrl); + } + if (secondaryViewContainer()->view()->url() == oldUrl) { + secondaryViewContainer()->view()->setUrl(newUrl); + } + } else { + activeViewContainer()->view()->setUrl(newUrl); + } Q_EMIT activeViewUrlChanged(newUrl); } |
