mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Refactoring
This commit is contained in:
@@ -23,10 +23,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
|
||||
@interface MPMainWindowController ()
|
||||
|
||||
@property (assign) IBOutlet NSOutlineView *outlineView;
|
||||
@property (retain) IBOutlet NSView *passwordView;
|
||||
|
||||
@property (assign) IBOutlet NSTextField *passwordTextField;
|
||||
@property (assign) IBOutlet NSPathControl *keyPathControl;
|
||||
@property (assign) IBOutlet NSView *contentView;
|
||||
@property (retain) IBOutlet NSView *welcomeView;
|
||||
|
||||
@@ -35,7 +32,6 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
|
||||
@property (retain) MPOutlineViewDelegate *outlineDelegate;
|
||||
@property (retain) MPMainWindowDelegate *windowDelegate;
|
||||
|
||||
- (IBAction)usePassword:(id)sender;
|
||||
- (void)updateData;
|
||||
|
||||
@end
|
||||
@@ -95,11 +91,4 @@ NSString *const kOutlineViewIdentifier = @"OutlineView";
|
||||
[self.window makeFirstResponder:self.passwordView];
|
||||
}
|
||||
|
||||
- (void)usePassword:(id)sender {
|
||||
NSString *password = [self.passwordTextField stringValue];
|
||||
|
||||
[[MPDatabaseController defaultController] openDatabase:self.openFile password:password keyfile:nil];
|
||||
[self updateData];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
14
MacPass/MPPasswordInputController.h
Normal file
14
MacPass/MPPasswordInputController.h
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// MPPasswordInputController.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 17.02.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPViewController.h"
|
||||
#import "MPViewControllerProtocol.h"
|
||||
|
||||
@interface MPPasswordInputController : MPViewController <MPViewControllerProtocol>
|
||||
|
||||
@end
|
||||
41
MacPass/MPPasswordInputController.m
Normal file
41
MacPass/MPPasswordInputController.m
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// MPPasswordInputController.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 17.02.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPPasswordInputController.h"
|
||||
#import "MPDatabaseController.h"
|
||||
|
||||
@interface MPPasswordInputController ()
|
||||
|
||||
@property (assign) IBOutlet NSSecureTextField *passwordTextField;
|
||||
|
||||
- (IBAction)selectKeyFile:(id)sender;
|
||||
- (IBAction)open:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPPasswordInputController
|
||||
|
||||
- (id)init {
|
||||
return [[MPPasswordInputController alloc] initWithNibName:@"PasswordView" bundle:nil];
|
||||
}
|
||||
|
||||
- (NSResponder *)reconmendetFirstResponder {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)selectKeyFile:(id)sender {
|
||||
|
||||
}
|
||||
|
||||
- (IBAction)open:(id)sender {
|
||||
NSString *password = [self.passwordTextField stringValue];
|
||||
[[MPDatabaseController defaultController] openDatabase:self.openFile password:password keyfile:nil];
|
||||
}
|
||||
}
|
||||
@end
|
||||
16
MacPass/MPViewControllerProtocol.h
Normal file
16
MacPass/MPViewControllerProtocol.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MPViewControllerProtocol.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 17.02.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol MPViewControllerProtocol <NSObject>
|
||||
|
||||
@required
|
||||
- (NSResponder *)reconmendetFirstResponder;
|
||||
|
||||
@end
|
||||
@@ -30,7 +30,7 @@
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="NSCustomObject" id="1001">
|
||||
<string key="NSClassName">MPMainWindowController</string>
|
||||
<string key="NSClassName">MPPasswordInputController</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1003">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
@@ -173,7 +173,6 @@
|
||||
<string key="NSFrame">{{209, 13}, {74, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1005"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="736946738">
|
||||
@@ -202,29 +201,37 @@
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1005"/>
|
||||
</object>
|
||||
<int key="connectionID">143</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">passwordTextField</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="83199440"/>
|
||||
</object>
|
||||
<int key="connectionID">99</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">passwordView</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1005"/>
|
||||
</object>
|
||||
<int key="connectionID">101</int>
|
||||
<int key="connectionID">151</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">usePassword:</string>
|
||||
<string key="label">selectKeyFile:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="723622123"/>
|
||||
</object>
|
||||
<int key="connectionID">152</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">open:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="769513826"/>
|
||||
</object>
|
||||
<int key="connectionID">102</int>
|
||||
<int key="connectionID">154</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
@@ -541,11 +548,6 @@
|
||||
<reference key="object" ref="108091909"/>
|
||||
<reference key="parent" ref="662046682"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">45</int>
|
||||
<reference key="object" ref="207368608"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">104</int>
|
||||
<reference key="object" ref="723622123"/>
|
||||
@@ -574,34 +576,24 @@
|
||||
<reference key="object" ref="1001566026"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">123</int>
|
||||
<reference key="object" ref="744080106"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">124</int>
|
||||
<reference key="object" ref="781301592"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">119</int>
|
||||
<reference key="object" ref="649511608"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">131</int>
|
||||
<reference key="object" ref="339307312"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">134</int>
|
||||
<reference key="object" ref="151404172"/>
|
||||
<int key="objectID">132</int>
|
||||
<reference key="object" ref="957344773"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">112</int>
|
||||
<reference key="object" ref="862589174"/>
|
||||
<int key="objectID">142</int>
|
||||
<reference key="object" ref="679367678"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
@@ -609,19 +601,34 @@
|
||||
<reference key="object" ref="949733562"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">132</int>
|
||||
<reference key="object" ref="957344773"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">107</int>
|
||||
<reference key="object" ref="937587174"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">142</int>
|
||||
<reference key="object" ref="679367678"/>
|
||||
<int key="objectID">45</int>
|
||||
<reference key="object" ref="207368608"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">123</int>
|
||||
<reference key="object" ref="744080106"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">134</int>
|
||||
<reference key="object" ref="151404172"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">119</int>
|
||||
<reference key="object" ref="649511608"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">112</int>
|
||||
<reference key="object" ref="862589174"/>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
</array>
|
||||
@@ -683,61 +690,49 @@
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">142</int>
|
||||
<int key="maxID">154</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPMainWindowController</string>
|
||||
<string key="superclassName">NSWindowController</string>
|
||||
<string key="className">MPPasswordInputController</string>
|
||||
<string key="superclassName">MPViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<string key="NS.key.0">usePassword:</string>
|
||||
<string key="NS.key.0">selectKeyFile:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">usePassword:</string>
|
||||
<string key="NS.key.0">selectKeyFile:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">usePassword:</string>
|
||||
<string key="name">selectKeyFile:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="contentView">NSView</string>
|
||||
<string key="keyPathControl">NSPathControl</string>
|
||||
<string key="outlineView">NSOutlineView</string>
|
||||
<string key="passwordTextField">NSTextField</string>
|
||||
<string key="passwordView">NSView</string>
|
||||
<string key="welcomeView">NSView</string>
|
||||
<string key="openDocument">NSButton</string>
|
||||
<string key="passwordTextField">NSSecureTextField</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="contentView">
|
||||
<string key="name">contentView</string>
|
||||
<string key="candidateClassName">NSView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="keyPathControl">
|
||||
<string key="name">keyPathControl</string>
|
||||
<string key="candidateClassName">NSPathControl</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="outlineView">
|
||||
<string key="name">outlineView</string>
|
||||
<string key="candidateClassName">NSOutlineView</string>
|
||||
<object class="IBToOneOutletInfo" key="openDocument">
|
||||
<string key="name">openDocument</string>
|
||||
<string key="candidateClassName">NSButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="passwordTextField">
|
||||
<string key="name">passwordTextField</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="passwordView">
|
||||
<string key="name">passwordView</string>
|
||||
<string key="candidateClassName">NSView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="welcomeView">
|
||||
<string key="name">welcomeView</string>
|
||||
<string key="candidateClassName">NSView</string>
|
||||
<string key="candidateClassName">NSSecureTextField</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MPMainWindowController.h</string>
|
||||
<string key="minorKey">./Classes/MPPasswordInputController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPViewController</string>
|
||||
<string key="superclassName">NSViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MPViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
Reference in New Issue
Block a user