blob: 472a8fab23f773f92678ec3c35bf7f303858261e (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#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];
NSDictionary *dictionary = @{@"path": path};
// Inbox
QSObject *inbox = [QSObject
makeObjectWithIdentifier: ThingsAppSectionKeyInbox];
[inbox setName:@"Inbox"];
[inbox setPrimaryType:kAppSectionType];
[inbox setObject:[dictionary copy] forType:kAppSectionType];
[objects addObject:inbox];
// Today
QSObject *today = [QSObject
makeObjectWithIdentifier: ThingsAppSectionKeyToday];
[today setName:@"Today"];
[today setPrimaryType:kAppSectionType];
[today setObject:[dictionary copy] forType:kAppSectionType];
[objects addObject:today];
// Upcoming
QSObject *upcoming = [QSObject
makeObjectWithIdentifier: ThingsAppSectionKeyUpcoming];
[upcoming setName:@"Upcoming"];
[upcoming setPrimaryType:kAppSectionType];
[upcoming setObject:[dictionary copy] forType:kAppSectionType];
[objects addObject:upcoming];
// Anytime
QSObject *anytime = [QSObject
makeObjectWithIdentifier: ThingsAppSectionKeyAnytime];
[anytime setName:@"Anytime"];
[anytime setPrimaryType:kAppSectionType];
[anytime setObject:[dictionary copy] forType:kAppSectionType];
[objects addObject:anytime];
// Anytime
QSObject *someday = [QSObject
makeObjectWithIdentifier: ThingsAppSectionKeySomeday];
[someday setName:@"Someday"];
[someday setPrimaryType:kAppSectionType];
[someday setObject:[dictionary copy] forType:kAppSectionType];
[objects addObject:someday];
return objects;
}
@end
|