зеркало из https://github.com/mozilla/pjs.git
We have to manually update items on the Bookmarks menu and its submenus, because we turn auto-enabling of items off for this menu (presumably, for performance with lots of bookmarks).
This commit is contained in:
Родитель
9954ed21d6
Коммит
9039b8cf97
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -60,6 +60,9 @@ class BookmarksService;
|
||||||
IBOutlet NSMenu* mBookmarksMenu;
|
IBOutlet NSMenu* mBookmarksMenu;
|
||||||
|
|
||||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mAddBookmarkMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksFolderMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksSeparatorMenuItem;
|
||||||
|
|
||||||
BOOL mOffline;
|
BOOL mOffline;
|
||||||
|
|
||||||
|
@ -128,6 +131,8 @@ class BookmarksService;
|
||||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||||
- (void)fixCloseMenuItemKeyEquivalents;
|
- (void)fixCloseMenuItemKeyEquivalents;
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow;
|
-(NSWindow*)getFrontmostBrowserWindow;
|
||||||
|
|
||||||
- (MVPreferencesController *)preferencesController;
|
- (MVPreferencesController *)preferencesController;
|
||||||
|
|
|
@ -327,6 +327,13 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
[[[mApplication mainWindow] windowController] home: aSender];
|
[[[mApplication mainWindow] windowController] home: aSender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
{
|
||||||
|
[mAddBookmarkMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksFolderMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksSeparatorMenuItem setEnabled:NO]; // separators are not implemented yet
|
||||||
|
}
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow
|
-(NSWindow*)getFrontmostBrowserWindow
|
||||||
{
|
{
|
||||||
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
||||||
|
@ -458,6 +465,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) addSeparator:(id)aSender
|
-(IBAction) addSeparator:(id)aSender
|
||||||
{
|
{
|
||||||
|
NSLog(@"Separators not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) openMenuBookmark:(id)aSender
|
-(IBAction) openMenuBookmark:(id)aSender
|
||||||
|
@ -582,10 +590,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||||
{
|
{
|
||||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
|
||||||
|
|
||||||
// disable items that aren't relevant if there's no main browser window open
|
// disable items that aren't relevant if there's no main browser window open
|
||||||
SEL action = [aMenuItem action];
|
SEL action = [aMenuItem action];
|
||||||
|
|
||||||
|
//NSLog(@"MainController validateMenuItem for %@ (%s)", [aMenuItem title], action);
|
||||||
|
|
||||||
if (action == @selector(newTab:) ||
|
if (action == @selector(newTab:) ||
|
||||||
/* ... many more items go here ... */
|
/* ... many more items go here ... */
|
||||||
action == @selector(printPage:) ||
|
action == @selector(printPage:) ||
|
||||||
|
@ -595,7 +604,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
action == @selector(smallerTextSize:) ||
|
action == @selector(smallerTextSize:) ||
|
||||||
action == @selector(viewSource:) ||
|
action == @selector(viewSource:) ||
|
||||||
action == @selector(goHome:) ||
|
action == @selector(goHome:) ||
|
||||||
action == @selector(addBookmark:) || // doesn't work, not sure why
|
|
||||||
action == @selector(savePage:)) {
|
action == @selector(savePage:)) {
|
||||||
if ([self isMainWindowABrowserWindow])
|
if ([self isMainWindowABrowserWindow])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -60,6 +60,9 @@ class BookmarksService;
|
||||||
IBOutlet NSMenu* mBookmarksMenu;
|
IBOutlet NSMenu* mBookmarksMenu;
|
||||||
|
|
||||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mAddBookmarkMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksFolderMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksSeparatorMenuItem;
|
||||||
|
|
||||||
BOOL mOffline;
|
BOOL mOffline;
|
||||||
|
|
||||||
|
@ -128,6 +131,8 @@ class BookmarksService;
|
||||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||||
- (void)fixCloseMenuItemKeyEquivalents;
|
- (void)fixCloseMenuItemKeyEquivalents;
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow;
|
-(NSWindow*)getFrontmostBrowserWindow;
|
||||||
|
|
||||||
- (MVPreferencesController *)preferencesController;
|
- (MVPreferencesController *)preferencesController;
|
||||||
|
|
|
@ -327,6 +327,13 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
[[[mApplication mainWindow] windowController] home: aSender];
|
[[[mApplication mainWindow] windowController] home: aSender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
{
|
||||||
|
[mAddBookmarkMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksFolderMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksSeparatorMenuItem setEnabled:NO]; // separators are not implemented yet
|
||||||
|
}
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow
|
-(NSWindow*)getFrontmostBrowserWindow
|
||||||
{
|
{
|
||||||
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
||||||
|
@ -458,6 +465,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) addSeparator:(id)aSender
|
-(IBAction) addSeparator:(id)aSender
|
||||||
{
|
{
|
||||||
|
NSLog(@"Separators not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) openMenuBookmark:(id)aSender
|
-(IBAction) openMenuBookmark:(id)aSender
|
||||||
|
@ -582,10 +590,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||||
{
|
{
|
||||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
|
||||||
|
|
||||||
// disable items that aren't relevant if there's no main browser window open
|
// disable items that aren't relevant if there's no main browser window open
|
||||||
SEL action = [aMenuItem action];
|
SEL action = [aMenuItem action];
|
||||||
|
|
||||||
|
//NSLog(@"MainController validateMenuItem for %@ (%s)", [aMenuItem title], action);
|
||||||
|
|
||||||
if (action == @selector(newTab:) ||
|
if (action == @selector(newTab:) ||
|
||||||
/* ... many more items go here ... */
|
/* ... many more items go here ... */
|
||||||
action == @selector(printPage:) ||
|
action == @selector(printPage:) ||
|
||||||
|
@ -595,7 +604,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
action == @selector(smallerTextSize:) ||
|
action == @selector(smallerTextSize:) ||
|
||||||
action == @selector(viewSource:) ||
|
action == @selector(viewSource:) ||
|
||||||
action == @selector(goHome:) ||
|
action == @selector(goHome:) ||
|
||||||
action == @selector(addBookmark:) || // doesn't work, not sure why
|
|
||||||
action == @selector(savePage:)) {
|
action == @selector(savePage:)) {
|
||||||
if ([self isMainWindowABrowserWindow])
|
if ([self isMainWindowABrowserWindow])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -60,6 +60,9 @@ class BookmarksService;
|
||||||
IBOutlet NSMenu* mBookmarksMenu;
|
IBOutlet NSMenu* mBookmarksMenu;
|
||||||
|
|
||||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mAddBookmarkMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksFolderMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksSeparatorMenuItem;
|
||||||
|
|
||||||
BOOL mOffline;
|
BOOL mOffline;
|
||||||
|
|
||||||
|
@ -128,6 +131,8 @@ class BookmarksService;
|
||||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||||
- (void)fixCloseMenuItemKeyEquivalents;
|
- (void)fixCloseMenuItemKeyEquivalents;
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow;
|
-(NSWindow*)getFrontmostBrowserWindow;
|
||||||
|
|
||||||
- (MVPreferencesController *)preferencesController;
|
- (MVPreferencesController *)preferencesController;
|
||||||
|
|
|
@ -327,6 +327,13 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
[[[mApplication mainWindow] windowController] home: aSender];
|
[[[mApplication mainWindow] windowController] home: aSender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
{
|
||||||
|
[mAddBookmarkMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksFolderMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksSeparatorMenuItem setEnabled:NO]; // separators are not implemented yet
|
||||||
|
}
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow
|
-(NSWindow*)getFrontmostBrowserWindow
|
||||||
{
|
{
|
||||||
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
||||||
|
@ -458,6 +465,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) addSeparator:(id)aSender
|
-(IBAction) addSeparator:(id)aSender
|
||||||
{
|
{
|
||||||
|
NSLog(@"Separators not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) openMenuBookmark:(id)aSender
|
-(IBAction) openMenuBookmark:(id)aSender
|
||||||
|
@ -582,10 +590,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||||
{
|
{
|
||||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
|
||||||
|
|
||||||
// disable items that aren't relevant if there's no main browser window open
|
// disable items that aren't relevant if there's no main browser window open
|
||||||
SEL action = [aMenuItem action];
|
SEL action = [aMenuItem action];
|
||||||
|
|
||||||
|
//NSLog(@"MainController validateMenuItem for %@ (%s)", [aMenuItem title], action);
|
||||||
|
|
||||||
if (action == @selector(newTab:) ||
|
if (action == @selector(newTab:) ||
|
||||||
/* ... many more items go here ... */
|
/* ... many more items go here ... */
|
||||||
action == @selector(printPage:) ||
|
action == @selector(printPage:) ||
|
||||||
|
@ -595,7 +604,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
action == @selector(smallerTextSize:) ||
|
action == @selector(smallerTextSize:) ||
|
||||||
action == @selector(viewSource:) ||
|
action == @selector(viewSource:) ||
|
||||||
action == @selector(goHome:) ||
|
action == @selector(goHome:) ||
|
||||||
action == @selector(addBookmark:) || // doesn't work, not sure why
|
|
||||||
action == @selector(savePage:)) {
|
action == @selector(savePage:)) {
|
||||||
if ([self isMainWindowABrowserWindow])
|
if ([self isMainWindowABrowserWindow])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -44,11 +44,14 @@
|
||||||
CLASS = MainController;
|
CLASS = MainController;
|
||||||
LANGUAGE = ObjC;
|
LANGUAGE = ObjC;
|
||||||
OUTLETS = {
|
OUTLETS = {
|
||||||
|
mAddBookmarkMenuItem = NSMenuItem;
|
||||||
mApplication = NSApplication;
|
mApplication = NSApplication;
|
||||||
mBookmarksMenu = NSMenu;
|
mBookmarksMenu = NSMenu;
|
||||||
mBookmarksToolbarMenuItem = NSMenuItem;
|
mBookmarksToolbarMenuItem = NSMenuItem;
|
||||||
mCloseTabMenuItem = NSMenuItem;
|
mCloseTabMenuItem = NSMenuItem;
|
||||||
mCloseWindowMenuItem = NSMenuItem;
|
mCloseWindowMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksFolderMenuItem = NSMenuItem;
|
||||||
|
mCreateBookmarksSeparatorMenuItem = NSMenuItem;
|
||||||
mFilterList = NSPopUpButton;
|
mFilterList = NSPopUpButton;
|
||||||
mFilterView = NSView;
|
mFilterView = NSView;
|
||||||
mOfflineMenuItem = NSMenuItem;
|
mOfflineMenuItem = NSMenuItem;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<plist version="0.9">
|
<plist version="0.9">
|
||||||
<dict>
|
<dict>
|
||||||
<key>IBDocumentLocation</key>
|
<key>IBDocumentLocation</key>
|
||||||
<string>96 99 356 240 0 0 1152 746 </string>
|
<string>95 100 356 240 0 0 1152 746 </string>
|
||||||
<key>IBEditorPositions</key>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>266</key>
|
<key>266</key>
|
||||||
|
@ -29,6 +29,10 @@
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBLastGroupID</key>
|
<key>IBLastGroupID</key>
|
||||||
<string>2</string>
|
<string>2</string>
|
||||||
|
<key>IBOpenObjects</key>
|
||||||
|
<array>
|
||||||
|
<integer>29</integer>
|
||||||
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>5S66</string>
|
<string>5S66</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Двоичный файл не отображается.
|
@ -60,6 +60,9 @@ class BookmarksService;
|
||||||
IBOutlet NSMenu* mBookmarksMenu;
|
IBOutlet NSMenu* mBookmarksMenu;
|
||||||
|
|
||||||
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
IBOutlet NSMenuItem* mBookmarksToolbarMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mAddBookmarkMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksFolderMenuItem;
|
||||||
|
IBOutlet NSMenuItem* mCreateBookmarksSeparatorMenuItem;
|
||||||
|
|
||||||
BOOL mOffline;
|
BOOL mOffline;
|
||||||
|
|
||||||
|
@ -128,6 +131,8 @@ class BookmarksService;
|
||||||
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
- (void)adjustCloseTabMenuItemKeyEquivalent:(BOOL)inHaveTabs;
|
||||||
- (void)fixCloseMenuItemKeyEquivalents;
|
- (void)fixCloseMenuItemKeyEquivalents;
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow;
|
-(NSWindow*)getFrontmostBrowserWindow;
|
||||||
|
|
||||||
- (MVPreferencesController *)preferencesController;
|
- (MVPreferencesController *)preferencesController;
|
||||||
|
|
|
@ -327,6 +327,13 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
[[[mApplication mainWindow] windowController] home: aSender];
|
[[[mApplication mainWindow] windowController] home: aSender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)adjustBookmarksMenuItemsEnabling:(BOOL)inBrowserWindowFrontmost;
|
||||||
|
{
|
||||||
|
[mAddBookmarkMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksFolderMenuItem setEnabled:inBrowserWindowFrontmost];
|
||||||
|
[mCreateBookmarksSeparatorMenuItem setEnabled:NO]; // separators are not implemented yet
|
||||||
|
}
|
||||||
|
|
||||||
-(NSWindow*)getFrontmostBrowserWindow
|
-(NSWindow*)getFrontmostBrowserWindow
|
||||||
{
|
{
|
||||||
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
// for some reason, [NSApp mainWindow] doesn't always work, so we have to
|
||||||
|
@ -458,6 +465,7 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(IBAction) addSeparator:(id)aSender
|
-(IBAction) addSeparator:(id)aSender
|
||||||
{
|
{
|
||||||
|
NSLog(@"Separators not implemented yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(IBAction) openMenuBookmark:(id)aSender
|
-(IBAction) openMenuBookmark:(id)aSender
|
||||||
|
@ -582,10 +590,11 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
|
|
||||||
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
|
||||||
{
|
{
|
||||||
//NSLog(@"validateMenuItem for %@ called on the MainController", [aMenuItem title]);
|
|
||||||
|
|
||||||
// disable items that aren't relevant if there's no main browser window open
|
// disable items that aren't relevant if there's no main browser window open
|
||||||
SEL action = [aMenuItem action];
|
SEL action = [aMenuItem action];
|
||||||
|
|
||||||
|
//NSLog(@"MainController validateMenuItem for %@ (%s)", [aMenuItem title], action);
|
||||||
|
|
||||||
if (action == @selector(newTab:) ||
|
if (action == @selector(newTab:) ||
|
||||||
/* ... many more items go here ... */
|
/* ... many more items go here ... */
|
||||||
action == @selector(printPage:) ||
|
action == @selector(printPage:) ||
|
||||||
|
@ -595,7 +604,6 @@ static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
|
||||||
action == @selector(smallerTextSize:) ||
|
action == @selector(smallerTextSize:) ||
|
||||||
action == @selector(viewSource:) ||
|
action == @selector(viewSource:) ||
|
||||||
action == @selector(goHome:) ||
|
action == @selector(goHome:) ||
|
||||||
action == @selector(addBookmark:) || // doesn't work, not sure why
|
|
||||||
action == @selector(savePage:)) {
|
action == @selector(savePage:)) {
|
||||||
if ([self isMainWindowABrowserWindow])
|
if ([self isMainWindowABrowserWindow])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче