mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-19 03:49:21 +00:00
Added more protocols to clarify types for certain editors
This commit is contained in:
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// View controller to show and edit KPKAttributes of KPKEntries.
|
||||
/// Set the represented object to the KPKAttribute the editor shoudl show/edit
|
||||
/// The editor can be set to edit or view
|
||||
@interface MPEntryAttributeViewController : NSViewController <MPInspectorEditor, HNHUITextFieldDelegate>
|
||||
@interface MPEntryAttributeViewController : NSViewController <MPAttributeInspectorEditor, HNHUITextFieldDelegate>
|
||||
|
||||
@property (strong) IBOutlet NSTextField *keyTextField;
|
||||
@property (strong) IBOutlet HNHUISecureTextField *valueTextField;
|
||||
|
||||
@@ -27,7 +27,6 @@ NSString *nameForDefaultKey(NSString *key) {
|
||||
@interface MPEntryAttributeViewController () {
|
||||
BOOL _isDefaultAttribute;
|
||||
}
|
||||
@property (readonly, nullable, strong) KPKAttribute *representedAttribute;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
MPTagsTokenFieldDelegate *_tagTokenFieldDelegate;
|
||||
MPAddCustomFieldContextMenuDelegate *_addCustomFieldContextMenuDelegate;
|
||||
|
||||
NSMutableArray<NSViewController<MPInspectorEditor> *> *_attributeEditorViewControllers;
|
||||
NSMutableArray<NSViewController<MPInspectorEditor> *> *_customAttributeEditorViewControllers;
|
||||
|
||||
MPEntryAttributeViewController *_titleEditorViewController;
|
||||
MPEntryAttributeViewController *_usernameEditorViewController;
|
||||
@@ -122,7 +122,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
|
||||
_customFieldTableDelegate.viewController = self;
|
||||
_addCustomFieldContextMenuDelegate.viewController = self;
|
||||
|
||||
_attributeEditorViewControllers = [[NSMutableArray alloc] init];
|
||||
_customAttributeEditorViewControllers = [[NSMutableArray alloc] init];
|
||||
_activeTab = MPEntryTabGeneral;
|
||||
}
|
||||
return self;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// View controller to edit password attributes of entries.
|
||||
@interface MPEntryPasswordAttributeViewController : MPEntryAttributeViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
@property (strong) IBOutlet NSButton *togglePasswordButton;
|
||||
@property (strong) IBOutlet NSButton *generatePasswordButton;
|
||||
|
||||
@property (strong, nullable, readonly) KPKAttribute *representedAttribute;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPEntryPasswordAttributeViewController
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@class KPKAttribute;
|
||||
@class KPKEntry;
|
||||
@class KPKTimeInfo;
|
||||
@class KPKNode;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -14,12 +18,33 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// Individual editors shoudl adopt different APIs to accomodate their needs
|
||||
/// The preferred way to set model data is to use the representedObject
|
||||
@protocol MPInspectorEditor <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic) BOOL isEditor;
|
||||
|
||||
- (void)commitChanges;
|
||||
@end
|
||||
|
||||
/// NodeInspectorEditors require the represented object to be a KPKNode
|
||||
@protocol KPKNodeInspectorEditor <MPInspectorEditor>
|
||||
@required
|
||||
@property (nonatomic, nullable, readonly, strong) KPKNode *representedNode;
|
||||
@end
|
||||
|
||||
/// EntryInspectorEditors require the represented object to be a KPKEnty
|
||||
@protocol MPEntryInspectorEditor <MPInspectorEditor>
|
||||
@required
|
||||
@property (nonatomic, nullable, readonly, strong) KPKEntry *representedEntry;
|
||||
@end
|
||||
|
||||
/// AttributeInspectorEditors require the represented object to be a KPKAttribute
|
||||
@protocol MPAttributeInspectorEditor <MPInspectorEditor>
|
||||
@required
|
||||
@property (nonatomic, nullable, readonly, strong) KPKAttribute *representedAttribute;
|
||||
@end
|
||||
|
||||
/// TimeInfoInpspectorEditors require the represented object to be a KPKTimeInfo
|
||||
@protocol MPTimeInfoInpspectorEditor <MPInspectorEditor>
|
||||
@required
|
||||
@property (nonatomic, nullable, readonly, strong) KPKTimeInfo *representedTimeInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MPNodeExpirationViewController : NSViewController <MPInspectorEditor>
|
||||
@interface MPNodeExpirationViewController : NSViewController <MPTimeInfoInpspectorEditor>
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
@interface MPNodeExpirationViewController ()
|
||||
|
||||
@property (nonatomic, readonly, strong) KPKTimeInfo *representedTimeInfo;
|
||||
@property (strong) IBOutlet NSButton *expiredCheckButton;
|
||||
@property (strong) IBOutlet NSButton *pickExpireDateButton;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user