mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 12:52:21 +00:00
Stubbed workflow settings to select preferred browser for URL handling
This commit is contained in:
@@ -10,5 +10,6 @@
|
||||
#import "MPSettingsTab.h"
|
||||
|
||||
@interface MPWorkflowSettingsController : MPViewController <MPSettingsTab>
|
||||
@property (weak) IBOutlet NSPopUpButton *browserPopup;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,12 +8,19 @@
|
||||
|
||||
#import "MPWorkflowSettingsController.h"
|
||||
|
||||
#import "MPSettingsHelper.h"
|
||||
|
||||
NSString *const kMPChromeBundleId = @"com.google.chrome";
|
||||
NSString *const kMPSafariBundleId = @"com.apple.safari";
|
||||
NSString *const kMPFirefoxBundleId = @"org.mozilla.firefox";
|
||||
|
||||
@interface MPWorkflowSettingsController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPWorkflowSettingsController
|
||||
|
||||
#pragma mark LifeCycle
|
||||
- (id)init {
|
||||
self = [self initWithNibName:@"WorkflowSettings" bundle:nil];
|
||||
return self;
|
||||
@@ -27,6 +34,25 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)didLoadView {
|
||||
NSMenu *browserMenu = [[NSMenu alloc] init];
|
||||
[browserMenu addItemWithTitle:NSLocalizedString(@"DEFAULT_BROWSER", "Default Browser") action:NULL keyEquivalent:@""];
|
||||
[browserMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
NSArray *browser = @[kMPChromeBundleId, kMPSafariBundleId, kMPFirefoxBundleId];
|
||||
for(NSString *bundle in browser) {
|
||||
|
||||
}
|
||||
|
||||
if([[browserMenu itemArray] count] > 2) {
|
||||
[browserMenu addItem:[NSMenuItem separatorItem]];
|
||||
}
|
||||
[browserMenu addItemWithTitle:NSLocalizedString(@"OTHER_BROWSER", "Selecte Browser") action:NULL keyEquivalent:@""];
|
||||
|
||||
[self.browserPopup setMenu:browserMenu];
|
||||
}
|
||||
|
||||
#pragma mark MPSettingsTab Protocol
|
||||
- (NSString *)identifier {
|
||||
return @"WorkflowSettings";
|
||||
}
|
||||
@@ -39,4 +65,21 @@
|
||||
return NSLocalizedString(@"WORKFLOW", "");
|
||||
}
|
||||
|
||||
#pragma mark Actions
|
||||
- (IBAction)selectBrowser:(id)sender {
|
||||
NSString *browserBundleId = [sender representedObject];
|
||||
NSLog(@"New default Browser: %@", browserBundleId);
|
||||
[[NSUserDefaults standardUserDefaults] setObject:browserBundleId forKey:kMPSettingsKeyBrowserBundleId];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
#pragma mark Helper
|
||||
- (NSArray *)_availableBrowser {
|
||||
NSArray *browser = @[kMPChromeBundleId, kMPSafariBundleId, kMPFirefoxBundleId];
|
||||
for(NSString *bundle in browser) {
|
||||
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MPWorkflowSettingsController">
|
||||
<connections>
|
||||
<outlet property="browserPopup" destination="ehI-gq-lsb" id="YMy-L1-pQw"/>
|
||||
<outlet property="view" destination="1" id="52"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -35,12 +36,12 @@
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13">
|
||||
<rect key="frame" x="161" y="42" width="105" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Copies URL" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="14">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="15">
|
||||
<items>
|
||||
<menuItem title="Copies URL" state="on" id="16"/>
|
||||
<menuItem title="Copies URL" id="16"/>
|
||||
<menuItem title="Opens URL" id="17"/>
|
||||
</items>
|
||||
</menu>
|
||||
@@ -58,12 +59,12 @@
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="40">
|
||||
<rect key="frame" x="161" y="11" width="136" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Opens Inspector" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="41">
|
||||
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="41">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="42">
|
||||
<items>
|
||||
<menuItem title="Opens Inspector" state="on" id="44"/>
|
||||
<menuItem title="Opens Inspector" id="44"/>
|
||||
<menuItem title="is Ignored" id="43"/>
|
||||
</items>
|
||||
</menu>
|
||||
@@ -92,7 +93,7 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Default Browser" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" enabled="NO" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="7YX-EA-9KA" id="7Ip-sU-sAK">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="XgO-Tj-QjO">
|
||||
<items>
|
||||
<menuItem title="Default Browser" state="on" id="7YX-EA-9KA"/>
|
||||
|
||||
Reference in New Issue
Block a user