Files
MacPass/MacPass/MPGeneralSettingsController.m
michael starke bfc610a25e Added "reopen last database" featuer
Removed standard open new db on activate
Enabled windows state restoration
Enabled table column state restoration
Menu items should be validated better
2013-07-18 04:21:23 +02:00

47 lines
2.0 KiB
Objective-C

//
// MPGeneralSettingsController.m
// MacPass
//
// Created by Michael Starke on 23.07.12.
// Copyright (c) 2012 HicknHack Software GmbH. All rights reserved.
//
#import "MPGeneralSettingsController.h"
#import "MPSettingsHelper.h"
#import "MPIconHelper.h"
NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
@implementation MPGeneralSettingsController
- (id)init {
return [self initWithNibName:@"GeneralSettings" bundle:[NSBundle mainBundle]];
}
- (NSString *)identifier {
return MPGeneralSetingsIdentifier;
}
- (NSImage *)image {
return [MPIconHelper icon:MPIconWarning];
}
- (NSString *)label {
return NSLocalizedString(@"GENERAL_SETTINGS", @"General Settings Label");
}
- (void)didLoadView {
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
NSString *reopenLastFilePath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyReopenLastDatabaseOnLaunch];
NSString *clearPasteboardKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyClearPasteboardOnQuit];
NSString *clearPasteboardTimeOutKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyPasteboardClearTimeout];
NSString *idleTimeOutKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyIdleLockTimeOut];
NSString *lockOnSleepKeyPath = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyLockOnSleep];
[self.clearPasteboardOnQuitCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:clearPasteboardKeyPath options:nil];
[self.clearPasteboardTimeoutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:clearPasteboardTimeOutKeyPath options:nil];
[self.lockOnSleepCheckButton bind:NSValueBinding toObject:defaultsController withKeyPath:lockOnSleepKeyPath options:nil];
[self.idleTimeOutPopup bind:NSSelectedTagBinding toObject:defaultsController withKeyPath:idleTimeOutKeyPath options:nil];
[self.reopenLastDatabase bind:NSValueBinding toObject:defaultsController withKeyPath:reopenLastFilePath options:nil];
}
@end