2012-05-30 16:10:56 +00:00
|
|
|
/*
|
2015-01-03 21:30:57 +00:00
|
|
|
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
2012-05-30 16:10:56 +00:00
|
|
|
|
2015-01-03 21:33:16 +00:00
|
|
|
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2012-05-30 16:10:56 +00:00
|
|
|
which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
http://www.gnu.org/licenses/gpl-3.0.html
|
2012-05-30 16:10:56 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#import "DeletionOptions.h"
|
2012-07-23 14:14:50 +00:00
|
|
|
#import "DeletionOptions_UI.h"
|
2012-05-30 16:10:56 +00:00
|
|
|
#import "HSPyUtil.h"
|
|
|
|
|
|
|
|
@implementation DeletionOptions
|
2012-07-23 14:14:50 +00:00
|
|
|
|
|
|
|
@synthesize messageTextField;
|
2012-08-01 16:36:23 +00:00
|
|
|
@synthesize linkButton;
|
|
|
|
@synthesize linkTypeRadio;
|
2012-07-23 14:14:50 +00:00
|
|
|
@synthesize directButton;
|
|
|
|
|
2012-05-30 16:10:56 +00:00
|
|
|
- (id)initWithPyRef:(PyObject *)aPyRef
|
|
|
|
{
|
2012-07-23 14:14:50 +00:00
|
|
|
self = [super initWithWindow:nil];
|
2012-05-30 16:10:56 +00:00
|
|
|
model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
|
2012-07-23 14:14:50 +00:00
|
|
|
[self setWindow:createDeletionOptions_UI(self)];
|
2012-05-30 16:10:56 +00:00
|
|
|
[model bindCallback:createCallback(@"DeletionOptionsView", self)];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
[model release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2012-07-23 14:14:50 +00:00
|
|
|
- (void)updateOptions
|
2012-05-30 16:10:56 +00:00
|
|
|
{
|
2012-08-01 16:36:23 +00:00
|
|
|
[model setLinkDeleted:[linkButton state] == NSOnState];
|
|
|
|
[model setUseHardlinks:[linkTypeRadio selectedColumn] == 1];
|
2012-05-30 16:10:56 +00:00
|
|
|
[model setDirect:[directButton state] == NSOnState];
|
|
|
|
}
|
|
|
|
|
2012-07-23 14:14:50 +00:00
|
|
|
- (void)proceed
|
2012-05-30 16:10:56 +00:00
|
|
|
{
|
|
|
|
[NSApp stopModalWithCode:NSOKButton];
|
|
|
|
}
|
|
|
|
|
2012-07-23 14:14:50 +00:00
|
|
|
- (void)cancel
|
2012-05-30 16:10:56 +00:00
|
|
|
{
|
|
|
|
[NSApp stopModalWithCode:NSCancelButton];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* model --> view */
|
|
|
|
- (void)updateMsg:(NSString *)msg
|
|
|
|
{
|
|
|
|
[messageTextField setStringValue:msg];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)show
|
|
|
|
{
|
2012-08-01 16:36:23 +00:00
|
|
|
[linkButton setState:NSOffState];
|
2012-05-30 16:10:56 +00:00
|
|
|
[directButton setState:NSOffState];
|
2012-08-01 16:36:23 +00:00
|
|
|
[linkTypeRadio selectCellAtRow:0 column:0];
|
2012-05-30 16:10:56 +00:00
|
|
|
NSInteger r = [NSApp runModalForWindow:[self window]];
|
|
|
|
[[self window] close];
|
|
|
|
return r == NSOKButton;
|
|
|
|
}
|
2013-12-06 21:17:04 +00:00
|
|
|
|
|
|
|
- (void)setHardlinkOptionEnabled:(BOOL)enabled
|
|
|
|
{
|
|
|
|
[linkTypeRadio setEnabled:enabled];
|
|
|
|
}
|
2012-05-30 16:10:56 +00:00
|
|
|
@end
|