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 class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">documentSettings:</string>
<string key="label">showDocumentSettings:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="544639599"/>
</object>
<int key="connectionID">1232</int>
<int key="connectionID">1233</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
@@ -1298,7 +1298,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">1232</int>
<int key="maxID">1233</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1357,18 +1357,18 @@
<string key="className">MPDocumentWindowController</string>
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="documentSettings:">id</string>
<string key="editPassword:">id</string>
<string key="showDocumentSettings:">id</string>
</dictionary>
<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:">
<string key="name">editPassword:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="showDocumentSettings:">
<string key="name">showDocumentSettings:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<object class="NSMutableDictionary" key="outlets">
<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>
FOUNDATION_EXPORT NSString *const MPPasteBoardType;
FOUNDATION_EXPORT NSString *const MPErrorDomain;
#endif

View File

@@ -8,4 +8,5 @@
#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>
@class MPDocument;
@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;
@end

View File

@@ -7,56 +7,47 @@
//
#import "MPDocumentSettingsWindowController.h"
#import "MPDocument.h"
#import "MPDatabaseVersion.h"
#import "Kdb4Node.h"
@interface MPDocumentSettingsWindowController ()
@interface MPDocumentSettingsWindowController () {
MPDocument *_document;
}
@end
@implementation MPDocumentSettingsWindowController
- (id)init {
return [self initWithWindowNibName:@"DocumentSettingsWindow"];
return [self initWithDocument:nil];
}
- (id)initWithWindow:(NSWindow *)window {
self = [super initWithWindow:window];
if (self) {
// @property(nonatomic, copy) NSString *databaseName;
// @property(nonatomic, retain) NSDate *databaseNameChanged;
// @property(nonatomic, copy) NSString *databaseDescription;
// @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;
}
- (id)initWithDocument:(MPDocument *)document {
self = [super initWithWindowNibName:@"DocumentSettingsWindow"];
if(self) {
_document = document;
}
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];
return self;
[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 {

View File

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

View File

@@ -17,6 +17,7 @@
#import "MPAppDelegate.h"
#import "MPActionHelper.h"
#import "MPDocumentSettingsWindowController.h"
#import "MPConstants.h"
NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCurrentItemChangedNotification";
@@ -64,7 +65,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_toolbar release];
[_passwordInputController release];
@@ -80,7 +81,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
#pragma mark View Handling
- (void)windowDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didRevertDocument:) name:MPDocumentDidRevertNotifiation object:[self document]];
[_entryViewController setupNotifications:self];
@@ -151,7 +152,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
#pragma mark Notification handling
- (void)_updateCurrentItem:(NSNotification *)notification {
id sender = [notification object];
self.currentGroup = _outlineViewController.selectedGroup;
self.currentEntry = _entryViewController.selectedEntry;
@@ -219,9 +220,9 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
[self _setContentViewController:self.passwordEditController];
}
- (void)documentSettings:(id)sender {
- (void)showDocumentSettings:(id)sender {
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];
}
@@ -279,7 +280,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
/*
The current easy way to prevent layout hickups is to add the inspect
Add all neded contraints an then remove it again, if it was hidden
*/
*/
BOOL removeInspector = NO;
if(![inspectorView superview]) {
[_splitView addSubview:inspectorView];

View File

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

View File

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