Added default Autotype sequence to settings. Using sepearte MPTreeDeleagte for autotype and editing

This commit is contained in:
michael starke
2014-09-01 19:28:29 +02:00
parent 8ab4d9f787
commit 2aef949a5b
5 changed files with 37 additions and 3 deletions

View File

@@ -31,6 +31,8 @@
#import "MPNotifications.h" #import "MPNotifications.h"
#import "MPConstants.h" #import "MPConstants.h"
#import "MPSavePanelAccessoryViewController.h" #import "MPSavePanelAccessoryViewController.h"
#import "MPTreeDelegate.h"
#import "DDXMLNode.h" #import "DDXMLNode.h"
@@ -65,6 +67,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
@private @private
BOOL _didLockFile; BOOL _didLockFile;
NSData *_encryptedData; NSData *_encryptedData;
MPTreeDelegate *_treeDelgate;
} }
@property (nonatomic, assign) NSUInteger unlockCount; @property (nonatomic, assign) NSUInteger unlockCount;
@@ -396,6 +399,10 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
if(_tree != tree) { if(_tree != tree) {
_tree = tree; _tree = tree;
_tree.undoManager = [self undoManager]; _tree.undoManager = [self undoManager];
if(nil == _treeDelgate) {
_treeDelgate = [[MPTreeDelegate alloc] initWithDocument:self];
}
_tree.delegate = _treeDelgate;
} }
} }

View File

@@ -36,6 +36,7 @@ NSString *const kMPSettingsKeyRememeberdKeysForDatabases = @"Rememe
NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey"; NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey";
NSString *const kMPSettingsKeyEnableGlobalAutotype = @"EnableGlobalAutotype"; NSString *const kMPSettingsKeyEnableGlobalAutotype = @"EnableGlobalAutotype";
NSString *const kMPSettingsKeyGlobalAutotypeKeyDataKey = @"GlobalAutotypeKeyDataKey"; NSString *const kMPSettingsKeyGlobalAutotypeKeyDataKey = @"GlobalAutotypeKeyDataKey";
NSString *const kMPSettingsKeyDefaultGlobalAutotypeSequence = @"DefaultGlobalAutotypeSequence";
NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext"; NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext";
@@ -99,6 +100,7 @@ NSString *const kMPDeprecatedSettingsKeyEntrySearchFilterMode = @"En
kMPSettingsKeyRememberKeyFilesForDatabases: @NO, kMPSettingsKeyRememberKeyFilesForDatabases: @NO,
kMPSettingsKeySendCommandForControlKey: @YES, kMPSettingsKeySendCommandForControlKey: @YES,
kMPSettingsKeyEnableGlobalAutotype: @NO, kMPSettingsKeyEnableGlobalAutotype: @NO,
kMPSettingsKeyDefaultGlobalAutotypeSequence: @"{USERNAME}{TAB}{PASSWORD}{ENTER}",
kMPSettingsKeyEnableQuicklookPreview: @NO, kMPSettingsKeyEnableQuicklookPreview: @NO,
kMPSettingsKeyCopyGeneratedPasswordToClipboard: @NO, kMPSettingsKeyCopyGeneratedPasswordToClipboard: @NO,
kMPSettingsKeyDefaultPasswordRounds: @50000, kMPSettingsKeyDefaultPasswordRounds: @50000,

View File

@@ -9,6 +9,10 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "KPKTree.h" #import "KPKTree.h"
@class MPDocument;
@interface MPTreeDelegate : NSObject <KPKTreeDelegate> @interface MPTreeDelegate : NSObject <KPKTreeDelegate>
- (instancetype)initWithDocument:(MPDocument *)document;
@end @end

View File

@@ -8,11 +8,32 @@
#import "MPTreeDelegate.h" #import "MPTreeDelegate.h"
#import "MPDocument.h"
#import "MPSettingsHelper.h"
@interface MPTreeDelegate ();
@property (weak) MPDocument *document;
@end
@implementation MPTreeDelegate @implementation MPTreeDelegate
- (instancetype)initWithDocument:(MPDocument *)document {
self = [super init];
if(self) {
self.document = document;
}
return self;
}
- (NSString *)defaultAutotypeSequenceForTree:(KPKTree *)tree { - (NSString *)defaultAutotypeSequenceForTree:(KPKTree *)tree {
/* TODO use Settings for the default autotype sequence */ return [[NSUserDefaults standardUserDefaults] stringForKey:kMPSettingsKeyDefaultGlobalAutotypeSequence];
return nil; }
- (BOOL)shouldEditTree:(KPKTree *)tree {
return (NO == self.document.isReadOnly);
} }
@end @end