Extracted context menu operations into MPContextMenuHelper

Removed private declarations as they aren't needed for the compiler anymore
Fixed drawing order in MPPopupImageView
Fixed #7 Error occurred due to duplicate shortcut.
Copy Password now is bound to ⌘+⌥+C
This commit is contained in:
michael starke
2013-06-09 18:20:04 +02:00
parent 88ff8c79a0
commit 288d118184
18 changed files with 149 additions and 218 deletions

View File

@@ -12,6 +12,8 @@
#import "MPDocument.h"
#import "MPAppDelegate.h"
#import "KdbLib.h"
#import "KdbGroup+Undo.h"
#import "MPContextMenuHelper.h"
@interface MPOutlineViewController () {
@@ -25,11 +27,6 @@
@property (retain) MPOutlineViewDelegate *outlineDelegate;
@property (retain) NSMenu *menu;
- (void)_didUpdateData:(NSNotification *)notification;
- (NSMenu *)_contextMenu;
- (KdbGroup *)_clickedOrSelectedGroup;
@end
@implementation MPOutlineViewController
@@ -45,17 +42,6 @@
_bindingEstablished = NO;
_outlineDelegate = [[MPOutlineViewDelegate alloc] init];
_datasource = [[MPOutlineDataSource alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didUpdateData:)
name:MPDocumentDidAddGroupNotification
object:[[self windowController] document]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didUpdateData:)
name:MPDocumentWillDelteGroupNotification
object:[[self windowController] document]];
}
@@ -99,7 +85,7 @@
- (NSMenu *)_contextMenu {
NSMenu *menu = [[NSMenu alloc] init];
NSArray *items = [(MPAppDelegate *)[NSApp delegate] contextMenuItemsWithItems:MPContextMenuMinimal];
NSArray *items = [MPContextMenuHelper contextMenuItemsWithItems:MPContextMenuMinimal];
for(NSMenuItem *item in items) {
[menu addItem:item];
}
@@ -132,15 +118,13 @@
if(group) {
MPDocument *document = [[self windowController] document];
[document createEntry:group];
// Notify the the entry view about changes
}
}
- (void)deleteEntry:(id)sender {
KdbGroup *group = [self _clickedOrSelectedGroup];
if(group) {
MPDocument *document = [[self windowController] document];
[document deleteGroup:group];
if(group && group.parent) {
[group.parent removeGroupUndoable:group];
}
}
@@ -152,9 +136,4 @@
return [[self.outlineView itemAtRow:row] representedObject];
}
- (void)_didUpdateData:(NSNotification *)notification {
[self.outlineView reloadData];
}
@end