Disable the '+'/sort menu-buttons in appropriate bookmark collections. Patch by smorgan <stuart.morgan@alumni.case.edu> r=me sr=pink b=288814

This commit is contained in:
stridey%gmail.com 2006-10-18 17:12:56 +00:00
parent f9ab9d1464
commit 1c052acad7
2 changed files with 19 additions and 6 deletions

View File

@ -832,11 +832,8 @@ static const unsigned int TableViewSolidVerticalGridLineMask = 1;
- (void) setCanEditSelectedContainerContents:(BOOL)inCanEdit
{
[mBookmarksOutlineView setAllowsEditing:inCanEdit];
// XXX update buttons
// [mAddBookmarkButton setEnabled:inCanEdit];
// [mAddFolderButton setEnabled:inCanEdit];
// if editable and something is selected, then enable get info button, otherwise disable it
//[mInfoButton setEnabled:(inCanEdit && ([mBookmarksOutlineView numberOfSelectedRows] == 1))];
[mAddButton setEnabled:inCanEdit];
[mSortButton setEnabled:inCanEdit];
}
-(void) setActiveCollection:(BookmarkFolder *)aFolder
@ -1196,7 +1193,9 @@ static const unsigned int TableViewSolidVerticalGridLineMask = 1;
[mHistoryOutlineViewDelegate clearSearchResults];
[mHistoryOutlineViewDelegate historyViewMadeVisible:YES];
[mAddButton setEnabled:NO];
[mActionButton setMenu:mActionMenuHistory];
[mSortButton setEnabled:YES];
[mSortButton setMenu:mSortMenuHistory];
[mSearchField setPopupMenu:mQuickSearchMenuHistory];
[mSearchField selectPopupMenuItem:[[mSearchField popupMenu] itemWithTag:1]]; // select the "all" item
@ -1904,7 +1903,9 @@ static const unsigned int TableViewSolidVerticalGridLineMask = 1;
{
actionMenu = [[BookmarkManager sharedBookmarkManager] contextMenuForItems:selectedBMs fromView:mBookmarksOutlineView target:self];
// remove the arrange stuff, because it's on the sort button too
[actionMenu removeItemsFromIndex:[actionMenu indexOfItemWithTag:kBookmarksContextMenuArrangeSeparatorTag]];
int arrangeSeparatorIndex = [actionMenu indexOfItemWithTag:kBookmarksContextMenuArrangeSeparatorTag];
if (arrangeSeparatorIndex != -1)
[actionMenu removeItemsFromIndex:arrangeSeparatorIndex];
}
else
actionMenu = mActionMenuBookmarks;

View File

@ -69,6 +69,9 @@ NSString* const PopupMenuButtonWillDisplayMenu = @"PopupMenuButtonWillDisplayMen
return;
}
if (![self isEnabled])
return;
[[NSNotificationCenter defaultCenter] postNotificationName:PopupMenuButtonWillDisplayMenu object:self];
NSPoint menuLocation = NSMakePoint(0, NSHeight([self frame]) + 4.0);
@ -91,8 +94,17 @@ NSString* const PopupMenuButtonWillDisplayMenu = @"PopupMenuButtonWillDisplayMen
[[self cell] setHighlighted:NO];
}
- (NSMenu *)menuForEvent:(NSEvent *)theEvent
{
// the menu should only show when we explicitly show it (not for events like right-click)
return nil;
}
- (void)mouseDown:(NSEvent *)event
{
if (![self isEnabled])
return;
[[NSNotificationCenter defaultCenter] postNotificationName:PopupMenuButtonWillDisplayMenu object:self];
NSPoint menuLocation = NSMakePoint(0, NSHeight([self frame]) + 4.0);