2012-05-30 16:10:56 +00:00
|
|
|
/*
|
2013-04-28 14:35:51 +00:00
|
|
|
Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
2012-05-30 16:10:56 +00:00
|
|
|
|
|
|
|
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
|
|
|
which should be included with this package. The terms are also available at
|
|
|
|
http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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;
|
|
|
|
}
|
|
|
|
@end
|