mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 21:42:32 +00:00
adoptin new KeePassKit API
This commit is contained in:
2
Cartfile
2
Cartfile
@@ -1,3 +1,3 @@
|
||||
github "sparkle-project/Sparkle" ~> 1.13.1
|
||||
github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd"
|
||||
github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453"
|
||||
github "mstarke/HNHUi" ~> 1.1
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
github "mstarke/HNHUi" "1.1"
|
||||
github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd"
|
||||
github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453"
|
||||
github "sparkle-project/Sparkle" "1.14.0"
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
}
|
||||
|
||||
- (NSString *)typeForData:(NSData *)data {
|
||||
KPKFileInfo fileInfo = [self fileInfoForData:data];
|
||||
return [self _typeToUTIdictionary][@(fileInfo.format)];
|
||||
KPKFileVersion fileVersion = [self fileVersionForData:data];
|
||||
return [self _typeToUTIdictionary][@(fileVersion.format)];
|
||||
}
|
||||
|
||||
- (NSString *)typeForContentOfURL:(NSURL *)url {
|
||||
|
||||
@@ -78,7 +78,7 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey;
|
||||
@property (nonatomic, strong, readonly) KPKCompositeKey *compositeKey;
|
||||
|
||||
@property (assign, readonly, getter = isReadOnly) BOOL readOnly;
|
||||
@property (nonatomic, readonly, assign) KPKDatabaseFormat versionForFileType;
|
||||
@property (nonatomic, readonly, assign) KPKDatabaseFormat formatForFileType;
|
||||
|
||||
/*
|
||||
State (active group/entry)
|
||||
|
||||
@@ -89,7 +89,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
return [NSSet setWithObject:NSStringFromSelector(@selector(tree))];
|
||||
}
|
||||
|
||||
+ (KPKDatabaseFormat)versionForFileType:(NSString *)fileType {
|
||||
+ (KPKDatabaseFormat)formatForFileType:(NSString *)fileType {
|
||||
if( NSOrderedSame == [fileType compare:MPKdbDocumentUTI options:NSCaseInsensitiveSearch]) {
|
||||
return KPKDatabaseFormatKdb;
|
||||
}
|
||||
@@ -408,8 +408,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
|
||||
}
|
||||
|
||||
#pragma mark Properties
|
||||
- (KPKDatabaseFormat)versionForFileType {
|
||||
return [[self class] versionForFileType:self.fileType];
|
||||
- (KPKDatabaseFormat)formatForFileType {
|
||||
return [self.class versionForFileType:self.fileType];
|
||||
}
|
||||
|
||||
- (BOOL)encrypted {
|
||||
|
||||
@@ -199,7 +199,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
|
||||
NSString *fileType = document.fileType;
|
||||
/* we did open as legacy */
|
||||
if([fileType isEqualToString:MPKdbDocumentUTI]) {
|
||||
if(document.tree.minimumFormat != KPKDatabaseFormatKdb) {
|
||||
if(document.tree.minimumVersion.format != KPKDatabaseFormatKdb) {
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.messageText = NSLocalizedString(@"WARNING_ON_LOSSY_SAVE", "");
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
- (IBAction)generateKey:(id)sender {
|
||||
MPDocument *document = self.document;
|
||||
NSData *data = [NSData generateKeyfiledataForVersion:document.tree.minimumFormat];
|
||||
NSData *data = [NSData generateKeyfiledataForFormat:document.tree.minimumVersion.format];
|
||||
if(data) {
|
||||
NSSavePanel *savePanel = [NSSavePanel savePanel];
|
||||
savePanel.allowedFileTypes = @[@"key", @"xml"];
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
*/
|
||||
NSView *view = self.view;
|
||||
NSAssert(view != nil, @"View has to be loaded at this point");
|
||||
switch(self.document.versionForFileType) {
|
||||
switch(self.document.formatForFileType) {
|
||||
case KPKDatabaseFormatKdb:
|
||||
[self.fileTypePopupButton selectItemAtIndex:1];
|
||||
break;
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
- (void)_updateNote {
|
||||
NSString *uti = self.fileTypePopupButton.selectedItem.representedObject;
|
||||
BOOL showInfoText = (self.document.tree.minimumFormat == KPKDatabaseFormatKdbx && [uti isEqualToString:MPKdbDocumentUTI]);
|
||||
BOOL showInfoText = (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx && [uti isEqualToString:MPKdbDocumentUTI]);
|
||||
self.infoTextField.hidden = !showInfoText;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user