diff --git a/camino/BookmarksService.mm b/camino/BookmarksService.mm index b28551259a3..75d3374cd0d 100644 --- a/camino/BookmarksService.mm +++ b/camino/BookmarksService.mm @@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder) // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [aTabView addTabViewItem: tabViewItem]; } diff --git a/camino/BrowserWindowController.h b/camino/BrowserWindowController.h index 06393dfc8a1..1722c2fa4ce 100644 --- a/camino/BrowserWindowController.h +++ b/camino/BrowserWindowController.h @@ -128,6 +128,7 @@ class nsIDOMNode; NSModalSession mModalSession; BOOL mShouldAutosave; + BOOL mShouldLoadHomePage; BOOL mDrawerCachedFrame; NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should @@ -196,7 +197,7 @@ class nsIDOMNode; - (void)importBookmarks: (NSString*)aURLSpec; - (IBAction)toggleSidebar:(id)aSender; -- (void)newTab; +- (void)newTab:(BOOL)allowHomepage; - (void)closeTab; - (void)previousTab; - (void)nextTab; @@ -215,6 +216,7 @@ class nsIDOMNode; -(void)autosaveWindowFrame; -(void)disableAutosave; +-(void)disableLoadPage; -(void)setChromeMask:(unsigned int)aMask; -(unsigned int)chromeMask; diff --git a/camino/BrowserWindowController.mm b/camino/BrowserWindowController.mm index 82dcd31b838..8862d611b6f 100644 --- a/camino/BrowserWindowController.mm +++ b/camino/BrowserWindowController.mm @@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil; mInitialized = NO; mMoveReentrant = NO; mShouldAutosave = YES; + mShouldLoadHomePage = YES; mChromeMask = 0; mContextMenuFlags = 0; mContextMenuEvent = nsnull; @@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil; mShouldAutosave = NO; } +-(void)disableLoadPage +{ + mShouldLoadHomePage = NO; +} + - (void)windowWillClose:(NSNotification *)notification { printf("Window will close notification.\n"); @@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil; // We now remove the IB tab, then add one of our own. [mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]]; - [self newTab]; + [self newTab:mShouldLoadHomePage]; if (mURL) { - [self loadURL: mURL]; + if (mShouldLoadHomePage) + [self loadURL: mURL]; [mURL release]; } @@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil; [[self window] display]; } --(void)newTab +-(void)newTab:(BOOL)allowHomepage { - PRInt32 newTabPage = 0; - nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); - pref->GetIntPref("browser.tabs.startPage", &newTabPage); - NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; - [newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")]; + PRInt32 newTabPage = 0; + if (allowHomepage) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + pref->GetIntPref("browser.tabs.startPage", &newTabPage); + } + + [newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))]; [newTab setView: newView]; [mTabBrowser addTabViewItem: newTab]; - [[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; + if (allowHomepage) + [[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; [mTabBrowser selectLastTabViewItem: self]; @@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; [newView setTab: newTab]; - [newTab setLabel: @"Loading..."]; + [newTab setLabel: NSLocalizedString(@"TabLoading", @"")]; [newTab setView: newView]; [[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone]; diff --git a/camino/CHBrowserWrapper.mm b/camino/CHBrowserWrapper.mm index 492a31fbc2d..5a09c23743d 100644 --- a/camino/CHBrowserWrapper.mm +++ b/camino/CHBrowserWrapper.mm @@ -56,7 +56,6 @@ #include "nsIWebProgressListener.h" #define DOCUMENT_DONE_STRING @"Document: Done" -#define LOADING_STRING @"Loading..." static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; @@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; [progress setIndeterminate:YES]; [progress startAnimation:self]; - loadingStatus = LOADING_STRING; + loadingStatus = NSLocalizedString(@"TabLoading", @""); [status setStringValue:loadingStatus]; mIsBusy = YES; - [mTab setLabel: LOADING_STRING]; + [mTab setLabel: NSLocalizedString(@"TabLoading", @"")]; if (mWindowController) { [mWindowController updateToolbarItems]; @@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; } else { if (!title || [title isEqualToString:@""]) - title = [NSString stringWithString:@"Untitled"]; + title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")]; mTitle = [title retain]; } if ( mIsPrimary ) @@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; if (title && ![title isEqualToString:@""]) [mTab setLabel:title]; else - [mTab setLabel:@"Untitled"]; + [mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")]; } // @@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"]; [controller setChromeMask: aMask]; [controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings. + [controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window [controller enterModalSession]; [[[controller getBrowserWrapper] getBrowserView] setActive: YES]; return [[controller getBrowserWrapper] getBrowserView]; diff --git a/camino/CHExtendedTabView.mm b/camino/CHExtendedTabView.mm index 672c6367433..9e47097b789 100644 --- a/camino/CHExtendedTabView.mm +++ b/camino/CHExtendedTabView.mm @@ -207,7 +207,7 @@ // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [self window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [self addTabViewItem: tabViewItem]; diff --git a/camino/English.lproj/Localizable.strings b/camino/English.lproj/Localizable.strings index 3b56396868d..b189e41294b 100644 Binary files a/camino/English.lproj/Localizable.strings and b/camino/English.lproj/Localizable.strings differ diff --git a/camino/MainController.mm b/camino/MainController.mm index c0bb133e1f1..c05da5c39d4 100644 --- a/camino/MainController.mm +++ b/camino/MainController.mm @@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; -(IBAction)newTab:(id)aSender { - [[[mApplication mainWindow] windowController] newTab]; + [[[mApplication mainWindow] windowController] newTab:YES]; } -(IBAction)closeTab:(id)aSender diff --git a/camino/resources/localized/English.lproj/Localizable.strings b/camino/resources/localized/English.lproj/Localizable.strings index 3b56396868d..b189e41294b 100644 Binary files a/camino/resources/localized/English.lproj/Localizable.strings and b/camino/resources/localized/English.lproj/Localizable.strings differ diff --git a/camino/src/application/MainController.mm b/camino/src/application/MainController.mm index c0bb133e1f1..c05da5c39d4 100644 --- a/camino/src/application/MainController.mm +++ b/camino/src/application/MainController.mm @@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; -(IBAction)newTab:(id)aSender { - [[[mApplication mainWindow] windowController] newTab]; + [[[mApplication mainWindow] windowController] newTab:YES]; } -(IBAction)closeTab:(id)aSender diff --git a/camino/src/bookmarks/BookmarksService.mm b/camino/src/bookmarks/BookmarksService.mm index b28551259a3..75d3374cd0d 100644 --- a/camino/src/bookmarks/BookmarksService.mm +++ b/camino/src/bookmarks/BookmarksService.mm @@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder) // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [aTabView addTabViewItem: tabViewItem]; } diff --git a/camino/src/browser/BrowserWindowController.h b/camino/src/browser/BrowserWindowController.h index 06393dfc8a1..1722c2fa4ce 100644 --- a/camino/src/browser/BrowserWindowController.h +++ b/camino/src/browser/BrowserWindowController.h @@ -128,6 +128,7 @@ class nsIDOMNode; NSModalSession mModalSession; BOOL mShouldAutosave; + BOOL mShouldLoadHomePage; BOOL mDrawerCachedFrame; NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should @@ -196,7 +197,7 @@ class nsIDOMNode; - (void)importBookmarks: (NSString*)aURLSpec; - (IBAction)toggleSidebar:(id)aSender; -- (void)newTab; +- (void)newTab:(BOOL)allowHomepage; - (void)closeTab; - (void)previousTab; - (void)nextTab; @@ -215,6 +216,7 @@ class nsIDOMNode; -(void)autosaveWindowFrame; -(void)disableAutosave; +-(void)disableLoadPage; -(void)setChromeMask:(unsigned int)aMask; -(unsigned int)chromeMask; diff --git a/camino/src/browser/BrowserWindowController.mm b/camino/src/browser/BrowserWindowController.mm index 82dcd31b838..8862d611b6f 100644 --- a/camino/src/browser/BrowserWindowController.mm +++ b/camino/src/browser/BrowserWindowController.mm @@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil; mInitialized = NO; mMoveReentrant = NO; mShouldAutosave = YES; + mShouldLoadHomePage = YES; mChromeMask = 0; mContextMenuFlags = 0; mContextMenuEvent = nsnull; @@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil; mShouldAutosave = NO; } +-(void)disableLoadPage +{ + mShouldLoadHomePage = NO; +} + - (void)windowWillClose:(NSNotification *)notification { printf("Window will close notification.\n"); @@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil; // We now remove the IB tab, then add one of our own. [mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]]; - [self newTab]; + [self newTab:mShouldLoadHomePage]; if (mURL) { - [self loadURL: mURL]; + if (mShouldLoadHomePage) + [self loadURL: mURL]; [mURL release]; } @@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil; [[self window] display]; } --(void)newTab +-(void)newTab:(BOOL)allowHomepage { - PRInt32 newTabPage = 0; - nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); - pref->GetIntPref("browser.tabs.startPage", &newTabPage); - NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; - [newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")]; + PRInt32 newTabPage = 0; + if (allowHomepage) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + pref->GetIntPref("browser.tabs.startPage", &newTabPage); + } + + [newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))]; [newTab setView: newView]; [mTabBrowser addTabViewItem: newTab]; - [[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; + if (allowHomepage) + [[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; [mTabBrowser selectLastTabViewItem: self]; @@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; [newView setTab: newTab]; - [newTab setLabel: @"Loading..."]; + [newTab setLabel: NSLocalizedString(@"TabLoading", @"")]; [newTab setView: newView]; [[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone]; diff --git a/camino/src/browser/BrowserWrapper.mm b/camino/src/browser/BrowserWrapper.mm index 492a31fbc2d..5a09c23743d 100644 --- a/camino/src/browser/BrowserWrapper.mm +++ b/camino/src/browser/BrowserWrapper.mm @@ -56,7 +56,6 @@ #include "nsIWebProgressListener.h" #define DOCUMENT_DONE_STRING @"Document: Done" -#define LOADING_STRING @"Loading..." static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; @@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; [progress setIndeterminate:YES]; [progress startAnimation:self]; - loadingStatus = LOADING_STRING; + loadingStatus = NSLocalizedString(@"TabLoading", @""); [status setStringValue:loadingStatus]; mIsBusy = YES; - [mTab setLabel: LOADING_STRING]; + [mTab setLabel: NSLocalizedString(@"TabLoading", @"")]; if (mWindowController) { [mWindowController updateToolbarItems]; @@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; } else { if (!title || [title isEqualToString:@""]) - title = [NSString stringWithString:@"Untitled"]; + title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")]; mTitle = [title retain]; } if ( mIsPrimary ) @@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; if (title && ![title isEqualToString:@""]) [mTab setLabel:title]; else - [mTab setLabel:@"Untitled"]; + [mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")]; } // @@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"]; [controller setChromeMask: aMask]; [controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings. + [controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window [controller enterModalSession]; [[[controller getBrowserWrapper] getBrowserView] setActive: YES]; return [[controller getBrowserWrapper] getBrowserView]; diff --git a/chimera/BookmarksService.mm b/chimera/BookmarksService.mm index b28551259a3..75d3374cd0d 100644 --- a/chimera/BookmarksService.mm +++ b/chimera/BookmarksService.mm @@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder) // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [aTabView addTabViewItem: tabViewItem]; } diff --git a/chimera/BrowserWindowController.h b/chimera/BrowserWindowController.h index 06393dfc8a1..1722c2fa4ce 100644 --- a/chimera/BrowserWindowController.h +++ b/chimera/BrowserWindowController.h @@ -128,6 +128,7 @@ class nsIDOMNode; NSModalSession mModalSession; BOOL mShouldAutosave; + BOOL mShouldLoadHomePage; BOOL mDrawerCachedFrame; NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should @@ -196,7 +197,7 @@ class nsIDOMNode; - (void)importBookmarks: (NSString*)aURLSpec; - (IBAction)toggleSidebar:(id)aSender; -- (void)newTab; +- (void)newTab:(BOOL)allowHomepage; - (void)closeTab; - (void)previousTab; - (void)nextTab; @@ -215,6 +216,7 @@ class nsIDOMNode; -(void)autosaveWindowFrame; -(void)disableAutosave; +-(void)disableLoadPage; -(void)setChromeMask:(unsigned int)aMask; -(unsigned int)chromeMask; diff --git a/chimera/BrowserWindowController.mm b/chimera/BrowserWindowController.mm index 82dcd31b838..8862d611b6f 100644 --- a/chimera/BrowserWindowController.mm +++ b/chimera/BrowserWindowController.mm @@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil; mInitialized = NO; mMoveReentrant = NO; mShouldAutosave = YES; + mShouldLoadHomePage = YES; mChromeMask = 0; mContextMenuFlags = 0; mContextMenuEvent = nsnull; @@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil; mShouldAutosave = NO; } +-(void)disableLoadPage +{ + mShouldLoadHomePage = NO; +} + - (void)windowWillClose:(NSNotification *)notification { printf("Window will close notification.\n"); @@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil; // We now remove the IB tab, then add one of our own. [mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]]; - [self newTab]; + [self newTab:mShouldLoadHomePage]; if (mURL) { - [self loadURL: mURL]; + if (mShouldLoadHomePage) + [self loadURL: mURL]; [mURL release]; } @@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil; [[self window] display]; } --(void)newTab +-(void)newTab:(BOOL)allowHomepage { - PRInt32 newTabPage = 0; - nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); - pref->GetIntPref("browser.tabs.startPage", &newTabPage); - NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; - [newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")]; + PRInt32 newTabPage = 0; + if (allowHomepage) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + pref->GetIntPref("browser.tabs.startPage", &newTabPage); + } + + [newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))]; [newTab setView: newView]; [mTabBrowser addTabViewItem: newTab]; - [[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; + if (allowHomepage) + [[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; [mTabBrowser selectLastTabViewItem: self]; @@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; [newView setTab: newTab]; - [newTab setLabel: @"Loading..."]; + [newTab setLabel: NSLocalizedString(@"TabLoading", @"")]; [newTab setView: newView]; [[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone]; diff --git a/chimera/CHBrowserWrapper.mm b/chimera/CHBrowserWrapper.mm index 492a31fbc2d..5a09c23743d 100644 --- a/chimera/CHBrowserWrapper.mm +++ b/chimera/CHBrowserWrapper.mm @@ -56,7 +56,6 @@ #include "nsIWebProgressListener.h" #define DOCUMENT_DONE_STRING @"Document: Done" -#define LOADING_STRING @"Loading..." static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; @@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; [progress setIndeterminate:YES]; [progress startAnimation:self]; - loadingStatus = LOADING_STRING; + loadingStatus = NSLocalizedString(@"TabLoading", @""); [status setStringValue:loadingStatus]; mIsBusy = YES; - [mTab setLabel: LOADING_STRING]; + [mTab setLabel: NSLocalizedString(@"TabLoading", @"")]; if (mWindowController) { [mWindowController updateToolbarItems]; @@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; } else { if (!title || [title isEqualToString:@""]) - title = [NSString stringWithString:@"Untitled"]; + title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")]; mTitle = [title retain]; } if ( mIsPrimary ) @@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; if (title && ![title isEqualToString:@""]) [mTab setLabel:title]; else - [mTab setLabel:@"Untitled"]; + [mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")]; } // @@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"]; [controller setChromeMask: aMask]; [controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings. + [controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window [controller enterModalSession]; [[[controller getBrowserWrapper] getBrowserView] setActive: YES]; return [[controller getBrowserWrapper] getBrowserView]; diff --git a/chimera/CHExtendedTabView.mm b/chimera/CHExtendedTabView.mm index 672c6367433..9e47097b789 100644 --- a/chimera/CHExtendedTabView.mm +++ b/chimera/CHExtendedTabView.mm @@ -207,7 +207,7 @@ // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [self window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [self addTabViewItem: tabViewItem]; diff --git a/chimera/English.lproj/Localizable.strings b/chimera/English.lproj/Localizable.strings index 3b56396868d..b189e41294b 100644 Binary files a/chimera/English.lproj/Localizable.strings and b/chimera/English.lproj/Localizable.strings differ diff --git a/chimera/MainController.mm b/chimera/MainController.mm index c0bb133e1f1..c05da5c39d4 100644 --- a/chimera/MainController.mm +++ b/chimera/MainController.mm @@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; -(IBAction)newTab:(id)aSender { - [[[mApplication mainWindow] windowController] newTab]; + [[[mApplication mainWindow] windowController] newTab:YES]; } -(IBAction)closeTab:(id)aSender diff --git a/chimera/resources/localized/English.lproj/Localizable.strings b/chimera/resources/localized/English.lproj/Localizable.strings index 3b56396868d..b189e41294b 100644 Binary files a/chimera/resources/localized/English.lproj/Localizable.strings and b/chimera/resources/localized/English.lproj/Localizable.strings differ diff --git a/chimera/src/application/MainController.mm b/chimera/src/application/MainController.mm index c0bb133e1f1..c05da5c39d4 100644 --- a/chimera/src/application/MainController.mm +++ b/chimera/src/application/MainController.mm @@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; -(IBAction)newTab:(id)aSender { - [[[mApplication mainWindow] windowController] newTab]; + [[[mApplication mainWindow] windowController] newTab:YES]; } -(IBAction)closeTab:(id)aSender diff --git a/chimera/src/bookmarks/BookmarksService.mm b/chimera/src/bookmarks/BookmarksService.mm index b28551259a3..75d3374cd0d 100644 --- a/chimera/src/bookmarks/BookmarksService.mm +++ b/chimera/src/bookmarks/BookmarksService.mm @@ -1007,7 +1007,7 @@ BookmarksService::OpenBookmarkGroup(id aTabView, nsIDOMElement* aFolder) // We need to make a new tab. tabViewItem = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: tabViewItem andWindow: [aTabView window]] autorelease]; - [tabViewItem setLabel: @"Untitled"]; + [tabViewItem setLabel: NSLocalizedString(@"UntitledPageTitle", @"")]; [tabViewItem setView: newView]; [aTabView addTabViewItem: tabViewItem]; } diff --git a/chimera/src/browser/BrowserWindowController.h b/chimera/src/browser/BrowserWindowController.h index 06393dfc8a1..1722c2fa4ce 100644 --- a/chimera/src/browser/BrowserWindowController.h +++ b/chimera/src/browser/BrowserWindowController.h @@ -128,6 +128,7 @@ class nsIDOMNode; NSModalSession mModalSession; BOOL mShouldAutosave; + BOOL mShouldLoadHomePage; BOOL mDrawerCachedFrame; NSRect mCachedFrameBeforeDrawerOpen; // This is used by the drawer to figure out if the window should @@ -196,7 +197,7 @@ class nsIDOMNode; - (void)importBookmarks: (NSString*)aURLSpec; - (IBAction)toggleSidebar:(id)aSender; -- (void)newTab; +- (void)newTab:(BOOL)allowHomepage; - (void)closeTab; - (void)previousTab; - (void)nextTab; @@ -215,6 +216,7 @@ class nsIDOMNode; -(void)autosaveWindowFrame; -(void)disableAutosave; +-(void)disableLoadPage; -(void)setChromeMask:(unsigned int)aMask; -(unsigned int)chromeMask; diff --git a/chimera/src/browser/BrowserWindowController.mm b/chimera/src/browser/BrowserWindowController.mm index 82dcd31b838..8862d611b6f 100644 --- a/chimera/src/browser/BrowserWindowController.mm +++ b/chimera/src/browser/BrowserWindowController.mm @@ -133,6 +133,7 @@ static NSArray* sToolbarDefaults = nil; mInitialized = NO; mMoveReentrant = NO; mShouldAutosave = YES; + mShouldLoadHomePage = YES; mChromeMask = 0; mContextMenuFlags = 0; mContextMenuEvent = nsnull; @@ -154,6 +155,11 @@ static NSArray* sToolbarDefaults = nil; mShouldAutosave = NO; } +-(void)disableLoadPage +{ + mShouldLoadHomePage = NO; +} + - (void)windowWillClose:(NSNotification *)notification { printf("Window will close notification.\n"); @@ -240,10 +246,11 @@ static NSArray* sToolbarDefaults = nil; // We now remove the IB tab, then add one of our own. [mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]]; - [self newTab]; + [self newTab:mShouldLoadHomePage]; if (mURL) { - [self loadURL: mURL]; + if (mShouldLoadHomePage) + [self loadURL: mURL]; [mURL release]; } @@ -855,20 +862,23 @@ static NSArray* sToolbarDefaults = nil; [[self window] display]; } --(void)newTab +-(void)newTab:(BOOL)allowHomepage { - PRInt32 newTabPage = 0; - nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); - pref->GetIntPref("browser.tabs.startPage", &newTabPage); - NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease]; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; - [newTab setLabel: (newTabPage ? @"Loading..." : @"Untitled")]; + PRInt32 newTabPage = 0; + if (allowHomepage) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + pref->GetIntPref("browser.tabs.startPage", &newTabPage); + } + + [newTab setLabel: ((newTabPage == 1) ? NSLocalizedString(@"TabLoading", @"") : NSLocalizedString(@"UntitledPageTitle", @""))]; [newTab setView: newView]; [mTabBrowser addTabViewItem: newTab]; - [[newView getBrowserView] loadURI: (newTabPage ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; + if (allowHomepage) + [[newView getBrowserView] loadURI: ((newTabPage == 1) ? [[CHPreferenceManager sharedInstance] homePage: NO] : @"about:blank") flags:NSLoadFlagsNone]; [mTabBrowser selectLastTabViewItem: self]; @@ -976,7 +986,7 @@ static NSArray* sToolbarDefaults = nil; CHBrowserWrapper* newView = [[[CHBrowserWrapper alloc] initWithTab: newTab andWindow: [mTabBrowser window]] autorelease]; [newView setTab: newTab]; - [newTab setLabel: @"Loading..."]; + [newTab setLabel: NSLocalizedString(@"TabLoading", @"")]; [newTab setView: newView]; [[newView getBrowserView] loadURI:aURLSpec flags:NSLoadFlagsNone]; diff --git a/chimera/src/browser/BrowserWrapper.mm b/chimera/src/browser/BrowserWrapper.mm index 492a31fbc2d..5a09c23743d 100644 --- a/chimera/src/browser/BrowserWrapper.mm +++ b/chimera/src/browser/BrowserWrapper.mm @@ -56,7 +56,6 @@ #include "nsIWebProgressListener.h" #define DOCUMENT_DONE_STRING @"Document: Done" -#define LOADING_STRING @"Loading..." static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; @@ -231,11 +230,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; [progress setIndeterminate:YES]; [progress startAnimation:self]; - loadingStatus = LOADING_STRING; + loadingStatus = NSLocalizedString(@"TabLoading", @""); [status setStringValue:loadingStatus]; mIsBusy = YES; - [mTab setLabel: LOADING_STRING]; + [mTab setLabel: NSLocalizedString(@"TabLoading", @"")]; if (mWindowController) { [mWindowController updateToolbarItems]; @@ -363,7 +362,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; } else { if (!title || [title isEqualToString:@""]) - title = [NSString stringWithString:@"Untitled"]; + title = [NSString stringWithString:NSLocalizedString(@"UntitledPageTitle", @"")]; mTitle = [title retain]; } if ( mIsPrimary ) @@ -374,7 +373,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; if (title && ![title isEqualToString:@""]) [mTab setLabel:title]; else - [mTab setLabel:@"Untitled"]; + [mTab setLabel:NSLocalizedString(@"UntitledPageTitle", @"")]; } // @@ -514,6 +513,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1"; BrowserWindowController* controller = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"]; [controller setChromeMask: aMask]; [controller disableAutosave]; // The Web page opened this window, so we don't ever use its settings. + [controller disableLoadPage]; // don't load about:blank initially since this is a script-opened window [controller enterModalSession]; [[[controller getBrowserWrapper] getBrowserView] setActive: YES]; return [[controller getBrowserWrapper] getBrowserView];