Web+: avoid empty tab title

Use file name, if no title is provided by the page

Fixes #13663
This commit is contained in:
Adrien Destugues 2017-08-15 10:34:35 +02:00
parent acad802d56
commit 43d60df2b0

View File

@ -1798,7 +1798,20 @@ BrowserWindow::AuthenticationChallenge(BString message, BString& inOutUser,
void
BrowserWindow::_UpdateTitle(const BString& title)
{
BString windowTitle = title;
BString windowTitle;
if (title.Length() > 0)
windowTitle = title;
else {
BWebView* webView = CurrentWebView();
if (webView != NULL) {
BString url = webView->MainFrameURL();
int32 leafPos = url.FindLast('/');
url.Remove(0, leafPos + 1);
windowTitle = url;
}
}
if (windowTitle.Length() > 0)
windowTitle << " - ";
windowTitle << kApplicationName;