Localized inconpatible plugins alert. Added ability to open a dedicated preferences pane

This commit is contained in:
Michael Starke
2019-02-11 14:06:12 +01:00
parent 00362bf33c
commit 37ea36c8a6
10 changed files with 63 additions and 39 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -31,14 +31,14 @@
<box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Autotype" translatesAutoresizingMaskIntoConstraints="NO" id="P9N-HM-wER">
<rect key="frame" x="17" y="115" width="366" height="328"/>
<view key="contentView" id="faU-Ok-HJ3">
<rect key="frame" x="1" y="1" width="364" height="312"/>
<rect key="frame" x="3" y="3" width="360" height="310"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" translatesAutoresizingMaskIntoConstraints="NO" id="j52-9L-k7c">
<rect key="frame" x="18" y="19" width="328" height="283"/>
<rect key="frame" x="16" y="17" width="328" height="283"/>
<beginningViews>
<textField verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="328" translatesAutoresizingMaskIntoConstraints="NO" id="hMJ-Mo-xOM">
<rect key="frame" x="-2" y="227" width="331" height="56"/>
<rect key="frame" x="-2" y="227" width="332" height="56"/>
<textFieldCell key="cell" controlSize="small" id="H37-ku-aTc">
<font key="font" metaFont="smallSystem"/>
<string key="title">Autotype is not available, because MacPass is not allowed to control your computer. To enable Autotype, go to the Security and Privacy Preferences and add MacPass to the Accessibilty group. Changes require a restart of MacPass.</string>
@@ -47,8 +47,8 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jai-b6-Qv4">
<rect key="frame" x="-6" y="191" width="153" height="32"/>
<buttonCell key="cell" type="push" title="Open Preference…" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="NP0-R3-m6n">
<rect key="frame" x="-6" y="191" width="160" height="32"/>
<buttonCell key="cell" type="push" title="Open Preferences…" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="NP0-R3-m6n">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@@ -113,7 +113,7 @@
</buttonCell>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8Wz-lo-AXG">
<rect key="frame" x="-2" y="100" width="207" height="18"/>
<rect key="frame" x="-2" y="100" width="206" height="18"/>
<buttonCell key="cell" type="check" title="Include Entry URL for matches" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="TzR-00-Vp3">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -134,14 +134,14 @@
</buttonCell>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VK8-z4-2ci">
<rect key="frame" x="-2" y="34" width="123" height="18"/>
<rect key="frame" x="-2" y="34" width="122" height="18"/>
<buttonCell key="cell" type="check" title="Interpret ⌃ as ⌘" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="QfO-yG-l3F">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wbP-A9-jpw">
<rect key="frame" x="-2" y="0.0" width="310" height="28"/>
<rect key="frame" x="-2" y="0.0" width="332" height="28"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="If enabled, every {CONTROL} command will be sent as ⌘. Only disable this if you are sure you need to." id="QRy-CY-ENC">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -186,18 +186,18 @@
<box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Preview" translatesAutoresizingMaskIntoConstraints="NO" id="VVs-b5-cX9">
<rect key="frame" x="17" y="16" width="366" height="95"/>
<view key="contentView" id="ww4-uR-8gP">
<rect key="frame" x="1" y="1" width="364" height="79"/>
<rect key="frame" x="3" y="3" width="360" height="77"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="LNw-5t-TS4">
<rect key="frame" x="16" y="53" width="178" height="18"/>
<rect key="frame" x="14" y="51" width="178" height="18"/>
<buttonCell key="cell" type="check" title="Enable Quicklook Preview" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="ERs-ct-Eyx">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="V6l-R9-hIj">
<rect key="frame" x="16" y="19" width="332" height="28"/>
<rect key="frame" x="14" y="17" width="332" height="28"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="If enabled attached files will be copied to a temporary location for preview and deleted after the preview is closed." id="WmI-IB-Aso">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>

View File

@@ -152,7 +152,7 @@ Gw
<constraint firstItem="d8O-Ha-rrS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="vxq-YP-UhR"/>
<constraint firstItem="2" firstAttribute="leading" secondItem="2pb-ZG-spA" secondAttribute="trailing" constant="12" id="ytJ-5Z-5rT"/>
</constraints>
<point key="canvasLocation" x="77" y="-2"/>
<point key="canvasLocation" x="-217" y="-96"/>
</customView>
</objects>
<resources>

View File

@@ -36,6 +36,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
- (IBAction)checkForUpdates:(id)sender;
- (IBAction)showPreferences:(id)sender;
- (IBAction)showPluginPrefences:(id)sender;
- (IBAction)showPasswordCreator:(id)sender;
- (IBAction)createNewDatabase:(id)sender;
- (IBAction)openDatabase:(id)sender;

View File

