@@ -299,24 +299,35 @@ - (IBAction)moveToTrash:(id)sender
299
299
300
300
NSURL *workingDirectoryURL = self.repository .workingDirectoryURL ;
301
301
302
- BOOL anyTrashed = NO ;
303
- for (PBChangedFile *file in selectedFiles)
304
- {
305
- NSURL * fileURL = [workingDirectoryURL URLByAppendingPathComponent: [file path ]];
302
+ NSAlert *confirmTrash = [[NSAlert alloc ] init ];
303
+ confirmTrash.alertStyle = NSAlertStyleWarning;
304
+ confirmTrash.messageText = NSLocalizedString(@" Move to trash" , @" Move to trash alert - title" );
305
+ confirmTrash.informativeText = NSLocalizedString(@" Do you want to move the following files to the trash ?" , @" Move to trash alert - message" );
306
+ [confirmTrash addButtonWithTitle: NSLocalizedString(@" OK" , @" Move to trash alert - OK button" )];
307
+ [confirmTrash addButtonWithTitle: NSLocalizedString(@" Cancel" , @" Move to trash alert - Cancel button" )];
308
+
309
+ [confirmTrash beginSheetModalForWindow: self .windowController.window completionHandler: ^(NSModalResponse returnCode) {
310
+ if (returnCode != NSAlertFirstButtonReturn ) return ;
306
311
307
- NSError * error = nil ;
308
- NSURL * resultURL = nil ;
309
- if ([[NSFileManager defaultManager ] trashItemAtURL: fileURL
310
- resultingItemURL: &resultURL
311
- error: &error])
312
+ BOOL anyTrashed = NO ;
313
+ for (PBChangedFile *file in selectedFiles)
312
314
{
313
- anyTrashed = YES ;
315
+ NSURL * fileURL = [workingDirectoryURL URLByAppendingPathComponent: [file path ]];
316
+
317
+ NSError * error = nil ;
318
+ NSURL * resultURL = nil ;
319
+ if ([[NSFileManager defaultManager ] trashItemAtURL: fileURL
320
+ resultingItemURL: &resultURL
321
+ error: &error])
322
+ {
323
+ anyTrashed = YES ;
324
+ }
314
325
}
315
- }
316
- if (anyTrashed)
317
- {
318
- [ self .repository.index refresh ];
319
- }
326
+ if (anyTrashed)
327
+ {
328
+ [ self .repository.index refresh ];
329
+ }
330
+ }];
320
331
}
321
332
322
333
- (IBAction )ignoreFiles: (id ) sender
0 commit comments