Merged pull request #117

This commit is contained in:
michael starke
2013-12-02 17:15:13 +01:00
parent 336fe02e2d
commit 1964adb439
3 changed files with 21 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
[urlColumn setSortDescriptorPrototype:urlSortDescriptor];
[parentColumn setSortDescriptorPrototype:groupnameSortDescriptor];
[modifiedColumn setSortDescriptorPrototype:dateSortDescriptor];
[[parentColumn headerCell] setStringValue:NSLocalizedString(@"GROUP", "")];
[[titleColumn headerCell] setStringValue:NSLocalizedString(@"TITLE", "")];
[[userNameColumn headerCell] setStringValue:NSLocalizedString(@"USERNAME", "")];
@@ -189,7 +189,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
[self.entryTable bind:NSContentBinding toObject:self.entryArrayController withKeyPath:@"arrangedObjects" options:nil];
[self.entryTable bind:NSSortDescriptorsBinding toObject:self.entryArrayController withKeyPath:@"sortDescriptors" options:nil];
[self.entryTable setDataSource:_dataSource];
// bind NSArrayController sorting so that sort order gets auto-saved
// see: http://simx.me/technonova/software_development/sort_descriptors_nstableview_bindings_a.html
[self.entryArrayController bind:NSSortDescriptorsBinding
toObject:[NSUserDefaultsController sharedUserDefaultsController]
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEntryTableSortDescriptors]
options:@{ NSValueTransformerNameBindingOption: NSUnarchiveFromDataTransformerName }];
[self _setupHeaderMenu];
[parentColumn setHidden:YES];
}

View File

@@ -32,6 +32,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyIdleLockTimeOut;
/* Autosaving states */
APPKIT_EXTERN NSString *const kMPSettingsKeyShowInspector;
APPKIT_EXTERN NSString *const kMPSettingsKeyEntryTableSortDescriptors;
/* Kdb Hide/Show settings */
APPKIT_EXTERN NSString *const kMPSettingsKeyLegacyHideTitle;
@@ -55,7 +56,17 @@ typedef NS_ENUM(NSUInteger, MPPasswordEncoding) {
@interface MPSettingsHelper : NSObject
/**
* Registers all the defaults for the applciaiton
*/
+ (void)setupDefaults;
/**
* Convenience Method to create a bind path for the NSUserDefaultsController
*
* @param key SettingsKey (see MPSettingsHelper.h for available keys)
*
* @return NSString containing the bindpath for this property for the NSUserDefaultController
*/
+ (NSString *)defaultControllerPathForKey:(NSString *)key;
@end

View File

@@ -20,6 +20,7 @@ NSString *const kMPSettingsKeyShowMenuItem = @"ShowMenuItem";
NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep";
NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut";
NSString *const kMPSettingsKeyShowInspector = @"ShowInspector";
NSString *const kMPSettingsKeyEntryTableSortDescriptors = @"EntryTableSortDescriptors";
NSString *const kMPSettingsKeyLegacyHideTitle = @"LegacyHideTitle";
NSString *const kMPSettingsKeyLegacyHideUsername = @"LegacyHideUsername ";