mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 06:49:32 +00:00
Using current KeePassKit. Adopted API changes
This commit is contained in:
@@ -299,6 +299,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL error:(NSError *__autoreleasing*)error{
|
||||
self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password key:keyFileURL];
|
||||
self.tree = [[KPKTree alloc] initWithData:self.encryptedData password:self.compositeKey error:error];
|
||||
/* clear out the encrypted data as we do not need it for now */
|
||||
self.encryptedData = nil;
|
||||
|
||||
BOOL isUnlocked = (nil != self.tree);
|
||||
if(isUnlocked) {
|
||||
@@ -356,7 +358,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
}
|
||||
|
||||
- (BOOL)encrypted {
|
||||
return (self.tree == nil);
|
||||
/* we have an encrypted document if there's data loaded but no tree set */
|
||||
return (nil != self.encryptedData && self.tree == nil);
|
||||
}
|
||||
|
||||
- (KPKGroup *)root {
|
||||
|
||||
@@ -382,7 +382,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
[self.URLTextField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(url)) options:nil];
|
||||
[self.expiresCheckButton bind:NSTitleBinding
|
||||
toObject:self.entry.timeInfo
|
||||
withKeyPath:NSStringFromSelector(@selector(expiryTime))
|
||||
withKeyPath:NSStringFromSelector(@selector(expirationDate))
|
||||
options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
||||
[self.expiresCheckButton bind:NSValueBinding toObject:self.entry.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
|
||||
[self.tagsTokenField bind:NSValueBinding toObject:self.entry withKeyPath:NSStringFromSelector(@selector(tags)) options:nil];
|
||||
|
||||
@@ -101,7 +101,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
||||
+ (NSString *)timeInfoModificationTimeKeyPath {
|
||||
static NSString *timeInfoModificationTimeKeyPath;
|
||||
if(nil == timeInfoModificationTimeKeyPath) {
|
||||
timeInfoModificationTimeKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(lastModificationTime))];
|
||||
timeInfoModificationTimeKeyPath = [[NSString alloc] initWithFormat:@"%@.%@", NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(modificationDate))];
|
||||
}
|
||||
return timeInfoModificationTimeKeyPath;
|
||||
}
|
||||
@@ -320,7 +320,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
||||
NSString *modificatoinTimeKeyPath = [NSString stringWithFormat:@"%@.%@.%@",
|
||||
NSStringFromSelector(@selector(objectValue)),
|
||||
NSStringFromSelector(@selector(timeInfo)),
|
||||
NSStringFromSelector(@selector(lastModificationTime))];
|
||||
NSStringFromSelector(@selector(modificationDate))];
|
||||
|
||||
[view.textField bind:NSValueBinding toObject:view withKeyPath:modificatoinTimeKeyPath options:nil];
|
||||
return view;
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
if(self.group) {
|
||||
[self.titleTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(name)) options:nil];
|
||||
[self.expiresCheckButton bind:NSValueBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
|
||||
[self.expiresCheckButton bind:NSTitleBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expiryTime)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
||||
[self.expiresCheckButton bind:NSTitleBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expirationDate)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
||||
[self.autotypePopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isAutoTypeEnabled)) options:nil];
|
||||
[self.autotypeSequenceTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(defaultAutoTypeSequence)) options:nil];
|
||||
[self.searchPopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isSearchEnabled)) options:nil];
|
||||
|
||||
@@ -224,8 +224,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
MPDatePickingViewController *controller = [[MPDatePickingViewController alloc] init];
|
||||
controller.popover = self.popover;
|
||||
MPDocument *document = self.windowController.document;
|
||||
if(document.selectedItem.timeInfo.expiryTime) {
|
||||
controller.date = document.selectedItem.timeInfo.expiryTime;
|
||||
if(document.selectedItem.timeInfo.expirationDate) {
|
||||
controller.date = document.selectedItem.timeInfo.expirationDate;
|
||||
}
|
||||
self.popover.contentViewController = controller;
|
||||
[self.popover showRelativeToRect:NSZeroRect ofView:sender preferredEdge:NSMinYEdge];
|
||||
@@ -267,7 +267,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
|
||||
|
||||
- (void)_setExpiryDate:(NSDate *)date {
|
||||
MPDocument *document = [[self windowController] document];
|
||||
document.selectedItem.timeInfo.expiryTime = date;
|
||||
document.selectedItem.timeInfo.expirationDate = date;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
Reference in New Issue
Block a user