mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
Removed HNHUIBadgedTextField in favour of a composed UI
This commit is contained in:
4
Cartfile
4
Cartfile
@@ -1,3 +1,3 @@
|
||||
github "sparkle-project/Sparkle" ~> 1.18.1
|
||||
github "MacPass/KeePassKit" ~> 1.13.9
|
||||
github "mstarke/HNHUi" ~> 2.0
|
||||
github "MacPass/KeePassKit" ~> 1.13.10
|
||||
github "mstarke/HNHUi" ~> 3.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
github "MacPass/KeePassKit" "1.13.9"
|
||||
github "mstarke/HNHUi" "2.0.1"
|
||||
github "MacPass/KeePassKit" "1.13.10"
|
||||
github "mstarke/HNHUi" "3.0"
|
||||
github "robbiehanson/KissXML" "5.2.3"
|
||||
github "sparkle-project/Sparkle" "1.20.0"
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
4C2F17A21FD69BCA0097418D /* MPUserNotificationCenterDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C2F17A11FD69BCA0097418D /* MPUserNotificationCenterDelegate.m */; };
|
||||
4C32B0E71A1D4436007E12F1 /* KPKFormat+MPUTIDetection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C32B0E61A1D4436007E12F1 /* KPKFormat+MPUTIDetection.m */; };
|
||||
4C3666411787327E00B249F1 /* MPDocument+Attachments.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3666401787327E00B249F1 /* MPDocument+Attachments.m */; };
|
||||
4C370EFE215B76CB00703AAE /* MPOutlineTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C370EFD215B76CB00703AAE /* MPOutlineTableCellView.m */; };
|
||||
4C37A84015B8B474005EF8EE /* MPOutlineDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */; };
|
||||
4C3826721AD04B51007D7D67 /* addFolderTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C3826711AD04B51007D7D67 /* addFolderTemplate.pdf */; };
|
||||
4C3826741AD04BA5007D7D67 /* infoTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4C3826731AD04BA5007D7D67 /* infoTemplate.pdf */; };
|
||||
@@ -392,6 +393,8 @@
|
||||
4C32B0E51A1D4436007E12F1 /* KPKFormat+MPUTIDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKFormat+MPUTIDetection.h"; sourceTree = "<group>"; };
|
||||
4C32B0E61A1D4436007E12F1 /* KPKFormat+MPUTIDetection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPKFormat+MPUTIDetection.m"; sourceTree = "<group>"; };
|
||||
4C3666401787327E00B249F1 /* MPDocument+Attachments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPDocument+Attachments.m"; sourceTree = "<group>"; };
|
||||
4C370EFC215B76CB00703AAE /* MPOutlineTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPOutlineTableCellView.h; sourceTree = "<group>"; };
|
||||
4C370EFD215B76CB00703AAE /* MPOutlineTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPOutlineTableCellView.m; sourceTree = "<group>"; };
|
||||
4C37A83E15B8B474005EF8EE /* MPOutlineDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOutlineDataSource.h; sourceTree = "<group>"; };
|
||||
4C37A83F15B8B474005EF8EE /* MPOutlineDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOutlineDataSource.m; sourceTree = "<group>"; };
|
||||
4C3826711AD04B51007D7D67 /* addFolderTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = addFolderTemplate.pdf; path = Icons/addFolderTemplate.pdf; sourceTree = "<group>"; };
|
||||
@@ -1027,6 +1030,8 @@
|
||||
4CF6C3011FBF39BF0055AD03 /* MPPluginTabelCellView.m */,
|
||||
4C0F043E2147A6FA000B8568 /* MPCustomFieldTableView.h */,
|
||||
4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */,
|
||||
4C370EFC215B76CB00703AAE /* MPOutlineTableCellView.h */,
|
||||
4C370EFD215B76CB00703AAE /* MPOutlineTableCellView.m */,
|
||||
);
|
||||
name = Views;
|
||||
sourceTree = "<group>";
|
||||
@@ -1942,6 +1947,7 @@
|
||||
4C65C79C16DD283900E32CFF /* MPToolbarButton.m in Sources */,
|
||||
4C431BCD16E2A82800700A81 /* MPPasteBoardController.m in Sources */,
|
||||
4C6AEEF91A043E2B00CA2420 /* MPDocumentController.m in Sources */,
|
||||
4C370EFE215B76CB00703AAE /* MPOutlineTableCellView.m in Sources */,
|
||||
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */,
|
||||
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */,
|
||||
4C7B63761C0CB51F00D7038C /* TTTJSONTransformer.m in Sources */,
|
||||
|
||||
21
MacPass/MPOutlineTableCellView.h
Normal file
21
MacPass/MPOutlineTableCellView.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MPOutlineTableCellView.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 26.09.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MPOutlineTableCellView : NSTableCellView
|
||||
|
||||
@property (nonatomic) NSInteger count;
|
||||
@property (nonatomic) BOOL hideZeroCount;
|
||||
@property (nonatomic, strong) IBOutlet NSButton *countButton;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
73
MacPass/MPOutlineTableCellView.m
Normal file
73
MacPass/MPOutlineTableCellView.m
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// MPOutlineTableCellView.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 26.09.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPOutlineTableCellView.h"
|
||||
|
||||
@implementation MPOutlineTableCellView
|
||||
|
||||
@synthesize count = _count;
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect {
|
||||
self = [super initWithFrame:frameRect];
|
||||
if(self) {
|
||||
[self _setupDefaults];
|
||||
[self _updateCountDisplay];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder {
|
||||
self = [super initWithCoder:decoder];
|
||||
if(self) {
|
||||
[self _setupDefaults];
|
||||
if([decoder containsValueForKey:NSStringFromSelector(@selector(count))]) {
|
||||
_count = [decoder decodeIntegerForKey:NSStringFromSelector(@selector(count))];
|
||||
}
|
||||
if([decoder containsValueForKey:NSStringFromSelector(@selector(hideZeroCount))]) {
|
||||
_hideZeroCount = [decoder decodeBoolForKey:NSStringFromSelector(@selector(hideZeroCount))];
|
||||
}
|
||||
[self _updateCountDisplay];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[super encodeWithCoder:aCoder];
|
||||
[aCoder encodeBool:_hideZeroCount forKey:NSStringFromSelector(@selector(hideZeroCount))];
|
||||
[aCoder encodeInteger:_count forKey:NSStringFromSelector(@selector(count))];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[self _updateCountDisplay];
|
||||
}
|
||||
|
||||
- (void)_setupDefaults {
|
||||
_count = 0;
|
||||
_hideZeroCount = YES;
|
||||
}
|
||||
|
||||
- (void)setCount:(NSInteger)count {
|
||||
if(_count != count) {
|
||||
_count = count;
|
||||
[self _updateCountDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setHideZeroCount:(BOOL)hideZeroCount {
|
||||
if(_hideZeroCount != hideZeroCount) {
|
||||
_hideZeroCount = hideZeroCount;
|
||||
[self _updateCountDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_updateCountDisplay {
|
||||
self.countButton.title = [NSString stringWithFormat:@"%ld", _count];
|
||||
self.countButton.hidden = (self.hideZeroCount && self.count == 0);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -30,6 +30,7 @@
|
||||
#import "MPNotifications.h"
|
||||
#import "MPOutlineContextMenuDelegate.h"
|
||||
#import "MPOutlineDataSource.h"
|
||||
#import "MPOutlineTableCellView.h"
|
||||
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
#import "KPKNode+IconImage.h"
|
||||
@@ -258,7 +259,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
#pragma mark NSOutlineViewDelegate
|
||||
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
|
||||
NSTableCellView *view;
|
||||
MPOutlineTableCellView *view;
|
||||
if( [self _itemIsRootNode:item] ) {
|
||||
view = [outlineView makeViewWithIdentifier:_MPOutlinveViewHeaderViewIdentifier owner:self];
|
||||
[view.textField bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(databaseNameWrapper)) options:nil];
|
||||
@@ -273,7 +274,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
|
||||
NSString *entriesCountKeyPath = [[NSString alloc] initWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), KPKEntriesArrayBinding, @"@count"];
|
||||
[view.textField bind:NSStringFromSelector(@selector(count)) toObject:item withKeyPath:entriesCountKeyPath options:nil];
|
||||
[view bind:NSStringFromSelector(@selector(count)) toObject:item withKeyPath:entriesCountKeyPath options:nil];
|
||||
}
|
||||
|
||||
return view;
|
||||
|
||||
@@ -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="14313.18" 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="14313.18"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -65,7 +65,7 @@
|
||||
<outlet property="textField" destination="238" id="245"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="DataCell" id="240">
|
||||
<tableCellView identifier="DataCell" id="240" customClass="MPOutlineTableCellView">
|
||||
<rect key="frame" x="1" y="17" width="269" height="24"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
@@ -77,14 +77,21 @@
|
||||
</constraints>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="242"/>
|
||||
</imageView>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="243" customClass="HNHUIBadgedTextField">
|
||||
<rect key="frame" x="26" y="4" width="242" height="17"/>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="243">
|
||||
<rect key="frame" x="26" y="4" width="214" height="17"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="244" customClass="HNHUIBadgedTextFieldCell">
|
||||
<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>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mX2-wv-qML">
|
||||
<rect key="frame" x="246" y="3" width="20" height="17"/>
|
||||
<buttonCell key="cell" type="inline" title="0" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="gnA-JK-kZz">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="smallSystemBold"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="241" firstAttribute="top" secondItem="243" secondAttribute="top" id="258"/>
|
||||
@@ -92,9 +99,12 @@
|
||||
<constraint firstItem="243" firstAttribute="leading" secondItem="241" secondAttribute="trailing" constant="8" symbolic="YES" id="260"/>
|
||||
<constraint firstItem="241" firstAttribute="centerY" secondItem="240" secondAttribute="centerY" id="349"/>
|
||||
<constraint firstItem="243" firstAttribute="bottom" secondItem="241" secondAttribute="bottom" id="388"/>
|
||||
<constraint firstAttribute="trailing" secondItem="243" secondAttribute="trailing" constant="3" id="389"/>
|
||||
<constraint firstAttribute="trailing" secondItem="mX2-wv-qML" secondAttribute="trailing" constant="3" id="QVK-iI-TAI"/>
|
||||
<constraint firstItem="mX2-wv-qML" firstAttribute="leading" secondItem="243" secondAttribute="trailing" constant="8" symbolic="YES" id="c8g-bX-Xvj"/>
|
||||
<constraint firstItem="mX2-wv-qML" firstAttribute="centerY" secondItem="243" secondAttribute="centerY" id="cQH-fE-J5j"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="countButton" destination="mX2-wv-qML" id="mGA-jF-HO3"/>
|
||||
<outlet property="imageView" destination="241" id="247"/>
|
||||
<outlet property="textField" destination="243" id="246"/>
|
||||
</connections>
|
||||
@@ -122,7 +132,7 @@
|
||||
<constraint firstItem="227" firstAttribute="trailing" secondItem="196" secondAttribute="trailing" id="269"/>
|
||||
<constraint firstAttribute="bottom" secondItem="227" secondAttribute="bottom" id="NQ5-NK-jdK"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-288" y="-139"/>
|
||||
<point key="canvasLocation" x="-288" y="-139.5"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
Reference in New Issue
Block a user