mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 20:32:43 +00:00
Added binary lookup to MPDocument
This commit is contained in:
@@ -90,7 +90,6 @@
|
||||
4C669B8A16760ED100DD0774 /* InputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B4716760ED100DD0774 /* InputStream.m */; };
|
||||
4C669B8B16760ED100DD0774 /* OutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B4916760ED100DD0774 /* OutputStream.m */; };
|
||||
4C669B8C16760ED100DD0774 /* Sha256OutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B4B16760ED100DD0774 /* Sha256OutputStream.m */; };
|
||||
4C669B8F16760ED100DD0774 /* DDXMLDocument+MKPAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B5216760ED100DD0774 /* DDXMLDocument+MKPAdditions.m */; };
|
||||
4C669B9016760ED100DD0774 /* DDXMLElement+MKPAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B5416760ED100DD0774 /* DDXMLElement+MKPAdditions.m */; };
|
||||
4C669B9116760ED100DD0774 /* Kdb.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B5616760ED100DD0774 /* Kdb.m */; };
|
||||
4C669B9316760ED100DD0774 /* Kdb3Node.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C669B5A16760ED100DD0774 /* Kdb3Node.m */; };
|
||||
@@ -334,8 +333,6 @@
|
||||
4C669B4916760ED100DD0774 /* OutputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OutputStream.m; sourceTree = "<group>"; };
|
||||
4C669B4A16760ED100DD0774 /* Sha256OutputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sha256OutputStream.h; sourceTree = "<group>"; };
|
||||
4C669B4B16760ED100DD0774 /* Sha256OutputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Sha256OutputStream.m; sourceTree = "<group>"; };
|
||||
4C669B5116760ED100DD0774 /* DDXMLDocument+MKPAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DDXMLDocument+MKPAdditions.h"; sourceTree = "<group>"; };
|
||||
4C669B5216760ED100DD0774 /* DDXMLDocument+MKPAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DDXMLDocument+MKPAdditions.m"; sourceTree = "<group>"; };
|
||||
4C669B5316760ED100DD0774 /* DDXMLElement+MKPAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DDXMLElement+MKPAdditions.h"; sourceTree = "<group>"; };
|
||||
4C669B5416760ED100DD0774 /* DDXMLElement+MKPAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "DDXMLElement+MKPAdditions.m"; sourceTree = "<group>"; };
|
||||
4C669B5516760ED100DD0774 /* Kdb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kdb.h; sourceTree = "<group>"; };
|
||||
@@ -694,6 +691,8 @@
|
||||
4C2724CB1778EF8E00FD8456 /* Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C669B5316760ED100DD0774 /* DDXMLElement+MKPAdditions.h */,
|
||||
4C669B5416760ED100DD0774 /* DDXMLElement+MKPAdditions.m */,
|
||||
4C2724CC1778EFB100FD8456 /* NSData+Random.h */,
|
||||
4C2724CD1778EFB100FD8456 /* NSData+Random.m */,
|
||||
4C2724CF1778EFE300FD8456 /* NSString+Empty.h */,
|
||||
@@ -862,10 +861,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C2724CB1778EF8E00FD8456 /* Categories */,
|
||||
4C669B5116760ED100DD0774 /* DDXMLDocument+MKPAdditions.h */,
|
||||
4C669B5216760ED100DD0774 /* DDXMLDocument+MKPAdditions.m */,
|
||||
4C669B5316760ED100DD0774 /* DDXMLElement+MKPAdditions.h */,
|
||||
4C669B5416760ED100DD0774 /* DDXMLElement+MKPAdditions.m */,
|
||||
4C669B5516760ED100DD0774 /* Kdb.h */,
|
||||
4C669B5616760ED100DD0774 /* Kdb.m */,
|
||||
4C669B5916760ED100DD0774 /* Kdb3Node.h */,
|
||||
@@ -1311,7 +1306,6 @@
|
||||
4C669B8A16760ED100DD0774 /* InputStream.m in Sources */,
|
||||
4C669B8B16760ED100DD0774 /* OutputStream.m in Sources */,
|
||||
4C669B8C16760ED100DD0774 /* Sha256OutputStream.m in Sources */,
|
||||
4C669B8F16760ED100DD0774 /* DDXMLDocument+MKPAdditions.m in Sources */,
|
||||
4C669B9016760ED100DD0774 /* DDXMLElement+MKPAdditions.m in Sources */,
|
||||
4C669B9116760ED100DD0774 /* Kdb.m in Sources */,
|
||||
4C669B9316760ED100DD0774 /* Kdb3Node.m in Sources */,
|
||||
|
||||
@@ -22,6 +22,8 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@class KdbEntry;
|
||||
@class KdbTree;
|
||||
@class UUID;
|
||||
@class Binary;
|
||||
@class BinaryRef;
|
||||
|
||||
@interface MPDocument : NSDocument
|
||||
|
||||
@@ -37,13 +39,21 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@property (nonatomic, retain) NSURL *key;
|
||||
@property (assign, readonly) MPDatabaseVersion version;
|
||||
|
||||
|
||||
- (id)initWithVersion:(MPDatabaseVersion)version;
|
||||
- (BOOL)decryptWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL;
|
||||
|
||||
/* Lookup */
|
||||
#pragma mark Data Lookup
|
||||
/*
|
||||
Returns the entry for the given UUID, nil if none was found
|
||||
*/
|
||||
- (KdbEntry *)findEntry:(UUID *)uuid;
|
||||
/*
|
||||
Return the Binary for the given BinaryRef. nil if none was found
|
||||
*/
|
||||
- (Binary *)binaryForRef:(BinaryRef *)binaryRef;
|
||||
|
||||
|
||||
#pragma mark Data Manipulation
|
||||
/* Undoable Intiialization of elements */
|
||||
- (KdbGroup *)createGroup:(KdbGroup *)parent;
|
||||
- (KdbEntry *)createEntry:(KdbGroup *)parent;
|
||||
|
||||
@@ -158,6 +158,19 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
return [self.root entryForUUID:uuid];
|
||||
}
|
||||
|
||||
- (Binary *)binaryForRef:(BinaryRef *)binaryRef {
|
||||
if(self.version != MPDatabaseVersion4) {
|
||||
return nil;
|
||||
}
|
||||
NSPredicate *filterPredicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
||||
Binary *binaryFile = evaluatedObject;
|
||||
return (binaryFile.binaryId == binaryRef.ref);
|
||||
}];
|
||||
Kdb4Tree *tree = (Kdb4Tree *)self.tree;
|
||||
NSArray *filteredBinary = [tree.binaries filteredArrayUsingPredicate:filterPredicate];
|
||||
return [filteredBinary lastObject];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Data manipulation
|
||||
- (KdbEntry *)createEntry:(KdbGroup *)parent {
|
||||
|
||||
@@ -300,14 +300,8 @@ enum {
|
||||
Kdb4Entry *entry = (Kdb4Entry *)self.selectedEntry;
|
||||
BinaryRef *binaryRef = entry.binaries[row];
|
||||
[[view textField] bind:NSValueBinding toObject:binaryRef withKeyPath:@"key" options:nil];
|
||||
MPDocument *document = [[self windowController] document];
|
||||
Kdb4Tree *tree = (Kdb4Tree *)document.tree;
|
||||
NSPredicate *filterPredicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
||||
Binary *binaryFile = evaluatedObject;
|
||||
return (binaryFile.binaryId == binaryRef.ref);
|
||||
}];
|
||||
NSArray *filteredBinary = [tree.binaries filteredArrayUsingPredicate:filterPredicate];
|
||||
Binary *attachedFile = [filteredBinary lastObject];
|
||||
// MPDocument *document = [[self windowController] document];
|
||||
// [document binaryForRef:binaryRef];
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1090</string>
|
||||
<string>1103</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Submodule MiniKeePassLib updated: 5bda74e608...c0d72eccd7
Reference in New Issue
Block a user