mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 07:59:27 +00:00
Refacoted window and view controller to use windowNibName and nibName. Fixes #164
This commit is contained in:
@@ -48,8 +48,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
@implementation MPOutlineViewController
|
||||
|
||||
- (id)init {
|
||||
return [[MPOutlineViewController alloc] initWithNibName:@"OutlineView" bundle:nil];
|
||||
- (NSString *)nibName {
|
||||
return @"OutlineView";
|
||||
}
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
@@ -78,6 +78,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
[self.outlineView setFloatsGroupRows:NO];
|
||||
[self.outlineView registerForDraggedTypes:@[ KPKGroupUTI, KPKEntryUTI ]];
|
||||
[self.outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
|
||||
[self.outlineView setDoubleAction:@selector(_doubleClickedGroup:)];
|
||||
[self.bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight];
|
||||
[self.addGroupButton setAction:[MPActionHelper actionOfType:MPActionAddGroup]];
|
||||
|
||||
@@ -140,7 +141,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
#pragma mark Notifications
|
||||
- (void)regsiterNotificationsForDocument:(MPDocument *)document {
|
||||
// Nothing to do anymore
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document];
|
||||
}
|
||||
|
||||
- (void)clearSelection {
|
||||
@@ -156,6 +157,11 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
document.selectedItem = document.selectedGroup;
|
||||
}
|
||||
|
||||
# pragma mark MPDocument Notifications
|
||||
- (void)_didAddGroup:(NSNotification *)notification {
|
||||
//TODO: find group to expand!
|
||||
}
|
||||
|
||||
- (id)itemUnderMouse {
|
||||
NSPoint mouseLocation = [[self.outlineView window] mouseLocationOutsideOfEventStream];
|
||||
NSPoint localPoint = [self.outlineView convertPoint:mouseLocation fromView:[[self.outlineView window] contentView]];
|
||||
@@ -187,6 +193,10 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
[[[self windowController] document] deleteGroup:[self _clickedOrSelectedGroup]];
|
||||
}
|
||||
|
||||
- (void)_doubleClickedGroup:(id)sender {
|
||||
[[self windowController] showInspector:sender];
|
||||
}
|
||||
|
||||
#pragma mark NSOutlineViewDelegate
|
||||
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
||||
NSTableCellView *view;
|
||||
|
||||
Reference in New Issue
Block a user