2009-08-05 08:59:46 +00:00
|
|
|
/*
|
2011-04-12 08:04:01 +00:00
|
|
|
Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
2009-08-05 08:59:46 +00:00
|
|
|
|
2010-09-30 10:17:41 +00:00
|
|
|
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2009-08-05 08:59:46 +00:00
|
|
|
which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
http://www.hardcoded.net/licenses/bsd_license
|
2009-08-05 08:59:46 +00:00
|
|
|
*/
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
#import "ResultWindow.h"
|
|
|
|
#import "Dialogs.h"
|
|
|
|
#import "ProgressController.h"
|
|
|
|
#import "Utils.h"
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
#import "Consts.h"
|
2011-09-13 20:31:25 +00:00
|
|
|
#import "PrioritizeDialog.h"
|
2009-06-01 09:55:11 +00:00
|
|
|
|
|
|
|
@implementation ResultWindowBase
|
2011-01-14 12:56:50 +00:00
|
|
|
- (id)initWithParentApp:(AppDelegateBase *)aApp;
|
2009-06-01 09:55:11 +00:00
|
|
|
{
|
2011-01-14 12:56:50 +00:00
|
|
|
self = [super initWithWindowNibName:@"ResultWindow"];
|
|
|
|
app = aApp;
|
|
|
|
py = [app py];
|
2011-04-22 09:37:53 +00:00
|
|
|
[[self window] setTitle:fmt(@"%@ Results", [py appName])];
|
2011-01-14 12:56:50 +00:00
|
|
|
columnsMenu = [app columnsMenu];
|
2010-09-24 14:01:38 +00:00
|
|
|
/* Put a cute iTunes-like bottom bar */
|
|
|
|
[[self window] setContentBorderThickness:28 forEdge:NSMinYEdge];
|
2011-11-27 17:47:00 +00:00
|
|
|
table = [[ResultTable alloc] initWithPy:[py resultTable] view:matches];
|
2010-02-11 19:54:06 +00:00
|
|
|
statsLabel = [[StatsLabel alloc] initWithPyParent:py labelView:stats];
|
2010-04-12 10:21:01 +00:00
|
|
|
problemDialog = [[ProblemDialog alloc] initWithPy:py];
|
2009-10-30 12:56:05 +00:00
|
|
|
[self initResultColumns];
|
|
|
|
[self fillColumnsMenu];
|
2010-02-09 13:50:27 +00:00
|
|
|
[matches setTarget:self];
|
2010-02-09 13:55:51 +00:00
|
|
|
[matches setDoubleAction:@selector(openClicked:)];
|
2010-02-09 13:50:27 +00:00
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil];
|
2009-06-01 09:55:11 +00:00
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobStarted:) name:JobStarted object:nil];
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobInProgress:) name:JobInProgress object:nil];
|
2011-01-14 12:56:50 +00:00
|
|
|
return self;
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
2009-10-30 12:56:05 +00:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
2010-09-24 13:48:59 +00:00
|
|
|
[table release];
|
2010-04-12 10:21:01 +00:00
|
|
|
[statsLabel release];
|
|
|
|
[problemDialog release];
|
2009-10-30 12:56:05 +00:00
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2011-01-15 10:38:59 +00:00
|
|
|
/* Virtual */
|
|
|
|
- (void)initResultColumns
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setScanOptions
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-06-14 14:48:47 +00:00
|
|
|
/* Helpers */
|
2009-10-30 12:56:05 +00:00
|
|
|
- (void)fillColumnsMenu
|
|
|
|
{
|
2011-11-26 15:55:14 +00:00
|
|
|
NSArray *menuItems = [[[table columns] py] menuItems];
|
|
|
|
for (NSInteger i=0; i < [menuItems count]; i++) {
|
|
|
|
NSArray *pair = [menuItems objectAtIndex:i];
|
|
|
|
NSString *display = [pair objectAtIndex:0];
|
|
|
|
BOOL marked = n2b([pair objectAtIndex:1]);
|
|
|
|
NSMenuItem *mi = [columnsMenu addItemWithTitle:display action:@selector(toggleColumn:) keyEquivalent:@""];
|
2009-10-30 12:56:05 +00:00
|
|
|
[mi setTarget:self];
|
2011-11-26 15:55:14 +00:00
|
|
|
[mi setState:marked ? NSOnState : NSOffState];
|
|
|
|
[mi setTag:i];
|
2009-10-30 12:56:05 +00:00
|
|
|
}
|
|
|
|
[columnsMenu addItem:[NSMenuItem separatorItem]];
|
2011-01-18 14:35:14 +00:00
|
|
|
NSMenuItem *mi = [columnsMenu addItemWithTitle:TR(@"Reset to Default")
|
|
|
|
action:@selector(resetColumnsToDefault:) keyEquivalent:@""];
|
2009-10-30 12:56:05 +00:00
|
|
|
[mi setTarget:self];
|
|
|
|
}
|
|
|
|
|
2010-09-25 13:37:18 +00:00
|
|
|
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted
|
|
|
|
{
|
|
|
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
|
|
|
if (!mark_count) {
|
|
|
|
return;
|
|
|
|
}
|
2011-11-04 17:10:11 +00:00
|
|
|
NSString *msg = TR(@"You are about to send %d files to Trash. Continue?");
|
2010-09-25 13:37:18 +00:00
|
|
|
if (hardlinkDeleted) {
|
2011-11-04 17:10:11 +00:00
|
|
|
msg = TR(@"You are about to send %d files to Trash (and hardlink them afterwards). Continue?");
|
2010-09-25 13:37:18 +00:00
|
|
|
}
|
|
|
|
if ([Dialogs askYesNo:[NSString stringWithFormat:msg,mark_count]] == NSAlertSecondButtonReturn) { // NO
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
|
|
|
[py setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
|
|
|
|
if (hardlinkDeleted) {
|
|
|
|
[py hardlinkMarked];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
[py deleteMarked];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-13 12:51:00 +00:00
|
|
|
- (void)updateOptionSegments
|
|
|
|
{
|
2011-01-14 12:56:50 +00:00
|
|
|
[optionsSwitch setSelected:[[app detailsPanel] isVisible] forSegment:0];
|
2011-01-13 12:51:00 +00:00
|
|
|
[optionsSwitch setSelected:[table powerMarkerMode] forSegment:1];
|
|
|
|
[optionsSwitch setSelected:[table deltaValuesMode] forSegment:2];
|
|
|
|
}
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
/* Actions */
|
2010-02-06 10:40:10 +00:00
|
|
|
- (IBAction)clearIgnoreList:(id)sender
|
|
|
|
{
|
|
|
|
NSInteger i = n2i([py getIgnoreListCount]);
|
|
|
|
if (!i)
|
|
|
|
return;
|
2011-11-04 17:10:11 +00:00
|
|
|
NSString *msg = [NSString stringWithFormat:TR(@"Do you really want to remove all %d items from the ignore list?"),i];
|
2011-01-18 14:35:14 +00:00
|
|
|
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
|
2010-02-06 10:40:10 +00:00
|
|
|
return;
|
|
|
|
[py clearIgnoreList];
|
|
|
|
}
|
|
|
|
|
2011-01-13 12:51:00 +00:00
|
|
|
- (IBAction)changeOptions:(id)sender
|
2009-06-01 09:55:11 +00:00
|
|
|
{
|
2011-01-13 12:51:00 +00:00
|
|
|
NSInteger seg = [optionsSwitch selectedSegment];
|
|
|
|
if (seg == 0) {
|
|
|
|
[self toggleDetailsPanel:sender];
|
|
|
|
}
|
|
|
|
else if (seg == 1) {
|
|
|
|
[self togglePowerMarker:sender];
|
|
|
|
}
|
|
|
|
else if (seg == 2) {
|
|
|
|
[self toggleDelta:sender];
|
|
|
|
}
|
2009-06-16 08:04:23 +00:00
|
|
|
}
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
- (IBAction)copyMarked:(id)sender
|
|
|
|
{
|
2010-01-15 10:19:24 +00:00
|
|
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
2009-06-01 09:55:11 +00:00
|
|
|
if (!mark_count)
|
|
|
|
return;
|
|
|
|
NSOpenPanel *op = [NSOpenPanel openPanel];
|
|
|
|
[op setCanChooseFiles:NO];
|
|
|
|
[op setCanChooseDirectories:YES];
|
|
|
|
[op setCanCreateDirectories:YES];
|
|
|
|
[op setAllowsMultipleSelection:NO];
|
2011-11-04 17:10:11 +00:00
|
|
|
[op setTitle:TR(@"Select a directory to copy marked files to")];
|
2011-01-18 14:35:14 +00:00
|
|
|
if ([op runModal] == NSOKButton) {
|
2009-06-01 09:55:11 +00:00
|
|
|
NSString *directory = [[op filenames] objectAtIndex:0];
|
|
|
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
|
|
|
[py copyOrMove:b2n(YES) markedTo:directory recreatePath:[ud objectForKey:@"recreatePathType"]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)deleteMarked:(id)sender
|
|
|
|
{
|
2010-09-25 13:37:18 +00:00
|
|
|
[self sendMarkedToTrash:NO];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)hardlinkMarked:(id)sender
|
|
|
|
{
|
|
|
|
[self sendMarkedToTrash:YES];
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
2009-09-01 14:05:00 +00:00
|
|
|
- (IBAction)exportToXHTML:(id)sender
|
|
|
|
{
|
2011-11-27 18:02:59 +00:00
|
|
|
NSString *exported = [py exportToXHTML];
|
2009-09-01 14:05:00 +00:00
|
|
|
[[NSWorkspace sharedWorkspace] openFile:exported];
|
|
|
|
}
|
|
|
|
|
2010-02-06 10:40:10 +00:00
|
|
|
- (IBAction)filter:(id)sender
|
|
|
|
{
|
|
|
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
2010-09-25 10:28:34 +00:00
|
|
|
[py setEscapeFilterRegexp:!n2b([ud objectForKey:@"useRegexpFilter"])];
|
2010-02-06 10:40:10 +00:00
|
|
|
[py applyFilter:[filterField stringValue]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)ignoreSelected:(id)sender
|
|
|
|
{
|
2010-09-24 13:48:59 +00:00
|
|
|
NSInteger selectedDupeCount = [table selectedDupeCount];
|
2010-02-12 15:30:32 +00:00
|
|
|
if (!selectedDupeCount)
|
2010-02-06 10:40:10 +00:00
|
|
|
return;
|
2011-11-04 17:10:11 +00:00
|
|
|
NSString *msg = [NSString stringWithFormat:TR(@"All selected %d matches are going to be ignored in all subsequent scans. Continue?"),selectedDupeCount];
|
2010-02-06 11:12:20 +00:00
|
|
|
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
|
2010-02-06 10:40:10 +00:00
|
|
|
return;
|
|
|
|
[py addSelectedToIgnoreList];
|
|
|
|
}
|
|
|
|
|
2010-04-12 15:43:24 +00:00
|
|
|
- (IBAction)invokeCustomCommand:(id)sender
|
|
|
|
{
|
|
|
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
|
|
|
NSString *cmd = [ud stringForKey:@"CustomCommand"];
|
2010-04-13 08:52:44 +00:00
|
|
|
if ((cmd != nil) && ([cmd length] > 0)) {
|
|
|
|
[py invokeCommand:cmd];
|
|
|
|
}
|
|
|
|
else {
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"You have no custom command set up. Set it up in your preferences.")];
|
2010-04-13 08:52:44 +00:00
|
|
|
}
|
2010-04-12 15:43:24 +00:00
|
|
|
}
|
|
|
|
|
2010-02-06 10:40:10 +00:00
|
|
|
- (IBAction)markAll:(id)sender
|
|
|
|
{
|
|
|
|
[py markAll];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)markInvert:(id)sender
|
|
|
|
{
|
|
|
|
[py markInvert];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)markNone:(id)sender
|
|
|
|
{
|
|
|
|
[py markNone];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)markSelected:(id)sender
|
|
|
|
{
|
|
|
|
[py toggleSelectedMark];
|
|
|
|
}
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
- (IBAction)moveMarked:(id)sender
|
|
|
|
{
|
2010-01-15 10:19:24 +00:00
|
|
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
2009-06-01 09:55:11 +00:00
|
|
|
if (!mark_count)
|
|
|
|
return;
|
|
|
|
NSOpenPanel *op = [NSOpenPanel openPanel];
|
|
|
|
[op setCanChooseFiles:NO];
|
|
|
|
[op setCanChooseDirectories:YES];
|
|
|
|
[op setCanCreateDirectories:YES];
|
|
|
|
[op setAllowsMultipleSelection:NO];
|
2011-11-04 19:11:09 +00:00
|
|
|
[op setTitle:TR(@"Select a directory to move marked files to")];
|
2011-01-18 14:35:14 +00:00
|
|
|
if ([op runModal] == NSOKButton) {
|
2009-06-01 09:55:11 +00:00
|
|
|
NSString *directory = [[op filenames] objectAtIndex:0];
|
|
|
|
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
2010-09-25 10:28:34 +00:00
|
|
|
[py setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
|
2009-06-01 09:55:11 +00:00
|
|
|
[py copyOrMove:b2n(NO) markedTo:directory recreatePath:[ud objectForKey:@"recreatePathType"]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-09 13:55:51 +00:00
|
|
|
- (IBAction)openClicked:(id)sender
|
|
|
|
{
|
|
|
|
if ([matches clickedRow] < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
[matches selectRowIndexes:[NSIndexSet indexSetWithIndex:[matches clickedRow]] byExtendingSelection:NO];
|
|
|
|
[py openSelected];
|
|
|
|
}
|
|
|
|
|
2010-02-06 10:40:10 +00:00
|
|
|
- (IBAction)openSelected:(id)sender
|
|
|
|
{
|
|
|
|
[py openSelected];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)removeMarked:(id)sender
|
|
|
|
{
|
|
|
|
int mark_count = [[py getMarkCount] intValue];
|
|
|
|
if (!mark_count)
|
|
|
|
return;
|
2011-01-18 14:35:14 +00:00
|
|
|
NSString *msg = [NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",mark_count];
|
|
|
|
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
|
2010-02-06 10:40:10 +00:00
|
|
|
return;
|
|
|
|
[py removeMarked];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)removeSelected:(id)sender
|
|
|
|
{
|
2010-09-24 13:48:59 +00:00
|
|
|
[table removeSelected];
|
2010-02-06 10:40:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)renameSelected:(id)sender
|
|
|
|
{
|
|
|
|
NSInteger col = [matches columnWithIdentifier:@"0"];
|
|
|
|
NSInteger row = [matches selectedRow];
|
|
|
|
[matches editColumn:col row:row withEvent:[NSApp currentEvent] select:YES];
|
|
|
|
}
|
|
|
|
|
2011-09-13 20:31:25 +00:00
|
|
|
- (IBAction)reprioritizeResults:(id)sender
|
|
|
|
{
|
|
|
|
PrioritizeDialog *dlg = [[PrioritizeDialog alloc] initWithPy:py];
|
2011-09-13 22:19:46 +00:00
|
|
|
NSInteger result = [NSApp runModalForWindow:[dlg window]];
|
|
|
|
if (result == NSRunStoppedResponse) {
|
|
|
|
[[dlg py] performReprioritization];
|
|
|
|
}
|
|
|
|
[dlg release];
|
|
|
|
[[self window] makeKeyAndOrderFront:nil];
|
2011-09-13 20:31:25 +00:00
|
|
|
}
|
|
|
|
|
2009-10-30 14:40:17 +00:00
|
|
|
- (IBAction)resetColumnsToDefault:(id)sender
|
|
|
|
{
|
2011-11-26 15:55:14 +00:00
|
|
|
[[[table columns] py] resetToDefaults];
|
2009-10-30 14:40:17 +00:00
|
|
|
}
|
|
|
|
|
2010-02-06 10:40:10 +00:00
|
|
|
- (IBAction)revealSelected:(id)sender
|
|
|
|
{
|
|
|
|
[py revealSelected];
|
|
|
|
}
|
|
|
|
|
2010-08-13 11:06:18 +00:00
|
|
|
- (IBAction)saveResults:(id)sender
|
|
|
|
{
|
|
|
|
NSSavePanel *sp = [NSSavePanel savePanel];
|
|
|
|
[sp setCanCreateDirectories:YES];
|
|
|
|
[sp setAllowedFileTypes:[NSArray arrayWithObject:@"dupeguru"]];
|
2011-11-04 17:10:11 +00:00
|
|
|
[sp setTitle:TR(@"Select a file to save your results to")];
|
2010-08-13 11:06:18 +00:00
|
|
|
if ([sp runModal] == NSOKButton) {
|
|
|
|
[py saveResultsAs:[sp filename]];
|
2011-01-14 12:56:50 +00:00
|
|
|
[[app recentResults] addFile:[sp filename]];
|
2010-08-13 11:06:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-12 16:15:48 +00:00
|
|
|
- (IBAction)startDuplicateScan:(id)sender
|
|
|
|
{
|
2011-01-15 10:38:59 +00:00
|
|
|
if ([py resultsAreModified]) {
|
2011-11-04 17:10:11 +00:00
|
|
|
if ([Dialogs askYesNo:TR(@"You have unsaved results, do you really want to continue?")] == NSAlertSecondButtonReturn) // NO
|
2011-01-15 10:38:59 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
[self setScanOptions];
|
2011-09-22 14:35:17 +00:00
|
|
|
[py doScan];
|
2010-02-12 16:15:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-14 14:48:47 +00:00
|
|
|
- (IBAction)switchSelected:(id)sender
|
|
|
|
{
|
|
|
|
[py makeSelectedReference];
|
|
|
|
}
|
|
|
|
|
2009-10-30 12:56:05 +00:00
|
|
|
- (IBAction)toggleColumn:(id)sender
|
|
|
|
{
|
|
|
|
NSMenuItem *mi = sender;
|
2011-11-26 15:55:14 +00:00
|
|
|
BOOL checked = [[[table columns] py] toggleMenuItem:[mi tag]];
|
|
|
|
[mi setState:checked ? NSOnState : NSOffState];
|
2009-10-30 12:56:05 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 12:51:00 +00:00
|
|
|
- (IBAction)toggleDetailsPanel:(id)sender
|
2010-02-06 10:40:10 +00:00
|
|
|
{
|
2011-01-14 12:56:50 +00:00
|
|
|
[[app detailsPanel] toggleVisibility];
|
2011-01-13 12:51:00 +00:00
|
|
|
[self updateOptionSegments];
|
2010-02-06 10:40:10 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 12:51:00 +00:00
|
|
|
- (IBAction)toggleDelta:(id)sender
|
2009-11-02 15:16:34 +00:00
|
|
|
{
|
2011-01-13 12:51:00 +00:00
|
|
|
[table setDeltaValuesMode:![table deltaValuesMode]];
|
|
|
|
[self updateOptionSegments];
|
2009-11-02 15:16:34 +00:00
|
|
|
}
|
|
|
|
|
2009-06-16 08:04:23 +00:00
|
|
|
- (IBAction)togglePowerMarker:(id)sender
|
|
|
|
{
|
2011-01-13 12:51:00 +00:00
|
|
|
[table setPowerMarkerMode:![table powerMarkerMode]];
|
|
|
|
[self updateOptionSegments];
|
2009-06-16 08:04:23 +00:00
|
|
|
}
|
|
|
|
|
2011-09-22 19:59:11 +00:00
|
|
|
- (IBAction)toggleQuicklookPanel:(id)sender
|
|
|
|
{
|
|
|
|
if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible]) {
|
|
|
|
[[QLPreviewPanel sharedPreviewPanel] orderOut:nil];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Quicklook */
|
|
|
|
- (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel *)panel;
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)beginPreviewPanelControl:(QLPreviewPanel *)panel
|
|
|
|
{
|
|
|
|
// This document is now responsible of the preview panel
|
|
|
|
// It is allowed to set the delegate, data source and refresh panel.
|
|
|
|
previewPanel = [panel retain];
|
|
|
|
panel.delegate = table;
|
|
|
|
panel.dataSource = table;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)endPreviewPanelControl:(QLPreviewPanel *)panel
|
|
|
|
{
|
|
|
|
// This document loses its responsisibility on the preview panel
|
|
|
|
// Until the next call to -beginPreviewPanelControl: it must not
|
|
|
|
// change the panel's delegate, data source or refresh it.
|
|
|
|
[previewPanel release];
|
|
|
|
previewPanel = nil;
|
|
|
|
}
|
|
|
|
|
2009-06-01 09:55:11 +00:00
|
|
|
/* Notifications */
|
|
|
|
- (void)jobCompleted:(NSNotification *)aNotification
|
|
|
|
{
|
|
|
|
id lastAction = [[ProgressController mainProgressController] jobId];
|
2010-01-13 09:39:27 +00:00
|
|
|
if ([lastAction isEqualTo:jobCopy]) {
|
2010-04-12 10:21:01 +00:00
|
|
|
if ([py scanWasProblematic]) {
|
|
|
|
[problemDialog showWindow:self];
|
|
|
|
}
|
|
|
|
else {
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"All marked files were copied sucessfully.")];
|
2010-04-12 10:21:01 +00:00
|
|
|
}
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
2010-01-13 09:39:27 +00:00
|
|
|
else if ([lastAction isEqualTo:jobMove]) {
|
2010-04-12 10:21:01 +00:00
|
|
|
if ([py scanWasProblematic]) {
|
|
|
|
[problemDialog showWindow:self];
|
|
|
|
}
|
|
|
|
else {
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"All marked files were moved sucessfully.")];
|
2010-04-12 10:21:01 +00:00
|
|
|
}
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
2010-01-13 09:39:27 +00:00
|
|
|
else if ([lastAction isEqualTo:jobDelete]) {
|
2010-04-12 10:21:01 +00:00
|
|
|
if ([py scanWasProblematic]) {
|
|
|
|
[problemDialog showWindow:self];
|
2009-12-15 16:23:02 +00:00
|
|
|
}
|
2010-04-12 10:21:01 +00:00
|
|
|
else {
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"All marked files were sucessfully sent to Trash.")];
|
2010-04-12 10:21:01 +00:00
|
|
|
}
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
2010-01-13 09:39:27 +00:00
|
|
|
else if ([lastAction isEqualTo:jobScan]) {
|
2010-09-24 13:48:59 +00:00
|
|
|
NSInteger rowCount = [[table py] numberOfRows];
|
2011-01-18 14:35:14 +00:00
|
|
|
if (rowCount == 0) {
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"No duplicates found.")];
|
2011-01-18 14:35:14 +00:00
|
|
|
}
|
2010-01-13 09:39:27 +00:00
|
|
|
}
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)jobInProgress:(NSNotification *)aNotification
|
|
|
|
{
|
2011-11-04 17:10:11 +00:00
|
|
|
[Dialogs showMessage:TR(@"A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again.")];
|
2009-06-01 09:55:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)jobStarted:(NSNotification *)aNotification
|
|
|
|
{
|
2011-01-14 14:34:10 +00:00
|
|
|
[[self window] makeKeyAndOrderFront:nil];
|
2009-06-01 09:55:11 +00:00
|
|
|
NSDictionary *ui = [aNotification userInfo];
|
|
|
|
NSString *desc = [ui valueForKey:@"desc"];
|
|
|
|
[[ProgressController mainProgressController] setJobDesc:desc];
|
|
|
|
NSString *jobid = [ui valueForKey:@"jobid"];
|
|
|
|
[[ProgressController mainProgressController] setJobId:jobid];
|
|
|
|
[[ProgressController mainProgressController] showSheetForParent:[self window]];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
|
|
|
|
{
|
|
|
|
return ![[ProgressController mainProgressController] isShown];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
|
|
|
{
|
|
|
|
return ![[ProgressController mainProgressController] isShown];
|
|
|
|
}
|
|
|
|
@end
|