adoptin new KeePassKit API

This commit is contained in:
michael starke
2016-12-02 15:43:24 +01:00
parent 66aa2aab79
commit e9563f3f67
8 changed files with 12 additions and 12 deletions

View File

@@ -1,3 +1,3 @@
github "sparkle-project/Sparkle" ~> 1.13.1
github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd"
github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453"
github "mstarke/HNHUi" ~> 1.1

View File

@@ -1,3 +1,3 @@
github "mstarke/HNHUi" "1.1"
github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd"
github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453"
github "sparkle-project/Sparkle" "1.14.0"

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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", "");

View File

@@ -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"];

View File

@@ -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;
}