diff --git a/MacPass/IconSelection.xib b/MacPass/IconSelection.xib
index ab9cf547..51df2973 100644
--- a/MacPass/IconSelection.xib
+++ b/MacPass/IconSelection.xib
@@ -86,6 +86,7 @@
+
diff --git a/MacPass/KPKNode+IconImage.m b/MacPass/KPKNode+IconImage.m
index b51b3dae..63184865 100644
--- a/MacPass/KPKNode+IconImage.m
+++ b/MacPass/KPKNode+IconImage.m
@@ -14,6 +14,10 @@
@implementation KPKNode (IconImage)
++ (NSSet *)keyPathsForValuesAffectingIconImage {
+ return [NSSet setWithArray:@[@"customIcon", @"icon"]];
+}
+
- (NSImage *)iconImage {
if(self.customIcon) {
return self.customIcon.image;
diff --git a/MacPass/MPAutotypeContext.h b/MacPass/MPAutotypeContext.h
index e6f72d4b..dca05f68 100644
--- a/MacPass/MPAutotypeContext.h
+++ b/MacPass/MPAutotypeContext.h
@@ -14,8 +14,9 @@
@interface MPAutotypeContext : NSObject
@property (nonatomic, strong) KPKEntry *entry;
-@property (nonatomic, copy) NSString *commandsSequence;
-@property (nonatomic, assign) NSUInteger value;
+@property (nonatomic, copy) NSString *command;
+@property (nonatomic, assign, readonly) BOOL isCommand;
+@property (nonatomic, assign) NSInteger value;
/**
* Designated initializer
diff --git a/MacPass/MPAutotypeContext.m b/MacPass/MPAutotypeContext.m
index af12b58d..5bc52ee7 100644
--- a/MacPass/MPAutotypeContext.m
+++ b/MacPass/MPAutotypeContext.m
@@ -12,6 +12,12 @@
#import "KPKEntry.h"
#import "KPKWindowAssociation.h"
+@interface MPAutotypeContext ()
+
+@property (nonatomic, assign) BOOL isCommand;
+
+@end
+
@implementation MPAutotypeContext
- (instancetype)initWithWindowAssociation:(KPKWindowAssociation *)association {
@@ -38,20 +44,35 @@
}
else {
self.entry = entry;
- self.commandsSequence = sequence;
- NSRegularExpression *regexp = [[NSRegularExpression alloc] initWithPattern:@"{[a-z]+([0-9]*)}" options:NSRegularExpressionIgnoreMetacharacters error:0];
+ NSError *error;
+ NSRegularExpression *regexp = [[NSRegularExpression alloc] initWithPattern:@"\\{([a-z]+) ?([0-9]*)\\}" options:NSRegularExpressionCaseInsensitive error:&error];
if(regexp) {
- NSArray *matches = [regexp matchesInString:self.commandsSequence options:0 range:NSMakeRange(0, [self.commandsSequence length])];
- if(matches) {
- }
+ [regexp enumerateMatchesInString:sequence options:0 range:NSMakeRange(0, [sequence length]) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
+ NSRange commandRange = [result rangeAtIndex:1];
+ NSRange valueRange = [result rangeAtIndex:2];
+ if(commandRange.location != NSNotFound && commandRange.length != 0) {
+ self.command = [sequence substringWithRange:commandRange];
+ self.isCommand = YES;
+ }
+ if(valueRange.location != NSNotFound && valueRange.length != 0) {
+ self.value = [[sequence substringWithRange:valueRange] integerValue];
+ }
+ else {
+ self.value = NSNotFound;
+ }
+ }];
}
+ else {
+ NSLog(@"Error while trying to parse Autotype sequence: %@", [error localizedDescription]);
+ }
+
}
}
return self;
}
- (id)copyWithZone:(NSZone *)zone {
- MPAutotypeContext *copy = [[MPAutotypeContext alloc] initWithEntry:self.entry andSequence:self.commandsSequence];
+ MPAutotypeContext *copy = [[MPAutotypeContext alloc] initWithEntry:self.entry andSequence:self.command];
return copy;
}
diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m
index c390384a..30dfcecb 100644
--- a/MacPass/MPAutotypeDaemon.m
+++ b/MacPass/MPAutotypeDaemon.m
@@ -67,7 +67,7 @@ NSString *const kMPApplciationNameKey = @"applicationName";
if(candiates > 1) {
// open Dialog to select from possible entries
}
- /* Oder the Applciation to the front that we may have put to the background */
+ /* Just in case it's not there anymore, order the app for the window we want to autotype back to the foreground! */
[self _orderApplicationToFront:applicationName];
/*
Implement!
diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m
index 9cc1ca08..7bcc5080 100644
--- a/MacPass/MPEntryViewController.m
+++ b/MacPass/MPEntryViewController.m
@@ -125,7 +125,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
- (void)didLoadView {
[[self view] setWantsLayer:YES];
[self _hideFilterBarAnimated];
-
+
[_bottomBar setBorderType:HNHBorderTop];
[self.addEntryButton setAction:[MPActionHelper actionOfType:MPActionAddEntry]];
@@ -192,7 +192,6 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
[self _setupHeaderMenu];
[parentColumn setHidden:YES];
-
}
- (NSResponder *)reconmendedFirstResponder {
@@ -676,7 +675,13 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
if(selectedEntry && [selectedEntry.url length] > 0) {
NSURL *webURL = [NSURL URLWithString:selectedEntry.url];
+ NSString *scheme = [webURL scheme];
+ if(!scheme) {
+ webURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", selectedEntry.url]];
+ }
[[NSWorkspace sharedWorkspace] openURL:webURL];
+ /* Add custom browser support */
+ //[[NSWorkspace sharedWorkspace] openURLs:@[webURL] withAppBundleIdentifier:@"org.mozilla.firefox" options:NSWorkspaceLaunchAsync additionalEventParamDescriptor:nil launchIdentifiers:NULL];
}
}
diff --git a/MacPass/MPIconSelectViewController.h b/MacPass/MPIconSelectViewController.h
index af028216..1994cd63 100644
--- a/MacPass/MPIconSelectViewController.h
+++ b/MacPass/MPIconSelectViewController.h
@@ -8,11 +8,20 @@
#import "MPViewController.h"
+extern NSInteger const kMPDefaultIcon;
+
@interface MPIconSelectViewController : MPViewController
+/**
+ * Is the selected Icon, kMPDefaultIcon if the default icons was selected
+ */
+@property (nonatomic, assign) NSInteger selectedIcon;
+
@property (weak) IBOutlet NSCollectionView *iconCollectionView;
@property (weak) IBOutlet NSButton *imageButton;
+@property (weak) NSPopover *popover;
+- (void)reset;
- (IBAction)useDefault:(id)sender;
@end
diff --git a/MacPass/MPIconSelectViewController.m b/MacPass/MPIconSelectViewController.m
index 74644320..bc018547 100644
--- a/MacPass/MPIconSelectViewController.m
+++ b/MacPass/MPIconSelectViewController.m
@@ -8,6 +8,10 @@
#import "MPIconSelectViewController.h"
#import "MPIconHelper.h"
+#import "MPDocument.h"
+
+
+NSInteger const kMPDefaultIcon = -1;
@interface MPIconSelectViewController ()
@end
@@ -32,9 +36,22 @@
[self.iconCollectionView setSelectable:YES];
[self.iconCollectionView setAllowsMultipleSelection:NO];
[self.iconCollectionView setContent:[MPIconHelper databaseIcons]];
-
}
- (IBAction)useDefault:(id)sender {
+ self.selectedIcon = kMPDefaultIcon;
+ [self.popover performClose:self];
}
+
+- (void)reset {
+ self.selectedIcon = kMPDefaultIcon;
+}
+
+- (IBAction)_selectImage:(id)sender {
+ NSButton *button = sender;
+ NSImage *image = [button image];
+ self.selectedIcon = [[self.iconCollectionView content] indexOfObject:image];
+ [self.popover performClose:self];
+}
+
@end
diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m
index 0f7dcdd5..a943e54b 100644
--- a/MacPass/MPInspectorViewController.m
+++ b/MacPass/MPInspectorViewController.m
@@ -18,6 +18,8 @@
#import "KPKTree.h"
#import "KPKMetaData.h"
+#import "KPKGroup.h"
+#import "KPKEntry.h"
#import "HNHGradientView.h"
#import "MPPopupImageView.h"
@@ -34,6 +36,8 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
NSPopover *_popover;
}
+@property (strong) MPIconSelectViewController *iconSelectionViewController;
+
@property (nonatomic, strong) NSDate *modificationDate;
@property (nonatomic, strong) NSDate *creationDate;
@@ -160,11 +164,31 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
_popover = [[NSPopover alloc] init];
_popover.delegate = self;
_popover.behavior = NSPopoverBehaviorTransient;
- _popover.contentViewController = [[MPIconSelectViewController alloc] init];
+ if(!self.iconSelectionViewController) {
+ self.iconSelectionViewController = [[MPIconSelectViewController alloc] init];
+ }
+ [self.iconSelectionViewController reset];
+ self.iconSelectionViewController.popover = _popover;
+ _popover.contentViewController = self.iconSelectionViewController;
[_popover showRelativeToRect:NSZeroRect ofView:self.itemImageView preferredEdge:NSMinYEdge];
}
- (void)popoverDidClose:(NSNotification *)notification {
+ MPIconSelectViewController *viewController = (MPIconSelectViewController *)_popover.contentViewController;
+ MPDocument *document = [[self windowController] document];
+ BOOL useDefault = (viewController.selectedIcon == -1);
+ switch (self.activeTab) {
+ case MPGroupTab:
+ document.selectedGroup.icon = useDefault ? MPIconFolder : viewController.selectedIcon;
+ break;
+
+ case MPEntryTab:
+ document.selectedEntry.icon = useDefault ? MPIconPassword : viewController.selectedIcon;
+ break;
+
+ default:
+ break;
+ }
_popover = nil;
}
diff --git a/MacPass/WorkflowSettings.xib b/MacPass/WorkflowSettings.xib
index e4cf150d..858d67e1 100644
--- a/MacPass/WorkflowSettings.xib
+++ b/MacPass/WorkflowSettings.xib
@@ -1,844 +1,132 @@
-
-
-
- 1080
- 12E55
- 3084
- 1187.39
- 626.00
-
-
- IBNSLayoutConstraint
- NSBox
- NSCustomObject
- NSCustomView
- NSMenu
- NSMenuItem
- NSPopUpButton
- NSPopUpButtonCell
- NSTextField
- NSTextFieldCell
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
-
-
-
-
-
-
-
- view
-
-
-
- 52
-
-
-
-
-
- 0
-
-
-
-
-
- -2
-
-
- File's Owner
-
-
- -1
-
-
- First Responder
-
-
- -3
-
-
- Application
-
-
- 1
-
-
-
-
-
- 4
- 0
-
- 4
- 1
-
- 20
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 6
- 0
-
- 6
- 1
-
- 20
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 5
- 0
-
- 5
- 1
-
- 20
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 3
- 0
-
- 3
- 1
-
- 20
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 8
- 0
-
- 0
- 1
-
- 128
-
- 1000
-
- 9
- 40
- 1
-
-
-
- 7
- 0
-
- 0
- 1
-
- 400
-
- 1000
-
- 9
- 40
- 1
-
-
-
-
-
- 2
-
-
-
-
- 4
- 0
-
- 4
- 1
-
- 11
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 5
- 0
-
- 6
- 1
-
- 8
-
- 1000
-
- 6
- 24
- 3
-
-
-
- 5
- 0
-
- 6
- 1
-
- 8
-
- 1000
-
- 6
- 24
- 3
-
-
-
- 5
- 0
-
- 5
- 1
-
- 0.0
-
- 1000
-
- 6
- 24
- 2
-
-
-
- 3
- 0
-
- 3
- 1
-
- 25
-
- 1000
-
- 8
- 29
- 3
-
-
-
- 10
- 0
-
- 10
- 1
-
- 0.0
-
- 1000
-
- 6
- 24
- 2
-
-
-
- 10
- 0
-
- 10
- 1
-
- 0.0
-
- 1000
-
- 6
- 24
- 2
-
-
-
- 5
- 0
-
- 5
- 1
-
- 16
-
- 1000
-
- 8
- 29
- 3
-
-
-
-
-
-
-
-
-
- 3
-
-
-
-
- 5
-
-
-
-
- 8
-
-
-
-
- 9
-
-
-
-
-
-
-
- 10
-
-
-
-
- 13
-
-
-
-
-
-
-
- 14
-
-
-
-
-
-
-
- 15
-
-
-
-
-
-
-
-
- 16
-
-
-
-
- 17
-
-
-
-
- 29
-
-
-
-
- 31
-
-
-
-
- 36
-
-
-
-
-
-
-
- 37
-
-
-
-
- 38
-
-
-
-
- 40
-
-
-
-
-
-
-
- 41
-
-
-
-
-
-
-
- 42
-
-
-
-
-
-
-
-
- 43
-
-
-
-
- 44
-
-
-
-
- 46
-
-
-
-
- 47
-
-
-
-
- 48
-
-
-
-
- 49
-
-
-
-
- 50
-
-
-
-
- 51
-
-
-
-
- 53
-
-
-
-
- 54
-
-
-
-
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
-
-
-
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
-
-
-
-
-
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
-
- com.apple.InterfaceBuilder.CocoaPlugin
-
-
-
-
-
- 54
-
-
-
-
- MPViewController
- NSViewController
-
- IBProjectSource
- ./Classes/MPViewController.h
-
-
-
- MPWorkflowSettingsController
- MPViewController
-
- IBProjectSource
- ./Classes/MPWorkflowSettingsController.h
-
-
-
- NSLayoutConstraint
- NSObject
-
- IBProjectSource
- ./Classes/NSLayoutConstraint.h
-
-
-
-
- 0
- IBCocoaFramework
- YES
- 3
-
- {11, 11}
- {10, 3}
-
- YES
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file