From 1f75722e67ee55734d9fc55b40337d5e91cd0ef8 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sat, 15 Mar 2014 22:16:56 +0100 Subject: [PATCH] Notes are now displayed in a split view inside the inspector --- HNHUi | 2 +- MacPass/Base.lproj/InspectorView.xib | 1470 ++++------------------ MacPass/EntryInspectorView.xib | 89 +- MacPass/GroupInspectorView.xib | 291 ++--- MacPass/MPEntryInspectorViewController.h | 1 - MacPass/MPEntryInspectorViewController.m | 4 - MacPass/MPEntryViewController.m | 2 +- MacPass/MPGroupInspectorViewController.h | 1 - MacPass/MPGroupInspectorViewController.m | 2 - MacPass/MPInspectorViewController.m | 32 +- MacPass/MPOutlineViewController.m | 2 +- 11 files changed, 405 insertions(+), 1491 deletions(-) diff --git a/HNHUi b/HNHUi index 05245dc6..90ff9d2e 160000 --- a/HNHUi +++ b/HNHUi @@ -1 +1 @@ -Subproject commit 05245dc6a68661199b1c43f677a600a7d519c607 +Subproject commit 90ff9d2e35a7abfc4ba8889a848f691e5af46709 diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index f68e8ad3..67d7a32a 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -1,1233 +1,237 @@ - - - - 1080 - 13B42 - 4514 - 1265 - 696.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 4514 - - - IBNSLayoutConstraint - NSButton - NSButtonCell - NSCustomObject - NSCustomView - NSImageCell - NSImageView - NSTabView - NSTabViewItem - NSTextField - NSTextFieldCell - NSView - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - MPInspectorViewController - - - FirstResponder - - - NSApplication - - - - 268 - - - - 268 - {{58, 409}, {202, 17}} - - - - _NS:1535 - {249, 750} - YES - - 67108928 - 272636224 - Label - - .LucidaGrandeUI - 13 - 1044 - - _NS:1535 - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - NO - 1 - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{20, 401}, {32, 32}} - - - - _NS:9 - YES - - 134217728 - 33554432 - - NSImage - NSActionTemplate - - _NS:9 - 0 - 3 - 0 - NO - - NO - YES - - - - 268 - - - - -2147483380 - {{134, 2}, {56, 25}} - - - - _NS:22 - YES - - -2080374784 - 134217728 - Cancel - - _NS:22 - - -2038153216 - 163 - - - 400 - 75 - - NO - - - - -2147483380 - {{198, 2}, {60, 25}} - - - _NS:22 - YES - - -2080374784 - 134217728 - Edit - - _NS:22 - - -2034483200 - 163 - - NSImage - 07_NotepadTemplate - - - - 400 - 75 - - NO - - - {278, 30} - - - - _NS:9 - HNHGradientView - - - - 268 - {{0, 30}, {278, 369}} - - - - _NS:9 - - - 2 - - - 274 - {278, 369} - - - _NS:28 - - Entry - - - - - 1 - - - 256 - - {278, 369} - _NS:11 - - Group - - - - - - - 256 - - - - 268 - {{77, 173}, {125, 24}} - - - _NS:1535 - YES - - 68157504 - 272630784 - No Selection - - LucidaGrande - 20 - 16 - - _NS:1535 - - - - 6 - System - controlShadowColor - - 3 - MC4zMzMzMzMzMzMzAA - - - - NO - 1 - - - {278, 369} - - - NoSelection - - - - - - - 6 - YES - YES - - - - - - {278, 443} - - - - _NS:9 - NSView - - - - - - - view - - - - 2976 - - - - noSelectionInfo - - - - 2993 - - - - tabView - - - - 2994 - - - - bottomBar - - - - 2995 - - - - itemImageView - - - - 3024 - - - - itemNameTextField - - - - 3025 - - - - showImagePopup: - - - - 3095 - - - - editButton - - - - 3122 - - - - cancelEditButton - - - - 3141 - - - - toggleEdit: - - - - 3143 - - - - toggleEdit: - - - - 3144 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 2894 - - - - - 4 - 0 - - 4 - 1 - - 0.0 - - 1000 - - 9 - 40 - 3 - NO - - - - 3 - 0 - - 4 - 1 - - 0.0 - - 1000 - - 9 - 40 - 3 - NO - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 0 - 29 - 3 - NO - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 0 - 29 - 3 - NO - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 9 - 40 - 3 - NO - - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 9 - 40 - 3 - NO - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - NO - - - - 3 - 0 - - 3 - 1 - - 44 - - 1000 - - 3 - 9 - 3 - NO - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 0 - 29 - 3 - NO - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 0 - 29 - 3 - NO - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 9 - 40 - 3 - NO - - - - 3 - 0 - - 3 - 1 - - 10 - - 1000 - - 3 - 9 - 3 - NO - - - - - - - - - - 2895 - - - - - - - - - - 2896 - - - - - - - - 2897 - - - - - - - - 2898 - - - - - 2899 - - - - - - 2925 - - - - - 2929 - - - - - 2930 - - - - - 5 - 0 - - 6 - 1 - - 8 - - 1000 - - 6 - 24 - 3 - NO - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - NO - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 23 - 3 - NO - - - - 11 - 0 - - 11 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - NO - - - - 8 - 0 - - 0 - 1 - - 30 - - 1000 - - 9 - 40 - 1 - NO - - - - - - - - 2946 - - - - - 2947 - - - - - 2949 - - - - - 2951 - - - - - 2953 - - - - - 2974 - - - - - - - - 2975 - - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - NO - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - NO - - - - - - - 2985 - - - - - - - - 2986 - - - - - 2998 - - - - - - 8 - 0 - - 0 - 1 - - 32 - - 1000 - - 3 - 9 - 1 - NO - - - - 7 - 0 - - 0 - 1 - - 32 - - 1000 - - 9 - 40 - 1 - NO - - - - - - 2999 - - - - - 3013 - - - - - - - - 3014 - - - - - 2991 - - - - - 3023 - - - - - 3027 - - - - - 3028 - - - - - 3068 - - - - - 3069 - - - - - 3072 - - - - - 3073 - - - - - 3076 - - - - - 3075 - - - - - 3109 - - - - - - - - 3110 - - - - - 3126 - - - - - - - - 3127 - - - - - 3129 - - - - - 3138 - - - - - 3139 - - - - - 3140 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - InitialTabViewItem - - InitialTabViewItem - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - MPPopupImageView - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 3144 - - - - - HNHGradientView - NSView - - IBProjectSource - ./Classes/HNHGradientView.h - - - - MPInspectorViewController - MPViewController - - id - id - - - - showImagePopup: - id - - - toggleEdit: - id - - - - HNHGradientView - NSButton - NSTextField - NSButton - MPPopupImageView - NSTextField - NSTextField - NSTextField - NSTabView - - - - bottomBar - HNHGradientView - - - cancelEditButton - NSButton - - - createdTextField - NSTextField - - - editButton - NSButton - - - itemImageView - MPPopupImageView - - - itemNameTextField - NSTextField - - - modifiedTextField - NSTextField - - - noSelectionInfo - NSTextField - - - tabView - NSTabView - - - - IBProjectSource - ./Classes/MPInspectorViewController.h - - - - MPPopupImageView - NSImageView - - IBProjectSource - ./Classes/MPPopupImageView.h - - - - MPViewController - NSViewController - - IBProjectSource - ./Classes/MPViewController.h - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - - 0 - IBCocoaFramework - YES - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - {16, 16} - {14, 14} - - YES - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MacPass/EntryInspectorView.xib b/MacPass/EntryInspectorView.xib index c7a1ab4e..1b87f516 100644 --- a/MacPass/EntryInspectorView.xib +++ b/MacPass/EntryInspectorView.xib @@ -1,8 +1,8 @@ - + - + @@ -19,7 +19,6 @@ - @@ -93,14 +92,14 @@ - + - + @@ -278,14 +277,14 @@ - + - + @@ -460,11 +459,11 @@ - + - + @@ -473,7 +472,7 @@ - + @@ -485,7 +484,7 @@ - + @@ -494,7 +493,7 @@ - + @@ -506,7 +505,7 @@ - + @@ -518,7 +517,7 @@ - + @@ -527,7 +526,7 @@ - + @@ -536,7 +535,7 @@ - + @@ -563,7 +561,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - \ No newline at end of file + diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index f31f4a54..53b9060d 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -24,7 +24,6 @@ @property (weak) IBOutlet NSSegmentedControl *infoTabControl; @property (weak) IBOutlet NSTableView *attachmentTableView; @property (weak) IBOutlet NSTableView *customFieldsTableView; -@property (unsafe_unretained) IBOutlet NSTextView *notesTextView; @property (weak) IBOutlet NSButton *generatePasswordButton; @property (weak) IBOutlet NSButton *togglePassword; diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 6d26f209..4f11bd7c 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -272,7 +272,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.passwordTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"password" options:nil]; [self.usernameTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"username" options:nil]; [self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:@"url" options:nil]; - [self.notesTextView bind:NSValueBinding toObject:self.entry withKeyPath:@"notes" options:nil]; [self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:@"expires" options:nil]; [self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:@"tags" options:nil]; } @@ -281,7 +280,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.passwordTextField unbind:NSValueBinding]; [self.usernameTextField unbind:NSValueBinding]; [self.URLTextField unbind:NSValueBinding]; - [self.notesTextView unbind:NSValueBinding]; [self.expiresCheckButton unbind:NSValueBinding]; } } @@ -338,8 +336,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [_createdTextField setEditable:edit]; [_createdTextField setSelectable:edit]; - [_notesTextView setEditable:edit]; - [_notesTextView setSelectable:edit]; [_modifiedTextField setEditable:edit]; [_modifiedTextField setSelectable:edit]; diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 6c89cd2a..dd8cd0d5 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -109,7 +109,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell"; - (void)didLoadView { [[self view] setWantsLayer:YES]; - [_bottomBar setBorderType:HNHBorderTop]; + [_bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight]; [self.addEntryButton setAction:[MPActionHelper actionOfType:MPActionAddEntry]]; [self.entryTable setDelegate:self]; diff --git a/MacPass/MPGroupInspectorViewController.h b/MacPass/MPGroupInspectorViewController.h index b520f7fe..ad482567 100644 --- a/MacPass/MPGroupInspectorViewController.h +++ b/MacPass/MPGroupInspectorViewController.h @@ -14,7 +14,6 @@ @property (strong) IBOutlet NSView *contentView; @property (weak) IBOutlet HNHRoundedTextField *titleTextField; -@property (unsafe_unretained) IBOutlet NSTextView *notesTextView; @property (weak) IBOutlet NSButton *expiresCheckButton; diff --git a/MacPass/MPGroupInspectorViewController.m b/MacPass/MPGroupInspectorViewController.m index 6287056a..92acb2d4 100644 --- a/MacPass/MPGroupInspectorViewController.m +++ b/MacPass/MPGroupInspectorViewController.m @@ -74,14 +74,12 @@ - (void)_updateBindings { if(self.group) { [self.titleTextField bind:NSValueBinding toObject:self.group withKeyPath:@"name" options:nil]; - [self.notesTextView bind:NSValueBinding toObject:self.group withKeyPath:@"notes" options:nil]; [self.expiresCheckButton bind:NSValueBinding toObject:self.group.timeInfo withKeyPath:@"expires" options:nil]; [self.autotypePopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:@"isAutoTypeEnabled" options:nil]; [self.searchPopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:@"isSearchEnabled" options:nil]; } else { [self.titleTextField unbind:NSValueBinding]; - [self.notesTextView unbind:NSValueBinding]; [self.expiresCheckButton unbind:NSValueBinding]; [self.autotypePopupButton unbind:NSSelectedTagBinding]; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index 904d36de..0f3ad071 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -15,6 +15,7 @@ #import "MPIconSelectViewController.h" #import "NSDate+Humanized.h" +#import "KPKNode+IconImage.h" #import "KPKTree.h" #import "KPKMetaData.h" @@ -44,6 +45,10 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { @property (nonatomic, assign) NSUInteger activeTab; @property (weak) IBOutlet NSTabView *tabView; +@property (weak) IBOutlet NSSplitView *splitView; +@property (weak) IBOutlet NSTextField *notesHeaderTextField; +@property (weak) IBOutlet HNHGradientView *notesHeaderGradientView; +@property (unsafe_unretained) IBOutlet NSTextView *notesTextView; @end @@ -79,8 +84,11 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } } -- (void)didLoadView { - [_bottomBar setBorderType:HNHBorderTop]; +- (void)awakeFromNib { + [self.bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight]; + [self.notesHeaderGradientView setBorderType:HNHBorderBottom|HNHBorderHighlight]; + [[self.notesHeaderTextField cell] setBackgroundStyle:NSBackgroundStyleRaised]; + [[self.noSelectionInfo cell] setBackgroundStyle:NSBackgroundStyleRaised]; [[self.itemImageView cell] setBackgroundStyle:NSBackgroundStyleRaised]; [self.tabView bind:NSSelectedIndexBinding toObject:self withKeyPath:@"activeTab" options:nil]; @@ -102,11 +110,14 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { [_groupViewController updateResponderChain]; [_entryViewController updateResponderChain]; - [[self view] layoutSubtreeIfNeeded]; - + [[self view] layout]; [self _updateBindings:nil]; } +- (void)didLoadView { + +} + - (void)regsiterNotificationsForDocument:(MPDocument *)document { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeCurrentItem:) @@ -225,17 +236,20 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { [self.itemNameTextField setHidden:YES]; [self.itemImageView unbind:NSValueBinding]; [self.itemImageView setHidden:YES]; + [self.notesTextView unbind:NSValueBinding]; + [self.notesTextView setString:@""]; + [self.notesTextView setEditable:NO]; return; } - - [self.itemImageView bind:NSValueBinding toObject:item withKeyPath:@"iconImage" options:nil]; - + [self.itemImageView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(iconImage)) options:nil]; + [self.notesTextView setEditable:YES]; + [self.notesTextView bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(notes)) options:nil]; if([item respondsToSelector:@selector(title)]) { - [self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:@"title" options:nil]; + [self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(title)) options:nil]; } else if( [item respondsToSelector:@selector(name)]) { - [self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:@"name" options:nil]; + [self.itemNameTextField bind:NSValueBinding toObject:item withKeyPath:NSStringFromSelector(@selector(name)) options:nil]; } [self.itemImageView setHidden:NO]; [self.itemNameTextField setHidden:NO]; diff --git a/MacPass/MPOutlineViewController.m b/MacPass/MPOutlineViewController.m index e28aa75b..16586280 100644 --- a/MacPass/MPOutlineViewController.m +++ b/MacPass/MPOutlineViewController.m @@ -75,7 +75,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; [_outlineView setFloatsGroupRows:NO]; [_outlineView registerForDraggedTypes:@[ KPKGroupUTI, KPKEntryUTI ]]; [_outlineView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES]; - [_bottomBar setBorderType:HNHBorderTop]; + [_bottomBar setBorderType:HNHBorderTop|HNHBorderHighlight]; [_addGroupButton setAction:[MPActionHelper actionOfType:MPActionAddGroup]]; [[NSNotificationCenter defaultCenter] addObserver:self