mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 21:42:32 +00:00
Enhanced autotype candidate selection
selection window now uses a table instead of popup menu selection window will not activate MacPass and thus will not block view selection window displays evaluated placeholders (sans password) for better identification
This commit is contained in:
@@ -139,9 +139,8 @@
|
||||
4C6BC6601A36717E00BDDF3D /* MPDatabaseSearch.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6BC65F1A36717E00BDDF3D /* MPDatabaseSearch.m */; };
|
||||
4C6D1D25178579570014C5A5 /* 48_FolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C6D1D24178579570014C5A5 /* 48_FolderTemplate.pdf */; };
|
||||
4C6DCC451FA2457900C8AD3F /* ContextBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C6DCC471FA2457900C8AD3F /* ContextBar.xib */; };
|
||||
4C6DCC5B1FA24AC600C8AD3F /* AutotypeCandidateSelectionWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C6DCC5D1FA24AC600C8AD3F /* AutotypeCandidateSelectionWindow.xib */; };
|
||||
4C6DCC611FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6DCC5F1FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.m */; };
|
||||
4C6DCC621FA24C2100C8AD3F /* AutotypeCandidateSelectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionViewController.xib */; };
|
||||
4C6DCC621FA24C2100C8AD3F /* AutotypeCandidateSelectionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionView.xib */; };
|
||||
4C6F228919A4A7F90012310C /* MPAutotypeClear.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6F228819A4A7F90012310C /* MPAutotypeClear.m */; };
|
||||
4C6F228C19A4AA700012310C /* MPAutotypeDelay.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6F228B19A4AA700012310C /* MPAutotypeDelay.m */; };
|
||||
4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C701CBB178618A000581B88 /* 12_RemoteTemplate.pdf */; };
|
||||
@@ -534,10 +533,9 @@
|
||||
4C6DCC571FA2458200C8AD3F /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/ContextBar.strings; sourceTree = "<group>"; };
|
||||
4C6DCC591FA2458300C8AD3F /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/ContextBar.strings; sourceTree = "<group>"; };
|
||||
4C6DCC5A1FA246ED00C8AD3F /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
4C6DCC5C1FA24AC600C8AD3F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AutotypeCandidateSelectionWindow.xib; sourceTree = "<group>"; };
|
||||
4C6DCC5E1FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPAutotypeCandidateSelectionViewController.h; sourceTree = "<group>"; };
|
||||
4C6DCC5F1FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeCandidateSelectionViewController.m; sourceTree = "<group>"; };
|
||||
4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AutotypeCandidateSelectionViewController.xib; sourceTree = "<group>"; };
|
||||
4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AutotypeCandidateSelectionView.xib; sourceTree = "<group>"; };
|
||||
4C6F228719A4A7F90012310C /* MPAutotypeClear.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeClear.h; sourceTree = "<group>"; };
|
||||
4C6F228819A4A7F90012310C /* MPAutotypeClear.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeClear.m; sourceTree = "<group>"; };
|
||||
4C6F228A19A4AA700012310C /* MPAutotypeDelay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeDelay.h; sourceTree = "<group>"; };
|
||||
@@ -1498,7 +1496,7 @@
|
||||
4CA1827A1F96523600DD4A4A /* DuplicateEntryOptionsWindow.xib */,
|
||||
4C6DCC5E1FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.h */,
|
||||
4C6DCC5F1FA24C2100C8AD3F /* MPAutotypeCandidateSelectionViewController.m */,
|
||||
4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionViewController.xib */,
|
||||
4C6DCC601FA24C2100C8AD3F /* AutotypeCandidateSelectionView.xib */,
|
||||
);
|
||||
name = "Window Controller";
|
||||
sourceTree = "<group>";
|
||||
@@ -1519,7 +1517,6 @@
|
||||
4CE8247216E2E99F00573141 /* Windows */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4C6DCC5D1FA24AC600C8AD3F /* AutotypeCandidateSelectionWindow.xib */,
|
||||
4C1DDCDC1711ECEB00C98DA3 /* PasswordCreatorWindow.xib */,
|
||||
4C7F8B6A1A10B68400CCB83D /* WelcomeWindow.xib */,
|
||||
);
|
||||
@@ -1753,9 +1750,8 @@
|
||||
4C7ABA4A17BAEC6700FF5799 /* 17_CDRomTemplate.pdf in Resources */,
|
||||
4C7ABA4B17BAEC6700FF5799 /* 19_EmailTemplate.pdf in Resources */,
|
||||
4C3826C81AD04D8E007D7D67 /* 61_ServicesTemplate.pdf in Resources */,
|
||||
4C6DCC621FA24C2100C8AD3F /* AutotypeCandidateSelectionViewController.xib in Resources */,
|
||||
4C6DCC621FA24C2100C8AD3F /* AutotypeCandidateSelectionView.xib in Resources */,
|
||||
4C0B038D18E36DA400B9F9C9 /* FixAutotypeWindow.xib in Resources */,
|
||||
4C6DCC5B1FA24AC600C8AD3F /* AutotypeCandidateSelectionWindow.xib in Resources */,
|
||||
4C38267A1AD04CC6007D7D67 /* downloadTemplate.pdf in Resources */,
|
||||
4C7ABA4C17BAEC6700FF5799 /* 20_MiscTemplate.pdf in Resources */,
|
||||
4C7ABA4E17BAEC7000FF5799 /* addEntryTemplate.pdf in Resources */,
|
||||
@@ -1995,14 +1991,6 @@
|
||||
name = ContextBar.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4C6DCC5D1FA24AC600C8AD3F /* AutotypeCandidateSelectionWindow.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
4C6DCC5C1FA24AC600C8AD3F /* Base */,
|
||||
);
|
||||
name = AutotypeCandidateSelectionWindow.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4C7155DA1A10DB6D00979307 /* IconSelection.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
||||
@@ -8,23 +8,24 @@
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MPAutotypeCandidateSelectionViewController">
|
||||
<connections>
|
||||
<outlet property="contextTableView" destination="Ih2-lo-t2W" id="8uy-Mz-1vc"/>
|
||||
<outlet property="selectAutotypeContextButton" destination="V5B-Qq-GN8" id="mqv-H3-N01"/>
|
||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="375"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="241"/>
|
||||
<subviews>
|
||||
<scrollView wantsLayer="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7cB-re-3ys">
|
||||
<rect key="frame" x="20" y="61" width="440" height="252"/>
|
||||
<scrollView wantsLayer="YES" autohidesScrollers="YES" horizontalLineScroll="36" horizontalPageScroll="10" verticalLineScroll="36" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7cB-re-3ys">
|
||||
<rect key="frame" x="20" y="61" width="440" height="118"/>
|
||||
<clipView key="contentView" id="WSc-o2-GsZ">
|
||||
<rect key="frame" x="1" y="0.0" width="438" height="251"/>
|
||||
<rect key="frame" x="1" y="1" width="438" height="116"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" headerView="Ep2-Qz-mIE" viewBased="YES" id="Ih2-lo-t2W">
|
||||
<rect key="frame" x="0.0" y="0.0" width="438" height="228"/>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="34" viewBased="YES" id="Ih2-lo-t2W">
|
||||
<rect key="frame" x="0.0" y="0.0" width="438" height="116"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -47,21 +48,27 @@
|
||||
<rect key="frame" x="1" y="1" width="435" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Utl-Gl-ETE">
|
||||
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Utl-Gl-ETE">
|
||||
<rect key="frame" x="2" y="1" width="14" height="14"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="gT4-lt-7Ir"/>
|
||||
</imageView>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Dxk-A7-QSy">
|
||||
<rect key="frame" x="25" y="0.0" width="410" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="TN3-3a-LaA">
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dxk-A7-QSy">
|
||||
<rect key="frame" x="22" y="0.0" width="413" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Content" id="TN3-3a-LaA">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Dxk-A7-QSy" secondAttribute="bottom" id="0Ds-yc-1wj"/>
|
||||
<constraint firstItem="Dxk-A7-QSy" firstAttribute="top" secondItem="vkI-FK-7wg" secondAttribute="top" id="3KK-oo-Ogk"/>
|
||||
<constraint firstItem="Dxk-A7-QSy" firstAttribute="leading" secondItem="Utl-Gl-ETE" secondAttribute="trailing" constant="8" symbolic="YES" id="L0l-PB-4Dt"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Dxk-A7-QSy" secondAttribute="trailing" constant="2" id="kOy-Jo-rYe"/>
|
||||
<constraint firstItem="Utl-Gl-ETE" firstAttribute="leading" secondItem="vkI-FK-7wg" secondAttribute="leading" constant="2" id="rRi-nE-1Z3"/>
|
||||
<constraint firstItem="Utl-Gl-ETE" firstAttribute="top" secondItem="vkI-FK-7wg" secondAttribute="top" constant="2" id="sJf-FS-87E"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="imageView" destination="Utl-Gl-ETE" id="5dQ-R4-kfV"/>
|
||||
<outlet property="textField" destination="Dxk-A7-QSy" id="8uP-9M-aOd"/>
|
||||
@@ -85,13 +92,9 @@
|
||||
<rect key="frame" x="224" y="17" width="15" height="102"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<tableHeaderView key="headerView" id="Ep2-Qz-mIE">
|
||||
<rect key="frame" x="0.0" y="0.0" width="438" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="330" translatesAutoresizingMaskIntoConstraints="NO" id="kDw-2l-7gQ">
|
||||
<rect key="frame" x="18" y="321" width="444" height="34"/>
|
||||
<rect key="frame" x="18" y="187" width="444" height="34"/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="There are multiple matches for the current window. Please select which match should be used." id="gcf-gb-ZsF">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -119,10 +122,10 @@ Gw
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
DQ
|
||||
</string>
|
||||
<connections>
|
||||
<action selector="selectAutotypeContext:" target="-1" id="rAk-rF-Ncv"/>
|
||||
</connections>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="selectAutotypeContext:" target="-2" id="a2F-ID-uOd"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
@@ -139,7 +142,7 @@ DQ
|
||||
<constraint firstItem="7cB-re-3ys" firstAttribute="top" secondItem="kDw-2l-7gQ" secondAttribute="bottom" constant="8" symbolic="YES" id="ss6-Ku-XPY"/>
|
||||
<constraint firstAttribute="trailing" secondItem="kDw-2l-7gQ" secondAttribute="trailing" constant="20" symbolic="YES" id="zSz-fH-fVn"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="61" y="29.5"/>
|
||||
<point key="canvasLocation" x="-128" y="-54"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
|
||||
@property (copy) NSArray *candidates;
|
||||
|
||||
- (IBAction)selectAutotypeContext:(id)sender;
|
||||
- (IBAction)cancelSelection:(id)sender;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,33 +8,69 @@
|
||||
|
||||
#import "MPAutotypeCandidateSelectionViewController.h"
|
||||
#import "MPAutotypeContext.h"
|
||||
#import "MPAutotypeDaemon.h"
|
||||
|
||||
#import "KPKNode+IconImage.h"
|
||||
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
@interface MPAutotypeCandidateSelectionViewController () <NSTableViewDataSource, NSTableViewDelegate>
|
||||
@property (weak) IBOutlet NSButton *selectAutotypeContextButton;
|
||||
@property (weak) IBOutlet NSTableView *contextTableView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPAutotypeCandidateSelectionViewController
|
||||
|
||||
- (NSNibName)nibName {
|
||||
return @"AutotypeCandidateSelectionViewController";
|
||||
return @"AutotypeCandidateSelectionView";
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.selectAutotypeContextButton.enabled = NO;
|
||||
}
|
||||
|
||||
#pragma mark NSTableViewDataSource
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||
return self.candidates.count;
|
||||
}
|
||||
|
||||
#pragma mark NSTableViewDelegate
|
||||
|
||||
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
|
||||
NSTableCellView *view = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
|
||||
MPAutotypeContext *context = self.candidates[row];
|
||||
view.textField.stringValue = context.entry.title;
|
||||
view.imageView.image = context.entry.icon.image;
|
||||
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@", context.entry.title, context.maskedEvaluatedCommand]];
|
||||
[string setAttributes:@{NSForegroundColorAttributeName: NSColor.disabledControlTextColor} range:NSMakeRange(context.entry.title.length + 1, context.maskedEvaluatedCommand.length)];
|
||||
view.textField.attributedStringValue = string;
|
||||
view.imageView.image = context.entry.iconImage;
|
||||
return view;
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do view setup here.
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)notification {
|
||||
NSTableView *tableView = notification.object;
|
||||
if(tableView != self.contextTableView) {
|
||||
return;
|
||||
}
|
||||
self.selectAutotypeContextButton.enabled = (self.contextTableView.selectedRow != -1);
|
||||
}
|
||||
|
||||
#pragma mark Actions
|
||||
- (void)selectAutotypeContext:(id)sender {
|
||||
NSInteger selectedRow = self.contextTableView.selectedRow;
|
||||
if(selectedRow >= 0 && selectedRow < self.candidates.count) {
|
||||
[[MPAutotypeDaemon defaultDaemon] selectAutotypeCandiate:self.candidates[selectedRow]];
|
||||
}
|
||||
else {
|
||||
[self cancelSelection:sender]; // cancel since the selection was invalid!
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cancelSelection:(id)sender {
|
||||
[[MPAutotypeDaemon defaultDaemon] cancelAutotypeCandidateSelection];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
@class DDHotKey;
|
||||
@class KPKEntry;
|
||||
@class MPAutotypeContext;
|
||||
|
||||
/**
|
||||
* The autotype daemon is responsible for registering the global hotkey and to perform any autotype actions
|
||||
@@ -38,7 +39,7 @@
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (void)performAutotypeForEntry:(KPKEntry *)entry;
|
||||
- (IBAction)performAutotypeWithSelectedMatch:(id)sender;
|
||||
- (IBAction)cancelAutotypeSelection:(id)sender;
|
||||
- (void)selectAutotypeCandiate:(MPAutotypeContext *)context;
|
||||
- (void)cancelAutotypeCandidateSelection;
|
||||
|
||||
@end
|
||||
|
||||
@@ -140,16 +140,14 @@ static MPAutotypeDaemon *_sharedInstance;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Actions
|
||||
- (void)performAutotypeWithSelectedMatch:(id)sender {
|
||||
NSMenuItem *item = self.matchSelectionButton.selectedItem;
|
||||
MPAutotypeContext *context = item.representedObject;
|
||||
- (void)selectAutotypeCandiate:(MPAutotypeContext *)context {
|
||||
[self.matchSelectionWindow orderOut:self];
|
||||
self.matchSelectionWindow = nil;
|
||||
[self _performAutotypeForContext:context];
|
||||
}
|
||||
|
||||
- (void)cancelAutotypeSelection:(id)sender {
|
||||
[self.matchSelectionWindow orderOut:sender];
|
||||
- (void)cancelAutotypeCandidateSelection {
|
||||
[self.matchSelectionWindow orderOut:self];
|
||||
self.matchSelectionWindow = nil;
|
||||
if(self.targetPID) {
|
||||
[self _orderApplicationToFront:self.targetPID];
|
||||
@@ -299,38 +297,18 @@ static MPAutotypeDaemon *_sharedInstance;
|
||||
|
||||
|
||||
if(!self.matchSelectionWindow) {
|
||||
//[[NSBundle mainBundle] loadNibNamed:@"AutotypeCandidateSelectionWindow" owner:self topLevelObjects:nil];
|
||||
self.matchSelectionWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreRetained defer:YES];
|
||||
//self.matchSelectionWindow.level = NSFloatingWindowLevel;
|
||||
self.matchSelectionWindow = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
|
||||
styleMask:NSWindowStyleMaskNonactivatingPanel|NSWindowStyleMaskTitled
|
||||
backing:NSBackingStoreRetained
|
||||
defer:YES];
|
||||
self.matchSelectionWindow.level = NSScreenSaverWindowLevel;
|
||||
MPAutotypeCandidateSelectionViewController *vc = [[MPAutotypeCandidateSelectionViewController alloc] init];
|
||||
vc.candidates = candidates;
|
||||
self.matchSelectionWindow.contentViewController = vc;
|
||||
|
||||
}
|
||||
/*NSMenu *associationMenu = [[NSMenu alloc] init];
|
||||
[associationMenu addItemWithTitle:NSLocalizedString(@"SELECT_AUTOTYPE_CANDIDATE", "Menu item for selection a single match from multiple Autotype matches") action:NULL keyEquivalent:@""];
|
||||
[associationMenu addItem:[NSMenuItem separatorItem]];
|
||||
associationMenu.autoenablesItems = NO;
|
||||
for(MPAutotypeContext *context in candidates) {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:context.entry.title action:0 keyEquivalent:@""];
|
||||
[item setRepresentedObject:context];
|
||||
[associationMenu addItem:item];
|
||||
NSArray *attributes = (context.entry.username.length > 0 )
|
||||
? @[ context.entry.username, context.command ]
|
||||
: @[ context.command ];
|
||||
|
||||
for(NSString *value in attributes) {
|
||||
NSMenuItem *valueItem = [[NSMenuItem alloc] initWithTitle:value action:NULL keyEquivalent:@""];
|
||||
valueItem.indentationLevel = 1;
|
||||
valueItem.enabled = NO;
|
||||
[associationMenu addItem:valueItem];
|
||||
}
|
||||
}
|
||||
self.matchSelectionButton.menu = associationMenu;
|
||||
*/
|
||||
[self.matchSelectionWindow center];
|
||||
[self.matchSelectionWindow makeKeyAndOrderFront:self];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
Reference in New Issue
Block a user