2017-03-12 01:18:27 +00:00
|
|
|
/*
|
2017-04-05 00:59:25 +00:00
|
|
|
Copyright 2017 Virgil Dupras
|
2017-03-12 01:18:27 +00:00
|
|
|
|
|
|
|
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
|
|
|
which should be included with this package. The terms are also available at
|
|
|
|
http://www.gnu.org/licenses/gpl-3.0.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "DeletionOptions.h"
|
|
|
|
#import "HSPyUtil.h"
|
|
|
|
|
|
|
|
@implementation DeletionOptions
|
|
|
|
|
|
|
|
@synthesize messageTextField;
|
|
|
|
@synthesize linkButton;
|
|
|
|
@synthesize linkTypeRadio;
|
|
|
|
@synthesize directButton;
|
|
|
|
|
|
|
|
- (id)initWithPyRef:(PyObject *)aPyRef
|
|
|
|
{
|
2017-04-05 00:59:25 +00:00
|
|
|
self = [super initWithWindowNibName:@"DeletionOptions"];
|
|
|
|
[self window];
|
2017-03-12 01:18:27 +00:00
|
|
|
model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
|
|
|
|
[model bindCallback:createCallback(@"DeletionOptionsView", self)];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[model release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2017-04-05 00:59:25 +00:00
|
|
|
- (IBAction)updateOptions:(id)sender
|
2017-03-12 01:18:27 +00:00
|
|
|
{
|
2020-12-30 02:40:44 +00:00
|
|
|
[model setLinkDeleted:[linkButton state] == NSControlStateValueOn];
|
2017-03-12 01:18:27 +00:00
|
|
|
[model setUseHardlinks:[linkTypeRadio selectedColumn] == 1];
|
2020-12-30 02:40:44 +00:00
|
|
|
[model setDirect:[directButton state] == NSControlStateValueOn];
|
2017-03-12 01:18:27 +00:00
|
|
|
}
|
|
|
|
|
2017-04-05 00:59:25 +00:00
|
|
|
- (IBAction)proceed:(id)sender
|
2017-03-12 01:18:27 +00:00
|
|
|
{
|
2020-12-30 02:40:44 +00:00
|
|
|
[NSApp stopModalWithCode:NSModalResponseOK];
|
2017-03-12 01:18:27 +00:00
|
|
|
}
|
|
|
|
|
2017-04-05 00:59:25 +00:00
|
|
|
- (IBAction)cancel:(id)sender
|
2017-03-12 01:18:27 +00:00
|
|
|
{
|
2020-12-30 02:40:44 +00:00
|
|
|
[NSApp stopModalWithCode:NSModalResponseCancel];
|
2017-03-12 01:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* model --> view */
|
|
|
|
- (void)updateMsg:(NSString *)msg
|
|
|
|
{
|
|
|
|
[messageTextField setStringValue:msg];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)show
|
|
|
|
{
|
2020-12-30 02:40:44 +00:00
|
|
|
[linkButton setState:NSControlStateValueOff];
|
|
|
|
[directButton setState:NSControlStateValueOff];
|
2017-03-12 01:18:27 +00:00
|
|
|
[linkTypeRadio selectCellAtRow:0 column:0];
|
|
|
|
NSInteger r = [NSApp runModalForWindow:[self window]];
|
|
|
|
[[self window] close];
|
2020-12-30 02:40:44 +00:00
|
|
|
return r == NSModalResponseOK;
|
2017-03-12 01:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setHardlinkOptionEnabled:(BOOL)enabled
|
|
|
|
{
|
|
|
|
[linkTypeRadio setEnabled:enabled];
|
|
|
|
}
|
2020-12-30 02:40:44 +00:00
|
|
|
@end
|