@@ -227,11 +227,20 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
#pragma mark -
#pragma mark Actions
- (void)showPluginPrefences:(id)sender {
[self _showPreferencesTab:MPPreferencesTabPlugins];
}
- (void)showPreferences:(id)sender {
[self _showPreferencesTab:MPPreferencesTabGeneral];
}
- (void)_showPreferencesTab:(MPPreferencesTab)tab {
if(self.preferencesController == nil) {
self.preferencesController = [[MPPreferencesWindowController alloc] init];
}
[self.preferencesController showPreferences];
[self.preferencesController showPreferencesTab:tab];
}
- (void)showPasswordCreator:(id)sender {

View File

@@ -282,29 +282,35 @@ NSString *const MPPluginHostPluginBundleIdentifiyerKey = @"MPPluginHostPluginBun
}
}
if(incompatiblePlugins.count > 0) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_MESSAGE", "Message text of the alert displayed when plugins where disabled due to incompatibilty");
alert.informativeText = NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_INFORMATIVE_TEXT", "Informative text of the alert displayed when plugins where disabled due to incompatibilty");
alert.alertStyle = NSAlertStyleWarning;
alert.showsSuppressionButton = YES;
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OK", @"Button in dialog to leave plugin ds disabled and continiue!")];
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OPEN_PREFERENCES", @"Button in dialog to open plugin preferences pane!")];
NSModalResponse returnCode = [alert runModal];
//BOOL suppressWarning = (alert.suppressionButton.state == NSOnState);
//[NSUserDefaults.standardUserDefaults setBool:suppressWarning forKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning];
switch(returnCode) {
case NSAlertFirstButtonReturn: {
/* ok, ignore */
break;
}
case NSAlertSecondButtonReturn:
/* open prefs */
[((MPAppDelegate *)NSApp.delegate) showPreferences:nil];
break;
default:
break;
BOOL hideAlert = NO;
if(nil != [NSUserDefaults.standardUserDefaults objectForKey:kMPSettingsKeyHideIncopatiblePluginsWarning]) {
hideAlert = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyHideIncopatiblePluginsWarning];
}
if(!hideAlert) {
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_MESSAGE", "Message text of the alert displayed when plugins where disabled due to incompatibilty");
alert.informativeText = NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_INFORMATIVE_TEXT", "Informative text of the alert displayed when plugins where disabled due to incompatibilty");
alert.alertStyle = NSAlertStyleWarning;
alert.showsSuppressionButton = YES;
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OK", @"Button in dialog to leave plugin ds disabled and continiue!")];
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OPEN_PREFERENCES", @"Button in dialog to open plugin preferences pane!")];
NSModalResponse returnCode = [alert runModal];
BOOL suppressWarning = (alert.suppressionButton.state == NSOnState);
[NSUserDefaults.standardUserDefaults setBool:suppressWarning forKey:kMPSettingsKeyHideIncopatiblePluginsWarning];
switch(returnCode) {
case NSAlertFirstButtonReturn: {
/* ok, ignore */
break;
}
case NSAlertSecondButtonReturn:
/* open prefs */
[((MPAppDelegate *)NSApp.delegate) showPluginPrefences:nil];
break;
default:
break;
}
}
}
}

View File

@@ -132,7 +132,7 @@
break;
}
NSString *identifier;
for(id<MPPreferencesTab> tab in self.preferencesController) {
for(id<MPPreferencesTab> tab in self.preferencesController.allValues) {
if([tab isKindOfClass:tabClass]) {
identifier = tab.identifier;
break;

View File

@@ -83,6 +83,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyUpdatePasswordOnTemplateEntries;
APPKIT_EXTERN NSString *const kMPSettingsKeyLoadUnsecurePlugins; // If set to YES this will load all plugins regardless of their codesignature status
APPKIT_EXTERN NSString *const kMPSettingsKeyDisabledPlugins; // NSArray of bundle identifiers of disabled plugins
APPKIT_EXTERN NSString *const kMPSettingsKeyLoadIncompatiblePlugins; // If set to YES incompatible plugins (no version info, marked as incompatible, etc) will be loaded regardless
APPKIT_EXTERN NSString *const kMPSettingsKeyHideIncopatiblePluginsWarning; // Do not show an alert, when MacPass encounteres incompatible plugins
typedef NS_ENUM(NSUInteger, MPFileChangeStrategy) {
MPFileChangeStrategyAsk,

View File

@@ -80,6 +80,7 @@ NSString *const kMPSettingsKeyUpdatePasswordOnTemplateEntries = @"Update
NSString *const kMPSettingsKeyLoadUnsecurePlugins = @"LoadUnsecurePlugins";
NSString *const kMPSettingsKeyLoadIncompatiblePlugins = @"LoadIncompatiblePlugins";
NSString *const kMPSettingsKeyDisabledPlugins = @"DisabledPlugins";
NSString *const kMPSettingsKeyHideIncopatiblePluginsWarning = @"HideIncopatiblePluginsWarning";
/* Deprecated */
NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases";

View File

@@ -16,8 +16,8 @@
/* Class = "NSTextFieldCell"; title = "Shortcut is missing Key"; ObjectID = "Lxp-wI-yQy"; */
"Lxp-wI-yQy.title" = "Shortcut is missing Key";
/* Class = "NSButtonCell"; title = "Open Preference…"; ObjectID = "NP0-R3-m6n"; */
"NP0-R3-m6n.title" = "Open Preference…";
/* Class = "NSButtonCell"; title = "Open Preferences…"; ObjectID = "NP0-R3-m6n"; */
"NP0-R3-m6n.title" = "Open Preferences…";
/* Class = "NSBox"; title = "Autotype"; ObjectID = "P9N-HM-wER"; */
"P9N-HM-wER.title" = "Autotype";

View File

@@ -43,6 +43,12 @@
/* Alert message displayed when Autotype performs self check and lacks accessibilty permissions */
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_MESSAGE_TEXT" = "MacPass cannot perform Autotype";
/* Button in dialog to leave plugin ds disabled and continiue! */
"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OK" = "OK";
/* Button in dialog to open plugin preferences pane! */
"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OPEN_PREFERENCES" = "Show Plugin Preferences…";
/* Informative text of the alert displayed when plugins where disabled due to incompatibilty */
"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_INFORMATIVE_TEXT" = "Some plugins where disabled, because they are not compatible with this version of MacPass. Open the plugin settings for details.";