Entries copied to pasteboard now get placeholder and references evaluated

This commit is contained in:
michael starke
2014-05-27 11:59:20 +02:00
parent f7bb104b6a
commit 9240de444a
3 changed files with 13 additions and 13 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPInspectorViewController">
@@ -30,10 +30,10 @@
<rect key="frame" x="0.0" y="0.0" width="278" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3109">
<rect key="frame" x="198" y="2" width="60" height="25"/>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3109">
<rect key="frame" x="216" y="2" width="42" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="Edit" bezelStyle="texturedRounded" image="07_NotepadTemplate" imagePosition="left" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3110">
<buttonCell key="cell" type="roundTextured" title="Edit" bezelStyle="texturedRounded" imagePosition="left" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3110">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@@ -42,7 +42,7 @@
</connections>
</button>
<button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3126">
<rect key="frame" x="134" y="2" width="56" height="25"/>
<rect key="frame" x="152" y="2" width="56" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="Cancel" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3127">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -218,7 +218,6 @@
</customView>
</objects>
<resources>
<image name="07_NotepadTemplate" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
</resources>
</document>

View File

@@ -53,8 +53,7 @@
- (NSString *)evaluatedCommand {
if(!_evaluatedCommand) {
NSString *placeholderFilled = [self.normalizedCommand evaluatePlaceholderWithEntry:self.entry];
_evaluatedCommand = [[placeholderFilled resolveReferencesWithTree:self.entry.tree] copy];
_evaluatedCommand = [[self.normalizedCommand finalValueForEntry:self.entry] copy];
}
return _evaluatedCommand;
}

View File

@@ -39,6 +39,8 @@
#import "MPNotifications.h"
#import "NSString+Commands.h"
#define STATUS_BAR_ANIMATION_TIME 0.15
typedef NS_ENUM(NSUInteger,MPOVerlayInfoType) {
@@ -554,14 +556,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
- (void)copyPassword:(id)sender {
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
if(selectedEntry) {
[self _copyToPasteboard:selectedEntry.password overlayInfo:MPOverlayInfoPassword name:nil];
[self _copyToPasteboard:[selectedEntry.password finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoPassword name:nil];
}
}
- (void)copyUsername:(id)sender {
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
if(selectedEntry) {
[self _copyToPasteboard:selectedEntry.username overlayInfo:MPOverlayInfoUsername name:nil];
[self _copyToPasteboard:[selectedEntry.username finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoUsername name:nil];
}
}
@@ -571,14 +573,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
NSUInteger index = [sender tag];
NSAssert((index >= 0) && (index < [selectedEntry.customAttributes count]), @"Index for custom field needs to be valid");
KPKAttribute *attribute = selectedEntry.customAttributes[index];
[self _copyToPasteboard:attribute.value overlayInfo:MPOverlayInfoCustom name:attribute.key];
[self _copyToPasteboard:attribute.evaluatedValue overlayInfo:MPOverlayInfoCustom name:attribute.key];
}
}
- (void)copyURL:(id)sender {
KPKEntry *selectedEntry = [self _clickedOrSelectedEntry];
if(selectedEntry) {
[self _copyToPasteboard:selectedEntry.url overlayInfo:MPOverlayInfoURL name:nil];
[self _copyToPasteboard:[selectedEntry.url finalValueForEntry:selectedEntry] overlayInfo:MPOverlayInfoURL name:nil];
}
}