From fcbe8fba1b0d197fb2711bdce5e01a2b7a3a8e56 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 23 Oct 2012 17:26:08 +0200 Subject: Fix tab titles managements on empty page titles --- src/tabwindow/tabwindow.cpp | 11 +++-------- src/webwindow/webwindow.cpp | 11 ++++++++++- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp index 99c4aa40..5b295981 100644 --- a/src/tabwindow/tabwindow.cpp +++ b/src/tabwindow/tabwindow.cpp @@ -262,9 +262,7 @@ void TabWindow::tabTitleChanged(const QString &title) if (!tab) return; - bool emptyTitle = title.isEmpty(); - - QString tabTitle = emptyTitle ? tab->url().url() : title; + QString tabTitle = title.isEmpty() ? tab->title() : title; tabTitle.replace('&', "&&"); int index = indexOf(tab); @@ -275,14 +273,11 @@ void TabWindow::tabTitleChanged(const QString &title) if (currentIndex() != index) { - if (!emptyTitle) - tabBar()->setTabHighlighted(index, true); + tabBar()->setTabHighlighted(index, true); } else { - emptyTitle - ? setWindowTitle(QL1S("rekonq")) - : setWindowTitle(tabTitle + QL1S(" - rekonq")); + setWindowTitle(tabTitle + QL1S(" - rekonq")); } } diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index 4c8f9dae..b38498d5 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -630,7 +630,16 @@ KUrl WebWindow::url() const QString WebWindow::title() const { - return _tab->view()->title(); + QString t = _tab->view()->title(); + if (t.isEmpty()) + { + if (url().isLocalFile()) + return url().fileName(); + else + return QL1S("rekonq"); + } + + return t; } -- cgit v1.2.1