mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
NavigationBar: Fix syncing back/forward buttons state with web history
BUG: 391331 FIXED-IN: 3.0.1
This commit is contained in:
parent
081ff20722
commit
dc131ddfee
@ -967,11 +967,6 @@ void BrowserWindow::toggleWebInspector()
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::refreshHistory()
|
||||
{
|
||||
m_navigationToolbar->refreshHistory();
|
||||
}
|
||||
|
||||
void BrowserWindow::currentTabChanged()
|
||||
{
|
||||
TabbedWebView* view = weView();
|
||||
|
@ -170,7 +170,6 @@ private Q_SLOTS:
|
||||
void loadSettings();
|
||||
void postLaunch();
|
||||
|
||||
void refreshHistory();
|
||||
void webSearch();
|
||||
void searchOnPage();
|
||||
void changeEncoding();
|
||||
|
@ -225,6 +225,24 @@ void NavigationBar::setCurrentView(TabbedWebView *view)
|
||||
data.button->setWebView(view);
|
||||
}
|
||||
}
|
||||
|
||||
if (!view) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto updateButton = [](ToolButton *button, QAction *action) {
|
||||
button->setEnabled(action->isEnabled());
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
void NavigationBar::showReloadButton()
|
||||
@ -431,7 +449,6 @@ void NavigationBar::clearHistory()
|
||||
{
|
||||
QWebEngineHistory* history = m_window->weView()->page()->history();
|
||||
history->clear();
|
||||
refreshHistory();
|
||||
}
|
||||
|
||||
void NavigationBar::contextMenuRequested(const QPoint &pos)
|
||||
@ -599,17 +616,6 @@ void NavigationBar::loadHistoryIndexInNewTab(int index)
|
||||
loadHistoryItemInNewTab(history->itemAt(index));
|
||||
}
|
||||
|
||||
void NavigationBar::refreshHistory()
|
||||
{
|
||||
if (mApp->isClosing() || !m_window->weView()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QWebEngineHistory* history = m_window->weView()->page()->history();
|
||||
m_buttonBack->setEnabled(history->canGoBack());
|
||||
m_buttonForward->setEnabled(history->canGoForward());
|
||||
}
|
||||
|
||||
void NavigationBar::stop()
|
||||
{
|
||||
m_window->action(QSL("View/Stop"))->trigger();
|
||||
@ -657,8 +663,6 @@ void NavigationBar::goForwardInNewTab()
|
||||
void NavigationBar::loadHistoryItem(const QWebEngineHistoryItem &item)
|
||||
{
|
||||
m_window->weView()->page()->history()->goToItem(item);
|
||||
|
||||
refreshHistory();
|
||||
}
|
||||
|
||||
void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item)
|
||||
|
@ -73,8 +73,6 @@ public:
|
||||
void removeToolButton(AbstractButtonInterface *button);
|
||||
|
||||
public Q_SLOTS:
|
||||
void refreshHistory();
|
||||
|
||||
void stop();
|
||||
void reload();
|
||||
void goBack();
|
||||
@ -114,6 +112,8 @@ private:
|
||||
Menu *m_menuTools;
|
||||
ToolButton* m_supMenu;
|
||||
ToolButton *m_exitFullscreen;
|
||||
QMetaObject::Connection m_backConnection;
|
||||
QMetaObject::Connection m_forwardConnection;
|
||||
|
||||
struct WidgetData {
|
||||
QString id;
|
||||
|
@ -93,7 +93,6 @@ TabWidget::TabWidget(BrowserWindow *window, QWidget *parent)
|
||||
m_tabBar = new TabBar(m_window, this);
|
||||
setTabBar(m_tabBar);
|
||||
|
||||
connect(this, SIGNAL(currentChanged(int)), m_window, SLOT(refreshHistory()));
|
||||
connect(this, &TabWidget::changed, mApp, &MainApplication::changeOccurred);
|
||||
connect(this, &TabStackedWidget::pinStateChanged, this, &TabWidget::changed);
|
||||
|
||||
|
@ -46,7 +46,6 @@ TabbedWebView::TabbedWebView(WebTab* webTab)
|
||||
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
|
||||
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
|
||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
|
||||
connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
|
||||
}
|
||||
|
||||
void TabbedWebView::setPage(WebPage* page)
|
||||
@ -84,15 +83,6 @@ QString TabbedWebView::getIp() const
|
||||
return m_currentIp;
|
||||
}
|
||||
|
||||
void TabbedWebView::urlChanged(const QUrl &url)
|
||||
{
|
||||
Q_UNUSED(url)
|
||||
|
||||
if (m_webTab->isCurrentTab() && m_window) {
|
||||
m_window->navigationBar()->refreshHistory();
|
||||
}
|
||||
}
|
||||
|
||||
void TabbedWebView::slotLoadProgress(int prog)
|
||||
{
|
||||
Q_UNUSED(prog)
|
||||
|
@ -67,7 +67,6 @@ private Q_SLOTS:
|
||||
void slotLoadStarted();
|
||||
void slotLoadFinished();
|
||||
void slotLoadProgress(int prog);
|
||||
void urlChanged(const QUrl &url);
|
||||
void linkHovered(const QString &link);
|
||||
void setIp(const QHostInfo &info);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user