diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index 43602a55..d4fc2b15 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -2,10 +2,10 @@ 1080 - 13A603 + 13B42 4514 1265 - 695.00 + 696.00 com.apple.InterfaceBuilder.CocoaPlugin 4514 @@ -328,6 +328,14 @@ 3122 + + + handleEditButtonClickEvent: + + + + 3125 + @@ -988,7 +996,7 @@ - 3123 + 3125 @@ -1003,17 +1011,20 @@ MPInspectorViewController MPViewController - - showImagePopup: - id - - - showImagePopup: - + + id + id + + + + handleEditButtonClickEvent: + id + + showImagePopup: id - + HNHGradientView NSTextField diff --git a/MacPass/MPEntryInspectorViewController.h b/MacPass/MPEntryInspectorViewController.h index 77f41f2d..8e827b58 100644 --- a/MacPass/MPEntryInspectorViewController.h +++ b/MacPass/MPEntryInspectorViewController.h @@ -44,6 +44,7 @@ - (IBAction)addCustomField:(id)sender; - (IBAction)removeCustomField:(id)sender; - +- (void)beginEditing; +- (void)endEditing; @end diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 9f364fbc..94941439 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -184,6 +184,39 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { [self.entry removeBinary:binary]; } +// CS: could there be a better way? +- (void)beginEditing +{ + NSLog(@"beganEditing:"); + + _titleTextField.editable = YES; + _usernameTextField.editable = YES; + _URLTextField.editable = YES; + _passwordTextField.editable = YES; + + _createdTextField.editable = YES; + _modifiedTextField.editable = YES; + + _notesTextView.editable = YES; + +} + +// CS: could there be a better way? +- (void)endEditing +{ + NSLog(@"endEditing"); + _titleTextField.editable = NO; + _usernameTextField.editable = NO; + _URLTextField.editable = NO; + _passwordTextField.editable = NO; + + _createdTextField.editable = NO; + _modifiedTextField.editable = NO; + + _notesTextView.editable = NO; +} + + #pragma mark - #pragma mark Popovers diff --git a/MacPass/MPInspectorViewController.h b/MacPass/MPInspectorViewController.h index c447829b..668ed392 100644 --- a/MacPass/MPInspectorViewController.h +++ b/MacPass/MPInspectorViewController.h @@ -22,6 +22,7 @@ @property (weak) IBOutlet NSButton *editButton; - (IBAction)showImagePopup:(id)sender; +- (IBAction)handleEditButtonClickEvent:(id)sender; /* Seperate call to ensure alle registered objects are in place */ - (void)setupNotifications:(NSWindowController *)windowController; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index 9e50fcc9..c1e89498 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -156,6 +156,28 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } +#pragma mark - +#pragma mark Click Edit Button + +// button title can be used as a status indicator +- (IBAction)handleEditButtonClickEvent:(id)sender +{ + NSString *buttonTitle; + + buttonTitle = self.editButton.title; + + if ([buttonTitle isEqualToString:@"Edit"]) { + NSLog(@"begin editing"); + [_entryViewController beginEditing]; + self.editButton.title = @"Done"; + } + else if ([buttonTitle isEqualToString:@"Done"]) { + NSLog(@"finished editing"); + [_entryViewController endEditing]; + self.editButton.title = @"Edit"; + } +} + #pragma mark - #pragma mark Popup - (IBAction)showImagePopup:(id)sender { @@ -246,5 +268,9 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } } [self _updateItemBindings:document.selectedItem]; + + // disable the entry text fields whenever the entry selection changes + [_entryViewController endEditing]; + self.editButton.title = @"Edit"; } @end \ No newline at end of file