mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-21 21:19:32 +00:00
Stubbed custom attribute adding via context menu
Made MPContextToolbarButton usable as normal button. Added private API helper for adding buttons to NSUserNotification Remove Autotype plugin API Enhanced custom attribute plugin API Enhanced EntryActionPlugin API to decouple menu items from actual action/target setup Stubbed action on no-open documents NSUserNotifications Stubbed HMACOTP custom attribute setup
This commit is contained in:
@@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class MPPluginHost;
|
||||
@class MPAutotypeCommand;
|
||||
@class KPKEntry;
|
||||
@class KPKAttribute;
|
||||
|
||||
@interface MPPlugin : NSObject
|
||||
|
||||
@@ -35,8 +36,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (copy, readonly) NSString *version;
|
||||
@property (nonatomic, strong, readonly) NSBundle *bundle;
|
||||
|
||||
@property (readonly) NSString *requiredHostVersion; // the host version required for running the plugin in mayor.minor.path format
|
||||
|
||||
|
||||
/**
|
||||
If your plugin needs initalization override this method but you have to call [super initWithPluginHost:]
|
||||
@@ -59,41 +58,29 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
|
||||
/* Adopt this protocoll if you plugin supplied additinal autotype commands */
|
||||
@protocol MPAutotypePlugin <NSObject>
|
||||
@required
|
||||
/**
|
||||
Returns an array of string of commands supported by this pluing. Leave out enclosing curly brackets!
|
||||
E.g. if you support {FOO} and {BAR} you will return @[ @"FOO", @"BAR" ]. The autotype system is case insenstivie.
|
||||
*/
|
||||
@property (nonatomic,copy) NSArray <NSString *> *commandStrings;
|
||||
/**
|
||||
Will be called by the plugin host to generate autotype commands for the corresponding string.
|
||||
Command strings are considered case insensitive but mostly will be used in upper case.
|
||||
You should therefore compare case insensitive.
|
||||
|
||||
@param commandString The command string without any enclosing curly brackets. The string is normalized to upper cased.
|
||||
@param entry The entry for which the command will be used
|
||||
@return a command for the supplied string, return nil if parsing fails or an unsupported command is supplied
|
||||
*/
|
||||
- (MPAutotypeCommand * _Nullable)commandForString:(NSString *)commandString entry:(KPKEntry *)entry;
|
||||
@end
|
||||
|
||||
/*
|
||||
Adopt this protocoll if your plugin supports actions on entries.
|
||||
Actions will get listed in various places in menues. You should shoudl supply a valid menu item
|
||||
that is wired up with the correct target and action. Since there's responder chain resolving involved
|
||||
as well as a
|
||||
Actions will get listed in various places in menues.
|
||||
You should not set target nor actions since they will get stripped.
|
||||
MacPass will call you back via -[MPPlugin performActionFroMenuItem:withEntries:]
|
||||
*/
|
||||
@protocol MPEntryActionPlugin <NSObject>
|
||||
@optional
|
||||
- (NSMenuItem * _Nullable)menuItemForEntry;
|
||||
- (void)performActionForMenuItem:(NSMenuItem *)item withEntries:(NSArray <KPKEntry *>*)entries;
|
||||
@end
|
||||
|
||||
@protocol MPCustomAttributePlugin <NSObject>
|
||||
@optional
|
||||
/* Supply a list of attribute keys that will get suggested for autocompletion as well as added to the extend add for custom fields */
|
||||
@property (nonatomic,copy) NSArray<NSString *>* attributeKeys;
|
||||
/*
|
||||
For any attribute created with the special key the plugin will get called to offer a custom generation for the attributes value.
|
||||
You can e.g. show UI to help the user create a special format.
|
||||
|
||||
If nil is returned, an empty value will be used.
|
||||
*/
|
||||
- (NSString *)valueForAttributeWithKey:(NSString *)key;
|
||||
@end
|
||||
|
||||
@interface MPPlugin (Deprecated)
|
||||
|
||||
Reference in New Issue
Block a user