From 1d99eac1ec6f5ea964f061f441bb1ed791e2f843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelo=20Munhoz=20P=C3=A9los?= Date: Mon, 8 Jul 2013 23:55:55 -0300 Subject: [PATCH] Implements delete in ROM list. --- apple/iOS/browser.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apple/iOS/browser.m b/apple/iOS/browser.m index 9c6648a812..318e5b751e 100644 --- a/apple/iOS/browser.m +++ b/apple/iOS/browser.m @@ -158,6 +158,21 @@ return _sectionNames; } +- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + NSFileManager *fileManager = [NSFileManager defaultManager]; + RADirectoryItem *path = (RADirectoryItem*)[self itemForIndexPath:indexPath]; + + BOOL didRemoveItem = [fileManager removeItemAtPath:path.path error:nil]; + + if (didRemoveItem) { + [self refresh]; + } else { + apple_display_alert(@"Not possible to delete file.", 0); + } + } +} + @end @implementation RAModuleList