mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-18 03:49:22 +00:00
Added node expiration view controller
This commit is contained in:
2
Cartfile
2
Cartfile
@@ -1,4 +1,4 @@
|
|||||||
github "sparkle-project/Sparkle" ~> 1.22
|
github "sparkle-project/Sparkle" ~> 1.22
|
||||||
github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f"
|
github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f"
|
||||||
github "MacPass/KeePassKit" "3feaa35a8194695ffce2424b01ea28dcc1e3695d"
|
github "MacPass/KeePassKit" "35da75901b293a53b44b1d0fe9d8fb312a4a7602"
|
||||||
github "mstarke/HNHUi" ~> 4.0
|
github "mstarke/HNHUi" ~> 4.0
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
github "MacPass/KeePassKit" "3feaa35a8194695ffce2424b01ea28dcc1e3695d"
|
github "MacPass/KeePassKit" "35da75901b293a53b44b1d0fe9d8fb312a4a7602"
|
||||||
github "MacPass/KissXML" "933f04fe5ad95c2be07ec0c2f801e140007f20fa"
|
github "MacPass/KissXML" "933f04fe5ad95c2be07ec0c2f801e140007f20fa"
|
||||||
github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f"
|
github "MacPass/TransformerKit" "a8b5bb73cc327ec6798569b865c32fec5eb2289f"
|
||||||
github "mstarke/HNHUi" "4.0.4"
|
github "mstarke/HNHUi" "4.0.4"
|
||||||
|
|||||||
@@ -7,10 +7,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "MPInspectorEditor.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface MPNodeExpirationViewController : NSViewController
|
@interface MPNodeExpirationViewController : NSViewController <MPInspectorEditor>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -7,24 +7,39 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "MPNodeExpirationViewController.h"
|
#import "MPNodeExpirationViewController.h"
|
||||||
|
#import "MPInspectorViewController.h"
|
||||||
|
#import "MPValueTransformerHelper.h"
|
||||||
#import <KeePassKit/KeePassKit.h>
|
#import <KeePassKit/KeePassKit.h>
|
||||||
|
|
||||||
@interface MPNodeExpirationViewController ()
|
@interface MPNodeExpirationViewController ()
|
||||||
|
|
||||||
@property (nonatomic, readonly, strong) KPKTimeInfo *representedTimeInfo;
|
@property (nonatomic, readonly, strong) KPKTimeInfo *representedTimeInfo;
|
||||||
|
@property (strong) IBOutlet NSButton *expiredCheckButton;
|
||||||
|
@property (strong) IBOutlet NSButton *pickExpireDateButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MPNodeExpirationViewController
|
@implementation MPNodeExpirationViewController
|
||||||
|
|
||||||
|
@synthesize isEditor = _isEditor;
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
self.pickExpireDateButton.action = @selector(pickExpiryDate:);
|
||||||
|
[self _updateValues];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (KPKTimeInfo *)representedTimeInfo {
|
||||||
|
if([self.representedObject isKindOfClass:KPKTimeInfo.class]) {
|
||||||
|
return self.representedObject;
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setRepresentedObject:(id)representedObject {
|
- (void)setRepresentedObject:(id)representedObject {
|
||||||
/*if(self.representedTimeInfo) {
|
if(self.representedTimeInfo) {
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKWillChangeTimeInfo object:self.representedTimeInfo];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKWillChangeTimeInfoNotification object:self.representedTimeInfo];
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKDidChangeTimeInfo object:self.representedTimeInfo];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKDidChangeTimeInfoNotification object:self.representedTimeInfo];
|
||||||
}
|
}
|
||||||
super.representedObject = representedObject;
|
super.representedObject = representedObject;
|
||||||
if(self.representedTimeInfo) {
|
if(self.representedTimeInfo) {
|
||||||
@@ -38,20 +53,27 @@
|
|||||||
object:self.representedTimeInfo];
|
object:self.representedTimeInfo];
|
||||||
|
|
||||||
}
|
}
|
||||||
_isDefaultAttribute = self.representedAttribute.isDefault;
|
[self _updateValues];
|
||||||
[self _updateValues];*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setIsEditor:(BOOL)isEditor {
|
||||||
|
[self _updateValues];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)_updateValues {
|
- (void)_updateValues {
|
||||||
|
self.view.hidden = self.representedTimeInfo.expires;
|
||||||
|
self.expiredCheckButton.state = HNHUIStateForBool(self.representedTimeInfo.expires);
|
||||||
|
NSValueTransformer *dateTransformer = [NSValueTransformer valueTransformerForName:MPExpiryDateValueTransformerName];
|
||||||
|
self.expiredCheckButton.title = [dateTransformer transformedValue:self.representedTimeInfo.expirationDate];
|
||||||
|
|
||||||
|
self.expiredCheckButton.enabled = self.isEditor;
|
||||||
|
self.pickExpireDateButton.enabled = self.isEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_willChangeTimeInfo:(NSNotification *)notification {
|
- (void)_willChangeTimeInfo:(NSNotification *)notification {}
|
||||||
|
|
||||||
}
|
|
||||||
- (void)_didChangeTimeInfo:(NSNotification *)notification {
|
- (void)_didChangeTimeInfo:(NSNotification *)notification {
|
||||||
|
[self _updateValues];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="MPNodeExpirationViewController">
|
<customObject id="-2" userLabel="File's Owner" customClass="MPNodeExpirationViewController">
|
||||||
<connections>
|
<connections>
|
||||||
|
<outlet property="expiredCheckButton" destination="HAQ-Wk-M7P" id="C1J-nJ-Cdz"/>
|
||||||
|
<outlet property="pickExpireDateButton" destination="G7C-WZ-ad7" id="zvU-TW-Mar"/>
|
||||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
|
|||||||
Reference in New Issue
Block a user