Updated Readme

This commit is contained in:
michael starke
2012-07-21 15:49:44 +02:00
parent 60a8267396
commit 5687494582
6 changed files with 151 additions and 34 deletions

View File

@@ -34,7 +34,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
_database = [[MPDatabaseDocument alloc] initWithFile:nil andPassword:@""];
//_database = [[MPDatabaseDocument alloc] initWithFile:NSURL password:<#(NSString *)#> keyfile:<#(NSURL *)#>
_outlineDelegate = [[MPOutlineViewDelegate alloc] init];
_datasource = [[MPOutlineDataSource alloc] init];

View File

@@ -10,7 +10,6 @@
@interface MPDatabaseDocument : NSObject
- (id)initWithFile:(NSURL *)file andPassword:(NSString *)password;
- (id)initWithFile:(NSURL *)file andKeyfile:(NSURL *)keyfile;
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
@end

View File

@@ -11,46 +11,39 @@
@interface MPDatabaseDocument ()
@property (retain) KdbTree *tree;
- (id)initWithFile:(NSURL *)file andKdbPassword:(KdbPassword *)password;
@end
@implementation MPDatabaseDocument
@synthesize tree = _tree;
- (id)initWithFile:(NSURL *)file andKeyfile:(NSURL *)keyfile {
KdbPassword *password = [[KdbPassword alloc] initWithKeyfile:[keyfile path]];
[self initWithFile:file andKdbPassword:password];
[password release];
return self;
- (id)init {
return [self initWithFile:nil password:nil keyfile:nil];
}
- (id)initWithFile:(NSURL *)file andPassword:(NSString *)password {
KdbPassword *kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding];
[self initWithFile:file andKdbPassword:kdbPassword];
[password release];
return self;
}
- (id)initWithFile:(NSURL *)file andKdbPassword:(KdbPassword *)password {
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key
{
self = [super init];
if (self) {
NSString *path = [file path];
BOOL isReadable = [[NSFileManager defaultManager] isReadableFileAtPath:path];
BOOL isDirectory = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory];
// We may need more tests
if(isReadable && NO == isDirectory) {
@try {
self.tree = [KdbReaderFactory load:[file path] withPassword:password];
// test for supplied parameters
KdbPassword *kdbPassword = nil;
if( password != nil ) {
if( key != nil ) {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding keyfile:[key path]];
}
@catch (NSException *exception) {
// Log the error but proceede
NSLog(@"Could not load the Database at path:%@", file);
else {
kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding];
}
}
@try {
_tree = [KdbReaderFactory load:[file path] withPassword:kdbPassword];
}
@catch (NSException *exception) {
// ignore
}
}
return self;
}
@end

121
MacPass/PasswordWindow.xib Normal file
View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSCustomObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="NSCustomObject" id="1001">
<string key="NSClassName">NSObject</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="406222252">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 207}, {480, 270}}</string>
<int key="NSWTFlags">611845120</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="805694289">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:20</string>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords"/>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">293</int>
<reference key="object" ref="406222252"/>
<array class="NSMutableArray" key="children">
<reference ref="805694289"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">294</int>
<reference key="object" ref="805694289"/>
<reference key="parent" ref="406222252"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="293.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="293.NSWindowTemplate.visibleAtLaunch"/>
<string key="294.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">294</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<bool key="IBDocument.UseAutolayout">YES</bool>
</data>
</archive>