aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Actions
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-09-10 11:32:28 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-09-10 11:32:28 +0200
commitc791858db3de3568f0ea2839c79b360a0dfb15ab (patch)
tree7cf50c93cdf03075d10c14c8ad1f7a646b2a05c7 /QSThingsPlugin/Actions
Initial commit
Diffstat (limited to 'QSThingsPlugin/Actions')
-rw-r--r--QSThingsPlugin/Actions/SearchThingsAction.h11
-rw-r--r--QSThingsPlugin/Actions/SearchThingsAction.m24
-rw-r--r--QSThingsPlugin/Actions/ShowInThingsAction.h11
-rw-r--r--QSThingsPlugin/Actions/ShowInThingsAction.m33
4 files changed, 79 insertions, 0 deletions
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 <Foundation/Foundation.h>
+#import <QSCore/QSCore.h>
+
+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 <Foundation/Foundation.h>
+#import <QSCore/QSCore.h>
+
+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