зеркало из https://github.com/mozilla/pjs.git
Fix updating of stop menu item and a crash when a popup with the personal
toolbar hidden was the frontmost and the menubar was clicked. Fixed some warnings as well (bug 155461)
This commit is contained in:
Родитель
5bd251ee48
Коммит
f89e345974
|
@ -246,7 +246,7 @@ class nsIDOMNode;
|
|||
|
||||
- (IBAction)viewOnlyThisImage:(id)aSender;
|
||||
|
||||
- (NSView*) bookmarksToolbar;
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar;
|
||||
|
||||
// Called to get cached versions of our security icons
|
||||
+ (NSImage*) insecureIcon;
|
||||
|
|
|
@ -260,16 +260,17 @@ static NSArray* sToolbarDefaults = nil;
|
|||
|
||||
[mPersonalToolbar initializeToolbar];
|
||||
if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR) ) {
|
||||
// remove the personal toolbar and adjust the content area upwards
|
||||
// remove the personal toolbar and adjust the content area upwards. Removing it
|
||||
// from the parent view releases it, so we have to clear out the member var.
|
||||
float height = [mPersonalToolbar frame].size.height;
|
||||
[mPersonalToolbar removeFromSuperview];
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
mPersonalToolbar = nil;
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||
|
@ -1288,7 +1289,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSView*) bookmarksToolbar
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar
|
||||
{
|
||||
return mPersonalToolbar;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
|
||||
-(IBAction)newTab:(id)aSender
|
||||
{
|
||||
[[[mApplication mainWindow] windowController] newTab:YES];
|
||||
[(BrowserWindowController*)[[mApplication mainWindow] windowController] newTab:YES];
|
||||
}
|
||||
|
||||
-(IBAction)closeTab:(id)aSender
|
||||
|
@ -554,7 +554,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
/* ... many more items go here ... */
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
action == @selector(smallerTextSize:) ||
|
||||
|
@ -575,17 +574,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
// check what the state of the personal toolbar should be, but only if there is a browser
|
||||
// window open. Popup windows that have the personal toolbar removed should always gray
|
||||
// out this menu.
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
NSView* bookmarkToolbar = [[[mApplication mainWindow] windowController] bookmarksToolbar];
|
||||
if ( bookmarkToolbar ) {
|
||||
float height = [bookmarkToolbar frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
|
@ -600,6 +605,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
if ( action == @selector(doStop:) ) {
|
||||
if ([self isMainWindowABrowserWindow])
|
||||
return [[[[mApplication mainWindow] windowController] getBrowserWrapper] isBusy];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
CHBrowserView* browserView = [[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView];
|
||||
|
@ -609,7 +620,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [browserView canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
// default return
|
||||
|
|
|
@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
|
||||
-(IBAction)newTab:(id)aSender
|
||||
{
|
||||
[[[mApplication mainWindow] windowController] newTab:YES];
|
||||
[(BrowserWindowController*)[[mApplication mainWindow] windowController] newTab:YES];
|
||||
}
|
||||
|
||||
-(IBAction)closeTab:(id)aSender
|
||||
|
@ -554,7 +554,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
/* ... many more items go here ... */
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
action == @selector(smallerTextSize:) ||
|
||||
|
@ -575,17 +574,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
// check what the state of the personal toolbar should be, but only if there is a browser
|
||||
// window open. Popup windows that have the personal toolbar removed should always gray
|
||||
// out this menu.
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
NSView* bookmarkToolbar = [[[mApplication mainWindow] windowController] bookmarksToolbar];
|
||||
if ( bookmarkToolbar ) {
|
||||
float height = [bookmarkToolbar frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
|
@ -600,6 +605,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
if ( action == @selector(doStop:) ) {
|
||||
if ([self isMainWindowABrowserWindow])
|
||||
return [[[[mApplication mainWindow] windowController] getBrowserWrapper] isBusy];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
CHBrowserView* browserView = [[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView];
|
||||
|
@ -609,7 +620,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [browserView canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
// default return
|
||||
|
|
|
@ -246,7 +246,7 @@ class nsIDOMNode;
|
|||
|
||||
- (IBAction)viewOnlyThisImage:(id)aSender;
|
||||
|
||||
- (NSView*) bookmarksToolbar;
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar;
|
||||
|
||||
// Called to get cached versions of our security icons
|
||||
+ (NSImage*) insecureIcon;
|
||||
|
|
|
@ -260,16 +260,17 @@ static NSArray* sToolbarDefaults = nil;
|
|||
|
||||
[mPersonalToolbar initializeToolbar];
|
||||
if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR) ) {
|
||||
// remove the personal toolbar and adjust the content area upwards
|
||||
// remove the personal toolbar and adjust the content area upwards. Removing it
|
||||
// from the parent view releases it, so we have to clear out the member var.
|
||||
float height = [mPersonalToolbar frame].size.height;
|
||||
[mPersonalToolbar removeFromSuperview];
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
mPersonalToolbar = nil;
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||
|
@ -1288,7 +1289,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSView*) bookmarksToolbar
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar
|
||||
{
|
||||
return mPersonalToolbar;
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ class nsIDOMNode;
|
|||
|
||||
- (IBAction)viewOnlyThisImage:(id)aSender;
|
||||
|
||||
- (NSView*) bookmarksToolbar;
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar;
|
||||
|
||||
// Called to get cached versions of our security icons
|
||||
+ (NSImage*) insecureIcon;
|
||||
|
|
|
@ -260,16 +260,17 @@ static NSArray* sToolbarDefaults = nil;
|
|||
|
||||
[mPersonalToolbar initializeToolbar];
|
||||
if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR) ) {
|
||||
// remove the personal toolbar and adjust the content area upwards
|
||||
// remove the personal toolbar and adjust the content area upwards. Removing it
|
||||
// from the parent view releases it, so we have to clear out the member var.
|
||||
float height = [mPersonalToolbar frame].size.height;
|
||||
[mPersonalToolbar removeFromSuperview];
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
mPersonalToolbar = nil;
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||
|
@ -1288,7 +1289,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSView*) bookmarksToolbar
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar
|
||||
{
|
||||
return mPersonalToolbar;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
|
||||
-(IBAction)newTab:(id)aSender
|
||||
{
|
||||
[[[mApplication mainWindow] windowController] newTab:YES];
|
||||
[(BrowserWindowController*)[[mApplication mainWindow] windowController] newTab:YES];
|
||||
}
|
||||
|
||||
-(IBAction)closeTab:(id)aSender
|
||||
|
@ -554,7 +554,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
/* ... many more items go here ... */
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
action == @selector(smallerTextSize:) ||
|
||||
|
@ -575,17 +574,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
// check what the state of the personal toolbar should be, but only if there is a browser
|
||||
// window open. Popup windows that have the personal toolbar removed should always gray
|
||||
// out this menu.
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
NSView* bookmarkToolbar = [[[mApplication mainWindow] windowController] bookmarksToolbar];
|
||||
if ( bookmarkToolbar ) {
|
||||
float height = [bookmarkToolbar frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
|
@ -600,6 +605,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
if ( action == @selector(doStop:) ) {
|
||||
if ([self isMainWindowABrowserWindow])
|
||||
return [[[[mApplication mainWindow] windowController] getBrowserWrapper] isBusy];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
CHBrowserView* browserView = [[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView];
|
||||
|
@ -609,7 +620,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [browserView canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
// default return
|
||||
|
|
|
@ -173,7 +173,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
|
||||
-(IBAction)newTab:(id)aSender
|
||||
{
|
||||
[[[mApplication mainWindow] windowController] newTab:YES];
|
||||
[(BrowserWindowController*)[[mApplication mainWindow] windowController] newTab:YES];
|
||||
}
|
||||
|
||||
-(IBAction)closeTab:(id)aSender
|
||||
|
@ -554,7 +554,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
/* ... many more items go here ... */
|
||||
action == @selector(printPage:) ||
|
||||
action == @selector(findInPage:) ||
|
||||
action == @selector(doStop:) ||
|
||||
action == @selector(doReload:) ||
|
||||
action == @selector(biggerTextSize:) ||
|
||||
action == @selector(smallerTextSize:) ||
|
||||
|
@ -575,17 +574,23 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
// check what the state of the toolbar should be, but only if there is a browser
|
||||
// window open
|
||||
// check what the state of the personal toolbar should be, but only if there is a browser
|
||||
// window open. Popup windows that have the personal toolbar removed should always gray
|
||||
// out this menu.
|
||||
if (action == @selector(toggleBookmarksToolbar:)) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
float height = [[[[mApplication mainWindow] windowController] bookmarksToolbar] frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
NSView* bookmarkToolbar = [[[mApplication mainWindow] windowController] bookmarksToolbar];
|
||||
if ( bookmarkToolbar ) {
|
||||
float height = [bookmarkToolbar frame].size.height;
|
||||
BOOL toolbarShowing = (height > 0);
|
||||
if (toolbarShowing)
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Hide Bookmarks Toolbar",@"")];
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
[mBookmarksToolbarMenuItem setTitle: NSLocalizedString(@"Show Bookmarks Toolbar",@"")];
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
|
@ -600,6 +605,12 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return NO;
|
||||
}
|
||||
|
||||
if ( action == @selector(doStop:) ) {
|
||||
if ([self isMainWindowABrowserWindow])
|
||||
return [[[[mApplication mainWindow] windowController] getBrowserWrapper] isBusy];
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
if ( action == @selector(goBack:) || action == @selector(goForward:) ) {
|
||||
if ([self isMainWindowABrowserWindow]) {
|
||||
CHBrowserView* browserView = [[[[mApplication mainWindow] windowController] getBrowserWrapper] getBrowserView];
|
||||
|
@ -609,7 +620,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
|||
return [browserView canGoForward];
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
// default return
|
||||
|
|
|
@ -246,7 +246,7 @@ class nsIDOMNode;
|
|||
|
||||
- (IBAction)viewOnlyThisImage:(id)aSender;
|
||||
|
||||
- (NSView*) bookmarksToolbar;
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar;
|
||||
|
||||
// Called to get cached versions of our security icons
|
||||
+ (NSImage*) insecureIcon;
|
||||
|
|
|
@ -260,16 +260,17 @@ static NSArray* sToolbarDefaults = nil;
|
|||
|
||||
[mPersonalToolbar initializeToolbar];
|
||||
if ( mChromeMask && !(mChromeMask & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR) ) {
|
||||
// remove the personal toolbar and adjust the content area upwards
|
||||
// remove the personal toolbar and adjust the content area upwards. Removing it
|
||||
// from the parent view releases it, so we have to clear out the member var.
|
||||
float height = [mPersonalToolbar frame].size.height;
|
||||
[mPersonalToolbar removeFromSuperview];
|
||||
[mTabBrowser setFrame:NSMakeRect([mTabBrowser frame].origin.x, [mTabBrowser frame].origin.y,
|
||||
[mTabBrowser frame].size.width, [mTabBrowser frame].size.height + height)];
|
||||
mPersonalToolbar = nil;
|
||||
}
|
||||
else if (![self shouldShowBookmarkToolbar]) {
|
||||
[mPersonalToolbar showBookmarksToolbar:NO];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)drawerWillOpen: (NSNotification*)aNotification
|
||||
|
@ -1288,7 +1289,7 @@ static NSArray* sToolbarDefaults = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (NSView*) bookmarksToolbar
|
||||
- (CHBookmarksToolbar*) bookmarksToolbar
|
||||
{
|
||||
return mPersonalToolbar;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче