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"?>
<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>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPEntryViewController">
@@ -48,11 +48,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<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"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="271">
<font key="font" metaFont="system"/>
@@ -86,7 +86,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="298">
@@ -94,6 +94,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="17" id="312"/>
<constraint firstAttribute="height" constant="17" id="T73-FC-KyN"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="301"/>
</imageView>
@@ -136,11 +137,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<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"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="430">
<font key="font" metaFont="system"/>
@@ -174,7 +175,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="422">
@@ -212,7 +213,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="617">
@@ -292,4 +293,4 @@
<image name="NSActionTemplate" width="14" height="14"/>
<image name="NSAddTemplate" width="8" height="8"/>
</resources>
</document>
</document>

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
<?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>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPOutlineViewController">
@@ -78,8 +78,9 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="17" id="385"/>
<constraint firstAttribute="height" constant="17" id="bah-Ng-60T"/>
</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>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="243" customClass="HNHBadgedTextField">
<rect key="frame" x="26" y="4" width="242" height="17"/>
@@ -158,4 +159,4 @@
<image name="NSActionTemplate" width="14" height="14"/>
<image name="NSAddTemplate" width="8" height="8"/>
</resources>
</document>
</document>