mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 15:12:21 +00:00
Added AI assets
Keyfiles are now usable for opening databases
This commit is contained in:
13
MacPass/MPKeyfilePathControlDelegate.h
Normal file
13
MacPass/MPKeyfilePathControlDelegate.h
Normal 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
|
||||
22
MacPass/MPKeyfilePathControlDelegate.m
Normal file
22
MacPass/MPKeyfilePathControlDelegate.m
Normal 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
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user