mirror of
https://github.com/MacPass/MacPass.git
synced 2026-01-30 12:08:20 +00:00
Fixed save issue that resulted in appkit throwing an error because of atomic write option
Fixed issue with wrong file type being selected in save dialog Fixed issue with hidden warning box on save dialog when data loss will occur
This commit is contained in:
@@ -42,7 +42,7 @@ APPKIT_EXTERN NSString *const MPDocumnetDidChangeCurrentEntryNotification;
|
|||||||
@property (nonatomic, strong) NSURL *key;
|
@property (nonatomic, strong) NSURL *key;
|
||||||
|
|
||||||
@property (assign, readonly, getter = isReadOnly) BOOL readOnly;
|
@property (assign, readonly, getter = isReadOnly) BOOL readOnly;
|
||||||
|
@property (nonatomic, readonly, assign) KPKVersion versionForFileType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
State (active group/entry)
|
State (active group/entry)
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
|
|||||||
_didLockFile = NO;
|
_didLockFile = NO;
|
||||||
_hasPasswordOrKey = NO;
|
_hasPasswordOrKey = NO;
|
||||||
_readOnly = NO;
|
_readOnly = NO;
|
||||||
[self setFileType:MPXMLDocumentUTI];
|
|
||||||
self.tree = [KPKTree templateTree];
|
self.tree = [KPKTree templateTree];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -113,7 +112,7 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
NSData *treeData = [self.tree encryptWithPassword:password forVersion:version error:outError];
|
NSData *treeData = [self.tree encryptWithPassword:password forVersion:version error:outError];
|
||||||
if([treeData writeToURL:url options:NSDataWritingAtomic error:outError]) {
|
if(![treeData writeToURL:url options:0 error:outError]) {
|
||||||
NSLog(@"%@", [*outError localizedDescription]);
|
NSLog(@"%@", [*outError localizedDescription]);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@@ -208,6 +207,10 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
|
|||||||
|
|
||||||
#pragma mark Properties
|
#pragma mark Properties
|
||||||
|
|
||||||
|
- (KPKVersion)versionForFileType {
|
||||||
|
return [[self class] versionForFileType:[self fileType]];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)encrypted {
|
- (BOOL)encrypted {
|
||||||
return (self.tree == nil);
|
return (self.tree == nil);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,7 @@
|
|||||||
else if([uti isEqualToString:MPLegacyDocumentUTI]) {
|
else if([uti isEqualToString:MPLegacyDocumentUTI]) {
|
||||||
self.selectedVersion = KPKXmlVersion;
|
self.selectedVersion = KPKXmlVersion;
|
||||||
}
|
}
|
||||||
BOOL showInfoText = (self.document.tree.minimumVersion == KPKLegacyVersion && [uti isEqualToString:MPLegacyDocumentUTI]);
|
[self _updateNote];
|
||||||
[self.infoTextField setHidden:!showInfoText];
|
|
||||||
[self.savePanel setAllowedFileTypes:@[uti]];
|
[self.savePanel setAllowedFileTypes:@[uti]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)_updateView {
|
- (void)_updateView {
|
||||||
switch(self.document.tree.minimumVersion) {
|
switch(self.document.versionForFileType) {
|
||||||
case KPKLegacyVersion:
|
case KPKLegacyVersion:
|
||||||
[self.fileTypePopupButton selectItemAtIndex:1];
|
[self.fileTypePopupButton selectItemAtIndex:1];
|
||||||
break;
|
break;
|
||||||
@@ -76,6 +75,13 @@
|
|||||||
NSAssert(NO, @"Minimum Version should always be valid");
|
NSAssert(NO, @"Minimum Version should always be valid");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[self _updateNote];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_updateNote {
|
||||||
|
NSString *uti = [[self.fileTypePopupButton selectedItem] representedObject];
|
||||||
|
BOOL showInfoText = (self.document.tree.minimumVersion == KPKXmlVersion && [uti isEqualToString:MPLegacyDocumentUTI]);
|
||||||
|
[self.infoTextField setHidden:!showInfoText];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2527</string>
|
<string>2528</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user