diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp index 643c20ad26..9dc7430c68 100644 --- a/src/apps/webpositive/BrowserWindow.cpp +++ b/src/apps/webpositive/BrowserWindow.cpp @@ -1246,6 +1246,10 @@ BrowserWindow::LoadFinished(const BString& url, BWebView* view) NavigationCapabilitiesChanged(fBackButton->IsEnabled(), fForwardButton->IsEnabled(), false, view); + + int32 tabIndex = fTabManager->TabForView(view); + if (tabIndex > 0 && strcmp("New tab", fTabManager->TabLabel(tabIndex)) == 0) + fTabManager->SetTabLabel(tabIndex, url); } diff --git a/src/apps/webpositive/tabview/TabManager.cpp b/src/apps/webpositive/tabview/TabManager.cpp index 7ab8066436..3f364b652c 100644 --- a/src/apps/webpositive/tabview/TabManager.cpp +++ b/src/apps/webpositive/tabview/TabManager.cpp @@ -831,6 +831,15 @@ TabManager::SetTabLabel(int32 tabIndex, const char* label) fTabContainerView->SetTabLabel(tabIndex, label); } +const BString& +TabManager::TabLabel(int32 tabIndex) +{ + TabView* tab = fTabContainerView->TabAt(tabIndex); + if (tab) + return tab->Label(); + else + return ""; +} void TabManager::SetTabIcon(const BView* containedView, const BBitmap* icon) diff --git a/src/apps/webpositive/tabview/TabManager.h b/src/apps/webpositive/tabview/TabManager.h index 4ccc64d35e..97cd65c898 100644 --- a/src/apps/webpositive/tabview/TabManager.h +++ b/src/apps/webpositive/tabview/TabManager.h @@ -76,6 +76,7 @@ public: int32 CountTabs() const; void SetTabLabel(int32 tabIndex, const char* label); + const BString& TabLabel(int32); void SetTabIcon(const BView* containedView, const BBitmap* icon); void SetCloseButtonsAvailable(bool available);