瀏覽代碼

Add confirmation dialog before deleting media on iPad (close #8734)

Felix Paul Kühne 12 年之前
父節點
當前提交
08400fbe09
共有 2 個文件被更改,包括 11 次插入2 次删除
  1. 11 2
      AspenProject/VLCPlaylistGridView.m
  2. 二進制
      Resources/en.lproj/Localizable.strings

+ 11 - 2
AspenProject/VLCPlaylistGridView.m

@@ -89,8 +89,17 @@
 
 - (IBAction)removeMedia:(id)sender
 {
-    NSUInteger cellIndex = [self.gridView indexForCell:self];
-    [self.gridView.delegate gridView:self.gridView commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndex:cellIndex];
+    /* ask user if s/he really wants to delete the media file */
+    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DELETE_FILE", @"") message:[NSString stringWithFormat:NSLocalizedString(@"DELETE_FILE_LONG", @""), self.mediaObject.title] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:NSLocalizedString(@"BUTTON_DELETE", @""), nil];
+    [alert show];
+}
+
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+    if (buttonIndex == 1) {
+        NSUInteger cellIndex = [self.gridView indexForCell:self];
+        [self.gridView.delegate gridView:self.gridView commitEditingStyle:UITableViewCellEditingStyleDelete forRowAtIndex:cellIndex];
+    }
 }
 
 @end

二進制
Resources/en.lproj/Localizable.strings