aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Info.plist56
-rw-r--r--QSThingsPlugin.xcodeproj/project.pbxproj2
-rw-r--r--QSThingsPlugin/Parsers/QSThingsAppSectionsParser.h4
-rw-r--r--QSThingsPlugin/Parsers/QSThingsAppSectionsParser.m52
-rw-r--r--QSThingsPlugin/Parsers/QSThingsTagsParser.h4
-rw-r--r--QSThingsPlugin/Parsers/QSThingsTagsParser.m33
-rw-r--r--QSThingsPlugin/Types/Constants.h10
-rw-r--r--QSThingsPlugin/Types/Constants.m9
8 files changed, 169 insertions, 1 deletions
diff --git a/Info.plist b/Info.plist
index 3b2b7fd..400b7ea 100644
--- a/Info.plist
+++ b/Info.plist
@@ -224,7 +224,7 @@
<string>QSThingsPluginSource</string>
<key>things.project</key>
<string>QSThingsPluginSource</string>
- <key>things.section</key>
+ <key>things.app-section</key>
<string>QSThingsPluginSource</string>
<key>things.tag</key>
<string>QSThingsPluginSource</string>
@@ -248,6 +248,60 @@
<array>
<dict>
<key>ID</key>
+ <string>QSPresetThingsAppSections</string>
+ <key>enabled</key>
+ <true/>
+ <key>name</key>
+ <string>Things 3 (App Sections)</string>
+ <key>icon</key>
+ <string>com.culturedcode.ThingsMac</string>
+ <key>requiresBundle</key>
+ <string>com.culturedcode.ThingsMac</string>
+ <key>requiresSettingsPath</key>
+ <true/>
+ <key>settings</key>
+ <dict>
+ <key>fileContents</key>
+ <string>Things 3 App Sections</string>
+ <key>parser</key>
+ <string>QSThingsAppSectionsParser</string>
+ <key>path</key>
+ <string>~/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/*/Things Database.thingsdatabase/main.sqlite</string>
+ <key>skipItem</key>
+ <integer>1</integer>
+ </dict>
+ <key>source</key>
+ <string>QSFileSystemObjectSource</string>
+ </dict>
+ <dict>
+ <key>ID</key>
+ <string>QSPresetThingsTags</string>
+ <key>enabled</key>
+ <true/>
+ <key>name</key>
+ <string>Things 3 (Tags)</string>
+ <key>icon</key>
+ <string>com.culturedcode.ThingsMac</string>
+ <key>requiresBundle</key>
+ <string>com.culturedcode.ThingsMac</string>
+ <key>requiresSettingsPath</key>
+ <true/>
+ <key>settings</key>
+ <dict>
+ <key>fileContents</key>
+ <string>Things 3 Tags</string>
+ <key>parser</key>
+ <string>QSThingsTagsParser</string>
+ <key>path</key>
+ <string>~/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/*/Things Database.thingsdatabase/main.sqlite</string>
+ <key>skipItem</key>
+ <integer>1</integer>
+ </dict>
+ <key>source</key>
+ <string>QSFileSystemObjectSource</string>
+ </dict>
+ <dict>
+ <key>ID</key>
<string>QSPresetThingsAreas</string>
<key>enabled</key>
<true/>
diff --git a/QSThingsPlugin.xcodeproj/project.pbxproj b/QSThingsPlugin.xcodeproj/project.pbxproj
index 850ab01..973432e 100644
--- a/QSThingsPlugin.xcodeproj/project.pbxproj
+++ b/QSThingsPlugin.xcodeproj/project.pbxproj
@@ -49,8 +49,10 @@
Helpers/SQLHelper.m,
Helpers/TextParsingHelper.m,
Helpers/ThingsHelper.m,
+ Parsers/QSThingsAppSectionsParser.m,
Parsers/QSThingsAreasParser.m,
Parsers/QSThingsProjectsParser.m,
+ Parsers/QSThingsTagsParser.m,
Parsers/QSThingsTasksParser.m,
QSThingsPluginSource.m,
Types/Constants.m,
diff --git a/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.h b/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.h
new file mode 100644
index 0000000..e81f8db
--- /dev/null
+++ b/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.h
@@ -0,0 +1,4 @@
+@interface QSThingsAppSectionsParser : QSParser
+{
+}
+@end
diff --git a/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.m b/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.m
new file mode 100644
index 0000000..70a37ae
--- /dev/null
+++ b/QSThingsPlugin/Parsers/QSThingsAppSectionsParser.m
@@ -0,0 +1,52 @@
+#import "Constants.h"
+#import "QSThingsAppSectionsParser.h"
+#import "SQLHelper.h"
+
+@implementation QSThingsAppSectionsParser
+- (BOOL)validParserForPath:(NSString *)path {
+ return [[path lastPathComponent] isEqualToString:@"main.sqlite"];
+}
+
+// This is not really a parser, but having the sqlite helps us
+// confirm that this makes sense.
+- (NSArray *)objectsFromPath:(NSString *)path withSettings:(NSDictionary *)settings {
+ NSMutableArray *objects = [NSMutableArray array];
+
+ // Inbox
+ QSObject *inbox = [QSObject
+ makeObjectWithIdentifier: ThingsAppSectionKeyInbox];
+ [inbox setName:@"Inbox"];
+ [inbox setPrimaryType:kAppSectionType];
+ [objects addObject:inbox];
+
+ // Today
+ QSObject *today = [QSObject
+ makeObjectWithIdentifier: ThingsAppSectionKeyToday];
+ [today setName:@"Today"];
+ [today setPrimaryType:kAppSectionType];
+ [objects addObject:today];
+
+ // Upcoming
+ QSObject *upcoming = [QSObject
+ makeObjectWithIdentifier: ThingsAppSectionKeyUpcoming];
+ [upcoming setName:@"Upcoming"];
+ [upcoming setPrimaryType:kAppSectionType];
+ [objects addObject:upcoming];
+
+ // Anytime
+ QSObject *anytime = [QSObject
+ makeObjectWithIdentifier: ThingsAppSectionKeyAnytime];
+ [anytime setName:@"Anytime"];
+ [anytime setPrimaryType:kAppSectionType];
+ [objects addObject:anytime];
+
+ // Anytime
+ QSObject *someday = [QSObject
+ makeObjectWithIdentifier: ThingsAppSectionKeySomeday];
+ [someday setName:@"Someday"];
+ [someday setPrimaryType:kAppSectionType];
+ [objects addObject:someday];
+
+ return objects;
+}
+@end
diff --git a/QSThingsPlugin/Parsers/QSThingsTagsParser.h b/QSThingsPlugin/Parsers/QSThingsTagsParser.h
new file mode 100644
index 0000000..d57aac1
--- /dev/null
+++ b/QSThingsPlugin/Parsers/QSThingsTagsParser.h
@@ -0,0 +1,4 @@
+@interface QSThingsTagsParser : QSParser
+{
+}
+@end
diff --git a/QSThingsPlugin/Parsers/QSThingsTagsParser.m b/QSThingsPlugin/Parsers/QSThingsTagsParser.m
new file mode 100644
index 0000000..4a81de3
--- /dev/null
+++ b/QSThingsPlugin/Parsers/QSThingsTagsParser.m
@@ -0,0 +1,33 @@
+#import "Constants.h"
+#import "QSThingsTagsParser.h"
+#import "SQLHelper.h"
+
+@implementation QSThingsTagsParser
+- (BOOL)validParserForPath:(NSString *)path {
+ return [[path lastPathComponent] isEqualToString:@"main.sqlite"];
+}
+
+- (NSArray *)objectsFromPath:(NSString *)path withSettings:(NSDictionary *)settings {
+ NSString *query = @"SELECT "
+ "uuid, "
+ "title "
+ "FROM TMTag "
+ "ORDER BY title;";
+
+ NSArray *results = [SQLHelper executeSql:query onFile:path];
+
+ NSMutableArray *objects = [NSMutableArray array];
+ [results enumerateObjectsUsingBlock:^(NSDictionary *dictionary, NSUInteger i, BOOL *stop) {
+
+ QSObject *newObject = [QSObject
+ makeObjectWithIdentifier:[dictionary objectForKey:@"uuid"]];
+ [newObject setObject:dictionary forType:kTagType];
+ [newObject setName:[dictionary objectForKey:@"title"]];
+ [newObject setPrimaryType:kTagType];
+
+ [objects addObject:newObject];
+ }];
+
+ return objects;
+}
+@end
diff --git a/QSThingsPlugin/Types/Constants.h b/QSThingsPlugin/Types/Constants.h
index 044dcde..b94fd7a 100644
--- a/QSThingsPlugin/Types/Constants.h
+++ b/QSThingsPlugin/Types/Constants.h
@@ -9,3 +9,13 @@ extern NSString *const kTaskType;
#pragma mark - Keychain
extern NSString *const kKeychainService;
extern NSString *const kAuthenticationKeyKeychainKey;
+
+#pragma mark - App Section Keys
+typedef NSString* ThingsAppSectionKey NS_STRING_ENUM;
+
+extern ThingsAppSectionKey const ThingsAppSectionKeyInbox;
+extern ThingsAppSectionKey const ThingsAppSectionKeyToday;
+extern ThingsAppSectionKey const ThingsAppSectionKeyUpcoming;
+extern ThingsAppSectionKey const ThingsAppSectionKeyAnytime;
+extern ThingsAppSectionKey const ThingsAppSectionKeySomeday;
+extern ThingsAppSectionKey const ThingsURLRouteAdd;
diff --git a/QSThingsPlugin/Types/Constants.m b/QSThingsPlugin/Types/Constants.m
index e6158a2..d92d007 100644
--- a/QSThingsPlugin/Types/Constants.m
+++ b/QSThingsPlugin/Types/Constants.m
@@ -9,3 +9,12 @@ NSString *const kTaskType = @"things.task";
#pragma mark - Keychain
NSString *const kKeychainService = @"QSThingsPlugin";
NSString *const kAuthenticationKeyKeychainKey = @"authenticationKey";
+
+#pragma mark - App Section Keys
+typedef NSString* ThingsAppSectionKey NS_STRING_ENUM;
+
+ThingsAppSectionKey const ThingsAppSectionKeyInbox = @"things-app-section-inbox";
+ThingsAppSectionKey const ThingsAppSectionKeyToday = @"things-app-section-today";
+ThingsAppSectionKey const ThingsAppSectionKeyUpcoming = @"things-app-section-upcoming";
+ThingsAppSectionKey const ThingsAppSectionKeyAnytime = @"things-app-section-anytime";
+ThingsAppSectionKey const ThingsAppSectionKeySomeday = @"things-app-section-someday";