moved reference builder popup code to entry inspector

This commit is contained in:
michael starke
2017-11-06 11:52:35 +01:00
parent eaba7a6da3
commit 3db0e55b8f
7 changed files with 30 additions and 20 deletions

View File

@@ -24,6 +24,9 @@
@interface MPAutotypeBuilderViewController : NSViewController
- (void)presentBuilderWithSequence:(NSString *)sequence;
/**
Populate the autotype builder with a sequence.
*/
@property (nonatomic,copy) NSString *sequence;
@end

View File

@@ -69,9 +69,8 @@
self.commandBuilderTokenField.delegate = self;
}
- (void)presentBuilderWithSequence:(NSString *)sequence {
// TODO: tokenize input sequence!
//self.commandBuilderTokenField.stringValue = sequence;
- (void)setSequence:(NSString *)sequence {
self.commandBuilderTokenField.stringValue = sequence;
}
- (IBAction)addCustomKeyPlaceholder:(id)sender {

View File

@@ -77,6 +77,8 @@
- (void)registerNotificationsForDocument:(MPDocument *)document;
- (IBAction)showPasswordGenerator:(id)sender;
- (IBAction)showReferenceBuilder:(id)sender;
- (IBAction)showAutotypeBuilder:(id)sender;
- (IBAction)saveAttachment:(id)sender;
- (IBAction)addAttachment:(id)sender;

View File

@@ -29,6 +29,7 @@
#import "MPWindowAssociationsTableViewDelegate.h"
#import "MPWindowTitleComboBoxDelegate.h"
#import "MPAutotypeBuilderViewController.h"
#import "MPReferenceBuilderViewController.h"
#import "NSString+MPPasswordCreation.h"
@@ -317,11 +318,29 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
#pragma mark -
#pragma mark Popovers
- (IBAction)showReferenceBuilder:(id)sender {
NSView *location;
if([sender isKindOfClass:NSView.class]) {
location = sender;
}
else if([sender isKindOfClass:NSMenuItem.class]) {
location = [sender representedObject];
}
[self _showPopopver:[[MPReferenceBuilderViewController alloc] init] atView:location onEdge:NSMinYEdge];
}
- (IBAction)showAutotypeBuilder:(id)sender {
[sender setEnabled:NO];
NSView *location;
if([sender isKindOfClass:NSButton.class]) {
location = sender;
[sender setEnabled:NO];
}
if([sender isKindOfClass:NSMenuItem.class]){
location = [sender representedObject];
}
MPAutotypeBuilderViewController *autotypeBuilder = [[MPAutotypeBuilderViewController alloc] init];
autotypeBuilder.representedObject = self.representedObject;
[self _showPopopver:autotypeBuilder atView:sender onEdge:NSMinYEdge];
[self _showPopopver:autotypeBuilder atView:location onEdge:NSMinYEdge];
}
- (IBAction)showPasswordGenerator:(id)sender {

View File

@@ -120,7 +120,7 @@ typedef NS_ENUM(NSInteger, MPIconDownloadStatus) {
if(error) {
dispatch_async(dispatch_get_main_queue(), ^{
self.downloadStatus = MPIconDownloadStatusError;
[NSApp presentError:error];
//[NSApp presentError:error];
});
}
if(data.length > 0) {

View File

@@ -39,7 +39,6 @@
- (IBAction)pickIcon:(id)sender;
- (IBAction)pickExpiryDate:(id)sender;
- (IBAction)showPluginData:(id)sender;
- (IBAction)showReferenceBuilder:(id)sender;
/* Separate call to ensure all registered objects are in place */
- (void)registerNotificationsForDocument:(NSDocument *)document;

View File

@@ -30,7 +30,6 @@
#import "MPIconImageView.h"
#import "MPNotifications.h"
#import "MPPluginDataViewController.h"
#import "MPReferenceBuilderViewController.h"
#import "KeePassKit/KeePassKit.h"
@@ -196,17 +195,6 @@ typedef NS_ENUM(NSUInteger, MPContentTab) {
[self _popupViewController:[[MPPluginDataViewController alloc] init] atView:sender];
}
- (IBAction)showReferenceBuilder:(id)sender {
NSView *location;
if([sender isKindOfClass:NSView.class]) {
location = sender;
}
else if([sender isKindOfClass:NSMenuItem.class]) {
location = [sender representedObject];
}
[self _popupViewController:[[MPReferenceBuilderViewController alloc] init] atView:location];
}
- (void)_popupViewController:(MPViewController *)vc atView:(NSView *)view {
if(self.popover) {
return; // Popover still active, abort