Extended Settings

This commit is contained in:
michael starke
2013-06-27 03:33:30 +02:00
parent 552ae0bcb3
commit dbd424ffae
10 changed files with 1050 additions and 875 deletions

View File

@@ -788,11 +788,11 @@
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
<string key="label">documentSettings:</string> <string key="label">showDocumentSettings:</string>
<reference key="source" ref="1014"/> <reference key="source" ref="1014"/>
<reference key="destination" ref="544639599"/> <reference key="destination" ref="544639599"/>
</object> </object>
<int key="connectionID">1232</int> <int key="connectionID">1233</int>
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection"> <object class="IBActionConnection" key="connection">
@@ -1298,7 +1298,7 @@
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">1232</int> <int key="maxID">1233</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1357,18 +1357,18 @@
<string key="className">MPDocumentWindowController</string> <string key="className">MPDocumentWindowController</string>
<string key="superclassName">NSWindowController</string> <string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions"> <dictionary class="NSMutableDictionary" key="actions">
<string key="documentSettings:">id</string>
<string key="editPassword:">id</string> <string key="editPassword:">id</string>
<string key="showDocumentSettings:">id</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName"> <dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="documentSettings:">
<string key="name">documentSettings:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="editPassword:"> <object class="IBActionInfo" key="editPassword:">
<string key="name">editPassword:</string> <string key="name">editPassword:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo" key="showDocumentSettings:">
<string key="name">showDocumentSettings:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary> </dictionary>
<object class="NSMutableDictionary" key="outlets"> <object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">splitView</string> <string key="NS.key.0">splitView</string>

File diff suppressed because it is too large Load Diff

View File

@@ -12,5 +12,6 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
FOUNDATION_EXPORT NSString *const MPPasteBoardType; FOUNDATION_EXPORT NSString *const MPPasteBoardType;
FOUNDATION_EXPORT NSString *const MPErrorDomain;
#endif #endif

View File

@@ -9,3 +9,4 @@
#import "MPConstants.h" #import "MPConstants.h"
NSString *const MPPasteBoardType = @"com.hicknhack.macpass.pasteboard"; NSString *const MPPasteBoardType = @"com.hicknhack.macpass.pasteboard";
NSString *const MPErrorDomain = @"com.hicknhack.macpass.error";

View File

@@ -8,8 +8,26 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@class MPDocument;
@interface MPDocumentSettingsWindowController : NSWindowController @interface MPDocumentSettingsWindowController : NSWindowController
/* General */
@property (assign) IBOutlet NSTextField *databaseNameTextField;
@property (assign) IBOutlet NSTextView *databaseDescriptionTextView;
/* Protection */
@property (assign) IBOutlet NSTextField *passwordTextField;
@property (assign) IBOutlet NSPathControl *keyfilePathControl;
/* Display */
@property (assign) IBOutlet NSButton *protectTitleCheckButton;
@property (assign) IBOutlet NSButton *protectUserNameCheckButton;
@property (assign) IBOutlet NSButton *protectPasswortCheckButton;
@property (assign) IBOutlet NSButton *protectURLCheckButton;
@property (assign) IBOutlet NSButton *protectNotesCheckButton;
- (id)initWithDocument:(MPDocument *)document;
- (IBAction)saveChanges:(id)sender; - (IBAction)saveChanges:(id)sender;
@end @end

View File

