Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Indirect file types & various #1120

Merged
merged 3 commits into from Sep 26, 2012

Conversation

Projects
None yet
3 participants
Owner

pjrobertson commented Sep 18, 2012

This plugin contains a much talked about (lack of) feature by @skurfer - whereby 3rd pane objects aren't initially filtered based on an action's indirectTypes array.
Not that at this moment in time, it still won't work incredibly well, since QSLib can't handle UTIs.

In the future (let's hope) QSLib will use UTIs instead of strings, so this will work much better (e.g. it could work for public.folder) and would almost entirely remove the requirement for the validIndirectObjectsForAction… method.

The 2nd commit is a bonus :)

pjrobertson added some commits Sep 18, 2012

@pjrobertson pjrobertson Attempt to display more useful iObjects for 3rd pane actions
These changes kick in if an action provider doesn't (correctly) implement the `validIndirectObjectsForAction...` method.
If this method returns nil, these changes attempt to get a list of objects based on the action's `indirectTypes` array.

This will not incredibly well at the moment, since QSLib cannot deal with UTIs, but the `indirectFileTypes` array can
419619f
@pjrobertson pjrobertson Make a docking window's alpha level 0 when it disappears. Fixes #1064 50e7a7a

@skurfer skurfer and 1 other commented on an outdated diff Sep 25, 2012

...ilver/Code-QuickStepInterface/QSInterfaceController.m
@@ -341,7 +341,25 @@ - (void)updateActionsNow {
}
- (void)updateIndirectObjects {
- NSArray *indirects = [[[aSelector objectValue] provider] validIndirectObjectsForAction:[[aSelector objectValue] identifier] directObject:[dSelector objectValue]];
+ QSAction *aObj = [aSelector objectValue];
+ id actionProvider = [aObj provider];
+ NSArray *indirects = nil;
+ if (actionProvider && [actionProvider respondsToSelector:@selector(validIndirectObjectsForAction:directObject:)]) {
+ indirects = [actionProvider validIndirectObjectsForAction:[aObj identifier] directObject:[dSelector objectValue]];
+ }
+ // If the validIndirectObjectsForAction... method hasn't been implemented, attempt to get valid indirects from the action's 'indirectTypes'
+ if(!indirects) {
+ if ([aObj indirectTypes]) {
+ NSMutableArray *indirectsForAllTypes = [[NSMutableArray alloc] initWithCapacity:0];
+ for (NSString *eachType in [aObj indirectTypes]) {
@skurfer

skurfer Sep 25, 2012

Owner

Do you think it's worth using enumerateKeysAndObjectsWithOptions:NSEnumerationConcurrent usingBlock: on this?

@pjrobertson

pjrobertson Sep 25, 2012

Owner

How would you propose that work?
I didn't know the method (until you just mentioned it) but it takes an NSDict, which we don't have here?
Do you mean - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block

Using NSEnumerationConcurrent may well be faster there. We should probably use it everywhere tbh!

@skurfer

skurfer Sep 25, 2012

Owner

Yeah, that's what I meant. Sorry, I was looking at a dictionary example.

I don't know how much of a difference it would make, but in theory, it might help when there are several types to process.

Owner

pjrobertson commented Sep 25, 2012

OK, I've added a commit (two actually. Grrr :( ) with the changes as suggested by @skurfer

Owner

skurfer commented Sep 25, 2012

Whoa - did you rebase this branch or something? It has tons of stuff on it now. I think all of it's merged to master, but it still shows up as different under "Files Changed". Weird.

Owner

pjrobertson commented Sep 25, 2012

whoa whoa whoa! Ooops

I did a git pull pjr indirectFiletypes from work, where I didn't have this local branch.
I tried git pull --rebase per indirectFileTypes but I got merge conflicts.

I can cherry pick that commit and do a force push now I'm home, if you haven't pulled.

Owner

pjrobertson commented Sep 25, 2012

OK I forced an update on the branch to tidy things up. Apologies for that

Owner

skurfer commented Sep 26, 2012

No problem. I can just trash the local branch and start over.

Owner

skurfer commented Sep 26, 2012

Is there an easy way to test this? :-)

Owner

pjrobertson commented Sep 26, 2012

Sure thing :)

  • Find a method that should only show a single type in the 3rd pane. E.g. the 'append text…' action or the 'create file…' action
  • note how at the moment they show a blank third pane which, when you search in, filters ALL results: contacts, URLs etc. A bit silly!
  • Edit the Info.plist for the action under question, and add the correct indirectTypes. E.g. NSFilenamesPboardType or public.text
  • Notice how now, you only get that type in the 3rd pane :)

Also notice how you can't just specify public.text in the indirectTypes array for the action and get it to work straight off. That's because QSLibrarian can't deal with UTIs. Something you know that I want to change. This paves the way...

Owner

skurfer commented Sep 26, 2012

Ah, OK. Seems to work. I get some crazy random file in the third pane, but that's a separate issue. :-)

@skurfer skurfer added a commit that referenced this pull request Sep 26, 2012

@skurfer skurfer Merge pull request #1120 from pjrobertson/indirectFileTypes
Indirect file types & various
f9776d5

@skurfer skurfer merged commit f9776d5 into quicksilver:master Sep 26, 2012

This seems to have broken the third pane for AppleScript actions. See #1264.

Owner

pjrobertson replied Dec 5, 2012

Thanks. Not sure how this all works, but it sure we be cool if we could indicate in AppleScript actions what types they support in the third pane. And also what types they apply to in the first pane also, so we could write actions for specific types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment