From c791858db3de3568f0ea2839c79b360a0dfb15ab Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 10 Sep 2025 11:32:28 +0200 Subject: Initial commit --- QSThingsPlugin/Actions/SearchThingsAction.h | 11 ++++++++++ QSThingsPlugin/Actions/SearchThingsAction.m | 24 +++++++++++++++++++++ QSThingsPlugin/Actions/ShowInThingsAction.h | 11 ++++++++++ QSThingsPlugin/Actions/ShowInThingsAction.m | 33 +++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 QSThingsPlugin/Actions/SearchThingsAction.h create mode 100644 QSThingsPlugin/Actions/SearchThingsAction.m create mode 100644 QSThingsPlugin/Actions/ShowInThingsAction.h create mode 100644 QSThingsPlugin/Actions/ShowInThingsAction.m (limited to 'QSThingsPlugin/Actions') diff --git a/QSThingsPlugin/Actions/SearchThingsAction.h b/QSThingsPlugin/Actions/SearchThingsAction.h new file mode 100644 index 0000000..5f0ed48 --- /dev/null +++ b/QSThingsPlugin/Actions/SearchThingsAction.h @@ -0,0 +1,11 @@ +#import "Constants.h" +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SearchThingsAction : QSActionProvider + +@end + +NS_ASSUME_NONNULL_END diff --git a/QSThingsPlugin/Actions/SearchThingsAction.m b/QSThingsPlugin/Actions/SearchThingsAction.m new file mode 100644 index 0000000..9b042b3 --- /dev/null +++ b/QSThingsPlugin/Actions/SearchThingsAction.m @@ -0,0 +1,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 diff --git a/QSThingsPlugin/Actions/ShowInThingsAction.h b/QSThingsPlugin/Actions/ShowInThingsAction.h new file mode 100644 index 0000000..8d7790c --- /dev/null +++ b/QSThingsPlugin/Actions/ShowInThingsAction.h @@ -0,0 +1,11 @@ +#import "Constants.h" +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface ShowInThingsAction : QSActionProvider + +@end + +NS_ASSUME_NONNULL_END diff --git a/QSThingsPlugin/Actions/ShowInThingsAction.m b/QSThingsPlugin/Actions/ShowInThingsAction.m new file mode 100644 index 0000000..91fe3ec --- /dev/null +++ b/QSThingsPlugin/Actions/ShowInThingsAction.m @@ -0,0 +1,33 @@ +#import "ShowInThingsAction.h" + +NS_ASSUME_NONNULL_BEGIN + +@implementation ShowInThingsAction + +- (QSObject *)showObject:(QSObject *)directObject +{ + NSSet *validTypes = [NSSet setWithObjects:kAppSectionType, kTagType, kAreaType, kProjectType, kTaskType, nil]; + + + if ([validTypes containsObject:directObject.primaryType]) { + NSDictionary *contents = [directObject objectForType:directObject.primaryType]; + if (contents) { + NSString *uuid = [contents objectForKey:@"uuid"]; + if (uuid) { + NSString *urlString = [NSString stringWithFormat:@"things:///show?id=%@", uuid]; + NSURL *url = [NSURL URLWithString:urlString]; + + [[NSWorkspace sharedWorkspace] openURL:url]; + } else { + NSLog(@"Things object did not have a uuid."); + } + } else { + NSLog(@"Could not get the contents of the Things object."); + } + } + return directObject; +} + +@end + +NS_ASSUME_NONNULL_END -- cgit