1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +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 648090d167
commit 9ae6c12a3c
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() void BrowserWindow::addTab()
{ {
m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true); m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true);
m_tabWidget->setCurrentTabFresh(true);
if (isFullScreen())
showNavigationWithFullScreen();
} }
void BrowserWindow::webSearch() void BrowserWindow::webSearch()
@ -1035,6 +1039,9 @@ void BrowserWindow::showNavigationWithFullScreen()
void BrowserWindow::hideNavigationWithFullScreen() void BrowserWindow::hideNavigationWithFullScreen()
{ {
if (m_tabWidget->isCurrentTabFresh())
return;
if (!m_hideNavigationTimer->isActive()) { if (!m_hideNavigationTimer->isActive()) {
m_hideNavigationTimer->start(); m_hideNavigationTimer->start();
} }

View File

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

View File

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