Improved "Add Entry" workflow (issue #156)

- New entry is automatically scrolled to and selected
- Title textfield is automatically focused
- Pre-generate a password using the deault password creation settings
This commit is contained in:
James Hurst
2014-08-05 20:46:42 -04:00
parent 6ddce76b0d
commit 5ff911b824
6 changed files with 56 additions and 1 deletions

View File

@@ -206,6 +206,11 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
name:MPDocumentCurrentItemChangedNotification
object:document];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didAddItem:)
name:MPDocumentItemAddedNotification
object:document];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didEnterSearch:)
name:MPDocumentDidEnterSearchNotification
@@ -221,7 +226,6 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
name:MPDocumentDidChangeSearchResults
object:document];
[self.contextBarViewController registerNotificationsForDocument:document];
/* Setup warning message at the bottom*/
@@ -371,6 +375,13 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
}
}
- (void)_didAddItem:(NSNotification *)notification {
MPDocument *document = [[self windowController] document];
NSInteger row = document.selectedGroup.entries.count - 1;
[self.entryTable scrollRowToVisible:row];
[self.entryTable selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
}
- (void)_didUpdateSearchResults:(NSNotification *)notification {
[self _showContextBar];
NSArray *result = [notification userInfo][kMPDocumentSearchResultsKey];