mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 09:22:33 +00:00
Merge branch 'master' of https://github.com/mstarke/MacPass
Conflicts: MacPass.xcodeproj/project.pbxproj
This commit is contained in:
@@ -118,6 +118,8 @@
|
|||||||
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; };
|
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; };
|
||||||
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; };
|
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; };
|
||||||
4CFC53BF16E94729007396BE /* MPShadowBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CFC53BE16E94729007396BE /* MPShadowBox.m */; };
|
4CFC53BF16E94729007396BE /* MPShadowBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CFC53BE16E94729007396BE /* MPShadowBox.m */; };
|
||||||
|
6E71971217203FB700E4C5FC /* MPCreationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E71971017203FB600E4C5FC /* MPCreationViewController.m */; };
|
||||||
|
6E71971317203FB700E4C5FC /* CreationView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E71971117203FB600E4C5FC /* CreationView.xib */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -322,6 +324,10 @@
|
|||||||
4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = "<group>"; };
|
4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = "<group>"; };
|
||||||
4CFC53BD16E94729007396BE /* MPShadowBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPShadowBox.h; sourceTree = "<group>"; };
|
4CFC53BD16E94729007396BE /* MPShadowBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPShadowBox.h; sourceTree = "<group>"; };
|
||||||
4CFC53BE16E94729007396BE /* MPShadowBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPShadowBox.m; sourceTree = "<group>"; };
|
4CFC53BE16E94729007396BE /* MPShadowBox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPShadowBox.m; sourceTree = "<group>"; };
|
||||||
|
6E71970F17203FB600E4C5FC /* MPCreationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCreationViewController.h; sourceTree = "<group>"; };
|
||||||
|
6E71971017203FB600E4C5FC /* MPCreationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPCreationViewController.m; sourceTree = "<group>"; };
|
||||||
|
6E71971117203FB600E4C5FC /* CreationView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CreationView.xib; sourceTree = "<group>"; };
|
||||||
|
6E719715172058BA00E4C5FC /* MPDatabaseVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPDatabaseVersion.h; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -342,6 +348,7 @@
|
|||||||
4C06398C15B980480004DE27 /* Views */ = {
|
4C06398C15B980480004DE27 /* Views */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
6E71971117203FB600E4C5FC /* CreationView.xib */,
|
||||||
4C25D58616CF0FAA00F6806C /* EntryView.xib */,
|
4C25D58616CF0FAA00F6806C /* EntryView.xib */,
|
||||||
4CA0B2EF15BCADC800654E32 /* GeneralSettings.xib */,
|
4CA0B2EF15BCADC800654E32 /* GeneralSettings.xib */,
|
||||||
4C77E37B15B84A240093A587 /* MainMenu.xib */,
|
4C77E37B15B84A240093A587 /* MainMenu.xib */,
|
||||||
@@ -417,6 +424,7 @@
|
|||||||
4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */,
|
4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */,
|
||||||
4CBA981615BA0DB600721965 /* MPDatabaseDocument.h */,
|
4CBA981615BA0DB600721965 /* MPDatabaseDocument.h */,
|
||||||
4CBA981715BA0DB600721965 /* MPDatabaseDocument.m */,
|
4CBA981715BA0DB600721965 /* MPDatabaseDocument.m */,
|
||||||
|
6E719715172058BA00E4C5FC /* MPDatabaseVersion.h */,
|
||||||
);
|
);
|
||||||
name = Model;
|
name = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -645,6 +653,8 @@
|
|||||||
4C40AC5B170782730073D1C3 /* MPAbstractSettingsViewController.m */,
|
4C40AC5B170782730073D1C3 /* MPAbstractSettingsViewController.m */,
|
||||||
4C5A11FB1708DE8700223D8A /* MPPasswordCreatorViewController.h */,
|
4C5A11FB1708DE8700223D8A /* MPPasswordCreatorViewController.h */,
|
||||||
4C5A11FC1708DE8700223D8A /* MPPasswordCreatorViewController.m */,
|
4C5A11FC1708DE8700223D8A /* MPPasswordCreatorViewController.m */,
|
||||||
|
6E71970F17203FB600E4C5FC /* MPCreationViewController.h */,
|
||||||
|
6E71971017203FB600E4C5FC /* MPCreationViewController.m */,
|
||||||
);
|
);
|
||||||
name = "View Controller";
|
name = "View Controller";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -845,6 +855,7 @@
|
|||||||
4CE39AC116ECE359000FE29D /* IconSelection.xib in Resources */,
|
4CE39AC116ECE359000FE29D /* IconSelection.xib in Resources */,
|
||||||
4C5A11FF1708DE8800223D8A /* PasswordCreatorView.xib in Resources */,
|
4C5A11FF1708DE8800223D8A /* PasswordCreatorView.xib in Resources */,
|
||||||
4C1DDCDD1711ECEB00C98DA3 /* PasswordCreatorWindow.xib in Resources */,
|
4C1DDCDD1711ECEB00C98DA3 /* PasswordCreatorWindow.xib in Resources */,
|
||||||
|
6E71971317203FB700E4C5FC /* CreationView.xib in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -950,6 +961,7 @@
|
|||||||
4C46B88B1706D16E0046109A /* NSData+MPRandomBytes.m in Sources */,
|
4C46B88B1706D16E0046109A /* NSData+MPRandomBytes.m in Sources */,
|
||||||
4C40AC5C170782730073D1C3 /* MPAbstractSettingsViewController.m in Sources */,
|
4C40AC5C170782730073D1C3 /* MPAbstractSettingsViewController.m in Sources */,
|
||||||
4C5A11FE1708DE8700223D8A /* MPPasswordCreatorViewController.m in Sources */,
|
4C5A11FE1708DE8700223D8A /* MPPasswordCreatorViewController.m in Sources */,
|
||||||
|
6E71971217203FB700E4C5FC /* MPCreationViewController.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
1248
MacPass/CreationView.xib
Normal file
1248
MacPass/CreationView.xib
Normal file
File diff suppressed because it is too large
Load Diff
15
MacPass/MPCreationViewController.h
Normal file
15
MacPass/MPCreationViewController.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// MPCreationViewController.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Nathaniel Madura on 18/04/13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPViewController.h"
|
||||||
|
|
||||||
|
@interface MPCreationViewController : MPViewController
|
||||||
|
|
||||||
|
@property (retain) NSURL *fileURL;
|
||||||
|
|
||||||
|
@end
|
||||||
76
MacPass/MPCreationViewController.m
Normal file
76
MacPass/MPCreationViewController.m
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
//
|
||||||
|
// MPCreationViewController.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Nathaniel Madura on 18/04/13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPCreationViewController.h"
|
||||||
|
#import "MPKeyfilePathControlDelegate.h"
|
||||||
|
#import "MPDatabaseController.h"
|
||||||
|
#import "MPDatabaseDocument.h"
|
||||||
|
|
||||||
|
@interface MPCreationViewController ()
|
||||||
|
|
||||||
|
@property (assign) IBOutlet NSSecureTextField *passwordTextField;
|
||||||
|
@property (assign) IBOutlet NSSecureTextField *validatePasswordTextField;
|
||||||
|
@property (assign) IBOutlet NSPathControl *keyPathControl;
|
||||||
|
@property (retain) MPKeyfilePathControlDelegate *pathControlDelegate;
|
||||||
|
@property (assign) IBOutlet NSTextField *errorInfoTextField;
|
||||||
|
|
||||||
|
- (IBAction)_new:(id)sender;
|
||||||
|
- (void)_showError;
|
||||||
|
- (void)_reset;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MPCreationViewController
|
||||||
|
|
||||||
|
- (id)init {
|
||||||
|
return [[MPCreationViewController alloc] initWithNibName:@"CreationView" bundle:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[_fileURL release];
|
||||||
|
[_pathControlDelegate release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didLoadView {
|
||||||
|
[self.keyPathControl setDelegate:self.pathControlDelegate];
|
||||||
|
[self _reset];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSResponder *)reconmendedFirstResponder {
|
||||||
|
return self.passwordTextField;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)_new:(id)sender {
|
||||||
|
NSString *password = self.passwordTextField.stringValue;
|
||||||
|
NSURL *keyfile = [self.keyPathControl URL];
|
||||||
|
if ([password compare:self.validatePasswordTextField.stringValue] != NSOrderedSame)
|
||||||
|
{
|
||||||
|
[self.errorInfoTextField setStringValue:@"Passwords do not match"];
|
||||||
|
[self.errorInfoTextField setHidden:NO];
|
||||||
|
}
|
||||||
|
[self _reset];
|
||||||
|
|
||||||
|
[[MPDatabaseController defaultController] newDatabaseAtURL:self.fileURL
|
||||||
|
databaseVersion:MPDatabaseVersion4
|
||||||
|
password:password
|
||||||
|
keyfile:keyfile];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_reset {
|
||||||
|
[self.passwordTextField setStringValue:@""];
|
||||||
|
[self.validatePasswordTextField setStringValue:@""];
|
||||||
|
[self.keyPathControl setURL:nil];
|
||||||
|
[self.errorInfoTextField setHidden:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)_showError {
|
||||||
|
[self.errorInfoTextField setHidden:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MPDatabaseVersion.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Notification is posted, when a database is loaded
|
Notification is posted, when a database is loaded
|
||||||
@@ -30,7 +31,8 @@ APPKIT_EXTERN NSString *const MPDatabaseControllerDatabaseKey;
|
|||||||
+ (MPDatabaseController *)defaultController;
|
+ (MPDatabaseController *)defaultController;
|
||||||
+ (BOOL)hasOpenDatabase;
|
+ (BOOL)hasOpenDatabase;
|
||||||
|
|
||||||
//- (MPDatabaseDocument *)createDatabase:(MPDatabaseVersion )version password:(NSString *)password keyfile:(NSURL *)key;
|
- (MPDatabaseDocument *)createDatabase:(MPDatabaseVersion)version password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
- (MPDatabaseDocument *)openDatabase:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
- (MPDatabaseDocument *)openDatabase:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
|
- (MPDatabaseDocument *)newDatabaseAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)version password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ NSString *const MPDatabaseControllerDatabaseKey = @"com.macpass.MPDatabaseContro
|
|||||||
return self.database;
|
return self.database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (MPDatabaseDocument *)newDatabaseAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)version password:(NSString *)password keyfile:(NSURL *)key {
|
||||||
|
self.database = [MPDatabaseDocument newDocumentAtURL:url databaseVersion:version password:password keyfile:key];
|
||||||
|
return self.database;
|
||||||
|
}
|
||||||
|
|
||||||
- (MPDatabaseDocument *)openDatabase:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key {
|
- (MPDatabaseDocument *)openDatabase:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key {
|
||||||
self.database = [MPDatabaseDocument documentWithFile:file password:password keyfile:key];
|
self.database = [MPDatabaseDocument documentWithFile:file password:password keyfile:key];
|
||||||
return self.database;
|
return self.database;
|
||||||
|
|||||||
@@ -7,15 +7,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "MPDatabaseVersion.h"
|
||||||
|
|
||||||
APPKIT_EXTERN NSString *const MPDidLoadDatabaseNotification;
|
APPKIT_EXTERN NSString *const MPDidLoadDatabaseNotification;
|
||||||
APPKIT_EXTERN NSString *const MPDatabaseDocumentDocumentKey;
|
APPKIT_EXTERN NSString *const MPDatabaseDocumentDocumentKey;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
MPDatabaseVersion3,
|
|
||||||
MPDatabaseVersion4
|
|
||||||
} MPDatabaseVersion;
|
|
||||||
|
|
||||||
@class KdbPassword;
|
@class KdbPassword;
|
||||||
@class KdbGroup;
|
@class KdbGroup;
|
||||||
@class KdbEntry;
|
@class KdbEntry;
|
||||||
@@ -30,8 +26,10 @@ typedef enum {
|
|||||||
|
|
||||||
+ (id)documentWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
+ (id)documentWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
+ (id)documentWithNewDatabase:(MPDatabaseVersion)version;
|
+ (id)documentWithNewDatabase:(MPDatabaseVersion)version;
|
||||||
|
+ (id)newDocumentAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)dbversion password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
- (id)initWithNewDatabase:(MPDatabaseVersion)version;
|
- (id)initWithNewDatabase:(MPDatabaseVersion)version;
|
||||||
|
- (id)initNewDocumentAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)dbversion password:(NSString *)password keyfile:(NSURL *)key;
|
||||||
/*
|
/*
|
||||||
Saves the current database to the filesystem
|
Saves the current database to the filesystem
|
||||||
Tries to use the stored password and file path
|
Tries to use the stored password and file path
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ NSString *const MPDidLoadDatabaseNotification = @"DidLoadDataBaseNotification";
|
|||||||
@property (retain) NSURL *file;
|
@property (retain) NSURL *file;
|
||||||
@property (nonatomic, readonly) KdbPassword *passwordHash;
|
@property (nonatomic, readonly) KdbPassword *passwordHash;
|
||||||
@property (assign) MPDatabaseVersion version;
|
@property (assign) MPDatabaseVersion version;
|
||||||
|
@property (readonly)BOOL isNewFile;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -32,11 +33,42 @@ NSString *const MPDidLoadDatabaseNotification = @"DidLoadDataBaseNotification";
|
|||||||
return [[[MPDatabaseDocument alloc] initWithNewDatabase:version] autorelease];
|
return [[[MPDatabaseDocument alloc] initWithNewDatabase:version] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (id)newDocumentAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)dbversion password:(NSString *)password keyfile:(NSURL *)key
|
||||||
|
{
|
||||||
|
return [[[MPDatabaseDocument alloc] initNewDocumentAtURL:url databaseVersion:dbversion password:password keyfile:key] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
// create empty document
|
// create empty document
|
||||||
return [self initWithFile:nil password:nil keyfile:nil];
|
return [self initWithFile:nil password:nil keyfile:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (id)initNewDocumentAtURL:(NSURL *)url databaseVersion:(MPDatabaseVersion)dbversion password:(NSString *)password keyfile:(NSURL *)key
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if(self) {
|
||||||
|
self.file = url;
|
||||||
|
self.key = key;
|
||||||
|
self.password = password;
|
||||||
|
_isNewFile = YES;
|
||||||
|
switch(dbversion) {
|
||||||
|
case MPDatabaseVersion3:
|
||||||
|
self.tree = [[[Kdb3Tree alloc] init] autorelease];
|
||||||
|
break;
|
||||||
|
case MPDatabaseVersion4:
|
||||||
|
self.tree = [[[Kdb4Tree alloc] init] autorelease];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
[self release];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
KdbGroup *newGroup = [self.tree createGroup:self.tree.root];
|
||||||
|
newGroup.name = @"Default";
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Initalizer for creating
|
Initalizer for creating
|
||||||
*/
|
*/
|
||||||
@@ -109,7 +141,7 @@ NSString *const MPDidLoadDatabaseNotification = @"DidLoadDataBaseNotification";
|
|||||||
|
|
||||||
- (BOOL)save {
|
- (BOOL)save {
|
||||||
NSError *fileError;
|
NSError *fileError;
|
||||||
if( [self.file checkResourceIsReachableAndReturnError:&fileError] ) {
|
if(self.isNewFile || [self.file checkResourceIsReachableAndReturnError:&fileError] ) {
|
||||||
@try {
|
@try {
|
||||||
[KdbWriterFactory persist:self.tree file:[self.file path] withPassword:self.passwordHash];
|
[KdbWriterFactory persist:self.tree file:[self.file path] withPassword:self.passwordHash];
|
||||||
}
|
}
|
||||||
@@ -119,6 +151,11 @@ NSString *const MPDidLoadDatabaseNotification = @"DidLoadDataBaseNotification";
|
|||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"File Error: %@", fileError);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)saveAsFile:(NSURL *)file withPassword:(NSString *)password keyfile:(NSURL *)key {
|
- (BOOL)saveAsFile:(NSURL *)file withPassword:(NSString *)password keyfile:(NSURL *)key {
|
||||||
|
|||||||
17
MacPass/MPDatabaseVersion.h
Normal file
17
MacPass/MPDatabaseVersion.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// MPDatabaseVersion.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Nathaniel Madura on 18/04/13.
|
||||||
|
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MacPass_MPDatabaseVersion_h
|
||||||
|
#define MacPass_MPDatabaseVersion_h
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MPDatabaseVersion3,
|
||||||
|
MPDatabaseVersion4
|
||||||
|
} MPDatabaseVersion;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
@class MPInspectorTabViewController;
|
@class MPInspectorTabViewController;
|
||||||
@class MPPasswordInputController;
|
@class MPPasswordInputController;
|
||||||
@class MPOutlineViewController;
|
@class MPOutlineViewController;
|
||||||
|
@class MPCreationViewController;
|
||||||
|
|
||||||
@interface MPMainWindowController : NSWindowController
|
@interface MPMainWindowController : NSWindowController
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
@property (readonly, retain) MPEntryViewController *entryViewController;
|
@property (readonly, retain) MPEntryViewController *entryViewController;
|
||||||
@property (readonly, retain) MPOutlineViewController *outlineViewController;
|
@property (readonly, retain) MPOutlineViewController *outlineViewController;
|
||||||
@property (readonly, retain) MPInspectorTabViewController *inspectorTabViewController;
|
@property (readonly, retain) MPInspectorTabViewController *inspectorTabViewController;
|
||||||
|
@property (readonly, retain) MPCreationViewController *creationViewController;
|
||||||
|
|
||||||
|
|
||||||
- (void)showEntries;
|
- (void)showEntries;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#import "MPMainWindowSplitViewDelegate.h"
|
#import "MPMainWindowSplitViewDelegate.h"
|
||||||
#import "MPInspectorTabViewController.h"
|
#import "MPInspectorTabViewController.h"
|
||||||
#import "MPAppDelegate.h"
|
#import "MPAppDelegate.h"
|
||||||
|
#import "MPCreationViewController.h"
|
||||||
|
|
||||||
@interface MPMainWindowController ()
|
@interface MPMainWindowController ()
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
@property (retain) MPEntryViewController *entryViewController;
|
@property (retain) MPEntryViewController *entryViewController;
|
||||||
@property (retain) MPOutlineViewController *outlineViewController;
|
@property (retain) MPOutlineViewController *outlineViewController;
|
||||||
@property (retain) MPInspectorTabViewController *inspectorTabViewController;
|
@property (retain) MPInspectorTabViewController *inspectorTabViewController;
|
||||||
|
@property (retain) MPCreationViewController *creationViewController;
|
||||||
|
|
||||||
@property (retain) MPToolbarDelegate *toolbarDelegate;
|
@property (retain) MPToolbarDelegate *toolbarDelegate;
|
||||||
@property (retain) MPMainWindowSplitViewDelegate *splitViewDelegate;
|
@property (retain) MPMainWindowSplitViewDelegate *splitViewDelegate;
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
_outlineViewController = [[MPOutlineViewController alloc] init];
|
_outlineViewController = [[MPOutlineViewController alloc] init];
|
||||||
_inspectorTabViewController = [[MPInspectorTabViewController alloc] init];
|
_inspectorTabViewController = [[MPInspectorTabViewController alloc] init];
|
||||||
_splitViewDelegate = [[MPMainWindowSplitViewDelegate alloc] init];
|
_splitViewDelegate = [[MPMainWindowSplitViewDelegate alloc] init];
|
||||||
|
_creationViewController = [[MPCreationViewController alloc] init];
|
||||||
|
|
||||||
[[NSBundle mainBundle] loadNibNamed:@"WelcomeView" owner:self topLevelObjects:NULL];
|
[[NSBundle mainBundle] loadNibNamed:@"WelcomeView" owner:self topLevelObjects:NULL];
|
||||||
[self.welcomeView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[self.welcomeView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
@@ -76,6 +79,7 @@
|
|||||||
[_entryViewController release];
|
[_entryViewController release];
|
||||||
[_outlineViewController release];
|
[_outlineViewController release];
|
||||||
[_inspectorTabViewController release];
|
[_inspectorTabViewController release];
|
||||||
|
[_creationViewController release];
|
||||||
|
|
||||||
[_toolbarDelegate release];
|
[_toolbarDelegate release];
|
||||||
[_splitViewDelegate release];
|
[_splitViewDelegate release];
|
||||||
@@ -248,6 +252,31 @@
|
|||||||
- (void)showEditForm:(id)sender {
|
- (void)showEditForm:(id)sender {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)newDocument:(id)sender {
|
||||||
|
if (!self.creationViewController) {
|
||||||
|
self.creationViewController = [[[MPCreationViewController alloc] init] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSSavePanel *savePanel = [NSSavePanel savePanel];
|
||||||
|
[savePanel setAllowedFileTypes:@[@"kdbx", @"kdb"]];
|
||||||
|
[savePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
|
||||||
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
|
NSURL *file = [savePanel URL];
|
||||||
|
NSLog(@"Will create file at: %@", file);
|
||||||
|
self.creationViewController.fileURL = file;
|
||||||
|
[self _setContentViewController:self.creationViewController];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)saveDocument:(id)sender
|
||||||
|
{
|
||||||
|
NSLog(@"Attempting to save document");
|
||||||
|
if ([[MPDatabaseController defaultController].database save])
|
||||||
|
NSLog(@"Save successful");
|
||||||
|
else
|
||||||
|
NSLog(@"Save failed");
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark Helper
|
#pragma mark Helper
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user