aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Actions/SearchThingsAction.m
blob: 9b042b3e3515f2994e12168bfb0e396a3a47b513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import "SearchThingsAction.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SearchThingsAction

- (QSObject *)searchFor:(QSObject *)directObject
{

  NSString *contents = [directObject displayName];
  if (contents) {
      NSString *urlString = [NSString stringWithFormat:@"things:///search?query=%@", contents];
      NSURL *url = [NSURL URLWithString:urlString];
              
      [[NSWorkspace sharedWorkspace] openURL:url];
  } else {
    NSLog(@"Could not get the text of the Things object.");
  }
  return directObject;
}

@end

NS_ASSUME_NONNULL_END