mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 16:29:23 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user