1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

WebTab: Don't set "Loading..." tab text

Instead improve page title from url when title is empty
This commit is contained in:
David Rosca 2018-02-01 21:19:34 +01:00
parent 0c7245fa9f
commit 01c5397fef
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 11 additions and 10 deletions

View File

@ -417,6 +417,10 @@ void WebView::printPage()
void WebView::slotLoadStarted()
{
m_progress = 0;
if (title(/*allowEmpty*/true).isEmpty()) {
emit titleChanged(title());
}
}
void WebView::slotLoadProgress(int progress)
@ -446,7 +450,13 @@ void WebView::slotIconChanged()
void WebView::slotUrlChanged(const QUrl &url)
{
Q_UNUSED(url)
if (!url.isEmpty() && title(/*allowEmpty*/true).isEmpty()) {
// Don't treat this as background activity change
const bool oldActivity = m_backgroundActivity;
m_backgroundActivity = true;
emit titleChanged(title());
m_backgroundActivity = oldActivity;
}
// Don't save blank page / speed dial in tab history
if (!history()->canGoForward() && history()->backItems(1).size() == 1) {

View File

@ -170,7 +170,6 @@ WebTab::WebTab(QWidget *parent)
nlayout->setSpacing(1);
connect(m_webView, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
connect(m_webView, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged);
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged);
@ -558,13 +557,6 @@ void WebTab::showNotification(QWidget* notif)
notif->show();
}
void WebTab::loadStarted()
{
if (m_tabBar && m_webView->title(/*allowEmpty*/true).isEmpty()) {
m_tabBar->setTabText(tabIndex(), tr("Loading..."));
}
}
void WebTab::loadFinished()
{
titleWasChanged(m_webView->title());

View File

@ -118,7 +118,6 @@ public:
private slots:
void showNotification(QWidget* notif);
void loadStarted();
void loadFinished();
signals: