Fix bug 181560: allow New Tab to be available when no window is open; it will open a new window, following the pref for what to load in a new tab.

This commit is contained in:
smfr%smfr.org 2005-06-18 18:44:31 +00:00
Родитель 84bdddf2fa
Коммит 79fa335983
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -562,6 +562,18 @@ Otherwise, we return the URL we originally got. Right now this supports .url and
BrowserWindowController* browserController = [self getMainWindowBrowserController];
if (browserController)
[browserController newTab:aSender];
else
{
// follow the pref about what to load in a new tab (even though we're making a new window)
int newTabPage = [[PreferenceManager sharedInstance] getIntPref:"browser.tabs.startPage" withSuccess:NULL];
BOOL loadHomepage = (newTabPage == 1);
NSString* urlToLoad = @"about:blank";
if (loadHomepage)
urlToLoad = [[PreferenceManager sharedInstance] homePage:NO];
[self openBrowserWindowWithURL:urlToLoad andReferrer:nil behind:nil allowPopups:NO];
}
}
-(IBAction)closeTab:(id)aSender
@ -1243,10 +1255,7 @@ Otherwise, we return the URL we originally got. Right now this supports .url and
return (![browserController bookmarkManagerIsVisible]);
return NO;
}
if (action == @selector(newTab:))
return (browserController != nil);
// check if someone has previously done a find before allowing findAgain to be enabled
if (action == @selector(findAgain:) || action == @selector(findPrevious:))
return (browserController && [[browserController lastFindText] length] > 0);