From 4dcc983a41bf2db03bc6b8934080ca1090dcadf1 Mon Sep 17 00:00:00 2001 From: michael starke Date: Mon, 9 Nov 2015 20:22:27 +0100 Subject: [PATCH] Added plugin settings stub Signed-off-by: michael starke --- MacPass.xcodeproj/project.pbxproj | 10 +++ MacPass/Base.lproj/GeneralSettings.xib | 85 ++++++++++-------- MacPass/Base.lproj/IntegrationSettings.xib | 49 ++++++++--- MacPass/Base.lproj/UpdateSettings.xib | 24 +++--- MacPass/Base.lproj/WorkflowSettings.xib | 62 +++++++------- MacPass/MPPluginManager.m | 2 - MacPass/MPPluginSettingsController.h | 14 +++ MacPass/MPPluginSettingsController.m | 61 +++++++++++++ MacPass/MPSettingsTab.h | 2 +- MacPass/MPSettingsWindowController.m | 52 ++++++----- MacPass/PluginSettings.xib | 95 +++++++++++++++++++++ MacPass/en.lproj/Localizable.strings | Bin 12148 -> 12210 bytes 12 files changed, 335 insertions(+), 121 deletions(-) create mode 100644 MacPass/MPPluginSettingsController.h create mode 100644 MacPass/MPPluginSettingsController.m create mode 100644 MacPass/PluginSettings.xib diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index b32ca3da..2e210357 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ 4C1E9885185F71A800943563 /* MPContextBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1E9884185F71A800943563 /* MPContextBarViewController.m */; }; 4C1FA07B18231900003A3F8C /* MPDocument+Autotype.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1FA07A18231900003A3F8C /* MPDocument+Autotype.m */; }; 4C224B4217DFCB2400FF6AEE /* MPNumericalInputFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */; }; + 4C25703F1BF11C2300D39416 /* MPPluginSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */; }; + 4C2570401BF11C2300D39416 /* PluginSettings.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25703E1BF11C2300D39416 /* PluginSettings.xib */; }; 4C25D58716CF0FAA00F6806C /* EntryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C25D58616CF0FAA00F6806C /* EntryView.xib */; }; 4C26C33F18D8C92100CF1A1C /* MPTemporaryFileStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */; }; 4C26C34B18D8D5A300CF1A1C /* MPPreviewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C26C34918D8D5A300CF1A1C /* MPPreviewViewController.m */; }; @@ -391,6 +393,9 @@ 4C21F29F195B3A48002D610D /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/MainMenu.strings; sourceTree = ""; }; 4C224B4017DFCB2300FF6AEE /* MPNumericalInputFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPNumericalInputFormatter.h; sourceTree = ""; }; 4C224B4117DFCB2400FF6AEE /* MPNumericalInputFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPNumericalInputFormatter.m; sourceTree = ""; }; + 4C25703C1BF11C2300D39416 /* MPPluginSettingsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPluginSettingsController.h; sourceTree = ""; }; + 4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPluginSettingsController.m; sourceTree = ""; }; + 4C25703E1BF11C2300D39416 /* PluginSettings.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PluginSettings.xib; sourceTree = ""; }; 4C25D58616CF0FAA00F6806C /* EntryView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EntryView.xib; sourceTree = ""; }; 4C26C33D18D8C92100CF1A1C /* MPTemporaryFileStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPTemporaryFileStorage.h; sourceTree = ""; }; 4C26C33E18D8C92100CF1A1C /* MPTemporaryFileStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPTemporaryFileStorage.m; sourceTree = ""; }; @@ -1060,6 +1065,8 @@ 4CD7223A17A7CB0700F5A1E1 /* MPWorkflowSettingsController.m */, 4CFB18E218A17FA20097A34B /* MPUpdateSettingsController.h */, 4CFB18E318A17FA20097A34B /* MPUpdateSettingsController.m */, + 4C25703C1BF11C2300D39416 /* MPPluginSettingsController.h */, + 4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */, ); name = Settings; sourceTree = ""; @@ -1453,6 +1460,7 @@ 6021FE5818E1429500C3BC51 /* IntegrationSettings.xib */, 6021FE6318E15D9100C3BC51 /* WorkflowSettings.xib */, 6021FE6E18E15E6D00C3BC51 /* UpdateSettings.xib */, + 4C25703E1BF11C2300D39416 /* PluginSettings.xib */, ); name = Settings; sourceTree = ""; @@ -1754,6 +1762,7 @@ 4C7ABA4E17BAEC7000FF5799 /* addEntryTemplate.pdf in Resources */, 4C53A7A51864C39D000DFF0D /* KPKLocalizable.strings in Resources */, 4C3826761AD04C24007D7D67 /* harddiskTemplate.pdf in Resources */, + 4C2570401BF11C2300D39416 /* PluginSettings.xib in Resources */, 4C7F8B681A10B68400CCB83D /* WelcomeWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1848,6 +1857,7 @@ 4C3C4EA218D6FEA100153127 /* NSValueTransformer+TransformerKit.m in Sources */, 4CA0F3ED1A3074B50067C0E5 /* MPWindowTitleComboBoxDelegate.m in Sources */, 4CF78064176E75AD0032EE71 /* MPIntegrationSettingsController.m in Sources */, + 4C25703F1BF11C2300D39416 /* MPPluginSettingsController.m in Sources */, 4CF6C711176F4533007A811D /* MPStringLengthValueTransformer.m in Sources */, 4CD5D705177A5F3300100649 /* MPDatabaseSettingsWindowController.m in Sources */, 4C74DD07177BD1640034A9DB /* MPCustomFieldView.m in Sources */, diff --git a/MacPass/Base.lproj/GeneralSettings.xib b/MacPass/Base.lproj/GeneralSettings.xib index de0f5e29..8a083e67 100644 --- a/MacPass/Base.lproj/GeneralSettings.xib +++ b/MacPass/Base.lproj/GeneralSettings.xib @@ -1,8 +1,9 @@ - + - + + @@ -24,7 +25,7 @@ - + @@ -33,6 +34,7 @@ + @@ -44,6 +46,7 @@ + @@ -64,6 +67,7 @@ + @@ -71,6 +75,7 @@ + @@ -86,8 +91,9 @@ - + @@ -103,6 +110,7 @@ + Enabling this compromises security. If enabled, your preferences will contain mappings from database to keyfile. Key locations for databases without a password will not be saved. @@ -119,6 +128,7 @@ + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - + + + + + + @@ -201,6 +217,7 @@ + diff --git a/MacPass/Base.lproj/IntegrationSettings.xib b/MacPass/Base.lproj/IntegrationSettings.xib index 62d67e0c..1f88f281 100644 --- a/MacPass/Base.lproj/IntegrationSettings.xib +++ b/MacPass/Base.lproj/IntegrationSettings.xib @@ -1,8 +1,8 @@ - + - + @@ -33,19 +33,22 @@ + + @@ -60,6 +63,7 @@ + @@ -67,14 +71,16 @@ - + + @@ -82,7 +88,8 @@ - + + @@ -90,35 +97,40 @@ - + + @@ -126,7 +138,8 @@ - + + @@ -186,6 +204,7 @@ + @@ -195,6 +214,7 @@ + @@ -212,6 +232,7 @@ + diff --git a/MacPass/Base.lproj/UpdateSettings.xib b/MacPass/Base.lproj/UpdateSettings.xib index 9255bc9d..f1c73b4e 100644 --- a/MacPass/Base.lproj/UpdateSettings.xib +++ b/MacPass/Base.lproj/UpdateSettings.xib @@ -1,8 +1,8 @@ - + - - + + @@ -11,17 +11,16 @@ - + - - - + - + @@ -52,9 +51,9 @@ - + - + @@ -73,7 +72,8 @@ + - \ No newline at end of file + diff --git a/MacPass/Base.lproj/WorkflowSettings.xib b/MacPass/Base.lproj/WorkflowSettings.xib index 1c0c551e..8d966f55 100644 --- a/MacPass/Base.lproj/WorkflowSettings.xib +++ b/MacPass/Base.lproj/WorkflowSettings.xib @@ -1,8 +1,9 @@ - + - - + + + @@ -14,30 +15,28 @@ - + - - - + - + - + - + - + @@ -49,18 +48,18 @@ - + - + - + - + @@ -73,26 +72,28 @@ + - - - - - - - - - - - + + + + + + + + + + + + - + - + @@ -105,9 +106,9 @@ - + - + @@ -129,6 +130,7 @@ + diff --git a/MacPass/MPPluginManager.m b/MacPass/MPPluginManager.m index a5743776..51f98ee6 100644 --- a/MacPass/MPPluginManager.m +++ b/MacPass/MPPluginManager.m @@ -44,12 +44,10 @@ return [[NSArray alloc] initWithArray:[entries filteredArrayUsingPredicate:predicate] copyItems:YES]; } - - (NSArray *)filteredGroupsUsingBlock:(NodeMatchBlock)matchBlock { return nil; } - - (void)_loadPlugins { } diff --git a/MacPass/MPPluginSettingsController.h b/MacPass/MPPluginSettingsController.h new file mode 100644 index 00000000..6241cc20 --- /dev/null +++ b/MacPass/MPPluginSettingsController.h @@ -0,0 +1,14 @@ +// +// MPPluginSettingsController.h +// MacPass +// +// Created by Michael Starke on 09/11/15. +// Copyright © 2015 HicknHack Software GmbH. All rights reserved. +// + +#import "MPViewController.h" +#import "MPSettingsTab.h" + +@interface MPPluginSettingsController : MPViewController + +@end diff --git a/MacPass/MPPluginSettingsController.m b/MacPass/MPPluginSettingsController.m new file mode 100644 index 00000000..5af5fc3f --- /dev/null +++ b/MacPass/MPPluginSettingsController.m @@ -0,0 +1,61 @@ +// +// MPPluginSettingsController.m +// MacPass +// +// Created by Michael Starke on 09/11/15. +// Copyright © 2015 HicknHack Software GmbH. All rights reserved. +// + +#import "MPPluginSettingsController.h" + +NSString *const _kMPPluginTableNameColumn = @"Name"; +NSString *const _kMPPluginTableLoadedColumn = @"Loaded"; + +@interface MPPluginSettingsController () +@property (weak) IBOutlet NSTableView *pluginTableView; + +@end + +@implementation MPPluginSettingsController + +- (NSString *)nibName { + return @"PluginSettings"; +} + +- (NSString *)identifier { + return @"Plugins"; +} + +- (NSImage *)image { + return [NSImage imageNamed:NSImageNameApplicationIcon]; +} + +- (NSString *)label { + return NSLocalizedString(@"PLUGIN_SETTINGS", ""); +} + +- (void)didLoadView { + self.pluginTableView.tableColumns[0].identifier = _kMPPluginTableNameColumn; + self.pluginTableView.tableColumns[1].identifier = _kMPPluginTableLoadedColumn; + self.pluginTableView.tableColumns[0].title = NSLocalizedString(@"PLUGIN_TABLE_NAME_HEADER", ""); + self.pluginTableView.tableColumns[1].title = NSLocalizedString(@"PLUGIN_TABLE_LOAD_HEADER", ""); + + //self.pluginTableView.delegate = self; + self.pluginTableView.dataSource = self; +} + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + return 2; +} + +- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { + if([tableColumn.identifier isEqualToString:_kMPPluginTableLoadedColumn]) { + return @YES; + } + else if([tableColumn.identifier isEqualToString:_kMPPluginTableNameColumn]) { + return @"DummyPlugin"; + } + return nil; +} + +@end diff --git a/MacPass/MPSettingsTab.h b/MacPass/MPSettingsTab.h index 622a5e21..cd090a7a 100644 --- a/MacPass/MPSettingsTab.h +++ b/MacPass/MPSettingsTab.h @@ -15,7 +15,7 @@ @protocol MPSettingsTab @required -- (NSString *)identifier; +@property (readonly, copy) NSString *identifier; @optional - (NSString *)label; diff --git a/MacPass/MPSettingsWindowController.m b/MacPass/MPSettingsWindowController.m index 65a26a35..41977fd2 100644 --- a/MacPass/MPSettingsWindowController.m +++ b/MacPass/MPSettingsWindowController.m @@ -11,6 +11,7 @@ #import "MPIntegrationSettingsController.h" #import "MPWorkflowSettingsController.h" #import "MPUpdateSettingsController.h" +#import "MPPluginSettingsController.h" @interface MPSettingsWindowController () { NSString *lastIdentifier; @@ -74,9 +75,9 @@ if([tab respondsToSelector:@selector(willShowTab)]) { [tab willShowTab]; } - NSView *contentView = [[self window] contentView]; - if( [[contentView subviews] count] == 1) { - [[contentView subviews][0] removeFromSuperview]; + NSView *contentView = self.window.contentView; + if( contentView.subviews.count == 1) { + [contentView.subviews.firstObject removeFromSuperview]; } [contentView addSubview:tabView]; [contentView layout]; @@ -93,7 +94,7 @@ if([tab respondsToSelector:@selector(didShowTab)]) { [tab didShowTab]; } - [[self window] makeKeyAndOrderFront:[self window]]; + [self.window makeKeyAndOrderFront:nil]; } - (void)_addSettingsTab:(id)tabController { @@ -109,7 +110,7 @@ userInfo:nil]; @throw controllerException; } - NSString *identifier = [tabController identifier]; + NSString *identifier = tabController.identifier; if(nil != self.settingsController[identifier]) { NSLog(@"Warning: Settingscontroller with identifier %@ already present!", identifier); } @@ -119,22 +120,17 @@ } - (void)_setupDefaultSettingsTabs { - MPGeneralSettingsController *generalSettingsController = [[MPGeneralSettingsController alloc] init]; - MPIntegrationSettingsController *integrationSettingsController = [[MPIntegrationSettingsController alloc] init]; - MPWorkflowSettingsController *workflowSettingsController = [[MPWorkflowSettingsController alloc] init]; - MPUpdateSettingsController *updateSettingsController = [[MPUpdateSettingsController alloc] init]; - - [self _addSettingsTab:generalSettingsController]; - [self _addSettingsTab:integrationSettingsController]; - [self _addSettingsTab:workflowSettingsController]; - [self _addSettingsTab:updateSettingsController]; - - self.defaultToolbarItems = @[ [generalSettingsController identifier], - [integrationSettingsController identifier], - [workflowSettingsController identifier], - [updateSettingsController identifier]]; - - + NSArray *controllers = @[ [[MPGeneralSettingsController alloc] init], + [[MPIntegrationSettingsController alloc] init], + [[MPWorkflowSettingsController alloc] init], + [[MPUpdateSettingsController alloc] init], + [[MPPluginSettingsController alloc] init] ]; + NSMutableArray *identifier = [[NSMutableArray alloc] initWithCapacity:controllers.count]; + for(id controller in controllers) { + [self _addSettingsTab:controller]; + [identifier addObject:controller.identifier]; + } + self.defaultToolbarItems = [identifier copy]; } - (void)_showSettingsTab:(id)sender { @@ -147,7 +143,7 @@ #pragma mark NSToolbarDelegate - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar { - return [self.settingsController allKeys]; + return self.settingsController.allKeys; } - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar { @@ -155,7 +151,7 @@ } - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar { - return [self.settingsController allKeys]; + return self.settingsController.allKeys; } - (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag { @@ -168,19 +164,19 @@ */ id tab = self.settingsController[itemIdentifier]; if([tab respondsToSelector:@selector(label)]) { - [item setLabel:[tab label]]; + item.label = [tab label]; } else { - [item setLabel:itemIdentifier]; + item.label = itemIdentifier; } if([tab respondsToSelector:@selector(image)]) { - [item setImage:[tab image]]; + item.image = [tab image]; } else { - [item setImage:[NSImage imageNamed:NSImageNameCaution ]]; + item.image = [NSImage imageNamed:NSImageNameCaution]; } - [item setAction:@selector(_showSettingsTab:)]; + item.action = @selector(_showSettingsTab:); self.toolbarItems[itemIdentifier] = item; } return item; diff --git a/MacPass/PluginSettings.xib b/MacPass/PluginSettings.xib new file mode 100644 index 00000000..bbfdcea9 --- /dev/null +++ b/MacPass/PluginSettings.xib @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index c667b471a8da75732d38d7315f4f897242332bd8..0222f29b9dde0abb4ce5afc6d42e0adb73fbde72 100644 GIT binary patch delta 45 zcmewow<&(Z3k6;!h5!a1hEN7~22TdR$-eTkd;ttO45bX|44Djh48;taA1O@Y0{}C2 B40`|o delta 12 TcmdlK|0Qn23x&;UiamS)D~AQJ