From 58df7fe7c6cc24d14aa6b320da91b488acaef9ca Mon Sep 17 00:00:00 2001 From: michael starke Date: Thu, 13 Oct 2016 14:18:31 +0200 Subject: [PATCH] fixed #505 for good fixed typo for locking switched to notifications on locking to prevent UI changes on failure --- MacPass/MPDocument.m | 2 +- MacPass/MPDocumentWindowController.m | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 46525b54..3abcb399 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -334,7 +334,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou if(self != document) { return; // wrong parameters } - if(didSave) { + if(!didSave) { return; // not saved! } /* FIXME: User feedback is ignored */ diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 4b58b6d2..7f675f0b 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -91,6 +91,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didUnlockDatabase:) name:MPDocumentDidUnlockDatabaseNotification object:document]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddEntry:) name:MPDocumentDidAddEntryNotification object:document]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didLockDatabase:) name:MPDocumentDidLockDatabaseNotification object:document]; [self.entryViewController regsiterNotificationsForDocument:document]; [self.inspectorViewController registerNotificationsForDocument:document]; @@ -181,12 +182,17 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); [self showInspector:self]; } +- (void)_didLockDatabase:(NSNotification *)notification { + [self showPasswordInput]; +} + - (void)_didUnlockDatabase:(NSNotification *)notification { [self showEntries]; /* Show password reminders */ [self _presentPasswordIntervalAlerts]; } + #pragma mark Actions - (void)saveDocument:(id)sender { MPDocument *document = self.document; @@ -345,7 +351,6 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); if(document.encrypted) { return; // Document already locked } - [self showPasswordInput]; [document lockDatabase:sender]; }