1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Show navigation in new tab in fullscreen mode (#2055)

This commit is contained in:
Vlad 2016-08-15 14:54:54 +03:00 committed by David Rosca
parent 74417d8f36
commit 8e12480dc9
3 changed files with 27 additions and 0 deletions

View File

@ -970,6 +970,10 @@ void BrowserWindow::removeActions(const QList<QAction *> &actions)
void BrowserWindow::addTab()
{
m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true);
m_tabWidget->setCurrentTabFresh(true);
if (isFullScreen())
showNavigationWithFullScreen();
}
void BrowserWindow::webSearch()
@ -1035,6 +1039,9 @@ void BrowserWindow::showNavigationWithFullScreen()
void BrowserWindow::hideNavigationWithFullScreen()
{
if (m_tabWidget->isCurrentTabFresh())
return;
if (!m_hideNavigationTimer->isActive()) {
m_hideNavigationTimer->start();
}

View File

@ -230,6 +230,16 @@ void TabWidget::updateClosedTabsButton()
m_buttonClosedTabs->setEnabled(canRestoreTab());
}
bool TabWidget::isCurrentTabFresh() const
{
return m_currentTabFresh;
}
void TabWidget::setCurrentTabFresh(bool currentTabFresh)
{
m_currentTabFresh = currentTabFresh;
}
void TabWidget::tabBarOverFlowChanged(bool overflowed)
{
// Show buttons inside tabbar
@ -324,6 +334,7 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
{
QUrl url = req.url();
m_lastTabIndex = currentIndex();
m_currentTabFresh = false;
if (url.isEmpty() && !(openFlags & Qz::NT_CleanTab)) {
url = m_urlOnNewTab;
@ -367,6 +378,10 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
connect(webTab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
connect(webTab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
connect(webTab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
connect(webTab->webView(), &WebView::urlChanged, this, [this](const QUrl &url) {
if (url != m_urlOnNewTab)
m_currentTabFresh = false;
});
if (url.isValid() && url != req.url()) {
LoadRequest r(req);
@ -489,6 +504,7 @@ void TabWidget::currentTabChanged(int index)
m_lastBackgroundTabIndex = -1;
m_lastTabIndex = index;
m_currentTabFresh = false;
WebTab* webTab = weTab(index);
LocationBar* locBar = webTab->locationBar();

View File

@ -93,6 +93,8 @@ public:
ClosedTabsManager* closedTabsManager() const;
QList<WebTab*> allTabs(bool withPinned = true);
bool canRestoreTab() const;
bool isCurrentTabFresh() const;
void setCurrentTabFresh(bool currentTabFresh);
QStackedWidget* locationBars() const;
ToolButton* buttonClosedTabs() const;
@ -164,6 +166,8 @@ private:
bool m_newTabAfterActive;
bool m_newEmptyTabAfterActive;
QUrl m_urlOnNewTab;
bool m_currentTabFresh;
};
#endif // TABWIDGET_H