diff --git a/platform-darwin/Source/Mac/Base.lproj/MainMenu.xib b/platform-darwin/Source/Mac/Base.lproj/MainMenu.xib index 788eea94..6c644fdf 100644 --- a/platform-darwin/Source/Mac/Base.lproj/MainMenu.xib +++ b/platform-darwin/Source/Mac/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -12,11 +12,14 @@ - + + + + @@ -33,7 +36,7 @@ - + @@ -47,6 +50,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -152,53 +202,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + @@ -221,6 +241,7 @@ + diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.h b/platform-darwin/Source/Mac/MPMacAppDelegate.h index 1b82f7ec..7096953b 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.h +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.h @@ -34,6 +34,7 @@ @property(nonatomic, weak) IBOutlet NSMenuItem *openAtLoginItem; @property(nonatomic, weak) IBOutlet NSMenuItem *showFullScreenItem; @property(nonatomic, weak) IBOutlet NSMenuItem *savePasswordItem; +@property(nonatomic, weak) IBOutlet NSMenuItem *diagnosticsItem; @property(nonatomic, weak) IBOutlet NSMenuItem *createUserItem; @property(nonatomic, weak) IBOutlet NSMenuItem *deleteUserItem; @property(nonatomic, weak) IBOutlet NSMenuItem *usersItem; diff --git a/platform-darwin/Source/Mac/MPMacAppDelegate.m b/platform-darwin/Source/Mac/MPMacAppDelegate.m index 3dd0bfc6..7d5aabd0 100644 --- a/platform-darwin/Source/Mac/MPMacAppDelegate.m +++ b/platform-darwin/Source/Mac/MPMacAppDelegate.m @@ -29,6 +29,7 @@ #define LOGIN_HELPER_BUNDLE_ID @"com.lyndir.lhunath.MasterPassword.Mac.LoginHelper" + @implementation MPMacAppDelegate #pragma clang diagnostic push @@ -372,6 +373,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (IBAction)togglePreference:(id)sender { + if (sender == self.diagnosticsItem) + [MPConfig get].sendInfo = @(self.diagnosticsItem.state != NSOnState); if (sender == self.hidePasswordsItem) [MPConfig get].hidePasswords = @(self.hidePasswordsItem.state != NSOnState); if (sender == self.rememberPasswordItem) @@ -582,10 +585,13 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (void)updateUsers { - [[[self.usersItem submenu] itemArray] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (idx > 2) - [[self.usersItem submenu] removeItem:obj]; - }]; + BOOL foundSeparator = NO; + for (NSMenuItem *item in [[self.usersItem submenu] itemArray]) { + if (foundSeparator) + [[self.usersItem submenu] removeItem:item]; + else if (item.isSeparatorItem) + foundSeparator = YES; + } NSManagedObjectContext *mainContext = [MPMacAppDelegate managedObjectContextForMainThreadIfReady]; if (!mainContext) { @@ -715,6 +721,8 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven - (void)updateConfigKey:(NSString *)key { PearlMainQueue( ^{ + if (!key || [key isEqualToString:NSStringFromSelector( @selector( sendInfo ) )]) + self.diagnosticsItem.state = [[MPConfig get].sendInfo boolValue]? NSOnState: NSOffState; if (!key || [key isEqualToString:NSStringFromSelector( @selector( hidePasswords ) )]) self.hidePasswordsItem.state = [[MPConfig get].hidePasswords boolValue]? NSOnState: NSOffState; if (!key || [key isEqualToString:NSStringFromSelector( @selector( rememberLogin ) )])