Small updates to locking

Refactorings
This commit is contained in:
michael starke
2013-06-11 02:50:25 +02:00
parent b1f91ab807
commit df7a492ec8
16 changed files with 293 additions and 36 deletions

2
HNHUi

Submodule HNHUi updated: fd3d932c26...23b62dd2c5

View File

@@ -92,6 +92,7 @@
4C77E37315B84A240093A587 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C77E37215B84A240093A587 /* main.m */; };
4C77E37A15B84A240093A587 /* MPAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C77E37915B84A240093A587 /* MPAppDelegate.m */; };
4C77E37D15B84A240093A587 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C77E37B15B84A240093A587 /* MainMenu.xib */; };
4C79DF2A176685870083708F /* HNHRoundedTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C79DF29176685870083708F /* HNHRoundedTextField.m */; };
4C7E832A172DE2F2002493D8 /* MPPasswordEditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7E8329172DE2F2002493D8 /* MPPasswordEditViewController.m */; };
4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */; };
4C83814215BF4677001AE468 /* MPDocumentWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83814115BF4677001AE468 /* MPDocumentWindowController.m */; };
@@ -306,6 +307,9 @@
4C77E37415B84A240093A587 /* MacPass-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MacPass-Prefix.pch"; sourceTree = "<group>"; };
4C77E37815B84A240093A587 /* MPAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPAppDelegate.h; sourceTree = "<group>"; };
4C77E37915B84A240093A587 /* MPAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPAppDelegate.m; sourceTree = "<group>"; };
4C79DF28176685870083708F /* HNHRoundedTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHRoundedTextField.h; sourceTree = "<group>"; };
4C79DF29176685870083708F /* HNHRoundedTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHRoundedTextField.m; sourceTree = "<group>"; };
4C79DF2F1766941D0083708F /* MPResponderQuery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPResponderQuery.h; sourceTree = "<group>"; };
4C7E8328172DE2F2002493D8 /* MPPasswordEditViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordEditViewController.h; sourceTree = "<group>"; };
4C7E8329172DE2F2002493D8 /* MPPasswordEditViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordEditViewController.m; sourceTree = "<group>"; };
4C811C8116ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPKeyfilePathControlDelegate.h; sourceTree = "<group>"; };
@@ -730,6 +734,7 @@
isa = PBXGroup;
children = (
4CA0B30D15BCB6FD00654E32 /* MPSettingsTab.h */,
4C79DF2F1766941D0083708F /* MPResponderQuery.h */,
);
name = Protocolls;
sourceTree = "<group>";
@@ -792,6 +797,8 @@
children = (
4CC3AAB8175F4983003EF01B /* HNHRoundedTextFieldCell.h */,
4CC3AAB9175F4983003EF01B /* HNHRoundedTextFieldCell.m */,
4C79DF28176685870083708F /* HNHRoundedTextField.h */,
4C79DF29176685870083708F /* HNHRoundedTextField.m */,
4C9D6AA717615199001C660C /* HNHRoundedSecureTextFieldCell.h */,
4C9D6AA817615199001C660C /* HNHRoundedSecureTextFieldCell.m */,
4C58BD4D176370B100B8178C /* HNHBadgedTextField.h */,
@@ -1054,6 +1061,7 @@
4C569D9E17652B0600595B62 /* MPConstants.m in Sources */,
4C569DA117652BFE00595B62 /* MPEntryTableDataSource.m in Sources */,
4C569DA417653F3500595B62 /* KdbEntry+MPTreeTools.m in Sources */,
4C79DF2A176685870083708F /* HNHRoundedTextField.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -16,6 +16,8 @@
<string>NSCustomView</string>
<string>NSImageCell</string>
<string>NSImageView</string>
<string>NSLevelIndicator</string>
<string>NSLevelIndicatorCell</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSView</string>
@@ -307,7 +309,7 @@
<string key="NSFrame">{{80, 243}, {124, 22}}</string>
<reference key="NSSuperview" ref="87082330"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="432625169"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="11759019">
@@ -334,6 +336,28 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSClassName">HNHGradientView</string>
</object>
<object class="NSLevelIndicator" id="432625169">
<reference key="NSNextResponder" ref="87082330"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{80, 217}, {124, 18}}</string>
<reference key="NSSuperview" ref="87082330"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="816254670"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSLevelIndicatorCell" key="NSCell" id="357687486">
<int key="NSCellFlags">0</int>
<int key="NSCellFlags2">262144</int>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="432625169"/>
<double key="NSValue">2</double>
<double key="NSMaxValue">2</double>
<double key="NSWarningValue">2</double>
<double key="NSCriticalValue">2</double>
<int key="NSIndicatorStyle">2</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
<string key="NSFrameSize">{224, 487}</string>
<reference key="NSSuperview"/>
@@ -487,6 +511,54 @@
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="438211321">
<reference key="firstItem" ref="87082330"/>
<int key="firstAttribute">6</int>
<int key="relation">0</int>
<reference key="secondItem" ref="432625169"/>
<int key="secondAttribute">6</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">20</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="87082330"/>
<int key="scoringType">8</int>
<float key="scoringTypeFloat">29</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="427195617">
<reference key="firstItem" ref="432625169"/>
<int key="firstAttribute">5</int>
<int key="relation">0</int>
<reference key="secondItem" ref="438007584"/>
<int key="secondAttribute">5</int>
<float key="multiplier">1</float>
<object class="IBLayoutConstant" key="constant">
<double key="value">0.0</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="87082330"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">2</int>
</object>
<object class="IBNSLayoutConstraint" id="475693129">
<reference key="firstItem" ref="432625169"/>
<int key="firstAttribute">3</int>
<int key="relation">0</int>
<reference key="secondItem" ref="438007584"/>
<int key="secondAttribute">4</int>
<float key="multiplier">1</float>
<object class="IBNSLayoutSymbolicConstant" key="constant">
<double key="value">8</double>
</object>
<float key="priority">1000</float>
<reference key="containingView" ref="87082330"/>
<int key="scoringType">6</int>
<float key="scoringTypeFloat">24</float>
<int key="contentType">3</int>
</object>
<object class="IBNSLayoutConstraint" id="246479646">
<reference key="firstItem" ref="87082330"/>
<int key="firstAttribute">6</int>
@@ -947,6 +1019,7 @@
<reference ref="333573736"/>
<reference ref="438007584"/>
<reference ref="816254670"/>
<reference ref="432625169"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -1333,6 +1406,34 @@
<reference key="object" ref="574545128"/>
<reference key="parent" ref="816254670"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">684</int>
<reference key="object" ref="432625169"/>
<array class="NSMutableArray" key="children">
<reference ref="357687486"/>
</array>
<reference key="parent" ref="87082330"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">685</int>
<reference key="object" ref="357687486"/>
<reference key="parent" ref="432625169"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">686</int>
<reference key="object" ref="475693129"/>
<reference key="parent" ref="87082330"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">687</int>
<reference key="object" ref="427195617"/>
<reference key="parent" ref="87082330"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">689</int>
<reference key="object" ref="438211321"/>
<reference key="parent" ref="87082330"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -1372,6 +1473,9 @@
<reference ref="392529850"/>
<reference ref="522224579"/>
<reference ref="246479646"/>
<reference ref="475693129"/>
<reference ref="427195617"/>
<reference ref="438211321"/>
<reference ref="112302846"/>
<reference ref="313215172"/>
<reference ref="26385821"/>
@@ -1387,6 +1491,7 @@
<string key="462.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="463.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="463.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="464.CustomClassName">HNHRoundedTextField</string>
<boolean value="NO" key="464.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="464.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="465.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
@@ -1459,12 +1564,19 @@
<string key="665.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="667.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="669.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="684.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
<string key="684.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="685.CustomClassName">HNHLevelIndicatorCell</string>
<string key="685.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="686.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="687.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="689.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">683</int>
<int key="maxID">694</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1476,6 +1588,14 @@
<string key="minorKey">./Classes/HNHGradientView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">HNHLevelIndicatorCell</string>
<string key="superclassName">NSLevelIndicatorCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/HNHLevelIndicatorCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">HNHRoundedSecureTextFieldCell</string>
<string key="superclassName">HNHRoundedTextFieldCell</string>
@@ -1484,6 +1604,14 @@
<string key="minorKey">./Classes/HNHRoundedSecureTextFieldCell.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">HNHRoundedTextField</string>
<string key="superclassName">NSTextField</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/HNHRoundedTextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">HNHRoundedTextFieldCell</string>
<string key="superclassName">NSTextFieldCell</string>

View File

@@ -51,6 +51,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{125, 175}, {113, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="662046682"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -99,6 +100,7 @@
</set>
<string key="NSFrame">{{157, 200}, {48, 48}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="660673733"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -127,6 +129,7 @@
</set>
<string key="NSFrame">{{83, 94}, {197, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="769513826"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -151,6 +154,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{86, 123}, {191, 22}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="333885704"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
@@ -188,6 +192,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 126}, {64, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="219521947"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -208,6 +213,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{35, 99}, {46, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1034097047"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
@@ -228,6 +234,8 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{200, 50}, {83, 32}}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSHuggingPriority">{250, 250}</string>
<bool key="NSEnabled">YES</bool>
@@ -250,6 +258,7 @@
</array>
<string key="NSFrameSize">{362, 268}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="204058255"/>
<string key="NSAntiCompressionPriority">{751, 750}</string>
<string key="NSClassName">NSView</string>
@@ -1002,7 +1011,69 @@
<nil key="sourceID"/>
<int key="maxID">296</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MPPasswordInputController</string>
<string key="superclassName">MPViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">_decrypt:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">_decrypt:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">_decrypt:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="errorImageView">NSImageView</string>
<string key="errorInfoTextField">NSTextField</string>
<string key="keyPathControl">NSPathControl</string>
<string key="passwordTextField">NSSecureTextField</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="errorImageView">
<string key="name">errorImageView</string>
<string key="candidateClassName">NSImageView</string>
</object>
<object class="IBToOneOutletInfo" key="errorInfoTextField">
<string key="name">errorInfoTextField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="keyPathControl">
<string key="name">keyPathControl</string>
<string key="candidateClassName">NSPathControl</string>
</object>
<object class="IBToOneOutletInfo" key="passwordTextField">
<string key="name">passwordTextField</string>
<string key="candidateClassName">NSSecureTextField</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</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">
<string key="className">NSLayoutConstraint</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSLayoutConstraint.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>

View File

@@ -23,8 +23,9 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
@interface MPDocument : NSDocument
@property (assign, readonly) BOOL isProtected;
@property (assign, readonly) KdbGroup *root;
@property (retain, readonly) NSURL *file;
@property (nonatomic, retain, readonly) NSURL *file;
@property (nonatomic,retain) NSString *password;
@property (nonatomic, retain) NSURL *key;
@property (assign, readonly) MPDatabaseVersion version;

View File

@@ -28,6 +28,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
@interface MPDocument ()
@property (assign, nonatomic) BOOL isProtected;
@property (retain) KdbTree *tree;
@property (retain) NSURL *file;
@property (nonatomic, readonly) KdbPassword *passwordHash;
@@ -48,6 +49,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
self = [super init];
if(self) {
_isDecrypted = YES;
_isProtected = NO;
switch(version) {
case MPDatabaseVersion3:
self.tree = [[[Kdb3Tree alloc] init] autorelease];
@@ -123,6 +125,22 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
return YES;
}
- (void)setPassword:(NSString *)password {
if(![_password isEqualToString:password]) {
[_password release];
_password = [password retain];
self.isProtected = ([_password length] > 0);
}
}
- (void)setKey:(NSURL *)key {
if(![[_key absoluteString] isEqualToString:[key absoluteString]]) {
[_key release];
_key = [key retain];
self.isProtected = (_key != nil);
}
}
- (KdbPassword *)passwordHash {
// TODO: Use defaults to determine Encoding?
return [[[KdbPassword alloc] initWithPassword:self.password passwordEncoding:NSUTF8StringEncoding keyFile:[self.key path]] autorelease];

View File

@@ -17,7 +17,7 @@
@class MPCreationViewController;
@interface MPDocumentWindowController : NSWindowController <NSSplitViewDelegate> {
@interface MPDocumentWindowController : NSWindowController <NSWindowDelegate> {
@private
NSArray *_inspectorContraints;
}
@@ -37,6 +37,7 @@
- (IBAction)editPassword:(id)sender;
- (void)lock:(id)sender;
- (void)createGroup:(id)sender;
- (void)toggleInspector:(id)sender;
@end

View File

@@ -13,13 +13,14 @@
#import "MPPasswordEditViewController.h"
#import "MPToolbarDelegate.h"
#import "MPOutlineViewController.h"
#import "MPOutlineViewDelegate.h"
#import "MPInspectorViewController.h"
#import "MPAppDelegate.h"
#import "MPActionHelper.h"
@interface MPDocumentWindowController () {
@private
BOOL _needsDecryption;
id _firstResponder;
}
@property (retain) IBOutlet NSSplitView *splitView;
@@ -34,6 +35,7 @@
@property (retain) MPToolbarDelegate *toolbarDelegate;
@end
@implementation MPDocumentWindowController
@@ -41,7 +43,7 @@
-(id)init {
self = [super initWithWindowNibName:@"DocumentWindow" owner:self];
if( self ) {
_needsDecryption = NO;
_firstResponder = nil;
_toolbarDelegate = [[MPToolbarDelegate alloc] init];
_outlineViewController = [[MPOutlineViewController alloc] init];
_inspectorTabViewController = [[MPInspectorViewController alloc] init];
@@ -74,7 +76,7 @@
[self.toolbar setAllowsUserCustomization:YES];
[self.toolbar setDelegate:self.toolbarDelegate];
[self.window setToolbar:self.toolbar];
[self.splitView setTranslatesAutoresizingMaskIntoConstraints:NO];
NSView *outlineView = [_outlineViewController view];
@@ -87,7 +89,7 @@
[_splitView setHoldingPriority:NSLayoutPriorityDefaultLow+2 forSubviewAtIndex:0];
[_splitView setHoldingPriority:NSLayoutPriorityDefaultLow+1 forSubviewAtIndex:2];
[_splitView setDelegate:self];
[[self window] setDelegate:self];
MPDocument *document = [self document];
if(!document.isDecrypted) {
@@ -98,10 +100,6 @@
}
}
- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex {
return NO;
}
- (void)_setContentViewController:(MPViewController *)viewController {
NSView *newContentView = nil;
@@ -122,7 +120,7 @@
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(newContentView)]];
NSNumber *border = @([[self window] contentBorderThicknessForEdge:NSMinYEdge]);
[contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[newContentView]-border-|"
options:0
@@ -146,10 +144,15 @@
- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem {
SEL itemAction = [theItem action];
if( itemAction == [MPActionHelper actionOfType:MPActionLock]) {
return (nil == [[_passwordInputController view] superview]);
MPDocument *document = [self document];
BOOL showsNoLockScreen = (nil == [[_passwordInputController view] superview]);
return showsNoLockScreen && document.isProtected;
}
if(itemAction == [MPActionHelper actionOfType:MPActionAddEntry]) {
return (nil != _entryViewController.activeGroup);
}
return YES;
return [self.toolbarDelegate validateToolbarItem:theItem];
}
- (void)showPasswordInput {
@@ -175,8 +178,12 @@
[self showPasswordInput];
}
- (void)toggleInspector:(id)sender {
- (void)createGroup:(id)sender {
NSLog(@"WindowControllerCreateGroup");
}
- (void)toggleInspector:(id)sender {
}
- (void)showEntries {
@@ -227,6 +234,23 @@
[_outlineViewController showOutline];
}
#pragma mark NSWindowDelegate
- (void)windowDidUpdate:(NSNotification *)notification {
if(_firstResponder != [[self window] firstResponder]) {
_firstResponder = [[self window] firstResponder];
if(![_firstResponder isKindOfClass:[NSView class]]) {
return; // wrong responder
}
if( [_firstResponder isDescendantOf:[_entryViewController view]] ) {
//[_inspectorTabViewController showEntry];
}
else if([_firstResponder isDescendantOf:[_outlineViewController view]]) {
//[_inspectorTabViewController showGroup];
}
}
}
#pragma mark Helper
- (NSSearchField *)locateToolbarSearchField {
for(NSToolbarItem *toolbarItem in [[self.window toolbar] items]) {

View File

@@ -229,6 +229,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
}
else {
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController setContent:nil];
}
}
@@ -236,7 +237,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
#pragma mark Filtering
- (void)showFilter:(id)sender {
[self _showFilterBarAnimated:NO];
//[self _showFilterBarAnimated:NO];
}
- (BOOL)hasFilter {

View File

@@ -8,7 +8,9 @@
#import "MPViewController.h"
@class MPPopupImageView;
@class MPPopupImageView;
@class KdbEntry;
@class KdbGroup;
@interface MPInspectorViewController : MPViewController
@@ -21,10 +23,6 @@
@property (assign) IBOutlet NSTextField *passwordTextField;
@property (assign) IBOutlet NSTextField *titleOrNameLabel;
@property (assign) IBOutlet NSButton *openURLButton;
@property (assign) IBOutlet NSButton *showPasswordCreator;
- (BOOL)isVisible;
- (void)hideImagePopup:(id)sender;
@end

View File

@@ -23,7 +23,8 @@
@property (assign, nonatomic) KdbEntry *selectedEntry;
@property (assign, nonatomic) KdbGroup *selectedGroup;
@property (assign) BOOL showsEntry;
@property (assign, nonatomic) BOOL showsEntry;
@property (retain) NSPopover *iconPopup;
@property (retain) NSLayoutConstraint *showConstraint;
@property (retain) NSLayoutConstraint *hideConstraint;
@@ -70,10 +71,6 @@
[self _clearContent];
}
- (BOOL)isVisible {
return [[self view] frame].size.width > 0;
}
- (void)_updateContent {
if(self.showsEntry && self.selectedEntry) {
[self _showEntry];
@@ -151,8 +148,6 @@
[self.usernameTextField setEnabled:enabled];
[self.URLTextField setEnabled:enabled];
[self.openURLButton setEnabled:enabled];
}
#pragma mark Actions
@@ -202,5 +197,4 @@
[self _updateContent];
}
}
@end

View File

@@ -15,7 +15,6 @@
@property (retain, readonly) MPOutlineViewDelegate *outlineDelegate;
- (void)clearSelection;
- (void)showOutline;

View File

@@ -20,7 +20,6 @@
@interface MPOutlineViewController () {
BOOL _bindingEstablished;
}
@property (assign) IBOutlet NSOutlineView *outlineView;
@property (retain) NSTreeController *treeController;

View File

@@ -0,0 +1,15 @@
//
// MPResponderQuery.h
// MacPass
//
// Created by Michael Starke on 11.06.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MPResponderQuery <NSObject>
@required
- (BOOL)containsFirstResponder;
@end

View File

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

View File

@@ -204,7 +204,7 @@
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<double key="NSRowHeight">17</double>
<double key="NSRowHeight">24</double>
<int key="NSTvFlags">-767557632</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>