Skip to content

Commit

Permalink
Privacy and categories support for tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Dec 16, 2014
1 parent 70dbcf0 commit eb4d20e
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions ActiveSync/iCalToDo+ActiveSync.m
Expand Up @@ -54,9 +54,10 @@ @implementation iCalToDo (ActiveSync)
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
NSMutableString *s;
NSArray *categories;
id o;

int v;
int v, i;

s = [NSMutableString string];

Expand Down Expand Up @@ -96,9 +97,25 @@ - (NSString *) activeSyncRepresentationInContext: (WOContext *) context
// Reminder - FIXME
[s appendFormat: @"<ReminderSet xmlns=\"Tasks:\">%d</ReminderSet>", 0];

// Sensitivity - FIXME
[s appendFormat: @"<Sensitivity xmlns=\"Tasks:\">%d</Sensitivity>", 0];

if ([[self accessClass] isEqualToString: @"PRIVATE"])
v = 2;
else if ([[self accessClass] isEqualToString: @"CONFIDENTIAL"])
v = 3;
else
v = 0;

categories = [self categories];

if ([categories count])
{
[s appendFormat: @"<Categories xmlns=\"Tasks:\">"];
for (i = 0; i < [categories count]; i++)
{
[s appendFormat: @"<Category xmlns=\"Tasks:\">%@</Category>", [[categories objectAtIndex: i] activeSyncRepresentationInContext: context]];
}
[s appendFormat: @"</Categories>"];
}

// Subject
o = [self summary];
if ([o length])
Expand Down Expand Up @@ -182,6 +199,29 @@ - (void) takeActiveSyncValues: (NSDictionary *) theValues
[self setPriority: @"9"];
}

//
// 0- normal, 1- personal, 2- private and 3-confidential
//
if ((o = [theValues objectForKey: @"Sensitivity"]))
{
switch ([o intValue])
{
case 2:
[self setAccessClass: @"PRIVATE"];
break;
case 3:
[self setAccessClass: @"CONFIDENTIAL"];
break;
case 0:
case 1:
default:
[self setAccessClass: @"PUBLIC"];
}
}

// Categories
if ((o = [theValues objectForKey: @"Categories"]) && [o length])
[self setCategories: o];

if ((o = [theValues objectForKey: @"ReminderTime"]))
{
Expand Down

0 comments on commit eb4d20e

Please sign in to comment.