From becd776e282f5faf5be6b7a64d2289674edb5091 Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Sat, 6 Jul 2002 00:00:50 +0000 Subject: [PATCH] Fix for bug 155617: make sure we show the location dialog if the user removed the location field from their toolbar. Patch from David Haas. --- camino/BrowserWindowController.mm | 22 ++++++++++++------- camino/src/browser/BrowserWindowController.mm | 22 ++++++++++++------- chimera/BrowserWindowController.mm | 22 ++++++++++++------- .../src/browser/BrowserWindowController.mm | 22 ++++++++++++------- 4 files changed, 56 insertions(+), 32 deletions(-) diff --git a/camino/BrowserWindowController.mm b/camino/BrowserWindowController.mm index 4837b1556e83..2a6c068b929e 100644 --- a/camino/BrowserWindowController.mm +++ b/camino/BrowserWindowController.mm @@ -569,16 +569,22 @@ static NSArray* sToolbarDefaults = nil; - (void)performAppropriateLocationAction { - if ( [[[self window] toolbar] isVisible] ) { - if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || - ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { - [self focusURLBar]; - } else { - [self beginLocationSheet]; + NSToolbar *toolbar = [[self window] toolbar]; + if ( [toolbar isVisible] ) { + if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || + ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { + NSArray *itemsWeCanSee = [toolbar visibleItems]; + + for (unsigned int i=0;i<[itemsWeCanSee count];i++) { + if ([[[itemsWeCanSee objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) { + [self focusURLBar]; + return; } - } else { - [self beginLocationSheet]; + } } + } + + [self beginLocationSheet]; } - (void)focusURLBar diff --git a/camino/src/browser/BrowserWindowController.mm b/camino/src/browser/BrowserWindowController.mm index 4837b1556e83..2a6c068b929e 100644 --- a/camino/src/browser/BrowserWindowController.mm +++ b/camino/src/browser/BrowserWindowController.mm @@ -569,16 +569,22 @@ static NSArray* sToolbarDefaults = nil; - (void)performAppropriateLocationAction { - if ( [[[self window] toolbar] isVisible] ) { - if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || - ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { - [self focusURLBar]; - } else { - [self beginLocationSheet]; + NSToolbar *toolbar = [[self window] toolbar]; + if ( [toolbar isVisible] ) { + if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || + ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { + NSArray *itemsWeCanSee = [toolbar visibleItems]; + + for (unsigned int i=0;i<[itemsWeCanSee count];i++) { + if ([[[itemsWeCanSee objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) { + [self focusURLBar]; + return; } - } else { - [self beginLocationSheet]; + } } + } + + [self beginLocationSheet]; } - (void)focusURLBar diff --git a/chimera/BrowserWindowController.mm b/chimera/BrowserWindowController.mm index 4837b1556e83..2a6c068b929e 100644 --- a/chimera/BrowserWindowController.mm +++ b/chimera/BrowserWindowController.mm @@ -569,16 +569,22 @@ static NSArray* sToolbarDefaults = nil; - (void)performAppropriateLocationAction { - if ( [[[self window] toolbar] isVisible] ) { - if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || - ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { - [self focusURLBar]; - } else { - [self beginLocationSheet]; + NSToolbar *toolbar = [[self window] toolbar]; + if ( [toolbar isVisible] ) { + if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || + ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { + NSArray *itemsWeCanSee = [toolbar visibleItems]; + + for (unsigned int i=0;i<[itemsWeCanSee count];i++) { + if ([[[itemsWeCanSee objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) { + [self focusURLBar]; + return; } - } else { - [self beginLocationSheet]; + } } + } + + [self beginLocationSheet]; } - (void)focusURLBar diff --git a/chimera/src/browser/BrowserWindowController.mm b/chimera/src/browser/BrowserWindowController.mm index 4837b1556e83..2a6c068b929e 100644 --- a/chimera/src/browser/BrowserWindowController.mm +++ b/chimera/src/browser/BrowserWindowController.mm @@ -569,16 +569,22 @@ static NSArray* sToolbarDefaults = nil; - (void)performAppropriateLocationAction { - if ( [[[self window] toolbar] isVisible] ) { - if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || - ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { - [self focusURLBar]; - } else { - [self beginLocationSheet]; + NSToolbar *toolbar = [[self window] toolbar]; + if ( [toolbar isVisible] ) { + if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) || + ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) { + NSArray *itemsWeCanSee = [toolbar visibleItems]; + + for (unsigned int i=0;i<[itemsWeCanSee count];i++) { + if ([[[itemsWeCanSee objectAtIndex:i] itemIdentifier] isEqual:LocationToolbarItemIdentifier]) { + [self focusURLBar]; + return; } - } else { - [self beginLocationSheet]; + } } + } + + [self beginLocationSheet]; } - (void)focusURLBar