Added AI assets

Keyfiles are now usable for opening databases
This commit is contained in:
michael starke
2013-03-10 16:02:06 +01:00
parent ff7e8aaadd
commit 5ab229b0e8
9 changed files with 1252 additions and 226 deletions

View File

@@ -0,0 +1,13 @@
//
// MPKeyfilePathControlDelegate.h
// MacPass
//
// Created by Michael Starke on 10.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MPKeyfilePathControlDelegate : NSObject <NSPathControlDelegate>
@end

View File

@@ -0,0 +1,22 @@
//
// MPKeyfilePathControlDelegate.m
// MacPass
//
// Created by Michael Starke on 10.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPKeyfilePathControlDelegate.h"
@implementation MPKeyfilePathControlDelegate
- (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id<NSDraggingInfo>)info {
NSLog(@"%@", [info draggingPasteboard]);
return NSDragOperationNone;
}
- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel {
}
@end

View File

@@ -17,8 +17,6 @@
#import "MPInspectorTabViewController.h"
#import "MPAppDelegate.h"
#define MIN_WINDOW_WIDTH MPMainWindowSplitViewDelegateMinimumContentWidth + MPMainWindowSplitViewDelegateMinimumOutlineWidth + [self.splitView dividerThickness]
@interface MPMainWindowController ()
@property (assign) IBOutlet NSView *outlineView;
@@ -92,8 +90,8 @@
[self _updateWindowTitle];
[[self.welcomeText cell] setBackgroundStyle:NSBackgroundStyleRaised];
[self.window setMinSize:NSMakeSize( MIN_WINDOW_WIDTH, 400)];
CGFloat minWidht = MPMainWindowSplitViewDelegateMinimumContentWidth + MPMainWindowSplitViewDelegateMinimumOutlineWidth + [self.splitView dividerThickness];
[self.window setMinSize:NSMakeSize( minWidht, 400)];
_toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainWindowToolbar"];
[self.toolbar setAllowsUserCustomization:YES];

View File

@@ -9,7 +9,7 @@
#import "MPMainWindowSplitViewDelegate.h"
const CGFloat MPMainWindowSplitViewDelegateMinimumOutlineWidth = 150.0;
const CGFloat MPMainWindowSplitViewDelegateMinimumContentWidth = 250.0;
const CGFloat MPMainWindowSplitViewDelegateMinimumContentWidth = 350.0;
const CGFloat MPMainWindowSplitViewDelegateMinimumInspectorWidth = 250.0;

View File

@@ -8,14 +8,19 @@
#import "MPPasswordInputController.h"
#import "MPDatabaseController.h"
#import "MPKeyfilePathControlDelegate.h"
@interface MPPasswordInputController ()
@property (assign) IBOutlet NSSecureTextField *passwordTextField;
@property (assign) IBOutlet NSPathControl *keyPathControl;
@property (retain) MPKeyfilePathControlDelegate *pathControlDelegate;
@property (assign) IBOutlet NSImageView *errorImageView;
@property (assign) IBOutlet NSTextField *errorInfoTextField;
- (IBAction)_selectKeyFile:(id)sender;
- (IBAction)_open:(id)sender;
- (void)_showError;
- (void)_reset;
@end
@@ -26,32 +31,43 @@
}
- (void)dealloc {
self.fileURL = nil;
[_fileURL release];
[_pathControlDelegate release];
[super dealloc];
}
- (void)didLoadView {
[self.keyPathControl setDelegate:self.pathControlDelegate];
[self.errorImageView setImage:[NSImage imageNamed:NSImageNameCaution]];
[self _reset];
}
- (NSResponder *)reconmendedFirstResponder {
return self.passwordTextField;
}
- (IBAction)_selectKeyFile:(id)sender {
}
- (IBAction)_open:(id)sender {
NSString *password = [self.passwordTextField stringValue];
[self.passwordTextField setStringValue:@""];
NSURL *keyfile = [self.keyPathControl URL];
[self _reset];
MPDatabaseDocument *document = [[MPDatabaseController defaultController] openDatabase:self.fileURL
password:password
keyfile:nil];
keyfile:keyfile];
if(!document) {
[self _showError];
}
}
- (void)_reset {
[self.passwordTextField setStringValue:@""];
[self.keyPathControl setURL:nil];
[self.errorInfoTextField setHidden:YES];
[self.errorImageView setHidden:YES];
}
- (void)_showError {
#ifdef DEBUG
NSLog(@"Something went wrong");
#endif
[self.errorImageView setHidden:NO];
[self.errorInfoTextField setHidden:NO];
}
@end

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>4DD</string>
<string>4EB</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>

File diff suppressed because it is too large Load Diff