Removed unneccessary NSKeyPathControl subclass

This commit is contained in:
Michael Starke
2018-09-11 14:59:05 +02:00
parent 2b694663e3
commit e887bdda93
8 changed files with 4 additions and 150 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -45,14 +45,11 @@ DQ
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="241" customClass="MPPathControl">
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="241">
<rect key="frame" x="156" y="108" width="197" height="26"/>
<pathCell key="cell" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="242">
<font key="font" metaFont="system"/>
</pathCell>
<connections>
<outlet property="delegate" destination="MfG-kk-cQe" id="9pp-rr-g4V"/>
</connections>
</pathControl>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="262">
<rect key="frame" x="230" y="197" width="48" height="48"/>
@@ -155,9 +152,8 @@ Gw
<constraint firstItem="d8O-Ha-rrS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="vxq-YP-UhR"/>
<constraint firstItem="2" firstAttribute="leading" secondItem="2pb-ZG-spA" secondAttribute="trailing" constant="12" id="ytJ-5Z-5rT"/>
</constraints>
<point key="canvasLocation" x="-429" y="-68"/>
<point key="canvasLocation" x="-90" y="-12"/>
</customView>
<customObject id="MfG-kk-cQe" customClass="MPKeyfilePathControlDelegate"/>
</objects>
<resources>
<image name="02_MessageBoxWarningTemplate" width="16" height="16"/>

View File

@@ -53,21 +53,6 @@ NSInteger MPCustomFieldIndexFromTag(NSInteger tag) {
}
}
/*
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
static NSTextFieldCell *cell;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
cell = [[NSTextFieldCell alloc] init];
});
cell.stringValue = @"Mutli!";
NSTableColumn *column = tableView.tableColumns.firstObject;
NSRect frame = NSMakeRect(0, 0, column.width, CGFLOAT_MAX);
return [cell cellSizeForBounds:frame].height + 38;
}
*/
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
MPCustomFieldTableCellView *view = [tableView makeViewWithIdentifier:@"SelectedCell" owner:tableView];

View File

@@ -1,28 +0,0 @@
//
// MPKeyfilePathControlDelegate.h
// MacPass
//
// Created by Michael Starke on 10.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#import <Foundation/Foundation.h>
#import "MPPathControl.h"
@interface MPKeyfilePathControlDelegate : NSObject <MPPathControlDelegate>
@end

View File

@@ -1,45 +0,0 @@
//
// MPKeyfilePathControlDelegate.m
// MacPass
//
// Created by Michael Starke on 10.03.13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#import "MPKeyfilePathControlDelegate.h"
@implementation MPKeyfilePathControlDelegate
- (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id<NSDraggingInfo>)info {
return NSDragOperationNone;
}
- (void)pathControlDidBecomeKey:(NSPathControl *)control {
// if(control.URL) {
// return;
// }
//
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// NSOpenPanel *panel = [NSOpenPanel openPanel];
// panel.allowedFileTypes = control.allowedTypes;
// if([panel runModal] != NSModalResponseOK) {
// return;
// }
// control.URL = panel.URL;
// });
}
@end

View File

@@ -25,7 +25,6 @@
#import "MPDocumentWindowController.h"
#import "MPDocument.h"
#import "MPSettingsHelper.h"
#import "MPKeyfilePathControlDelegate.h"
#import "HNHUi/HNHUi.h"

View File

@@ -1,16 +0,0 @@
//
// MPPathControl.h
// MacPass
//
// Created by Christoph Leimbrock on 8/7/17.
//
#import <Cocoa/Cocoa.h>
@protocol MPPathControlDelegate <NSPathControlDelegate>
- (void)pathControlDidBecomeKey:(NSPathControl *_Nullable)control;
@end
@interface MPPathControl : NSPathControl
@property (nullable, weak) id <MPPathControlDelegate> delegate;
@end

View File

@@ -1,25 +0,0 @@
//
// MPPathControl.m
// MacPass
//
// Created by Christoph Leimbrock on 8/7/17.
//
#import "MPPathControl.h"
@implementation MPPathControl
@dynamic delegate;
- (BOOL)canBecomeKeyView {
return YES;
}
- (BOOL)acceptsFirstResponder {
return YES;
}
- (BOOL)becomeFirstResponder {
[self.delegate performSelector:@selector(pathControlDidBecomeKey:) withObject:self];
return YES;
}
@end