aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Actions/ShowInThingsAction.m
diff options
context:
space:
mode:
Diffstat (limited to 'QSThingsPlugin/Actions/ShowInThingsAction.m')
-rw-r--r--QSThingsPlugin/Actions/ShowInThingsAction.m33
1 files changed, 33 insertions, 0 deletions
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