From 36b98bcd6d1d8da7b5e6a85ee850a5de65849143 Mon Sep 17 00:00:00 2001 From: michael starke Date: Thu, 16 Nov 2017 17:55:08 +0100 Subject: [PATCH] customized open panels throughout the app. Added brows plugins button to plugin settings --- MacPass/Base.lproj/PluginSettings.xib | 14 ++++++++++++++ MacPass/MPDocumentWindowController.m | 4 +++- MacPass/MPEntryInspectorViewController.m | 2 ++ MacPass/MPPluginSettingsController.h | 1 + MacPass/MPPluginSettingsController.m | 6 ++++++ MacPass/MPWorkflowSettingsController.m | 2 ++ 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/MacPass/Base.lproj/PluginSettings.xib b/MacPass/Base.lproj/PluginSettings.xib index d9198d1f..4f4305ae 100644 --- a/MacPass/Base.lproj/PluginSettings.xib +++ b/MacPass/Base.lproj/PluginSettings.xib @@ -120,19 +120,33 @@ + + + + + diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 463895be..30fba062 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -263,7 +263,9 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); openPanel.allowsMultipleSelection = NO; openPanel.canChooseDirectories = NO; openPanel.canChooseFiles = YES; - openPanel.allowedFileTypes = @[(id)kUTTypeXML]; + openPanel.allowedFileTypes = @[(id)kUTTypeXML]; + openPanel.prompt = NSLocalizedString(@"OPEN_BUTTON_IMPORT_XML_OPEN_PANEL", "Open button in the open panel to import an XML file"); + openPanel.message = NSLocalizedString(@"MESSAGE_XML_OPEN_PANEL", "Message in the open panel to import an XML file"); [openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) { if(result == NSFileHandlingPanelOKButton) { [document readXMLfromURL:openPanel.URL]; diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index 6976e7ca..58d38424 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -222,6 +222,8 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { openPanel.canChooseDirectories = NO; openPanel.canChooseFiles = YES; openPanel.allowsMultipleSelection = YES; + openPanel.prompt = NSLocalizedString(@"OPEN_BUTTON_ADD_ATTACHMENT_OPEN_PANEL", "Open button in the open panel to add attachments to an entry"); + openPanel.message = NSLocalizedString(@"MESSAGE_ADD_ATTACHMENT_OPEN_PANEL", "Message in the open panel to add attachments to an entry"); [openPanel beginSheetModalForWindow:self.windowController.window completionHandler:^(NSInteger result) { if(result == NSFileHandlingPanelOKButton) { for (NSURL *attachmentURL in openPanel.URLs) { diff --git a/MacPass/MPPluginSettingsController.h b/MacPass/MPPluginSettingsController.h index 8a4ce96d..bc5034ba 100644 --- a/MacPass/MPPluginSettingsController.h +++ b/MacPass/MPPluginSettingsController.h @@ -26,5 +26,6 @@ @interface MPPluginSettingsController : MPViewController - (IBAction)addOrRemovePlugin:(id)sender; +- (IBAction)browsePlugins:(id)sender; @end diff --git a/MacPass/MPPluginSettingsController.m b/MacPass/MPPluginSettingsController.m index 2a442f05..6f536863 100644 --- a/MacPass/MPPluginSettingsController.m +++ b/MacPass/MPPluginSettingsController.m @@ -115,6 +115,10 @@ typedef NS_ENUM(NSUInteger, MPPluginSegmentType) { [self showSettingsForPlugin:plugin]; } +- (IBAction)browsePlugins:(id)sender { + [NSWorkspace.sharedWorkspace openURL:[NSApp applicationSupportDirectoryURL:YES]]; +} + - (IBAction)addOrRemovePlugin:(id)sender { if(sender != self.addRemovePluginsControl) { return; @@ -136,6 +140,8 @@ typedef NS_ENUM(NSUInteger, MPPluginSegmentType) { openPanel.allowsMultipleSelection = NO; openPanel.canChooseFiles = YES; openPanel.canChooseDirectories = NO; + openPanel.prompt = NSLocalizedString(@"OPEN_BUTTON_ADD_PLUGIN_OPEN_PANEL", "Open button in the add plugin open panel"); + openPanel.message = NSLocalizedString(@"MESSAGE_ADD_PLUGIN_OPEN_PANEL", "Message in the add plugin open panel"); [openPanel beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse result) { if(NSModalResponseOK) { if(openPanel.URLs.count == 1) { diff --git a/MacPass/MPWorkflowSettingsController.m b/MacPass/MPWorkflowSettingsController.m index f4342694..36ef5793 100644 --- a/MacPass/MPWorkflowSettingsController.m +++ b/MacPass/MPWorkflowSettingsController.m @@ -80,6 +80,8 @@ openPanel.allowsMultipleSelection = NO; openPanel.canChooseDirectories = NO; openPanel.canChooseFiles = YES; + openPanel.prompt = NSLocalizedString(@"SELECT_DEFAULT_BROWSER_OPEN_PANEL_SELECT_BUTTON", "Label for the select browser button on the open panel for selecting which browser to use for opening URLs"); + openPanel.message = NSLocalizedString(@"SELECT_DEFAULT_BROWSER_OPEN_PANEL_MESSAGE", "Message on the open panel for selecting which browser to use for opening URLs"); openPanel.allowedFileTypes = @[@"app"]; [openPanel beginSheetModalForWindow:self.view.window completionHandler:^(NSInteger result) {