Set the tab label to the URL if no title is provided in the HTML.

Fixes #6330.

And so I'm back on Web+ development. Yay.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@549 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
leavengood 2010-12-12 07:36:07 +00:00 committed by Alexandre Deckner
parent 26bc163200
commit 8c15e23385
3 changed files with 14 additions and 0 deletions

View File

@ -1246,6 +1246,10 @@ BrowserWindow::LoadFinished(const BString& url, BWebView* view)
NavigationCapabilitiesChanged(fBackButton->IsEnabled(), NavigationCapabilitiesChanged(fBackButton->IsEnabled(),
fForwardButton->IsEnabled(), false, view); fForwardButton->IsEnabled(), false, view);
int32 tabIndex = fTabManager->TabForView(view);
if (tabIndex > 0 && strcmp("New tab", fTabManager->TabLabel(tabIndex)) == 0)
fTabManager->SetTabLabel(tabIndex, url);
} }

View File

@ -831,6 +831,15 @@ TabManager::SetTabLabel(int32 tabIndex, const char* label)
fTabContainerView->SetTabLabel(tabIndex, label); fTabContainerView->SetTabLabel(tabIndex, label);
} }
const BString&
TabManager::TabLabel(int32 tabIndex)
{
TabView* tab = fTabContainerView->TabAt(tabIndex);
if (tab)
return tab->Label();
else
return "";
}
void void
TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon) TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon)

View File

@ -76,6 +76,7 @@ public:
int32 CountTabs() const; int32 CountTabs() const;
void SetTabLabel(int32 tabIndex, const char* label); void SetTabLabel(int32 tabIndex, const char* label);
const BString& TabLabel(int32);
void SetTabIcon(const BView* containedView, void SetTabIcon(const BView* containedView,
const BBitmap* icon); const BBitmap* icon);
void SetCloseButtonsAvailable(bool available); void SetCloseButtonsAvailable(bool available);