mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 22:19:21 +00:00
Fixed #46 Binaries get now deleted when entries are delete on trans cleaning
MenuEntries are validated and disabled to fix #58. Model still doesn't do any testing
This commit is contained in:
@@ -10,25 +10,42 @@
|
||||
|
||||
@implementation MPActionHelper
|
||||
|
||||
+ (SEL)actionOfType:(MPActionType)type {
|
||||
+ (NSDictionary *)_actionDictionary {
|
||||
static NSDictionary *actionDict;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
actionDict = @{
|
||||
@(MPActionAddEntry) : @"createEntry:",
|
||||
@(MPActionAddGroup) : @"createGroup:",
|
||||
@(MPActionCopyPassword) : @"copyPassword:",
|
||||
@(MPActionCopyURL) : @"copyURL:",
|
||||
@(MPActionCopyUsername) : @"copyUsername:",
|
||||
@(MPActionDelete) : @"deleteNode:",
|
||||
@(MPActionEdit) : @"editEntry:",
|
||||
@(MPActionOpenURL) : @"openURL:",
|
||||
@(MPActionToggleInspector) : @"toggleInspector:",
|
||||
@(MPActionLock) : @"lock:",
|
||||
@(MPActionEmptyTrash) : @"emptyTrash:"
|
||||
};
|
||||
@(MPActionAddEntry) : @"createEntry:",
|
||||
@(MPActionAddGroup) : @"createGroup:",
|
||||
@(MPActionCopyPassword) : @"copyPassword:",
|
||||
@(MPActionCopyURL) : @"copyURL:",
|
||||
@(MPActionCopyUsername) : @"copyUsername:",
|
||||
@(MPActionDelete) : @"deleteNode:",
|
||||
@(MPActionOpenURL) : @"openURL:",
|
||||
@(MPActionToggleInspector) : @"toggleInspector:",
|
||||
@(MPActionLock) : @"lock:",
|
||||
@(MPActionEmptyTrash) : @"emptyTrash:"
|
||||
};
|
||||
});
|
||||
return actionDict;
|
||||
}
|
||||
|
||||
+ (SEL)actionOfType:(MPActionType)type {
|
||||
NSDictionary *actionDict = [self _actionDictionary];
|
||||
return NSSelectorFromString(actionDict[@(type)]);
|
||||
}
|
||||
|
||||
+ (MPActionType)typeForAction:(SEL)action {
|
||||
NSString *selectorString = NSStringFromSelector(action);
|
||||
NSArray *selectors = [[self _actionDictionary] allValues];
|
||||
NSUInteger index = [selectors indexOfObject:selectorString];
|
||||
if(index == NSNotFound) {
|
||||
return MPUnkownAction;
|
||||
}
|
||||
NSArray *keys = [[self _actionDictionary] allKeysForObject:selectorString];
|
||||
NSAssert([keys count] == 1, @"There should only be one object for the specified key");
|
||||
return [[keys lastObject] integerValue];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user