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