@@ -7,56 +7,47 @@
// //
#import "MPDocumentSettingsWindowController.h" #import "MPDocumentSettingsWindowController.h"
#import "MPDocument.h"
#import "MPDatabaseVersion.h"
#import "Kdb4Node.h"
@interface MPDocumentSettingsWindowController () @interface MPDocumentSettingsWindowController () {
MPDocument *_document;
}
@end @end
@implementation MPDocumentSettingsWindowController @implementation MPDocumentSettingsWindowController
- (id)init { - (id)init {
return [self initWithWindowNibName:@"DocumentSettingsWindow"]; return [self initWithDocument:nil];
} }
- (id)initWithWindow:(NSWindow *)window { - (id)initWithDocument:(MPDocument *)document {
self = [super initWithWindow:window]; self = [super initWithWindowNibName:@"DocumentSettingsWindow"];
if(self) { if(self) {
// @property(nonatomic, copy) NSString *databaseName; _document = document;
// @property(nonatomic, retain) NSDate *databaseNameChanged; }
// @property(nonatomic, copy) NSString *databaseDescription; return self;
// @property(nonatomic, retain) NSDate *databaseDescriptionChanged;
// @property(nonatomic, copy) NSString *defaultUserName;
// @property(nonatomic, retain) NSDate *defaultUserNameChanged;
//
// @property(nonatomic, assign) NSInteger maintenanceHistoryDays;
//
// @property(nonatomic, copy) NSString *color;
//
// @property(nonatomic, retain) NSDate *masterKeyChanged;
// @property(nonatomic, assign) NSInteger masterKeyChangeRec;
// @property(nonatomic, assign) NSInteger masterKeyChangeForce;
//
// @property(nonatomic, assign) BOOL protectTitle;
// @property(nonatomic, assign) BOOL protectUserName;
// @property(nonatomic, assign) BOOL protectPassword;
// @property(nonatomic, assign) BOOL protectUrl;
// @property(nonatomic, assign) BOOL protectNotes;
//
// @property(nonatomic, readonly) NSMutableArray *customIcons;
// @property(nonatomic, assign) BOOL recycleBinEnabled;
// @property(nonatomic, retain) UUID *recycleBinUuid;
// @property(nonatomic, retain) NSDate *recycleBinChanged;
// @property(nonatomic, retain) UUID *entryTemplatesGroup;
// @property(nonatomic, retain) NSDate *entryTemplatesGroupChanged;
// @property(nonatomic, assign) NSInteger historyMaxItems;
// @property(nonatomic, assign) NSInteger historyMaxSize;
// @property(nonatomic, retain) UUID *lastSelectedGroup;
// @property(nonatomic, retain) UUID *lastTopVisibleGroup;
// @property(nonatomic, readonly) NSMutableArray *binaries;
// @property(nonatomic, readonly) NSMutableArray *customData;
} }
return self; - (void)windowDidLoad {
[super windowDidLoad];
NSAssert(_document != nil, @"Document needs to be present");
if( _document.version == MPDatabaseVersion4 ) {
Kdb4Tree *tree = (Kdb4Tree *)_document.tree;
[self.databaseNameTextField bind:NSValueBinding toObject:tree withKeyPath:@"databaseName" options:nil];
[self.databaseDescriptionTextView bind:NSValueBinding toObject:tree withKeyPath:@"databaseDescription" options:nil];
[self.protectNotesCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectNotes" options:nil];
[self.protectPasswortCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectPassword" options:nil];
[self.protectTitleCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectTitle" options:nil];
[self.protectURLCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectUrl" options:nil];
[self.protectUserNameCheckButton bind:NSValueBinding toObject:tree withKeyPath:@"protectUserName" options:nil];
}
else {
// Switch to KdbV3 View
}
} }
- (void)saveChanges:(id)sender { - (void)saveChanges:(id)sender {

View File

@@ -39,7 +39,7 @@ APPKIT_EXTERN NSString *const MPCurrentItemChangedNotification;
- (void)showPasswordInput; - (void)showPasswordInput;
- (void)performFindPanelAction:(id)sender; - (void)performFindPanelAction:(id)sender;
- (IBAction)editPassword:(id)sender; - (IBAction)editPassword:(id)sender;
- (IBAction)documentSettings:(id)sender; - (IBAction)showDocumentSettings:(id)sender;
- (void)lock:(id)sender; - (void)lock:(id)sender;
- (void)createGroup:(id)sender; - (void)createGroup:(id)sender;

View File

@@ -17,6 +17,7 @@
#import "MPAppDelegate.h" #import "MPAppDelegate.h"
#import "MPActionHelper.h" #import "MPActionHelper.h"
#import "MPDocumentSettingsWindowController.h" #import "MPDocumentSettingsWindowController.h"
#import "MPConstants.h"
NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCurrentItemChangedNotification"; NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCurrentItemChangedNotification";
@@ -219,9 +220,9 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
[self _setContentViewController:self.passwordEditController]; [self _setContentViewController:self.passwordEditController];
} }
- (void)documentSettings:(id)sender { - (void)showDocumentSettings:(id)sender {
if(!self.documentSettingsWindowController) { if(!self.documentSettingsWindowController) {
_documentSettingsWindowController = [[MPDocumentSettingsWindowController alloc] init]; _documentSettingsWindowController = [[MPDocumentSettingsWindowController alloc] initWithDocument:[self document]];
} }
[[NSApplication sharedApplication] beginSheet:[_documentSettingsWindowController window] modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; [[NSApplication sharedApplication] beginSheet:[_documentSettingsWindowController window] modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
} }

View File

@@ -45,6 +45,7 @@
} }
- (void)requestPassword { - (void)requestPassword {
// show Warnign if read-only mode!
[self _reset]; [self _reset];
} }

View File

@@ -48,7 +48,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1289</string> <string>1324</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>