Moved multiple instances of entry menu delegate to app delegate

This commit is contained in:
Michael Starke
2019-02-15 10:47:31 +01:00
parent ef7a3085fd
commit 8769f07079
6 changed files with 24 additions and 11 deletions

View File

@@ -35,6 +35,9 @@
#import "MPDocumentWindowController.h"
#import "MPDocument.h"
#import "NSApplication+MPAdditions.h"
#import "MPAppDelegate.h"
NSString *const MPToolbarItemLock = @"TOOLBAR_LOCK";
NSString *const MPToolbarItemAddGroup = @"TOOLBAR_ADD_GROUP";
NSString *const MPToolbarItemAddEntry = @"TOOLBAR_ADD_ENTRY";
@@ -49,7 +52,6 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE";
@interface MPToolbarDelegate() {
MPAddEntryContextMenuDelegate *_addEntryMenuDelegate;
MPEntryContextMenuDelegate * _entryActionContextMenuDelegate;
BOOL _didShowToolbarForSearch;
BOOL _didAddSearchfieldForSearch;
NSToolbarDisplayMode _displayModeBeforeSearch;
@@ -94,7 +96,6 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE";
_toolbarImages = [self createToolbarImages];
_toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:[self.toolbarIdentifiers count]];
_addEntryMenuDelegate = [[MPAddEntryContextMenuDelegate alloc] init];
_entryActionContextMenuDelegate = [[MPEntryContextMenuDelegate alloc] init];
}
return self;
}
@@ -137,7 +138,7 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE";
popupButton.frame = newFrame;
popupButton.menu = menu;
menu.delegate = _entryActionContextMenuDelegate;
menu.delegate = NSApp.mp_delegate.itemActionMenuDelegate;
item.menuFormRepresentation = menuRepresentation;
item.view = popupButton;
}