diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index fe7fbda8..1fab3a23 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -1177,7 +1177,6 @@ 4C6AEF041A0441F800CA2420 /* AccessoryViews */ = { isa = PBXGroup; children = ( - 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */, 4C6AEF021A04400E00CA2420 /* OpenPanelAccessoryView.xib */, ); name = AccessoryViews; @@ -1357,6 +1356,7 @@ 6021FE7918E15FF300C3BC51 /* DatePickingView.xib */, 4C0F647917B6BC9C00D9522A /* MPSavePanelAccessoryViewController.h */, 4C0F647A17B6BC9C00D9522A /* MPSavePanelAccessoryViewController.m */, + 4C0728BE17B68ED0005A7DD9 /* SavePanelAccessoryView.xib */, 4C1E9883185F71A800943563 /* MPContextBarViewController.h */, 4C1E9884185F71A800943563 /* MPContextBarViewController.m */, 4C3FFD9D16DAF60600DF9186 /* ContextBar.xib */, diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 214ec6ae..05a70351 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -258,7 +258,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou } - (NSString *)fileTypeFromLastRunSavePanel { - /* TODO evaluate if this is still necessary! */ if(self.savePanelViewController) { return [self.class fileTypeForVersion:self.savePanelViewController.selectedVersion]; } diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 8aef2470..c784d139 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -210,9 +210,10 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); #pragma mark Actions - (void)saveDocument:(id)sender { MPDocument *document = self.document; + /* did we open as legacy ? + NSString *fileType = document.fileType; - /* we did open as legacy */ - if([fileType isEqualToString:MPKdbDocumentUTI]) { + if([fileType isEqualToString:MPKdbxDocumentUTI]) { if(document.tree.minimumVersion.format != KPKDatabaseFormatKdb) { NSAlert *alert = [[NSAlert alloc] init]; alert.alertStyle = NSWarningAlertStyle; @@ -225,7 +226,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); [alert beginSheetModalForWindow:((NSDocument *)self.document).windowForSheet completionHandler:^(NSModalResponse returnCode) { switch(returnCode) { case NSAlertFirstButtonReturn: - /* Save lossy */ + // save lossy [self.document saveDocument:nil]; return; @@ -242,21 +243,19 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); return; } } - else if(!document.compositeKey) { - __weak MPDocument *weakDocument = self.document; - + else*/ + if(!document.compositeKey) { [self editPasswordWithCompetionHandler:^(NSInteger result) { if(result == NSModalResponseOK) { - [weakDocument saveDocument:sender]; + [self saveDocument:sender]; } }]; return; } else if(document.shouldEnforcePasswordChange) { - __weak MPDocument *weakDocument = [self document]; [self editPasswordWithCompetionHandler:^(NSInteger result) { if(result == NSModalResponseOK) { - [weakDocument saveDocument:sender]; + [self saveDocument:sender]; } }]; [self _presentPasswordIntervalAlerts]; @@ -272,10 +271,9 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); return; } /* we need to make sure that a password is set */ - __weak MPDocument *weakDocument = self.document; [self editPasswordWithCompetionHandler:^(NSInteger result) { if(result == NSModalResponseOK) { - [weakDocument saveDocumentAs:sender]; + [self saveDocumentAs:sender]; } }]; } diff --git a/MacPass/MPSavePanelAccessoryViewController.m b/MacPass/MPSavePanelAccessoryViewController.m index 9613a070..30102b32 100644 --- a/MacPass/MPSavePanelAccessoryViewController.m +++ b/MacPass/MPSavePanelAccessoryViewController.m @@ -96,7 +96,7 @@ - (void)_updateNote { NSString *uti = self.fileTypePopupButton.selectedItem.representedObject; - BOOL showInfoText = (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx && [uti isEqualToString:MPKdbDocumentUTI]); + BOOL showInfoText = [uti isEqualToString:MPKdbDocumentUTI] && (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx) && [self.document.fileType isEqualToString:MPKdbxDocumentUTI]; self.infoTextField.hidden = !showInfoText; }