mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 20:32:43 +00:00
Newly created groups should now be selected
Added lock on sleep Lock on idle still missing Fixed some issues with clipboard clearing Fixed preferences bindings errors
This commit is contained in:
@@ -125,6 +125,8 @@
|
||||
4C80BB6F176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C80BB6E176DE06F00E5E248 /* HNHScrollDocumentViewAdapter.m */; };
|
||||
4C811C8316ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */; };
|
||||
4C83814215BF4677001AE468 /* MPDocumentWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83814115BF4677001AE468 /* MPDocumentWindowController.m */; };
|
||||
4C83F4AA1774B155006C5FC0 /* Kdb3Tree+NewTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83F4A91774B155006C5FC0 /* Kdb3Tree+NewTree.m */; };
|
||||
4C83F4AD1774B25F006C5FC0 /* Kdb4Tree+NewTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C83F4AC1774B25F006C5FC0 /* Kdb4Tree+NewTree.m */; };
|
||||
4C888C9016EB6C91003D34A1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4C888C8E16EB6C91003D34A1 /* Localizable.strings */; };
|
||||
4C888C9316EB6F5E003D34A1 /* MPToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */; };
|
||||
4C888C9716EB754B003D34A1 /* MPActionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C888C9616EB754B003D34A1 /* MPActionHelper.m */; };
|
||||
@@ -413,6 +415,10 @@
|
||||
4C811C8216ECD06E00C4BAC6 /* MPKeyfilePathControlDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPKeyfilePathControlDelegate.m; sourceTree = "<group>"; };
|
||||
4C83814015BF4677001AE468 /* MPDocumentWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentWindowController.h; sourceTree = "<group>"; };
|
||||
4C83814115BF4677001AE468 /* MPDocumentWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentWindowController.m; sourceTree = "<group>"; };
|
||||
4C83F4A81774B155006C5FC0 /* Kdb3Tree+NewTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb3Tree+NewTree.h"; sourceTree = "<group>"; };
|
||||
4C83F4A91774B155006C5FC0 /* Kdb3Tree+NewTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Kdb3Tree+NewTree.m"; sourceTree = "<group>"; };
|
||||
4C83F4AB1774B25F006C5FC0 /* Kdb4Tree+NewTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Kdb4Tree+NewTree.h"; sourceTree = "<group>"; };
|
||||
4C83F4AC1774B25F006C5FC0 /* Kdb4Tree+NewTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Kdb4Tree+NewTree.m"; sourceTree = "<group>"; };
|
||||
4C888C8F16EB6C91003D34A1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
4C888C9116EB6F5E003D34A1 /* MPToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbarItem.h; sourceTree = "<group>"; };
|
||||
4C888C9216EB6F5E003D34A1 /* MPToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPToolbarItem.m; sourceTree = "<group>"; };
|
||||
@@ -682,7 +688,7 @@
|
||||
name = KeepassHttp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4C2C4C2516D3BCEA00D49295 /* KeePassLibAdditions */ = {
|
||||
4C2C4C2516D3BCEA00D49295 /* KeePassLib Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C569DA217653F3500595B62 /* KdbEntry+MPTreeTools.h */,
|
||||
@@ -697,8 +703,12 @@
|
||||
4C22040C1746ED160054C916 /* KdbGroup+Undo.m */,
|
||||
4C4A101017629DA900BBF2CA /* KdbGroup+KVOAdditions.h */,
|
||||
4C4A101117629DA900BBF2CA /* KdbGroup+KVOAdditions.m */,
|
||||
4C83F4A81774B155006C5FC0 /* Kdb3Tree+NewTree.h */,
|
||||
4C83F4A91774B155006C5FC0 /* Kdb3Tree+NewTree.m */,
|
||||
4C83F4AB1774B25F006C5FC0 /* Kdb4Tree+NewTree.h */,
|
||||
4C83F4AC1774B25F006C5FC0 /* Kdb4Tree+NewTree.m */,
|
||||
);
|
||||
name = KeePassLibAdditions;
|
||||
name = "KeePassLib Categories";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4C2E382016D141F700037A9D /* Helper */ = {
|
||||
@@ -930,7 +940,7 @@
|
||||
children = (
|
||||
4C245C11176E22150086100E /* KeepassHttp */,
|
||||
4C46B8821706397A0046109A /* Security Additions */,
|
||||
4C2C4C2516D3BCEA00D49295 /* KeePassLibAdditions */,
|
||||
4C2C4C2516D3BCEA00D49295 /* KeePassLib Categories */,
|
||||
4C2E382016D141F700037A9D /* Helper */,
|
||||
4C586F9C16D07ABD00E7DB57 /* Icons */,
|
||||
4CA0B30F15BCB85D00654E32 /* General */,
|
||||
@@ -1391,6 +1401,8 @@
|
||||
4CC299FF176F99E50050C939 /* MPRequestHandlerService.m in Sources */,
|
||||
4CC29A02176F9D140050C939 /* MPTestAssociateRequestHandler.m in Sources */,
|
||||
4CA0E3A7176FAF99004D18CB /* MPDocumentQueryService.m in Sources */,
|
||||
4C83F4AA1774B155006C5FC0 /* Kdb3Tree+NewTree.m in Sources */,
|
||||
4C83F4AD1774B25F006C5FC0 /* Kdb4Tree+NewTree.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -294,23 +294,23 @@
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
<nil key="NSMenuItem"/>
|
||||
<object class="NSMenuItem" key="NSMenuItem" id="17771272">
|
||||
<reference key="NSMenu" ref="552398563"/>
|
||||
<string key="NSTitle">Never</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<int key="NSState">1</int>
|
||||
<reference key="NSOnImage" ref="45262901"/>
|
||||
<reference key="NSMixedImage" ref="738594033"/>
|
||||
<string key="NSAction">_popUpItemAction:</string>
|
||||
<reference key="NSTarget" ref="52406626"/>
|
||||
</object>
|
||||
<bool key="NSMenuItemRespectAlignment">YES</bool>
|
||||
<object class="NSMenu" key="NSMenu" id="552398563">
|
||||
<string key="NSTitle">LockTimes</string>
|
||||
<array class="NSMutableArray" key="NSMenuItems">
|
||||
<object class="NSMenuItem" id="17771272">
|
||||
<reference key="NSMenu" ref="552398563"/>
|
||||
<string key="NSTitle">Never</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<int key="NSState">1</int>
|
||||
<reference key="NSOnImage" ref="45262901"/>
|
||||
<reference key="NSMixedImage" ref="738594033"/>
|
||||
<string key="NSAction">_popUpItemAction:</string>
|
||||
<reference key="NSTarget" ref="52406626"/>
|
||||
</object>
|
||||
<reference ref="17771272"/>
|
||||
<object class="NSMenuItem" id="158936574">
|
||||
<reference key="NSMenu" ref="552398563"/>
|
||||
<string key="NSTitle">for 1 Minute</string>
|
||||
@@ -363,7 +363,6 @@
|
||||
<string key="NSFrame">{{16, 12}, {122, 18}}</string>
|
||||
<reference key="NSSuperview" ref="731672371"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="252113219">
|
||||
@@ -484,6 +483,22 @@
|
||||
</object>
|
||||
<int key="connectionID">521</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">idleTimeOutPopup</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="272904029"/>
|
||||
</object>
|
||||
<int key="connectionID">809</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">lockOnSleepCheckButton</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1066302408"/>
|
||||
</object>
|
||||
<int key="connectionID">810</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
@@ -1456,7 +1471,7 @@
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">808</int>
|
||||
<int key="maxID">810</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -1466,7 +1481,9 @@
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="clearPasteboardOnQuitCheckButton">NSButton</string>
|
||||
<string key="clearPasteboardTimeoutPopup">NSPopUpButton</string>
|
||||
<string key="idleTimeOutPopup">NSPopUpButton</string>
|
||||
<string key="imageView">NSImageView</string>
|
||||
<string key="lockOnSleepCheckButton">NSButton</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="clearPasteboardOnQuitCheckButton">
|
||||
@@ -1477,10 +1494,18 @@
|
||||
<string key="name">clearPasteboardTimeoutPopup</string>
|
||||
<string key="candidateClassName">NSPopUpButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="idleTimeOutPopup">
|
||||
<string key="name">idleTimeOutPopup</string>
|
||||
<string key="candidateClassName">NSPopUpButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="imageView">
|
||||
<string key="name">imageView</string>
|
||||
<string key="candidateClassName">NSImageView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="lockOnSleepCheckButton">
|
||||
<string key="name">lockOnSleepCheckButton</string>
|
||||
<string key="candidateClassName">NSButton</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
- (IBAction)showPasswordCreator:(id)sender;
|
||||
|
||||
- (NSString *)applicationName;
|
||||
- (void)lockAllDocuments;
|
||||
|
||||
@end
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "MPStringLengthValueTransformer.h"
|
||||
#import "MPServerDaemon.h"
|
||||
#import "MPLockDaemon.h"
|
||||
#import "MPDocumentWindowController.h"
|
||||
|
||||
@interface MPAppDelegate () {
|
||||
@private
|
||||
@@ -46,7 +47,6 @@
|
||||
lockDaemon = [[MPLockDaemon alloc] init];
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[_settingsController release];
|
||||
[_passwordCreatorController release];
|
||||
@@ -91,4 +91,13 @@
|
||||
[self.passwordCreatorWindow makeKeyAndOrderFront:self.passwordCreatorWindow];
|
||||
}
|
||||
|
||||
- (void)lockAllDocuments {
|
||||
for(NSDocument *document in [[NSDocumentController sharedDocumentController] documents]) {
|
||||
NSArray *windowControllers = [document windowControllers];
|
||||
if([windowControllers count] > 0) {
|
||||
[windowControllers[0] lock:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -80,6 +80,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
|
||||
{
|
||||
[_entryViewController setupNotifications:self];
|
||||
[_inspectorViewController setupNotifications:self];
|
||||
[_outlineViewController setupNotifications:self];
|
||||
|
||||
[super windowDidLoad];
|
||||
_toolbar = [[NSToolbar alloc] initWithIdentifier:@"MainWindowToolbar"];
|
||||
@@ -202,6 +203,7 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
|
||||
}
|
||||
|
||||
- (void)lock:(id)sender {
|
||||
// Test if document is lockable
|
||||
[self showPasswordInput];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MPViewController.h"
|
||||
#import "MPSettingsTab.h"
|
||||
|
||||
@interface MPGeneralSettingsController : NSViewController <MPSettingsTab>
|
||||
@property (assign) IBOutlet NSImageView *imageView;
|
||||
@interface MPGeneralSettingsController : MPViewController <MPSettingsTab>
|
||||
|
||||
@property (assign) IBOutlet NSButton *clearPasteboardOnQuitCheckButton;
|
||||
@property (assign) IBOutlet NSPopUpButton *clearPasteboardTimeoutPopup;
|
||||
@property (assign) IBOutlet NSPopUpButton *idleTimeOutPopup;
|
||||
@property (assign) IBOutlet NSButton *lockOnSleepCheckButton;
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,8 +34,11 @@ NSString *const MPGeneralSetingsIdentifier = @"GeneralSettingsTab";
|
||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||
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];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
|
||||
#import "MPLockDaemon.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "MPAppDelegate.h"
|
||||
|
||||
NSString *const MPShouldLockDatabaseNotification = @"com.hicknhack.macpass.MPShouldLockDatabaseNotification";
|
||||
|
||||
@interface MPLockDaemon ()
|
||||
@interface MPLockDaemon () {
|
||||
NSTimer *idleTimer;
|
||||
}
|
||||
|
||||
@property (nonatomic,assign) BOOL lockOnSleep;
|
||||
@property (nonatomic,assign) NSUInteger idleLockTime;
|
||||
@@ -33,7 +36,7 @@ NSString *const MPShouldLockDatabaseNotification = @"com.hicknhack.macpass.MPSho
|
||||
self = [super init];
|
||||
if (self) {
|
||||
NSString *lockOnSleepKey = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyLockOnSleep];
|
||||
NSString *idleTimeOutKey = [NSString stringWithFormat:@"values.%@", kMPSEttingsKeyIdleLockTimeOut];
|
||||
NSString *idleTimeOutKey = [NSString stringWithFormat:@"values.%@", kMPSettingsKeyIdleLockTimeOut];
|
||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||
[self bind:@"lockOnSleep" toObject:defaultsController withKeyPath:lockOnSleepKey options:nil];
|
||||
[self bind:@"idleLockTime" toObject:defaultsController withKeyPath:idleTimeOutKey options:nil];
|
||||
@@ -73,7 +76,7 @@ NSString *const MPShouldLockDatabaseNotification = @"com.hicknhack.macpass.MPSho
|
||||
}
|
||||
|
||||
- (void)_willSleepNotification:(NSNotification *)notification {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPShouldLockDatabaseNotification object:self];
|
||||
[[NSApp delegate] lockAllDocuments];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@class MPOutlineViewDelegate;
|
||||
@class KdbGroup;
|
||||
@class HNHGradientView;
|
||||
@class MPDocumentWindowController;
|
||||
|
||||
@interface MPOutlineViewController : MPViewController
|
||||
|
||||
@@ -19,6 +20,7 @@
|
||||
@property (assign) IBOutlet HNHGradientView *bottomBar;
|
||||
|
||||
- (void)showOutline;
|
||||
- (void)setupNotifications:(MPDocumentWindowController *)windowController;
|
||||
|
||||
- (void)createGroup:(id)sender;
|
||||
- (void)createEntry:(id)sender;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
[_datasource release];
|
||||
[_outlineDelegate release];
|
||||
[_menu release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -86,6 +86,26 @@
|
||||
[_outlineView expandItem:node expandChildren:NO];
|
||||
}
|
||||
|
||||
- (void)setupNotifications:(MPDocumentWindowController *)windowController {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didCreateGroup:) name:MPDocumentDidAddGroupNotification object:[windowController document]];
|
||||
}
|
||||
|
||||
- (void)_didCreateGroup:(NSNotification *)notification {
|
||||
NSInteger selectedRow = [_outlineView selectedRow];
|
||||
NSIndexSet *indexSet;
|
||||
if( selectedRow == -1) {
|
||||
MPDocument *document = [[self windowController] document];
|
||||
indexSet = [NSIndexSet indexSetWithIndex:[document.root.groups count]];
|
||||
//TODO: Find out why selection is not set (treeUpdate?)
|
||||
}
|
||||
else {
|
||||
id item = [_outlineView itemAtRow:selectedRow];
|
||||
[_outlineView expandItem:item];
|
||||
indexSet = [NSIndexSet indexSetWithIndex:selectedRow + 1];
|
||||
}
|
||||
[_outlineView selectRowIndexes:indexSet byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
- (NSMenu *)_contextMenu {
|
||||
NSMenu *menu = [[NSMenu alloc] init];
|
||||
NSArray *items = [MPContextMenuHelper contextMenuItemsWithItems:MPContextMenuMinimal];
|
||||
@@ -127,7 +147,7 @@
|
||||
- (void)deleteEntry:(id)sender {
|
||||
KdbGroup *group = [self _clickedOrSelectedGroup];
|
||||
if(group && group.parent) {
|
||||
[group.parent removeGroupUndoable:group];
|
||||
[group.parent removeGroupUndoable:group];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +59,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item {
|
||||
NSTreeNode *treeNode = item;
|
||||
KdbGroup *group = [treeNode representedObject];
|
||||
return YES;
|
||||
//KdbGroup *group = item;
|
||||
//return (nil != [group parent]);
|
||||
return (nil != [group parent]);
|
||||
}
|
||||
|
||||
- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
|
||||
- (void)setClearTimeout:(NSTimeInterval)clearTimeout {
|
||||
if(_clearTimeout != clearTimeout) {
|
||||
if(clearTimeout > 0) {
|
||||
[self _clearPasteboardContents];
|
||||
}
|
||||
_clearTimeout = clearTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyShowMenuItem;
|
||||
|
||||
/* Autolock */
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyLockOnSleep;
|
||||
APPKIT_EXTERN NSString *const kMPSEttingsKeyIdleLockTimeOut;
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyIdleLockTimeOut;
|
||||
|
||||
|
||||
typedef NS_ENUM(NSUInteger, MPPasswordEncoding) {
|
||||
|
||||
@@ -15,7 +15,7 @@ NSString *const kMPSettingsKeyHttpPort =@"HttpPort";
|
||||
NSString *const kMPSettingsKeyEnableHttpServer = @"EnableHttpServer";
|
||||
NSString *const kMPSettingsKeyShowMenuItem = @"ShowMenuItem";
|
||||
NSString *const kMPSettingsKeyLockOnSleep = @"LockOnSleep";
|
||||
NSString *const kMPSEttingsKeyIdleLockTimeOut = @"IdleLockTimeOut";
|
||||
NSString *const kMPSettingsKeyIdleLockTimeOut = @"IdleLockTimeOut";
|
||||
|
||||
@implementation MPSettingsHelper
|
||||
|
||||
@@ -32,7 +32,7 @@ NSString *const kMPSEttingsKeyIdleLockTimeOut = @"IdleLockTimeOut";
|
||||
kMPSettingsKeyEnableHttpServer: @NO,
|
||||
kMPSettingsKeyShowMenuItem: @YES,
|
||||
kMPSettingsKeyLockOnSleep: @YES,
|
||||
kMPSEttingsKeyIdleLockTimeOut: @300 // 5 minutes
|
||||
kMPSettingsKeyIdleLockTimeOut: @0 // 5 minutes
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
#import "MPGeneralSettingsController.h"
|
||||
#import "MPServerSettingsController.h"
|
||||
|
||||
@interface MPSettingsWindowController ()
|
||||
@interface MPSettingsWindowController () {
|
||||
NSString *lastIdentifier;
|
||||
}
|
||||
|
||||
@property (retain, nonatomic) NSToolbar *toolbar;
|
||||
@property (retain, nonatomic) NSMutableDictionary *settingsController;
|
||||
@property (retain, nonatomic) NSMutableDictionary *toolbarItems;
|
||||
@property (retain) NSArray *defaultToolbarItems;
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,6 +31,7 @@
|
||||
[self.toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
|
||||
_settingsController = [[NSMutableDictionary alloc] initWithCapacity:5];
|
||||
_toolbarItems = [[NSMutableDictionary alloc] initWithCapacity:5];
|
||||
lastIdentifier = nil;
|
||||
|
||||
[self _setupDefaultSettingsTabs];
|
||||
|
||||
@@ -45,10 +49,8 @@
|
||||
}
|
||||
|
||||
- (void)showSettings {
|
||||
if([self.settingsController count] > 0) {
|
||||
id<MPSettingsTab> tab = [self.settingsController allValues][0];
|
||||
NSString *identifier = [tab identifier];
|
||||
[self showSettingsTabWithIdentifier:identifier];
|
||||
if([self.defaultToolbarItems count] > 0) {
|
||||
[self showSettingsTabWithIdentifier:self.defaultToolbarItems[0]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +118,12 @@
|
||||
|
||||
[self _addSettingsTab:generalSettingsController];
|
||||
[self _addSettingsTab:serverSettingsController];
|
||||
|
||||
self.defaultToolbarItems = @[ [generalSettingsController identifier], [serverSettingsController identifier] ];
|
||||
|
||||
[generalSettingsController release];
|
||||
[serverSettingsController release];
|
||||
|
||||
}
|
||||
|
||||
- (void)_showSettingsTab:(id)sender {
|
||||
@@ -135,7 +140,7 @@
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar {
|
||||
return [self.settingsController allKeys];
|
||||
return self.defaultToolbarItems;
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>747</string>
|
||||
<string>823</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Reference in New Issue
Block a user