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

Merge branch 'Falkon/3.0'

This commit is contained in:
David Rosca 2018-03-17 13:58:46 +01:00
commit f80b0bcbb5
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
7 changed files with 20 additions and 34 deletions

View File

@ -967,11 +967,6 @@ void BrowserWindow::toggleWebInspector()
} }
} }
void BrowserWindow::refreshHistory()
{
m_navigationToolbar->refreshHistory();
}
void BrowserWindow::currentTabChanged() void BrowserWindow::currentTabChanged()
{ {
TabbedWebView* view = weView(); TabbedWebView* view = weView();

View File

@ -170,7 +170,6 @@ private Q_SLOTS:
void loadSettings(); void loadSettings();
void postLaunch(); void postLaunch();
void refreshHistory();
void webSearch(); void webSearch();
void searchOnPage(); void searchOnPage();
void changeEncoding(); void changeEncoding();

View File

@ -225,6 +225,24 @@ void NavigationBar::setCurrentView(TabbedWebView *view)
data.button->setWebView(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() void NavigationBar::showReloadButton()
@ -431,7 +449,6 @@ void NavigationBar::clearHistory()
{ {
QWebEngineHistory* history = m_window->weView()->page()->history(); QWebEngineHistory* history = m_window->weView()->page()->history();
history->clear(); history->clear();
refreshHistory();
} }
void NavigationBar::contextMenuRequested(const QPoint &pos) void NavigationBar::contextMenuRequested(const QPoint &pos)
@ -599,17 +616,6 @@ void NavigationBar::loadHistoryIndexInNewTab(int index)
loadHistoryItemInNewTab(history->itemAt(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() void NavigationBar::stop()
{ {
m_window->action(QSL("View/Stop"))->trigger(); m_window->action(QSL("View/Stop"))->trigger();
@ -657,8 +663,6 @@ void NavigationBar::goForwardInNewTab()
void NavigationBar::loadHistoryItem(const QWebEngineHistoryItem &item) void NavigationBar::loadHistoryItem(const QWebEngineHistoryItem &item)
{ {
m_window->weView()->page()->history()->goToItem(item); m_window->weView()->page()->history()->goToItem(item);
refreshHistory();
} }
void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item) void NavigationBar::loadHistoryItemInNewTab(const QWebEngineHistoryItem &item)

View File

@ -73,8 +73,6 @@ public:
void removeToolButton(AbstractButtonInterface *button); void removeToolButton(AbstractButtonInterface *button);
public Q_SLOTS: public Q_SLOTS:
void refreshHistory();
void stop(); void stop();
void reload(); void reload();
void goBack(); void goBack();
@ -114,6 +112,8 @@ private:
Menu *m_menuTools; Menu *m_menuTools;
ToolButton* m_supMenu; ToolButton* m_supMenu;
ToolButton *m_exitFullscreen; ToolButton *m_exitFullscreen;
QMetaObject::Connection m_backConnection;
QMetaObject::Connection m_forwardConnection;
struct WidgetData { struct WidgetData {
QString id; QString id;

View File

@ -93,7 +93,6 @@ TabWidget::TabWidget(BrowserWindow *window, QWidget *parent)
m_tabBar = new TabBar(m_window, this); m_tabBar = new TabBar(m_window, this);
setTabBar(m_tabBar); setTabBar(m_tabBar);
connect(this, SIGNAL(currentChanged(int)), m_window, SLOT(refreshHistory()));
connect(this, &TabWidget::changed, mApp, &MainApplication::changeOccurred); connect(this, &TabWidget::changed, mApp, &MainApplication::changeOccurred);
connect(this, &TabStackedWidget::pinStateChanged, this, &TabWidget::changed); connect(this, &TabStackedWidget::pinStateChanged, this, &TabWidget::changed);

View File

@ -46,7 +46,6 @@ TabbedWebView::TabbedWebView(WebTab* webTab)
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
} }
void TabbedWebView::setPage(WebPage* page) void TabbedWebView::setPage(WebPage* page)
@ -84,15 +83,6 @@ QString TabbedWebView::getIp() const
return m_currentIp; 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) void TabbedWebView::slotLoadProgress(int prog)
{ {
Q_UNUSED(prog) Q_UNUSED(prog)

View File

@ -67,7 +67,6 @@ private Q_SLOTS:
void slotLoadStarted(); void slotLoadStarted();
void slotLoadFinished(); void slotLoadFinished();
void slotLoadProgress(int prog); void slotLoadProgress(int prog);
void urlChanged(const QUrl &url);
void linkHovered(const QString &link); void linkHovered(const QString &link);
void setIp(const QHostInfo &info); void setIp(const QHostInfo &info);