mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-17 21:59:28 +00:00
moved overlay display to MPPasteboardController
content copied in text fields now gets purged if clear-clipboard is set to true
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#import "MPTemporaryFileStorageCenter.h"
|
||||
#import "MPActionHelper.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "MPPasteBoardController.h"
|
||||
|
||||
#import "MPArrayController.h"
|
||||
|
||||
@@ -511,6 +512,41 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark HNHUITextFieldDelegate
|
||||
- (NSMenu *)textField:(NSTextField *)textField textView:(NSTextView *)view menu:(NSMenu *)menu {
|
||||
return menu;
|
||||
}
|
||||
|
||||
- (BOOL)textField:(NSTextField *)textField textView:(NSTextView *)textView performAction:(SEL)action {
|
||||
if(action == @selector(copy:)) {
|
||||
MPPasteboardOverlayInfoType info = MPPasteboardOverlayInfoCustom;
|
||||
NSString *value = textField.stringValue;
|
||||
NSString *name = @"";
|
||||
if(nil == value) {
|
||||
return YES;
|
||||
}
|
||||
if(textField == self.usernameTextField) {
|
||||
info = MPPasteboardOverlayInfoUsername;
|
||||
}
|
||||
else if(textField == self.passwordTextField) {
|
||||
info = MPPasteboardOverlayInfoPassword;
|
||||
}
|
||||
else if(textField == self.URLTextField) {
|
||||
info = MPPasteboardOverlayInfoURL;
|
||||
}
|
||||
else if(textField == self.uuidTextField) {
|
||||
name = NSLocalizedString(@"UUID", "Displayed name when uuid field was copied");
|
||||
}
|
||||
else if(textField == self.titleTextField) {
|
||||
name = NSLocalizedString(@"TITLE", "Displayed name when title field was copied");
|
||||
}
|
||||
[[MPPasteBoardController defaultController] copyObjects:@[value] overlayInfo:info name:name atView:self.view];
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (IBAction)toggleExpire:(NSButton*)sender {
|
||||
if([sender state] == NSOnState && [self.representedEntry.timeInfo.expirationDate isEqualToDate:[NSDate distantFuture]]) {
|
||||
[NSApp sendAction:self.pickExpireDateButton.action to:nil from:self.pickExpireDateButton];
|
||||
|
||||
Reference in New Issue
Block a user