Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Large type plain text #1185

Merged
merged 3 commits into from

2 participants

@pjrobertson
Owner

First off, this pull means actions are now validated based on whether the file's UTI (in the 1st pane) conforms to the directFileTypes UTI (if one is defined of course) as opposed to just an exact match.

Example:
Set directFileTypes for a action XXX to public.text.
Select a PHP file in the 1st pane (which has a UTI of public.php-script but conforms to public.text) and action XXX will appear for this

The reason I did this was so that 'Large Type' would appear for plain text files, so you can now use 'File
→ Large Type' as an equivalent to Terminal's cat file.php

@skurfer
Owner

Looks good. I was going to suggest adding com.apple.finder.textclipping to the list of UTI's but it doesn't seem to work. initWithContentsOfFile: must not like Text Clippings.

FYI, when I was in there adding the additional UTI in TextMate, I noticed a trailing tab after <string>public.plain-text</string>. Doesn't seem to cause any problems, but we should probably take it out.

@pjrobertson
Owner

Sorry never said - I'd removed the stray tab a couple of days ago

@skurfer
Owner

Sorry never said - I'd removed the stray tab a couple of days ago

I knew about it. I think you mentioned it on IRC. Anyway, merging.

@skurfer skurfer merged commit 59fa691 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
13 Quicksilver/Code-QuickStepCore/QSExecutor.m
@@ -116,7 +116,18 @@ - (void)loadFileActions {
- (NSArray *)actionsForFileTypes:(NSArray *)types {
NSMutableSet *set = [NSMutableSet set];
for (NSString *type in types) {
- [set addObjectsFromArray:[directObjectFileTypes objectForKey:type]];
+ CFStringRef UTIDescription = UTTypeCopyDescription((CFStringRef)type);
+ if (UTIDescription) {
+ CFRelease(UTIDescription);
+ UTIDescription = nil;
+ for (NSString *conformedType in [directObjectFileTypes allKeys]) {
+ if (UTTypeConformsTo((CFStringRef)type, (CFStringRef)conformedType)) {
+ [set addObjectsFromArray:[directObjectFileTypes objectForKey:conformedType]];
+ }
+ }
+ } else {
+ [set addObjectsFromArray:[directObjectFileTypes objectForKey:type]];
+ }
}
[set addObjectsFromArray:[directObjectFileTypes objectForKey:@"*"]];
return [set allObjects];
View
12 Quicksilver/PlugIns-Main/QSCorePlugIn/Code/QSTextSource.m
@@ -21,7 +21,17 @@
@implementation QSTextActions
- (QSObject *)showLargeType:(QSObject *)dObject {
- QSShowLargeType([dObject stringValue]);
+ NSString *display = nil;
+ if ([dObject singleFilePath]) {
+ NSError *err = nil;
+ display = [[[NSString alloc] initWithContentsOfFile:[dObject singleFilePath] usedEncoding:nil error:&err] autorelease];
+ if (err) {
+ NSLog(@"Error: %@",[err description]);
+ }
+ } else {
+ display = [dObject stringValue];
+ }
+ QSShowLargeType(display);
return nil;
}
View
5 Quicksilver/PlugIns-Main/QSCorePlugIn/QSCorePlugIn-Info.plist
@@ -820,6 +820,11 @@
<key>directTypes</key>
<array>
<string>NSStringPboardType</string>
+ <string>NSFilenamesPboardType</string>
+ </array>
+ <key>directFileTypes</key>
+ <array>
+ <string>public.plain-text</string>
</array>
<key>precedence</key>
<real>1</real>
Something went wrong with that request. Please try again.