Added a default Database name

Minor changes
Updtaed KeePassLib
This commit is contained in:
michael starke
2013-07-05 16:37:35 +02:00
parent 59db224a35
commit 7feb2517dd
10 changed files with 81 additions and 4 deletions

View File

@@ -185,6 +185,7 @@
4CE5B54B173AFBA700207B39 /* MPDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE5B549173AFBA700207B39 /* MPDocument.m */; };
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; };
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; };
4CF1F0CA1786B37900CD920E /* NSData+Gzip.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF1F0C81786B37900CD920E /* NSData+Gzip.m */; };
4CF6C711176F4533007A811D /* MPStringLengthValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF6C710176F4533007A811D /* MPStringLengthValueTransformer.m */; };
4CF6C718176F5234007A811D /* MPAssociateRequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF6C717176F5234007A811D /* MPAssociateRequestHandler.m */; };
4CF78057176E5CFD0032EE71 /* MPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF78056176E5CFD0032EE71 /* MPConnection.m */; };
@@ -541,6 +542,8 @@
4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayWindowController.m; sourceTree = "<group>"; };
4CE8247316E2F2B900573141 /* MPOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOverlayView.h; sourceTree = "<group>"; };
4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = "<group>"; };
4CF1F0C81786B37900CD920E /* NSData+Gzip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Gzip.m"; sourceTree = "<group>"; };
4CF1F0C91786B37900CD920E /* NSData+Gzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Gzip.h"; sourceTree = "<group>"; };
4CF6C70F176F4533007A811D /* MPStringLengthValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPStringLengthValueTransformer.h; sourceTree = "<group>"; };
4CF6C710176F4533007A811D /* MPStringLengthValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPStringLengthValueTransformer.m; sourceTree = "<group>"; };
4CF6C715176F5183007A811D /* MPServerRequestHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPServerRequestHandler.h; sourceTree = "<group>"; };
@@ -757,6 +760,8 @@
4C2724D01778EFE300FD8456 /* NSString+Empty.m */,
4C2724D21778FA0700FD8456 /* NSDate+Packed.h */,
4C2724D31778FA0700FD8456 /* NSDate+Packed.m */,
4CF1F0C81786B37900CD920E /* NSData+Gzip.m */,
4CF1F0C91786B37900CD920E /* NSData+Gzip.h */,
4C2724D51778FF1A00FD8456 /* NSUUID+KeePassLib.h */,
4C2724D61778FF1A00FD8456 /* NSUUID+KeePassLib.m */,
4C2724D817790E7C00FD8456 /* NSMutableData+Base64.h */,
@@ -1514,6 +1519,7 @@
4CC672791781D0C0006DEDCF /* KdbGroup+MPAdditions.m in Sources */,
4CC6727C1781D0D2006DEDCF /* KdbEntry+MPAdditions.m in Sources */,
4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */,
4CF1F0CA1786B37900CD920E /* NSData+Gzip.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -15,7 +15,7 @@
Kdb4Tree *tree = [[Kdb4Tree alloc] init];
tree.generator = @"MacPass";
tree.databaseName = @"";
tree.databaseName = NSLocalizedString(@"NEW_DATABASE", "Name for a newly created Database");
tree.databaseNameChanged = currentTime;
tree.databaseDescription = @"";
tree.databaseDescriptionChanged = currentTime;

View File

@@ -7,6 +7,8 @@
//
#import "KdbEntry+MPAdditions.h"
#import "Kdb3Node.h"
#import "Kdb4Node.h"
#import "MPIconHelper.h"

View File

@@ -17,4 +17,5 @@
return NSNotFound;
}
@end

View File

@@ -8,10 +8,18 @@
#import "Kdb.h"
@class BinaryRef;
@interface KdbTree (MPAdditions)
- (NSArray *)allEntries;
- (NSArray *)allGroups;
- (void)addAttachment:(NSURL *)location toEntry:(KdbEntry *)anEntry;
- (void)saveAttachmentFromEntry:(KdbEntry *)anEntry toLocation:(NSURL *)location;
- (void)saveAttachment:(BinaryRef *)reference toLocation:(NSURL *)location;
- (NSUInteger)nextBinaryId;
@end

View File

@@ -9,6 +9,9 @@
#import "KdbTree+MPAdditions.h"
#import "KdbGroup+MPTreeTools.h"
#import "Kdb3Node.h"
#import "Kdb4Node.h"
@implementation KdbTree (MPAdditions)
- (NSArray *)allGroups {
@@ -19,4 +22,61 @@
return [self.root childEntries];
}
- (void)addAttachment:(NSURL *)location toEntry:(KdbEntry *)anEntry {
NSError *error = nil;
NSString *fileName = [NSString stringWithFormat:@"%@.%@", [location lastPathComponent], [location pathExtension]];
if([anEntry isKindOfClass:[Kdb3Entry class]]) {
Kdb3Entry *entry = (Kdb3Entry *)anEntry;
NSData *binaryData = [NSData dataWithContentsOfURL:location options:NSDataReadingUncached error:&error];
if(!binaryData) {
[NSApp presentError:error];
binaryData = nil;
error = nil;
return; // failed
}
entry.binary = binaryData;
entry.binaryDesc = fileName;
}
if( [anEntry isKindOfClass:[Kdb4Entry class]]) {
Kdb4Entry *entry = (Kdb4Entry *)anEntry;
Kdb4Tree *tree = (Kdb4Tree *)self;
NSString *fileData = [NSString stringWithContentsOfURL:location usedEncoding:0 error:&error];
if(!fileData) {
[NSApp presentError:error];
fileData = nil;
error = nil;
return; // failed
}
Binary *binary = [[Binary alloc] init];
binary.binaryId = [self nextBinaryId];
binary.compressed = (tree.compressionAlgorithm == KPLCompressionGzip);
if(binary.compressed ) {
}
binary.data = fileData;
[tree.binaries addObject:binary];
BinaryRef *ref = [[BinaryRef alloc] init];
ref.key = fileName;
[entry.binaries addObject:ref];
}
}
- (void)saveAttachment:(BinaryRef *)reference toLocation:(NSURL *)location {
}
- (void)saveAttachmentFromEntry:(KdbEntry *)entry toLocation:(NSURL *)location {
}
- (NSUInteger)nextBinaryId {
Kdb4Tree *tree = (Kdb4Tree *)self;
NSUInteger maxKey = 0;
for(Binary *binary in tree.binaries) {
maxKey = MAX(binary.binaryId, maxKey);
}
return (maxKey + 1);
}
@end

View File

@@ -154,7 +154,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
NSImage *icon = [MPIconHelper icon:(MPIconType)[group image]];
[view.imageView setImage:icon];
[view.textField bind:NSValueBinding toObject:group withKeyPath:@"name" options:nil];
[view.textField bind:NSValueBinding toObject:group withKeyPath:MPGroupNameUndoableKey options:nil];
[view.textField bind:@"count" toObject:group withKeyPath:@"entries.@count" options:nil];
}

View File

@@ -48,7 +48,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1913</string>
<string>1923</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>

Binary file not shown.