Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:myellow/Less-2-Do

  • Loading branch information...
commit 199c7a5b2e52d19c310ede5423f124012c4d0afa 2 parents 9933672 + 1414443
Gerhard Schraml authored
View
1  Classes/EditContextViewController.m
@@ -279,6 +279,7 @@ - (IBAction) save:(id)sender {
[contextView release];
[self dismissModalViewControllerAnimated:YES];
}
+ [BaseManagedObject commit];
}
- (IBAction) textFieldDone:(id)sender {
View
8 Classes/Entities/Task.m
@@ -384,7 +384,7 @@ + (NSArray *) getTasksWithoutTag:(NSError **)error
+ (NSArray *) getTasksWithContext:(CLLocation *)theLocation error:(NSError **)error
{
NSMutableArray *result = [[NSMutableArray alloc] init];
- [result addObjectsFromArray:[Task getTasksWithFilterString:@"context != nil and context.gpsX != nil and context.gpsY != nil and isCompleted == NO and deleted == NO" error:error]];
+ [result addObjectsFromArray:[Task getTasksWithFilterString:@"context != nil and context.gpsX != nil and context.gpsY != nil and context.gpsY != 0 and context.gpsX != 0 and isCompleted == NO and deleted == NO" error:error]];
NSMutableArray *sorted = [[[NSMutableArray alloc] init] autorelease];
@@ -406,7 +406,11 @@ + (NSArray *) getTasksWithContext:(CLLocation *)theLocation error:(NSError **)er
[locNearest release];
[locTask release];
}
- [sorted addObject:[result objectAtIndex:nearest]];
+ if ([((Task *)[result objectAtIndex:nearest]).context hasGps]) {
+ ALog ("%@ - %@",((Task *)[result objectAtIndex:nearest]),((Task *)[result objectAtIndex:nearest]).context);
+ [sorted addObject:[result objectAtIndex:nearest]];
+ }
+
[result removeObjectAtIndex:nearest];
}
View
26 Classes/TasksListViewController.m
@@ -238,6 +238,32 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
NSError *error;
Task *t = (Task *)[self.tasks objectAtIndex:row];
+
+ //Remove Folder
+ Folder *f = t.folder;
+ if (f != nil)
+ [f removeTasksObject:t];
+ t.folder = nil;
+
+ //Remove Context
+ Context *c = t.context;
+ if (c != nil)
+ [c removeTasksObject:t];
+ t.context = nil;
+
+ //Remove Tags
+ NSMutableArray *tagsToRemove = [NSMutableArray array];
+ for(Tag *tag in t.tags)
+ {
+ [tagsToRemove addObject:tag];
+ }
+ for(Tag *tag in tagsToRemove)
+ {
+ [tag removeTasksObject:t];
+ }
+ [t removeTags:[NSSet setWithArray:tagsToRemove]];
+
+
[Task deleteObject:t error:&error];
[BaseManagedObject commit];
Please sign in to comment.
Something went wrong with that request. Please try again.