|
@@ -2216,7 +2216,7 @@
|
|
|
|
|
|
- (void)reloadTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
- (void)reloadTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
{
|
|
{
|
|
- UITouch * touch = [[event allTouches] anyObject];
|
|
|
|
|
|
+ UITouch *touch = [[event allTouches] anyObject];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
|
|
|
|
@@ -2286,7 +2286,7 @@
|
|
|
|
|
|
- (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
- (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
{
|
|
{
|
|
- UITouch * touch = [[event allTouches] anyObject];
|
|
|
|
|
|
+ UITouch *touch = [[event allTouches] anyObject];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
|
|
|
|
@@ -2305,7 +2305,47 @@
|
|
|
|
|
|
- (void)cancelAllTask:(id)sender
|
|
- (void)cancelAllTask:(id)sender
|
|
{
|
|
{
|
|
|
|
+ CGPoint location = [sender locationInView:self.tableView];
|
|
|
|
+ NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
|
|
+
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
+ [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_all_task_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
|
|
|
|
+
|
|
|
|
+ NSArray *metadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND status != %d AND status != %d", appDelegate.activeAccount, k_metadataStatusNormal, k_metadataStatusHide] sorted:@"fileName" ascending:true];
|
|
|
|
+
|
|
|
|
+ for (tableMetadata *metadata in metadatas) {
|
|
|
|
+
|
|
|
|
+ // Delete
|
|
|
|
+ if (metadata.status == k_metadataStatusWaitUpload || metadata.status == k_metadataStatusUploadError) {
|
|
|
|
+ [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID == %@", metadata.fileID] clearDateReadDirectoryID:metadata.directoryID];
|
|
|
|
+ }
|
|
|
|
+ // Modify
|
|
|
|
+ if (metadata.status == k_metadataStatusWaitDownload || metadata.status == k_metadataStatusDownloadError) {
|
|
|
|
+ metadata.session = @"";
|
|
|
|
+ metadata.sessionSelector = @"";
|
|
|
|
+ metadata.sessionSelectorPost = @"";
|
|
|
|
+ metadata.status = k_metadataStatusNormal;
|
|
|
|
+ (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
|
|
|
|
+ }
|
|
|
|
+ // Cancel Task
|
|
|
|
+ if (metadata.status == k_metadataStatusDownloading || metadata.status == k_metadataStatusUploading) {
|
|
|
|
+ [self cancelTaskButton:metadata reloadTable:NO];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [self reloadDatasource];
|
|
|
|
+ }]];
|
|
|
|
+
|
|
|
|
+ [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]];
|
|
|
|
+
|
|
|
|
+ alertController.popoverPresentationController.sourceView = self.view;
|
|
|
|
+ alertController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];
|
|
|
|
+
|
|
|
|
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
|
|
|
|
+ [alertController.view layoutIfNeeded];
|
|
|
|
+
|
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)cancelTaskButton:(tableMetadata *)metadata reloadTable:(BOOL)reloadTable
|
|
- (void)cancelTaskButton:(tableMetadata *)metadata reloadTable:(BOOL)reloadTable
|
|
@@ -2361,7 +2401,7 @@
|
|
|
|
|
|
- (void)stopTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
- (void)stopTaskButton:(id)sender withEvent:(UIEvent *)event
|
|
{
|
|
{
|
|
- UITouch * touch = [[event allTouches] anyObject];
|
|
|
|
|
|
+ UITouch *touch = [[event allTouches] anyObject];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
CGPoint location = [touch locationInView:self.tableView];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
|
|
|
|
|