Abort updateWindowTitle and activeViewChanged if not changed.

Summary:
 - Prevent activeViewChanged from updating the window if the view is the same view (happens at least once when starting up)
 - Stop updateWindowTitle from updating the title if its not changed.

Reviewers: #dolphin, elvisangelaccio, broulik

Reviewed By: #dolphin, elvisangelaccio, broulik

Subscribers: anthonyfieroni, broulik, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D17882
This commit is contained in:
Chris Rizzitello 2019-01-13 20:55:07 -05:00
parent d23b842a14
commit 784734ca16
2 changed files with 14 additions and 10 deletions

View file

@ -1008,7 +1008,10 @@ void DolphinMainWindow::tabCountChanged(int count)
void DolphinMainWindow::updateWindowTitle()
{
setWindowTitle(m_activeViewContainer->caption());
const QString newTitle = m_activeViewContainer->caption();
if (windowTitle() != newTitle) {
setWindowTitle(newTitle);
}
}
void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)

View file

@ -320,17 +320,18 @@ void DolphinTabPage::slotViewActivated()
const DolphinView* newActiveView = activeViewContainer()->view();
if (newActiveView != oldActiveView) {
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);
if (newActiveView == oldActiveView) {
return;
}
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);
emit activeViewChanged(activeViewContainer());
emit activeViewUrlChanged(activeViewContainer()->url());
}