Fixed issue with composite key storing not updating the MasterKeyChanged date (this should be moved to KeePassKit)

Fixed #120 (at least that's what I hope ;) )
This commit is contained in:
michael starke
2013-12-04 21:22:29 +01:00
parent fa52de144c
commit 4d9aa8cc02
6 changed files with 28 additions and 14 deletions

View File

@@ -278,7 +278,13 @@ typedef NS_ENUM(NSUInteger, MPAlertType) {
if([password length] == 0 && keyFileURL == nil) { if([password length] == 0 && keyFileURL == nil) {
return NO; return NO;
} }
[self.compositeKey setPassword:password andKeyfile:keyFileURL]; if(!self.compositeKey) {
self.compositeKey = [[KPKCompositeKey alloc] initWithPassword:password key:keyFileURL];
}
else {
[self.compositeKey setPassword:password andKeyfile:keyFileURL];
}
self.tree.metaData.masterKeyChanged = [NSDate date];
/* We need to store the key file once the user actually writes the database */ /* We need to store the key file once the user actually writes the database */
return YES; return YES;
} }

View File

@@ -28,8 +28,6 @@ typedef NS_ENUM( NSUInteger, MPCopyContentTypeTag) {
@interface MPEntryViewController : MPViewController <NSTableViewDelegate> @interface MPEntryViewController : MPViewController <NSTableViewDelegate>
@property (readonly, weak, nonatomic) KPKEntry *selectedEntry;
@property (weak,readonly) NSTableView *entryTable; @property (weak,readonly) NSTableView *entryTable;
@property (readonly, strong) NSArrayController *entryArrayController; @property (readonly, strong) NSArrayController *entryArrayController;
@property (nonatomic, strong) NSString *filter; @property (nonatomic, strong) NSString *filter;

View File

@@ -88,9 +88,6 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
@property (weak) IBOutlet NSButton *addEntryButton; @property (weak) IBOutlet NSButton *addEntryButton;
@property (weak) IBOutlet NSTextField *entryCountTextField; @property (weak) IBOutlet NSTextField *entryCountTextField;
@property (weak) KPKEntry *selectedEntry;
@property (nonatomic, strong) MPEntryTableDataSource *dataSource; @property (nonatomic, strong) MPEntryTableDataSource *dataSource;
@property (assign, nonatomic) MPFilterModeType filterMode; @property (assign, nonatomic) MPFilterModeType filterMode;
@@ -112,13 +109,13 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
_dataSource = [[MPEntryTableDataSource alloc] init]; _dataSource = [[MPEntryTableDataSource alloc] init];
_dataSource.viewController = self; _dataSource.viewController = self;
_menuDelegate = [[MPEntryContextMenuDelegate alloc] init]; _menuDelegate = [[MPEntryContextMenuDelegate alloc] init];
_selectedEntry = nil;
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[self unbind:@"filterMode"];
} }
@@ -413,8 +410,15 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
self.filter = [self.filterSearchField stringValue]; self.filter = [self.filterSearchField stringValue];
} }
- (void)setupFilterBar { - (void)_setupFilterBar {
if(!self.filterBar) { if(!self.filterBar) {
/*
[[NSUserDefaultsController sharedUserDefaultsController] bind:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEntrySearchFilterMode]
toObject:self
withKeyPath:@"filterMode"
options:nil];
*/
[[NSBundle mainBundle] loadNibNamed:@"FilterBar" owner:self topLevelObjects:nil]; [[NSBundle mainBundle] loadNibNamed:@"FilterBar" owner:self topLevelObjects:nil];
[self.filterURLButton setTag:MPFilterUrls]; [self.filterURLButton setTag:MPFilterUrls];
[self.filterUsernameButton setTag:MPFilterUsernames]; [self.filterUsernameButton setTag:MPFilterUsernames];
@@ -438,7 +442,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
- (void)_showFilterBarAnimated { - (void)_showFilterBarAnimated {
if(!self.filterBar) { if(!self.filterBar) {
[self setupFilterBar]; [self _setupFilterBar];
} }
/* /*
Make sure the buttons are set correctyl every time Make sure the buttons are set correctyl every time

View File

@@ -49,6 +49,9 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyRememberKeyFilesForDatabases;
/* Autotype */ /* Autotype */
APPKIT_EXTERN NSString *const kMPSettingsKeySendCommandForControlKey; APPKIT_EXTERN NSString *const kMPSettingsKeySendCommandForControlKey;
/* Search */
APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterMode;
typedef NS_ENUM(NSUInteger, MPPasswordEncoding) { typedef NS_ENUM(NSUInteger, MPPasswordEncoding) {
MPPasswordEncodingUTF8, MPPasswordEncodingUTF8,
MPPasswordEncodingASCII, MPPasswordEncodingASCII,

View File

@@ -34,6 +34,8 @@ NSString *const kMPSettingsKeyRememberKeyFilesForDatabases = @"RememberKeyFiles
NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey"; NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyForControlKey";
NSString *const kMPSettingsKeyEntrySearchFilterMode = @"EntrySearchFilterMode";
@implementation MPSettingsHelper @implementation MPSettingsHelper
+ (void)setupDefaults { + (void)setupDefaults {
@@ -63,7 +65,8 @@ NSString *const kMPSettingsKeySendCommandForControlKey = @"SendCommandKeyFo
kMPSettingsKeyLegacyHideURL: @NO, kMPSettingsKeyLegacyHideURL: @NO,
kMPSettingsKeyLegacyHideUsername: @NO, kMPSettingsKeyLegacyHideUsername: @NO,
kMPSettingsKeyRememberKeyFilesForDatabases: @NO, kMPSettingsKeyRememberKeyFilesForDatabases: @NO,
kMPSettingsKeySendCommandForControlKey: @YES kMPSettingsKeySendCommandForControlKey: @YES,
kMPSettingsKeyEntrySearchFilterMode: @0
}; };
} }