mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56: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:
parent
0c7245fa9f
commit
01c5397fef
@ -417,6 +417,10 @@ void WebView::printPage()
|
|||||||
void WebView::slotLoadStarted()
|
void WebView::slotLoadStarted()
|
||||||
{
|
{
|
||||||
m_progress = 0;
|
m_progress = 0;
|
||||||
|
|
||||||
|
if (title(/*allowEmpty*/true).isEmpty()) {
|
||||||
|
emit titleChanged(title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::slotLoadProgress(int progress)
|
void WebView::slotLoadProgress(int progress)
|
||||||
@ -446,7 +450,13 @@ void WebView::slotIconChanged()
|
|||||||
|
|
||||||
void WebView::slotUrlChanged(const QUrl &url)
|
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
|
// Don't save blank page / speed dial in tab history
|
||||||
if (!history()->canGoForward() && history()->backItems(1).size() == 1) {
|
if (!history()->canGoForward() && history()->backItems(1).size() == 1) {
|
||||||
|
@ -170,7 +170,6 @@ WebTab::WebTab(QWidget *parent)
|
|||||||
nlayout->setSpacing(1);
|
nlayout->setSpacing(1);
|
||||||
|
|
||||||
connect(m_webView, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
|
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, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
|
||||||
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged);
|
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleWasChanged);
|
||||||
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged);
|
connect(m_webView, &TabbedWebView::titleChanged, this, &WebTab::titleChanged);
|
||||||
@ -558,13 +557,6 @@ void WebTab::showNotification(QWidget* notif)
|
|||||||
notif->show();
|
notif->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebTab::loadStarted()
|
|
||||||
{
|
|
||||||
if (m_tabBar && m_webView->title(/*allowEmpty*/true).isEmpty()) {
|
|
||||||
m_tabBar->setTabText(tabIndex(), tr("Loading..."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebTab::loadFinished()
|
void WebTab::loadFinished()
|
||||||
{
|
{
|
||||||
titleWasChanged(m_webView->title());
|
titleWasChanged(m_webView->title());
|
||||||
|
@ -118,7 +118,6 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showNotification(QWidget* notif);
|
void showNotification(QWidget* notif);
|
||||||
void loadStarted();
|
|
||||||
void loadFinished();
|
void loadFinished();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
Loading…
Reference in New Issue
Block a user