Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add the indirect types to the AS action dict as well

  • Loading branch information...
commit 00d0abad49a05e55b15a5ae7b8432ca1965a7ea5 1 parent 5953f41
@pjrobertson authored
Showing with 17 additions and 4 deletions.
  1. +17 −4 Quicksilver/PlugIns-Main/QSCorePlugIn/Code/QSAppleScriptActions.m
View
21 Quicksilver/PlugIns-Main/QSCorePlugIn/Code/QSAppleScriptActions.m
@@ -32,8 +32,9 @@ - (QSAction *)scriptActionForPath:(NSString *)path {
[NSNumber numberWithBool:YES], kActionDisplaysResult,
nil];
- // attempt to get the valid direct types from the AppleScript's 'get direct types' handler
+ // try to get the valid direct/indirect types from the AppleScript's 'get direct/indirect types' handler to set on the actionDict
NSArray *validDirectTypes = [self validDirectTypesForScript:path];
+ NSArray *validIndirectTypes = [self validIndrectTypesForScript:path];
if ([handlers containsObject:@"aevtodoc"] || [handlers containsObject:@"DAEDopfl"]) {
// Only set the type if the user hasn't specified any (i.e. hasn't set the 'get direct types' handler)
@@ -41,7 +42,9 @@ - (QSAction *)scriptActionForPath:(NSString *)path {
validDirectTypes = [NSArray arrayWithObject:QSFilePathType];
}
[actionDict setObject:[handlers containsObject:@"DAEDopfl"] ? @"QSOpenFileWithEventPlaceholder" : @"QSOpenFileEventPlaceholder" forKey:kActionHandler];
- [actionDict setObject:[NSArray arrayWithObject:QSFilePathType] forKey:kActionIndirectTypes];
+ if (!validIndirectTypes) {
+ validIndirectTypes = [NSArray arrayWithObject:QSFilePathType];
+ }
}
if ([handlers containsObject:@"DAEDopnt"] && ![handlers containsObject:@"DAEDopfl"]) {
// Only set the type if the user hasn't specified any (i.e. hasn't set the 'get direct types' handler)
@@ -49,11 +52,17 @@ - (QSAction *)scriptActionForPath:(NSString *)path {
validDirectTypes = [NSArray arrayWithObject:QSTextType];
}
[actionDict setObject:@"QSOpenTextEventPlaceholder" forKey:kActionHandler];
- [actionDict setObject:[NSArray arrayWithObject:QSTextType] forKey:kActionIndirectTypes];
+ if (!validIndirectTypes) {
+ validIndirectTypes = [NSArray arrayWithObject:QSTextType];
+ }
}
if ([validDirectTypes count]) {
[actionDict setObject:validDirectTypes forKey:kActionDirectTypes];
}
+ if ([validIndirectTypes count]) {
+ [actionDict setObject:validIndirectTypes forKey:kActionIndirectTypes];
+ }
+
NSString *actionName = [[path lastPathComponent] stringByDeletingPathExtension];
QSAction *action = [QSAction actionWithDictionary:actionDict identifier:[kAppleScriptActionIDPrefix stringByAppendingString:path]];
[action setName:actionName];
@@ -273,6 +282,10 @@ -(NSArray *)validDirectTypesForScript:(NSString *)path {
return [self typeArrayForScript:path forHandler:@"DAEDgdob"];
}
+-(NSArray *)validIndrectTypesForScript:(NSString *)path {
+ return [self typeArrayForScript:path forHandler:@"DAEDgiob"];
+}
+
- (NSArray *)validIndirectObjectsForAction:(NSString *)action directObject:(QSObject *)dObject {
if ([action isEqualToString:kAppleScriptOpenTextAction]) {
return [NSArray arrayWithObject:[QSObject textProxyObjectWithDefaultValue:@""]];
@@ -289,7 +302,7 @@ - (NSArray *)validIndirectObjectsForAction:(NSString *)action directObject:(QSOb
-(NSArray *)validIndirectObjectsForAppleScript:(NSString *)script directObject:(QSObject *)dObject {
NSString *scriptPath = [script substringFromIndex:[kAppleScriptActionIDPrefix length]];
- id indirectTypes = [self typeArrayForScript:scriptPath forHandler:@"DAEDgiob"];
+ id indirectTypes = [self validIndrectTypesForScript:scriptPath];
if (indirectTypes) {
NSMutableArray *indirectObjects = [NSMutableArray array];
for (NSString *type in indirectTypes) {
Please sign in to comment.
Something went wrong with that request. Please try again.