Fixed height of image views in outline view and entry table

Added sub to display expired entries (uses the flag not the date for testing)
This commit is contained in:
michael starke
2014-03-18 00:33:37 +01:00
parent 1d823af4b9
commit c165d02c38
6 changed files with 34 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment defaultVersion="1080" identifier="macosx"/> <deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPEntryViewController"> <customObject id="-2" userLabel="File's Owner" customClass="MPEntryViewController">
@@ -48,11 +48,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="StringCell" id="269"> <tableCellView identifier="StringCell" id="269">
<rect key="frame" x="1" y="1" width="105" height="17"/> <rect key="frame" x="1" y="1" width="104.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="270">
<rect key="frame" x="1" y="0.0" width="103" height="17"/> <rect key="frame" x="1" y="0.0" width="102.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271"> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -86,7 +86,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="ImageCell" id="297"> <tableCellView identifier="ImageCell" id="297">
<rect key="frame" x="109" y="1" width="144" height="17"/> <rect key="frame" x="108.5" y="1" width="144" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="298"> <imageView translatesAutoresizingMaskIntoConstraints="NO" id="298">
@@ -94,6 +94,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="17" id="312"/> <constraint firstAttribute="width" constant="17" id="312"/>
<constraint firstAttribute="height" constant="17" id="T73-FC-KyN"/>
</constraints> </constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="301"/> <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="301"/>
</imageView> </imageView>
@@ -136,11 +137,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="PasswordCell" id="428"> <tableCellView identifier="PasswordCell" id="428">
<rect key="frame" x="256" y="1" width="119" height="17"/> <rect key="frame" x="255.5" y="1" width="118.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="429" customClass="NSSecureTextField">
<rect key="frame" x="1" y="0.0" width="117" height="17"/> <rect key="frame" x="1" y="0.0" width="116.5" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430"> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
@@ -174,7 +175,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView id="421"> <tableCellView id="421">
<rect key="frame" x="378" y="1" width="113" height="17"/> <rect key="frame" x="377" y="1" width="113" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422">
@@ -212,7 +213,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView id="616"> <tableCellView id="616">
<rect key="frame" x="494" y="1" width="198" height="17"/> <rect key="frame" x="493" y="1" width="198" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617">
@@ -292,4 +293,4 @@
<image name="NSActionTemplate" width="14" height="14"/> <image name="NSActionTemplate" width="14" height="14"/>
<image name="NSAddTemplate" width="8" height="8"/> <image name="NSAddTemplate" width="8" height="8"/>
</resources> </resources>
</document> </document>

View File

@@ -9,18 +9,26 @@
#import "KPKNode+IconImage.h" #import "KPKNode+IconImage.h"
#import "KPKIcon.h" #import "KPKIcon.h"
#import "KPKGroup.h"
#import "KPKTree.h" #import "KPKTree.h"
#import "KPKMetaData.h" #import "KPKMetaData.h"
#import "KPKTimeInfo.h"
#import "MPIconHelper.h" #import "MPIconHelper.h"
@implementation KPKNode (IconImage) @implementation KPKNode (IconImage)
+ (NSSet *)keyPathsForValuesAffectingIconImage { + (NSSet *)keyPathsForValuesAffectingIconImage {
return [NSSet setWithArray:@[@"iconUUID", @"iconId"]]; return [NSSet setWithArray:@[NSStringFromSelector(@selector(iconUUID)),
NSStringFromSelector(@selector(iconId)),
@"timeInfo.expires"]];
} }
- (NSImage *)iconImage { - (NSImage *)iconImage {
if(self.timeInfo.expires) {
const BOOL isGroup = [self isKindOfClass:[KPKGroup class]];
return [MPIconHelper icon:(isGroup ? MPIconExpiredGroup : MPIconExpiredEntry)];
}
if(self.iconUUID) { if(self.iconUUID) {
KPKIcon *icon = [self.tree.metaData findIcon:self.iconUUID]; KPKIcon *icon = [self.tree.metaData findIcon:self.iconUUID];
if(icon && icon.image) { if(icon && icon.image) {

View File

@@ -171,6 +171,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
} }
- (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError { - (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError {
[self _watchForFileChanges:YES];
/* FIXME: Lockfile handling /* FIXME: Lockfile handling
self.lockFileURL = [url URLByAppendingPathExtension:@"lock"]; self.lockFileURL = [url URLByAppendingPathExtension:@"lock"];
if([[NSFileManager defaultManager] fileExistsAtPath:[_lockFileURL path]]) { if([[NSFileManager defaultManager] fileExistsAtPath:[_lockFileURL path]]) {

View File

@@ -48,6 +48,8 @@ typedef NS_ENUM(NSUInteger, MPIconType) {
MPIconCreated, MPIconCreated,
MPIconAddEntry, MPIconAddEntry,
MPIconContextTriangle, MPIconContextTriangle,
MPIconExpiredEntry,
MPIconExpiredGroup,
}; };
/** /**

View File

@@ -17,7 +17,8 @@
} }
if([[icons allKeys] containsObject:@(type)]) { if([[icons allKeys] containsObject:@(type)]) {
NSString *imageName = icons[@(type)]; NSString *imageName = icons[@(type)];
return [[NSBundle mainBundle] imageForResource:imageName]; NSImage *image = [NSImage imageNamed:imageName];
return image;
} }
return [NSImage imageNamed:NSImageNameActionTemplate]; return [NSImage imageNamed:NSImageNameActionTemplate];
} }
@@ -83,7 +84,10 @@
@(MPIconHardDisk): @"99_HarddiskTemplate", @(MPIconHardDisk): @"99_HarddiskTemplate",
@(MPIconCreated): @"99_CreatedTemplate", @(MPIconCreated): @"99_CreatedTemplate",
@(MPIconAddEntry): @"addEntryTemplate", @(MPIconAddEntry): @"addEntryTemplate",
@(MPIconContextTriangle): @"contextTriangleTemplate" @(MPIconContextTriangle): @"contextTriangleTemplate",
@(MPIconExpiredEntry): NSImageNameCaution,
@(MPIconExpiredGroup): NSImageNameCaution
}; };
}); });
return imageNames; return imageNames;

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment defaultVersion="1080" identifier="macosx"/> <deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPOutlineViewController"> <customObject id="-2" userLabel="File's Owner" customClass="MPOutlineViewController">
@@ -78,8 +78,9 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="17" id="385"/> <constraint firstAttribute="width" constant="17" id="385"/>
<constraint firstAttribute="height" constant="17" id="bah-Ng-60T"/>
</constraints> </constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" image="NSActionTemplate" id="242"/> <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="242"/>
</imageView> </imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="243" customClass="HNHBadgedTextField"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="243" customClass="HNHBadgedTextField">
<rect key="frame" x="26" y="4" width="242" height="17"/> <rect key="frame" x="26" y="4" width="242" height="17"/>
@@ -158,4 +159,4 @@
<image name="NSActionTemplate" width="14" height="14"/> <image name="NSActionTemplate" width="14" height="14"/>
<image name="NSAddTemplate" width="8" height="8"/> <image name="NSAddTemplate" width="8" height="8"/>
</resources> </resources>
</document> </document>