mirror of
https://github.com/MacPass/MacPass.git
synced 2026-01-30 22:48:26 +00:00
Stubbed workflow settings to select preferred browser for URL handling
This commit is contained in:
@@ -10,5 +10,6 @@
|
|||||||
#import "MPSettingsTab.h"
|
#import "MPSettingsTab.h"
|
||||||
|
|
||||||
@interface MPWorkflowSettingsController : MPViewController <MPSettingsTab>
|
@interface MPWorkflowSettingsController : MPViewController <MPSettingsTab>
|
||||||
|
@property (weak) IBOutlet NSPopUpButton *browserPopup;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -8,12 +8,19 @@
|
|||||||
|
|
||||||
#import "MPWorkflowSettingsController.h"
|
#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 ()
|
@interface MPWorkflowSettingsController ()
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MPWorkflowSettingsController
|
@implementation MPWorkflowSettingsController
|
||||||
|
|
||||||
|
#pragma mark LifeCycle
|
||||||
- (id)init {
|
- (id)init {
|
||||||
self = [self initWithNibName:@"WorkflowSettings" bundle:nil];
|
self = [self initWithNibName:@"WorkflowSettings" bundle:nil];
|
||||||
return self;
|
return self;
|
||||||
@@ -27,6 +34,25 @@
|
|||||||
return self;
|
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 {
|
- (NSString *)identifier {
|
||||||
return @"WorkflowSettings";
|
return @"WorkflowSettings";
|
||||||
}
|
}
|
||||||
@@ -39,4 +65,21 @@
|
|||||||
return NSLocalizedString(@"WORKFLOW", "");
|
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
|
@end
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="MPWorkflowSettingsController">
|
<customObject id="-2" userLabel="File's Owner" customClass="MPWorkflowSettingsController">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="browserPopup" destination="ehI-gq-lsb" id="YMy-L1-pQw"/>
|
||||||
<outlet property="view" destination="1" id="52"/>
|
<outlet property="view" destination="1" id="52"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
@@ -35,12 +36,12 @@
|
|||||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13">
|
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="13">
|
||||||
<rect key="frame" x="161" y="42" width="105" height="26"/>
|
<rect key="frame" x="161" y="42" width="105" height="26"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<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"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="menu"/>
|
||||||
<menu key="menu" title="OtherViews" id="15">
|
<menu key="menu" title="OtherViews" id="15">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Copies URL" state="on" id="16"/>
|
<menuItem title="Copies URL" id="16"/>
|
||||||
<menuItem title="Opens URL" id="17"/>
|
<menuItem title="Opens URL" id="17"/>
|
||||||
</items>
|
</items>
|
||||||
</menu>
|
</menu>
|
||||||
@@ -58,12 +59,12 @@
|
|||||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="40">
|
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="40">
|
||||||
<rect key="frame" x="161" y="11" width="136" height="26"/>
|
<rect key="frame" x="161" y="11" width="136" height="26"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<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"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="menu"/>
|
||||||
<menu key="menu" title="OtherViews" id="42">
|
<menu key="menu" title="OtherViews" id="42">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Opens Inspector" state="on" id="44"/>
|
<menuItem title="Opens Inspector" id="44"/>
|
||||||
<menuItem title="is Ignored" id="43"/>
|
<menuItem title="is Ignored" id="43"/>
|
||||||
</items>
|
</items>
|
||||||
</menu>
|
</menu>
|
||||||
@@ -92,7 +93,7 @@
|
|||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<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">
|
<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"/>
|
<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">
|
<menu key="menu" title="OtherViews" id="XgO-Tj-QjO">
|
||||||
<items>
|
<items>
|
||||||
<menuItem title="Default Browser" state="on" id="7YX-EA-9KA"/>
|
<menuItem title="Default Browser" state="on" id="7YX-EA-9KA"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user