diff --git a/MacPass/ContextBar.xib b/MacPass/ContextBar.xib index 8ddaca78..cfad5c3d 100644 --- a/MacPass/ContextBar.xib +++ b/MacPass/ContextBar.xib @@ -200,7 +200,7 @@ - + diff --git a/MacPass/MPActionHelper.h b/MacPass/MPActionHelper.h index fd92f274..822e868a 100644 --- a/MacPass/MPActionHelper.h +++ b/MacPass/MPActionHelper.h @@ -14,6 +14,7 @@ typedef NS_ENUM(NSUInteger, MPActionType) { MPActionAddGroup, // Add a new group MPActionDuplicateEntry, // Simply duplicate an entry (including history) MPActionDuplicateEntryWithOptions, // Request user input on what to duplicate + MPActionReverToHistoryEntry, // Restore an entry to an older state in history MPActionDelete, // Delete entry or group MPActionCopyUsername, // copy username to pasteboard MPActionCopyPassword, // copy password to pasteboard diff --git a/MacPass/MPActionHelper.m b/MacPass/MPActionHelper.m index bd37dafa..18711830 100644 --- a/MacPass/MPActionHelper.m +++ b/MacPass/MPActionHelper.m @@ -23,6 +23,7 @@ @(MPActionAddGroup): NSStringFromSelector(@selector(createGroup:)), @(MPActionDuplicateEntry): NSStringFromSelector(@selector(duplicateEntry:)), @(MPActionDuplicateEntryWithOptions): NSStringFromSelector(@selector(duplicateEntryWithOptions:)), + @(MPActionReverToHistoryEntry): NSStringFromSelector(@selector(revertToHistoryEntry::)), @(MPActionCopyPassword): NSStringFromSelector(@selector(copyPassword:)), @(MPActionCopyURL): NSStringFromSelector(@selector(copyURL:)), @(MPActionCopyUsername): NSStringFromSelector(@selector(copyUsername:)), diff --git a/MacPass/MPDocument+History.m b/MacPass/MPDocument+History.m index ba3ee1f0..24a0f9a9 100644 --- a/MacPass/MPDocument+History.m +++ b/MacPass/MPDocument+History.m @@ -32,7 +32,7 @@ NSString *const MPDocumentHideEntryHistoryNotification = @"MPDocumentHideEntryH object:self]; } -- (void)restoreEntry:(KPKEntry *)entry toEntry:(KPKEntry *)historyEntry { +- (void)revertEntry:(KPKEntry *)entry toEntry:(KPKEntry *)historyEntry { [entry revertToEntry:historyEntry]; [self.undoManager setActionName:NSLocalizedString(@"RESTORE_HISTORY_ENTRY", "Action to restore and Entry to a previous state of it's history")]; } diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index beb2955d..37f4c18e 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -233,6 +233,7 @@ FOUNDATION_EXPORT NSString *const MPDocumentHideEntryHistoryNotification; - (IBAction)showEntryHistory:(id)sender; - (IBAction)hideEntryHistory:(id)sender; +- (IBAction)revertEntry:(KPKEntry *)entry toEntry:(KPKEntry *)historyEntry; @end diff --git a/MacPass/MPEntryViewController.h b/MacPass/MPEntryViewController.h index e03077dd..e08befe6 100644 --- a/MacPass/MPEntryViewController.h +++ b/MacPass/MPEntryViewController.h @@ -39,11 +39,15 @@ typedef NS_ENUM(NSUInteger, MPDisplayMode) { - (void)registerNotificationsForDocument:(MPDocument *)document; /* Copy/Paste */ -- (void)copyUsername:(id)sender; -- (void)copyPassword:(id)sender; -- (void)copyCustomAttribute:(id)sender; -- (void)copyURL:(id)sender; -- (void)openURL:(id)sender; +- (IBAction)copyUsername:(id)sender; +- (IBAction)copyPassword:(id)sender; +- (IBAction)copyCustomAttribute:(id)sender; +- (IBAction)copyURL:(id)sender; +- (IBAction)openURL:(id)sender; + +/* More Actions */ +- (IBAction)delete:(id)sender; +- (IBAction)revertToHistoryEntry:(id)sender; @end diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index 2bd6ceea..618ce8c0 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -730,6 +730,14 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; } } +- (void)revertToHistoryEntry:(id)sender { + MPDocument *document = self.windowController.document; + NSArray *historyEntries = [self currentTargetEntries]; + if(historyEntries.count != 1) { + return; + } + //[document restoreEntry:entry toEntry:historyEntries.firstObject]; +} - (void)_columnDoubleClick:(id)sender { if(0 == [[self.entryArrayController arrangedObjects] count]) {