Camino only - Bug 342232: Disable various menu items when window/tab contains binary content. r=cl sr=pink

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@214938 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
stuart.morgan%alumni.case.edu
2006-11-08 06:06:15 +00:00
parent f2ed2a3c51
commit dedcfb201c
3 changed files with 15 additions and 8 deletions

View File

@@ -1523,11 +1523,13 @@ const int kReuseWindowOnAE = 2;
// disable non-BWC items that aren't relevant if there's no main browser window open
// or the bookmark/history manager is open
if (action == @selector(findInPage:) ||
action == @selector(savePage:))
{
if (action == @selector(savePage:))
return (browserController && ![browserController bookmarkManagerIsVisible]);
}
// disable the find panel if there's no text content
if (action == @selector(findInPage:))
return (browserController && ![browserController bookmarkManagerIsVisible] &&
[[[browserController getBrowserWrapper] getBrowserView] isTextBasedContent]);
// BrowserWindowController decides about actions that are just sent on to
// the front window's BrowserWindowController. This works because the selectors
@@ -1544,9 +1546,7 @@ const int kReuseWindowOnAE = 2;
action == @selector(viewPageSource:) ||
action == @selector(sendURL:) ||
action == @selector(printDocument:) ||
action == @selector(pageSetup:) ||
action == @selector(findInPage:) ||
action == @selector(savePage:))
action == @selector(pageSetup:))
{
return (browserController && [browserController validateActionBySelector:action]);
}
@@ -1572,7 +1572,9 @@ const int kReuseWindowOnAE = 2;
- (void)adjustTextEncodingMenu
{
BrowserWindowController* browserController = [self getMainWindowBrowserController];
if (browserController) {
if (browserController && ![browserController bookmarkManagerIsVisible] &&
[[[browserController getBrowserWrapper] getBrowserView] isTextBasedContent])
{
// enable all items
[mTextEncodingsMenu setAllItemsEnabled:YES startingWithItemAtIndex:0 includingSubmenus:YES];

View File

@@ -3604,6 +3604,7 @@ enum BWCOpenDest {
BrowserWrapper* wrapper = [self getBrowserWrapper];
return (![wrapper isEmpty] &&
![self bookmarkManagerIsVisible] &&
[[wrapper getBrowserView] isTextBasedContent] &&
[[wrapper getBrowserView] canMakeTextBigger]);
}
@@ -3612,6 +3613,7 @@ enum BWCOpenDest {
BrowserWrapper* wrapper = [self getBrowserWrapper];
return (![wrapper isEmpty] &&
![self bookmarkManagerIsVisible] &&
[[wrapper getBrowserView] isTextBasedContent] &&
[[wrapper getBrowserView] canMakeTextSmaller]);
}
@@ -3620,6 +3622,7 @@ enum BWCOpenDest {
BrowserWrapper* wrapper = [self getBrowserWrapper];
return (![wrapper isEmpty] &&
![self bookmarkManagerIsVisible] &&
[[wrapper getBrowserView] isTextBasedContent] &&
![[wrapper getBrowserView] isTextDefaultSize]);
}

View File

@@ -1413,6 +1413,8 @@ const long NSFindPanelActionSetFindString = 7;
else if (action == @selector(selectAll:))
return YES;
else if (action == @selector(performFindPanelAction:)) {
if (![self isTextBasedContent])
return NO;
long tag = [aMenuItem tag];
if (tag == NSFindPanelActionNext || tag == NSFindPanelActionPrevious)
return ([[self lastFindText] length] > 0);