mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 23:52:21 +00:00
Renamed clone entry to duplicate entry. Using NSStringFromSelector in MPActionHelper
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="1080" identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<window title="Clone Entry" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" wantsToBeColor="NO" animationBehavior="default" id="1">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="287" height="115"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="287" height="115"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SZv-a7-ifG">
|
||||
<rect key="frame" x="196" y="13" width="77" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Clone" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="SfB-Er-9Rw">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="XpT-SI-BXo">
|
||||
<rect key="frame" x="75" y="79" width="103" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="clone history" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="oD5-qB-8vK">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="r9h-fj-Sew">
|
||||
<rect key="frame" x="75" y="59" width="137" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="clone attachments" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hah-2H-RqN">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="j5y-Yw-WYI">
|
||||
<rect key="frame" x="111" y="13" width="82" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="XYx-Ie-si3">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="XpT-SI-BXo" firstAttribute="top" secondItem="2" secondAttribute="top" constant="20" symbolic="YES" id="9Ro-Kb-xO4"/>
|
||||
<constraint firstItem="r9h-fj-Sew" firstAttribute="top" secondItem="XpT-SI-BXo" secondAttribute="bottom" constant="6" symbolic="YES" id="JFD-Va-WFi"/>
|
||||
<constraint firstItem="r9h-fj-Sew" firstAttribute="centerX" secondItem="2" secondAttribute="centerX" id="fDQ-Tk-yhX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SZv-a7-ifG" secondAttribute="trailing" constant="20" symbolic="YES" id="hhb-E3-WP7"/>
|
||||
<constraint firstItem="j5y-Yw-WYI" firstAttribute="baseline" secondItem="SZv-a7-ifG" secondAttribute="baseline" id="kkG-ta-sym"/>
|
||||
<constraint firstItem="j5y-Yw-WYI" firstAttribute="top" secondItem="r9h-fj-Sew" secondAttribute="bottom" constant="20" symbolic="YES" id="mAF-ad-rDG"/>
|
||||
<constraint firstItem="SZv-a7-ifG" firstAttribute="leading" secondItem="j5y-Yw-WYI" secondAttribute="trailing" constant="15" id="vId-Wx-Snz"/>
|
||||
<constraint firstItem="XpT-SI-BXo" firstAttribute="leading" secondItem="r9h-fj-Sew" secondAttribute="leading" id="vUr-UJ-DzQ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
69
MacPass/DuplicateEntryOptionsWindow.xib
Normal file
69
MacPass/DuplicateEntryOptionsWindow.xib
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="13F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="364" height="115"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="364" height="115"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="KYV-1i-31e">
|
||||
<rect key="frame" x="18" y="79" width="328" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Replace password and usernamen with refernces" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="O9X-XH-n8o">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="DG4-bd-Jhl">
|
||||
<rect key="frame" x="18" y="59" width="129" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Duplicate history" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="dXl-KS-4rE">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TFC-xG-RlB">
|
||||
<rect key="frame" x="214" y="13" width="136" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Duplicate Entry" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WqI-qH-ARf">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0j0-db-9Wu">
|
||||
<rect key="frame" x="132" y="13" width="82" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="x6e-bE-Y6R">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="KYV-1i-31e" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" id="2MP-Nd-nEI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="TFC-xG-RlB" secondAttribute="bottom" constant="20" symbolic="YES" id="7dL-yz-Jec"/>
|
||||
<constraint firstAttribute="trailing" secondItem="TFC-xG-RlB" secondAttribute="trailing" constant="20" symbolic="YES" id="Bp5-7H-WQn"/>
|
||||
<constraint firstItem="TFC-xG-RlB" firstAttribute="leading" secondItem="0j0-db-9Wu" secondAttribute="trailing" constant="12" id="Mo1-NA-twC"/>
|
||||
<constraint firstItem="TFC-xG-RlB" firstAttribute="centerY" secondItem="0j0-db-9Wu" secondAttribute="centerY" id="OI2-vr-Dxa"/>
|
||||
<constraint firstItem="DG4-bd-Jhl" firstAttribute="top" secondItem="KYV-1i-31e" secondAttribute="bottom" constant="6" id="Qsu-7N-dnm"/>
|
||||
<constraint firstItem="KYV-1i-31e" firstAttribute="leading" secondItem="DG4-bd-Jhl" secondAttribute="leading" id="TpN-gj-FoI"/>
|
||||
<constraint firstItem="TFC-xG-RlB" firstAttribute="top" secondItem="DG4-bd-Jhl" secondAttribute="bottom" constant="20" symbolic="YES" id="dbV-TU-M0Z"/>
|
||||
<constraint firstItem="KYV-1i-31e" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" id="tvk-Ic-tmq"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="KYV-1i-31e" secondAttribute="trailing" constant="20" symbolic="YES" id="xhH-o0-KHo"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="DG4-bd-Jhl" secondAttribute="trailing" constant="20" symbolic="YES" id="xnL-R7-g2p"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<point key="canvasLocation" x="640" y="443.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -12,8 +12,8 @@ typedef NS_ENUM(NSUInteger, MPActionType) {
|
||||
MPUnkownAction, // Neutral element to be used for returns
|
||||
MPActionAddEntry, // Add an new entry
|
||||
MPActionAddGroup, // Add a new group
|
||||
MPActionCloneEntry, // Simply clone an entry (inlcuding history)
|
||||
MPActionCloneEntryWithOptions, // Request user inptu what clone
|
||||
MPActionDuplicateEntry, // Simply duplicate an entry (inlcuding history)
|
||||
MPActionDuplicateEntryWithOptions, // Request user inptu on what to duplicate
|
||||
MPActionDelete, // Delete entry or group
|
||||
MPActionCopyUsername, // copy username to pasteboard
|
||||
MPActionCopyPassword, // copy password to pasteboard
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#import "MPActionHelper.h"
|
||||
#import "MPDocument+HistoryBrowsing.h"
|
||||
#import "MPEntryInspectorViewController.h"
|
||||
#import "MPEntryViewController.h"
|
||||
#import "MPDocumentWindowController.h"
|
||||
|
||||
@implementation MPActionHelper
|
||||
|
||||
@@ -17,26 +19,26 @@
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
actionDict = @{
|
||||
@(MPActionAddEntry): @"createEntry:",
|
||||
@(MPActionAddGroup): @"createGroup:",
|
||||
@(MPActionCloneEntry): @"cloneEntry:",
|
||||
@(MPActionCloneEntryWithOptions): @"cloneEntryWithOptions:",
|
||||
@(MPActionCopyPassword): @"copyPassword:",
|
||||
@(MPActionCopyURL): @"copyURL:",
|
||||
@(MPActionCopyUsername): @"copyUsername:",
|
||||
@(MPActionDelete): @"delete:",
|
||||
@(MPActionEditPassword): @"editPassword:",
|
||||
@(MPActionOpenURL): @"openURL:",
|
||||
@(MPActionToggleInspector): @"toggleInspector:",
|
||||
@(MPActionLock): @"lock:",
|
||||
@(MPActionEmptyTrash): @"emptyTrash:",
|
||||
@(MPActionDatabaseSettings): @"showDatabaseSettings:",
|
||||
@(MPActionEditTemplateGroup): @"editTemplateGroup:",
|
||||
@(MPActionExportXML): @"exportAsXML:",
|
||||
@(MPActionImportXML): @"importFromXMl:",
|
||||
@(MPActionToggleQuicklook): NSStringFromSelector(@selector(toggleQuicklookPreview:)),
|
||||
@(MPActionShowHistory): NSStringFromSelector(@selector(showHistory:)),
|
||||
@(MPActionExitHistory): NSStringFromSelector(@selector(exitHistory:))
|
||||
@(MPActionAddEntry): NSStringFromSelector(@selector(createEntry:)),
|
||||
@(MPActionAddGroup): NSStringFromSelector(@selector(createGroup:)),
|
||||
@(MPActionDuplicateEntry): NSStringFromSelector(@selector(duplicateEntry:)),
|
||||
@(MPActionDuplicateEntryWithOptions): NSStringFromSelector(@selector(duplicateEntryWithOptions:)),
|
||||
@(MPActionCopyPassword): NSStringFromSelector(@selector(copyPassword:)),
|
||||
@(MPActionCopyURL): NSStringFromSelector(@selector(copyURL:)),
|
||||
@(MPActionCopyUsername): NSStringFromSelector(@selector(copyUsername:)),
|
||||
@(MPActionDelete): NSStringFromSelector(@selector(delete:)),
|
||||
@(MPActionEditPassword): NSStringFromSelector(@selector(editPassword:)),
|
||||
@(MPActionOpenURL): NSStringFromSelector(@selector(openURL:)),
|
||||
@(MPActionToggleInspector): NSStringFromSelector(@selector(toggleInspector:)),
|
||||
@(MPActionLock): NSStringFromSelector(@selector(lock:)),
|
||||
@(MPActionEmptyTrash): NSStringFromSelector(@selector(emptyTrash:)),
|
||||
@(MPActionDatabaseSettings): NSStringFromSelector(@selector(showDatabaseSettings:)),
|
||||
@(MPActionEditTemplateGroup): NSStringFromSelector(@selector(editTemplateGroup:)),
|
||||
@(MPActionExportXML): NSStringFromSelector(@selector(exportAsXML:)),
|
||||
@(MPActionImportXML): NSStringFromSelector(@selector(importFromXML:)),
|
||||
@(MPActionToggleQuicklook): NSStringFromSelector(@selector(toggleQuicklookPreview:)),
|
||||
@(MPActionShowHistory): NSStringFromSelector(@selector(showHistory:)),
|
||||
@(MPActionExitHistory): NSStringFromSelector(@selector(exitHistory:))
|
||||
};
|
||||
});
|
||||
return actionDict;
|
||||
|
||||
@@ -13,9 +13,9 @@ typedef NS_OPTIONS(NSUInteger, MPContextMenuItemsFlags) {
|
||||
MPContextMenuDelete = 1 << 1,
|
||||
MPContextMenuCopy = 1 << 2,
|
||||
MPContextMenuTrash = 1 << 3,
|
||||
MPContextMenuClone = 1 << 4,
|
||||
MPContextMenuDuplicate = 1 << 4,
|
||||
MPContextMenuMinimal = MPContextMenuCreate | MPContextMenuDelete,
|
||||
MPContextMenuFull = MPContextMenuMinimal | MPContextMenuCopy | MPContextMenuClone,
|
||||
MPContextMenuFull = MPContextMenuMinimal | MPContextMenuCopy | MPContextMenuDuplicate,
|
||||
MPContextMenuExtended = MPContextMenuFull | MPContextMenuTrash
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ static void MPContextmenuHelperBeginSection(NSMutableArray *items) {
|
||||
BOOL const insertDelete = MPIsFlagSetInOptions(MPContextMenuDelete, flags);
|
||||
BOOL const insertCopy = MPIsFlagSetInOptions(MPContextMenuCopy, flags);
|
||||
BOOL const insertTrash = MPIsFlagSetInOptions(MPContextMenuTrash, flags);
|
||||
BOOL const insertClone = MPIsFlagSetInOptions(MPContextMenuClone, flags);
|
||||
BOOL const insertDuplicate = MPIsFlagSetInOptions(MPContextMenuDuplicate, flags);
|
||||
|
||||
NSMutableArray *items = [NSMutableArray arrayWithCapacity:10];
|
||||
if(insertCreate) {
|
||||
@@ -39,16 +39,16 @@ static void MPContextmenuHelperBeginSection(NSMutableArray *items) {
|
||||
|
||||
[items addObjectsFromArray:@[ newGroup, newEntry ]];
|
||||
}
|
||||
if(insertClone) {
|
||||
if(insertDuplicate) {
|
||||
MPContextmenuHelperBeginSection(items);
|
||||
NSMenuItem *cloneEntry = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"CLONE_ENTRY", @"")
|
||||
action:[MPActionHelper actionOfType:MPActionCloneEntry]
|
||||
NSMenuItem *duplicateEntry = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"DUPLICATE_ENTRY", @"")
|
||||
action:[MPActionHelper actionOfType:MPActionDuplicateEntry]
|
||||
keyEquivalent:@"D"];
|
||||
NSMenuItem *cloneEntyWithOptions = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"CLONE_ENTRY_WITH_OPTIONS", @"")
|
||||
action:[MPActionHelper actionOfType:MPActionCloneEntryWithOptions]
|
||||
NSMenuItem *duplicateEntyWithOptions = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"DUPLICATE_ENTRY_WITH_OPTIONS", @"")
|
||||
action:[MPActionHelper actionOfType:MPActionDuplicateEntryWithOptions]
|
||||
keyEquivalent:@""];
|
||||
|
||||
[items addObjectsFromArray:@[ cloneEntry, cloneEntyWithOptions ]];
|
||||
[items addObjectsFromArray:@[ duplicateEntry, duplicateEntyWithOptions ]];
|
||||
|
||||
}
|
||||
if(insertDelete || insertTrash) {
|
||||
|
||||
@@ -182,8 +182,8 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
*/
|
||||
- (IBAction)createEntryFromTemplate:(id)sender;
|
||||
|
||||
- (IBAction)cloneEntry:(id)sender;
|
||||
- (IBAction)duplicateEntry:(id)sender;
|
||||
|
||||
- (IBAction)cloneEntryWithOptions:(id)sender;
|
||||
- (IBAction)duplicateEntryWithOptions:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -606,14 +606,15 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cloneEntry:(id)sender {
|
||||
KPKEntry *clone = [self.selectedEntry copyWithTitle:nil];
|
||||
- (void)duplicateEntry:(id)sender {
|
||||
KPKEntry *duplicate = [self.selectedEntry copyWithTitle:nil];
|
||||
NSInteger index = [self.selectedEntry.parent.entries indexOfObject:self.selectedEntry];
|
||||
[self.selectedEntry.parent addEntry:clone atIndex:index+1];
|
||||
[self.undoManager setActionName:NSLocalizedString(@"CLONE_ENTRY", "")];
|
||||
[self.selectedEntry.parent addEntry:duplicate atIndex:index+1];
|
||||
[self.undoManager setActionName:NSLocalizedString(@"DUPLICATE_ENTRY", "")];
|
||||
}
|
||||
|
||||
- (void)cloneEntryWithOptions:(id)sender {
|
||||
- (void)duplicateEntryWithOptions:(id)sender {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -672,7 +673,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
valid &= (self.trash != targetNode);
|
||||
valid &= ![self isItemTrashed:targetNode];
|
||||
break;
|
||||
case MPActionCloneEntry:
|
||||
case MPActionDuplicateEntry:
|
||||
valid &= (nil != targetEntry);
|
||||
break;
|
||||
case MPActionEmptyTrash:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user