diff --git a/Cartfile b/Cartfile index d6853d43..2c54434b 100644 --- a/Cartfile +++ b/Cartfile @@ -1,4 +1,4 @@ github "sparkle-project/Sparkle" ~> 1.22 github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f" github "MacPass/KeePassKit" "35da75901b293a53b44b1d0fe9d8fb312a4a7602" -github "mstarke/HNHUi" ~> 5.0 +github "mstarke/HNHUi" ~> 6.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 8abdf49b..2fcf8501 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,5 +1,5 @@ github "MacPass/KeePassKit" "35da75901b293a53b44b1d0fe9d8fb312a4a7602" github "MacPass/KissXML" "933f04fe5ad95c2be07ec0c2f801e140007f20fa" github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f" -github "mstarke/HNHUi" "5.0" +github "mstarke/HNHUi" "6.0" github "sparkle-project/Sparkle" "1.24.0" diff --git a/MacPass/MPEntryAttributeViewController.m b/MacPass/MPEntryAttributeViewController.m index fc92bcd9..ad876b7f 100644 --- a/MacPass/MPEntryAttributeViewController.m +++ b/MacPass/MPEntryAttributeViewController.m @@ -50,7 +50,8 @@ [self updateEditing]; __weak MPEntryAttributeViewController *welf = self; - self.valueTextField.copyActionBlock = ^void(NSTextField *tf) { + self.valueTextField.buttonTitle = NSLocalizedString(@"COPY", "Button to copy the value of an Attribute"); + self.valueTextField.buttonActionBlock = ^void(NSTextField *tf) { NSText *text = [welf.view.window fieldEditor:NO forObject:welf.valueTextField]; if([text isKindOfClass:NSTextView.class]) { [welf textField:welf.valueTextField textView:(NSTextView *)text performAction:@selector(copy:)]; @@ -103,7 +104,7 @@ [selectedValue appendString:[textView.string substringWithRange:rangeValue.rangeValue]]; } if(selectedValue.length == 0) { - [selectedValue setString:textView.string]; + [selectedValue setString:textField.stringValue]; } NSString *name = @""; if([self.representedAttribute.key isEqual:kKPKUsernameKey]) { diff --git a/MacPass/MPTOTPViewController.m b/MacPass/MPTOTPViewController.m index 707fac69..f33eabc0 100644 --- a/MacPass/MPTOTPViewController.m +++ b/MacPass/MPTOTPViewController.m @@ -22,6 +22,14 @@ - (void)viewDidLoad { self.remainingTimeButton.title = @""; + self.toptValueTextField.buttonTitle = NSLocalizedString(@"COPY", @"Copy the TOTP value to the clipboard"); + __weak MPTOTPViewController *welf = self; + self.toptValueTextField.buttonActionBlock = (^void(NSTextField *tf) { + NSText *text = [welf.view.window fieldEditor:NO forObject:welf.toptValueTextField]; + if([text isKindOfClass:NSTextView.class]) { + [welf textField:welf.toptValueTextField textView:(NSTextView *)text performAction:@selector(copy:)]; + } + }); } - (IBAction)showOTPSetup:(id)sender { @@ -53,10 +61,10 @@ for(NSValue *rangeValue in textView.selectedRanges) { [selectedValue appendString:[textView.string substringWithRange:rangeValue.rangeValue]]; } - NSString *name = NSLocalizedString(@"TOTP", "Field TOTP was copied to the pasteboard"); if(selectedValue.length == 0) { - return YES; + [selectedValue setString:textField.stringValue]; } + NSString *name = NSLocalizedString(@"TOTP", "Field TOTP was copied to the pasteboard"); [MPPasteBoardController.defaultController copyObject:selectedValue overlayInfo:info name:name atView:self.view]; return NO; } diff --git a/MacPass/MPTOTPViewController.xib b/MacPass/MPTOTPViewController.xib index 18421d43..786d6489 100644 --- a/MacPass/MPTOTPViewController.xib +++ b/MacPass/MPTOTPViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -36,7 +36,7 @@ - + diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index fb9d8216..a25a35bc 100644 --- a/MacPass/en.lproj/Localizable.strings +++ b/MacPass/en.lproj/Localizable.strings @@ -210,6 +210,10 @@ /* Context menu that copies reference to username */ "COPIED_USERNAME_REFERENCE" = "Reference to username copied!"; +/* Button to copy the value of an Attribute + Copy the TOTP value to the clipboard */ +"COPY" = "Copy"; + /* Submenu to copy attributes as reference */ "COPY_AS_REFERENCE" = "Copy Reference To…"; @@ -758,6 +762,9 @@ /* Toolbar item to perform autotype */ "TOOLBAR_PERFORM_AUTOTYPE_FOR_ENTRY" = "Autotype"; +/* Field TOTP was copied to the pasteboard */ +"TOTP" = "TOTP"; + /* Time in seconds remaining for a valid TOTP string, format should be %ld */ "TOTP_REMAINING_TIME_%ld_SECONDS" = "%ld s";