mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-20 11:49:22 +00:00
Added warning in Integration settings when autotype is not available
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#import "MPIntegrationSettingsController.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "MPIconHelper.h"
|
||||
#import "MPAutotypeDaemon.h"
|
||||
|
||||
#import "DDHotKeyCenter.h"
|
||||
#import "DDHotKey+MacPassAdditions.h"
|
||||
@@ -67,8 +68,9 @@
|
||||
[self.matchTagsCheckBox bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyAutotypeMatchTags] options:nil];
|
||||
|
||||
[self.sendCommandForControlCheckBox bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeySendCommandForControlKey] options:nil];
|
||||
|
||||
[self _showWarning:NO];
|
||||
|
||||
[self _showKeyCodeMissingKeyWarning:NO];
|
||||
[self _updateAccessabilityWarning];
|
||||
}
|
||||
|
||||
- (void)willShowTab {
|
||||
@@ -92,14 +94,42 @@
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)obj {
|
||||
BOOL validHotKey = self.hotKeyTextField.hotKey.valid;
|
||||
[self _showWarning:!validHotKey];
|
||||
[self _showKeyCodeMissingKeyWarning:!validHotKey];
|
||||
if(validHotKey) {
|
||||
self.hotKey = self.hotKeyTextField.hotKey;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_showWarning:(BOOL)show {
|
||||
- (void)_showKeyCodeMissingKeyWarning:(BOOL)show {
|
||||
self.hotkeyWarningTextField.hidden = !show;
|
||||
}
|
||||
|
||||
- (void)_updateAccessabilityWarning {
|
||||
BOOL hasAutotypeSupport = MPAutotypeDaemon.defaultDaemon.autotypeSupported;
|
||||
|
||||
if(hasAutotypeSupport) {
|
||||
[self.autotypeStackView setVisibilityPriority:NSStackViewVisibilityPriorityNotVisible forView:self.autotypeWarningTextField];
|
||||
[self.autotypeStackView setVisibilityPriority:NSStackViewVisibilityPriorityNotVisible forView:self.openPreferencesButton];
|
||||
}
|
||||
else {
|
||||
[self.autotypeStackView setVisibilityPriority:NSStackViewVisibilityPriorityMustHold forView:self.autotypeWarningTextField];
|
||||
[self.autotypeStackView setVisibilityPriority:NSStackViewVisibilityPriorityMustHold forView:self.openPreferencesButton];
|
||||
}
|
||||
|
||||
NSArray <NSControl *> *controls = @[ self.enableGlobalAutotypeCheckBox,
|
||||
self.hotKeyTextField,
|
||||
self.matchTitleCheckBox,
|
||||
self.matchURLCheckBox,
|
||||
self.matchHostCheckBox,
|
||||
self.matchTagsCheckBox,
|
||||
self.sendCommandForControlCheckBox ];
|
||||
for(NSControl *control in controls) {
|
||||
control.enabled = hasAutotypeSupport;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openAccessibiltyPreferences:(id)sender {
|
||||
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"]];
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user