Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

add a dedicated type for Web Search URLs - close #625 #1082

Merged
merged 1 commit into from

3 participants

@skurfer
Owner

As previously discussed, this adds a specific type for search URLs.

The old versions of the web search plug-in will continue to work because the type they depend on, QSURLType, is still set for search URLs. A new version of the web search plug-in that takes advantage of this is in the works.

@pjrobertson
Owner
@skurfer
Owner

I have a feeling that there are other plugins somewhere that use *** as well

I think web search is the only one that needs updating. Like I said in the pull request, old stuff should continue to work. Updating would only be for efficiency. (I assume that's what you meant.)

Looked through the old repo that contains all of them. Safari and OmniWeb both used @"***", but only to later call URLObjectWithURL:, which will assign the new type automatically, so they should be good.

@skurfer
Owner

I think I should 'go on holiday' more often, you're going coding mad! ;-)

Oh, and this. I don't know what happened. I was so unmotivated to do anything Monday (for work, Quicksilver, or personal projects). Tuesday I just started looking for small things to get out of the way, and then went crazy from there. I do think your quietness is a factor. You usually contribute so much that I spend half the day looking it over (which is good). :-) Now I guess it's my turn (which is also good).

@pjrobertson
Owner
@studgeek

You probably know this and I don't know if it matters for this chunk, but FYI Chrome and Firefox search URLs use %s instead of **. I think maybe their plugins convert that to ** so maybe its a non-issue at the level you are working at.

@skurfer
Owner

Yes, the plug-ins for each browser should be finding the defined searches and replacing %s with ***, and I think the web search plug-in itself does that too, though I don't know if it ever needs to. Probably best to let the plug-ins handle that, as they can do browser specific things. For instance, OmniWeb uses %@ for the placeholder.

@skurfer skurfer referenced this pull request in quicksilver/elements.websearch-qsplugin
Merged

enhancements and cleanup #2

@pjrobertson pjrobertson merged commit 33734e2 into from
@skurfer skurfer referenced this pull request in quicksilver/GoogleChrome-qsplugin
Closed

New web search type #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 29, 2012
  1. @skurfer
This page is out of date. Refresh to see the latest.
View
7 Quicksilver/Code-QuickStepCore/QSObject_URLHandling.m
@@ -136,7 +136,7 @@ - (BOOL)loadIconForObject:(QSObject *)object {
if (!urlString) return NO;
// For search URLs
- if([[object stringValue] rangeOfString:QUERY_KEY].location !=NSNotFound) {
+ if([object containsType:QSSearchURLType]) {
NSInvocationOperation *theOp = [[[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(buildWebSearchIconForObject:)
object:object] autorelease];
@@ -265,6 +265,11 @@ - (void)assignURLTypesWithURL:(NSString *)urlString
[self setObject:urlString forType:QSTextType];
[self setPrimaryType:QSURLType];
}
+ // search URLs
+ if ([urlString rangeOfString:QUERY_KEY].location != NSNotFound) {
+ [self setObject:urlString forType:QSSearchURLType];
+ [self setPrimaryType:QSSearchURLType];
+ }
}
@end
View
1  Quicksilver/Code-QuickStepCore/QSTypes.h
@@ -6,6 +6,7 @@ extern NSString *QSTextType; //NSString
extern NSString *QSAliasDataType; //NSData
extern NSString *QSAliasFilePathType; //NSString
extern NSString *QSURLType; //NSString
+extern NSString *QSSearchURLType; //NSString
extern NSString *QSEmailAddressType; //NSString
//extern NSString *QSContactEmailType; //NSString
extern NSString *QSContactPhoneType; //NSString
View
1  Quicksilver/Code-QuickStepCore/QSTypes.m
@@ -13,6 +13,7 @@
NSString *QSAliasDataType = @"public.data.alias";
NSString *QSAliasFilePathType = @"public.alias";
NSString *QSURLType = @"Apple URL pasteboard type";
+NSString *QSSearchURLType = @"qs.url.search";
NSString *QSEmailAddressType = @"qs.contact.email";
NSString *QSContactEmailType = @"qs.contact.email";
NSString *QSContactPhoneType = @"qs.contact.phone";
View
4 Quicksilver/PlugIns-Main/QSCorePlugIn/Code/QSActionProvider_EmbeddedProviders.m
@@ -121,7 +121,7 @@ - (QSObject *)doURLOpenAction:(QSObject *)dObject {
// Escape characters (but not # or %)
NSURL *url = [NSURL URLWithString:[urlString URLEncoding]];
// replace QUERY_KEY *** with nothing if we're just opening the URL
- if ([urlString rangeOfString:QUERY_KEY].location != NSNotFound) {
+ if ([dObject containsType:QSSearchURLType]) {
NSInteger pathLoc = [urlString rangeOfString:[url path]].location;
if (pathLoc != NSNotFound)
url = [NSURL URLWithString:[[urlString substringWithRange:NSMakeRange(0, pathLoc)] URLEncoding]];
@@ -151,7 +151,7 @@ - (QSObject *)doURLOpenActionInBackground:(QSObject *)dObject {
for (NSString *urlString in [dObject arrayForType:QSURLType]) {
NSURL *url = [NSURL URLWithString:[urlString URLEncoding]];
- if ([urlString rangeOfString:QUERY_KEY].location != NSNotFound) {
+ if ([dObject containsType:QSSearchURLType]) {
NSInteger pathLoc = [urlString rangeOfString:[url path]].location;
if (pathLoc != NSNotFound)
url = [NSURL URLWithString:[[urlString substringWithRange:NSMakeRange(0, pathLoc)] URLEncoding]];
View
2  Quicksilver/PlugIns-Main/QSCorePlugIn/QSCorePlugIn-Info.plist
@@ -2164,6 +2164,8 @@
<string>QSHandledObjectHandler</string>
<key>Apple URL pasteboard type</key>
<string>QSURLObjectHandler</string>
+ <key>qs.url.search</key>
+ <string>QSURLObjectHandler</string>
<key>NSColor pasteboard type</key>
<string>QSColorObjectHandler</string>
<key>NSStringPboardType</key>
Something went wrong with that request. Please try again.