mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 22:52:26 +00:00
This commit is contained in:
@@ -230,6 +230,7 @@
|
||||
4CC0D2CE17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC0D2CD17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m */; };
|
||||
4CC0D2D117974A5A000B4BDA /* MPAttachmentTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC0D2D017974A5A000B4BDA /* MPAttachmentTableViewDelegate.m */; };
|
||||
4CC281891C0F675B00B9174D /* HNHUi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CC281881C0F675B00B9174D /* HNHUi.framework */; };
|
||||
4CC59C2721AF0893005E8D6B /* MPPathControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC59C2621AF0893005E8D6B /* MPPathControl.m */; };
|
||||
4CC663E7216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC663E5216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.m */; };
|
||||
4CC663E8216F7A7100E33965 /* PluginRepositoryBrowserView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CC663E6216F7A7100E33965 /* PluginRepositoryBrowserView.xib */; };
|
||||
4CC6DB7A17D23719002C6091 /* KPKNode+IconImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6DB7917D23719002C6091 /* KPKNode+IconImage.m */; };
|
||||
@@ -768,6 +769,8 @@
|
||||
4CC0D2CF17974A5A000B4BDA /* MPAttachmentTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAttachmentTableViewDelegate.h; sourceTree = "<group>"; };
|
||||
4CC0D2D017974A5A000B4BDA /* MPAttachmentTableViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAttachmentTableViewDelegate.m; sourceTree = "<group>"; };
|
||||
4CC281881C0F675B00B9174D /* HNHUi.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HNHUi.framework; path = Carthage/Build/Mac/HNHUi.framework; sourceTree = "<group>"; };
|
||||
4CC59C2521AF0893005E8D6B /* MPPathControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPPathControl.h; sourceTree = "<group>"; };
|
||||
4CC59C2621AF0893005E8D6B /* MPPathControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPPathControl.m; sourceTree = "<group>"; };
|
||||
4CC663E4216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPPluginRepositoryBrowserViewController.h; sourceTree = "<group>"; };
|
||||
4CC663E5216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPPluginRepositoryBrowserViewController.m; sourceTree = "<group>"; };
|
||||
4CC663E6216F7A7100E33965 /* PluginRepositoryBrowserView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PluginRepositoryBrowserView.xib; sourceTree = "<group>"; };
|
||||
@@ -1624,6 +1627,8 @@
|
||||
4C63B8FA17A3154D0091BD72 /* MPContextButton.m */,
|
||||
4C57AE1217BA422B00CA4F34 /* MPSegmentedContextCell.h */,
|
||||
4C57AE1317BA422B00CA4F34 /* MPSegmentedContextCell.m */,
|
||||
4CC59C2521AF0893005E8D6B /* MPPathControl.h */,
|
||||
4CC59C2621AF0893005E8D6B /* MPPathControl.m */,
|
||||
);
|
||||
name = Controls;
|
||||
sourceTree = "<group>";
|
||||
@@ -2049,6 +2054,7 @@
|
||||
4C4FCE15177CFE6B00BBF7AE /* MPCustomFieldTableCellView.m in Sources */,
|
||||
4C4B728518E4B9B400A1A5D5 /* MPDockTileHelper.m in Sources */,
|
||||
4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */,
|
||||
4CC59C2721AF0893005E8D6B /* MPPathControl.m in Sources */,
|
||||
4C3666411787327E00B249F1 /* MPDocument+Attachments.m in Sources */,
|
||||
4CF6C3021FBF39BF0055AD03 /* MPPluginTabelCellView.m in Sources */,
|
||||
4C10412C178CDD44001B5239 /* NSDate+Humanized.m in Sources */,
|
||||
|
||||
@@ -96,6 +96,11 @@
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "OS_ACTIVITY_MODE"
|
||||
value = "disable"
|
||||
isEnabled = "NO">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
|
||||
@@ -45,7 +45,7 @@ DQ
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="241">
|
||||
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="241" customClass="MPPathControl">
|
||||
<rect key="frame" x="156" y="153" width="197" height="25"/>
|
||||
<pathCell key="cell" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="242">
|
||||
<font key="font" metaFont="system"/>
|
||||
|
||||
@@ -25,15 +25,16 @@
|
||||
#import "MPDocumentWindowController.h"
|
||||
#import "MPDocument.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "MPPathControl.h"
|
||||
|
||||
#import "HNHUi/HNHUi.h"
|
||||
|
||||
#import "NSError+Messages.h"
|
||||
|
||||
@interface MPPasswordInputController ()
|
||||
@interface MPPasswordInputController () <NSPathControlDelegate>
|
||||
|
||||
@property (weak) IBOutlet HNHUISecureTextField *passwordTextField;
|
||||
@property (weak) IBOutlet NSPathControl *keyPathControl;
|
||||
@property (weak) IBOutlet MPPathControl *keyPathControl;
|
||||
@property (weak) IBOutlet NSImageView *messageImageView;
|
||||
@property (weak) IBOutlet NSTextField *messageInfoTextField;
|
||||
@property (weak) IBOutlet NSButton *togglePasswordButton;
|
||||
@@ -75,8 +76,7 @@
|
||||
[self.enablePasswordCheckBox bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
[self.togglePasswordButton bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
[self.passwordTextField bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
|
||||
[self.passwordTextField setNextKeyView:self.keyPathControl];
|
||||
self.keyPathControl.delegate = self;
|
||||
[self _reset];
|
||||
}
|
||||
|
||||
@@ -111,11 +111,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark NSPathControlDelegate
|
||||
-(void)pathControl:(NSPathControl *)pathControl willPopUpMenu:(NSMenu *)menu {
|
||||
if(pathControl != self.keyPathControl) {
|
||||
return;
|
||||
}
|
||||
if(!self.keyPathControl.URL) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(50 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
|
||||
[menu cancelTracking];
|
||||
});
|
||||
[self.keyPathControl showOpenPanel:self];
|
||||
}
|
||||
return;
|
||||
}
|
||||
- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel {
|
||||
openPanel.animationBehavior = NSWindowAnimationBehaviorDocumentWindow;
|
||||
openPanel.canChooseDirectories = NO;
|
||||
openPanel.allowsMultipleSelection = NO;
|
||||
openPanel.prompt = NSLocalizedString(@"CHOOSE_FILE_BUTTON_TITLE", @"Button title in the key file selection dialog for selecting a key");
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Private
|
||||
- (IBAction)_submit:(id)sender {
|
||||
|
||||
if(!self.completionHandler) {
|
||||
return;
|
||||
}
|
||||
|
||||
19
MacPass/MPPathControl.h
Normal file
19
MacPass/MPPathControl.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MPPathControl.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 28.11.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MPPathControl : NSPathControl
|
||||
|
||||
- (IBAction)showOpenPanel:(id _Nullable)sender;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
34
MacPass/MPPathControl.m
Normal file
34
MacPass/MPPathControl.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MPPathControl.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 28.11.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPPathControl.h"
|
||||
|
||||
@implementation MPPathControl
|
||||
|
||||
/*- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event {
|
||||
if(!self.URL) {
|
||||
[menu cancelTracking];
|
||||
[self _showOpenPanel];
|
||||
};
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)showOpenPanel:(id)sender {
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
if([self.delegate respondsToSelector:@selector(pathControl:willDisplayOpenPanel:)]) {
|
||||
[self.delegate pathControl:self willDisplayOpenPanel:panel];
|
||||
}
|
||||
[panel beginWithCompletionHandler:^(NSModalResponse result) {
|
||||
if(result == NSModalResponseOK) {
|
||||
self.URL = panel.URLs.firstObject;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user