1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

NavigationBar: Correctly reconnect to page actions

BUG: 395828
FIXED-IN: 3.0.2
This commit is contained in:
David Rosca 2018-07-08 20:34:58 +02:00
parent 9fd53c75fa
commit 53e0a43762
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -230,19 +230,24 @@ void NavigationBar::setCurrentView(TabbedWebView *view)
return;
}
auto updateButton = [](ToolButton *button, QAction *action) {
button->setEnabled(action->isEnabled());
auto connectPageActions = [this](QWebEnginePage *page) {
auto updateButton = [](ToolButton *button, QAction *action) {
button->setEnabled(action->isEnabled());
};
auto updateBackButton = std::bind(updateButton, m_buttonBack, page->action(QWebEnginePage::Back));
auto updateForwardButton = std::bind(updateButton, m_buttonForward, page->action(QWebEnginePage::Forward));
updateBackButton();
updateForwardButton();
disconnect(m_backConnection);
disconnect(m_forwardConnection);
m_backConnection = connect(page->action(QWebEnginePage::Back), &QAction::changed, this, updateBackButton);
m_forwardConnection = connect(page->action(QWebEnginePage::Forward), &QAction::changed, this, updateForwardButton);
};
auto updateBackButton = std::bind(updateButton, m_buttonBack, view->pageAction(QWebEnginePage::Back));
auto updateForwardButton = std::bind(updateButton, m_buttonForward, view->pageAction(QWebEnginePage::Forward));
updateBackButton();
updateForwardButton();
disconnect(m_backConnection);
disconnect(m_forwardConnection);
m_backConnection = connect(view->pageAction(QWebEnginePage::Back), &QAction::changed, this, updateBackButton);
m_forwardConnection = connect(view->pageAction(QWebEnginePage::Forward), &QAction::changed, this, updateForwardButton);
connectPageActions(view->page());
connect(view, &TabbedWebView::pageChanged, this, connectPageActions);
}
void NavigationBar::showReloadButton()