-
Notifications
You must be signed in to change notification settings - Fork 2
/
AppController.m
504 lines (424 loc) · 19.5 KB
/
AppController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
#import <Carbon/Carbon.h>
#import <JaguarAppKit/JaguarAppKit.h>
#import "AppController.h"
#import "UserDefaults.h"
#import "Environment.h"
#import "Errors.h"
#import "ChooseScriptController.h"
#import "KwikiController.h"
#import "LicenseWindowController.h"
#import "ScriptBrowserDocument.h"
#import "ScriptDocument+Running.h"
#import "ScriptEditorDocument.h"
#import "ScriptReference.h"
#import "ScriptWindowController.h"
#import "SoftwareLicenseController.h"
#import "WelcomeWindowController.h"
#import "ServicesController.h"
#import "EncodingManager.h"
#import "RunningPreferencePane.h"
#import "AppearancePreferencePane.h"
#import "GeneralPreferencePane.h"
#import "ScriptSessionController.h"
// Pipe trial period
static NSTimeInterval TrialPeriodInSeconds = 86400 * 15;
// Pipe product key for generating and verifying license keys (SHA1-HMAC)
static unsigned char const ProductKey[128] = {
0x7c, 0xf1, 0xe4, 0x7f, 0xf7, 0x1d, 0x8c, 0x40,
0xd1, 0xe6, 0xdf, 0x23, 0xcd, 0x0c, 0xb5, 0xd7,
0x14, 0x9e, 0x3e, 0x18, 0x6e, 0xb2, 0x2e, 0x96,
0xa7, 0xcb, 0x87, 0x2a, 0xed, 0xee, 0x68, 0x4c,
0xf4, 0xe7, 0x30, 0x67, 0xcc, 0x4d, 0xce, 0x27,
0x4c, 0xce, 0xb3, 0x24, 0xef, 0x05, 0x1f, 0x53,
0x29, 0x35, 0x2c, 0xc7, 0xc1, 0x57, 0x01, 0x77,
0xf2, 0x1b, 0x74, 0x3f, 0xe3, 0x3a, 0x3c, 0xe5,
0xd7, 0x06, 0x09, 0x96, 0x51, 0xc2, 0x44, 0x33,
0xa1, 0xce, 0x1a, 0x5b, 0x42, 0x20, 0x28, 0xd5,
0xa1, 0x7f, 0x90, 0x6f, 0x13, 0x4e, 0x78, 0x03,
0xc7, 0x6a, 0xdd, 0x46, 0x76, 0x7c, 0x8c, 0x7b,
0x46, 0x16, 0x6f, 0x95, 0xf9, 0x14, 0x3c, 0xee,
0x31, 0x5a, 0xb4, 0xc8, 0x6c, 0x8d, 0xeb, 0x04,
0x01, 0x34, 0xcb, 0x1f, 0xa4, 0xd5, 0xa6, 0x46,
0x53, 0x0e, 0xca, 0x7c, 0xa7, 0x01, 0x31, 0xa9
};
@implementation AppController
#pragma mark Application Setup
- (void)createSupportDirectories
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *supportDirectory, *currentDirectory;
NSEnumerator *directoryEnumerator;
BOOL exists, isDirectory;
supportDirectory = [NSString stringWithFormat:@"%@/Library/Application Support/%@", NSHomeDirectory(), [[NSProcessInfo processInfo] processName]];
directoryEnumerator = [[NSArray arrayWithObjects:
supportDirectory,
[supportDirectory stringByAppendingPathComponent:@"Templates"],
nil] objectEnumerator];
while ((currentDirectory = [directoryEnumerator nextObject])) {
exists = [fileManager fileExistsAtPath:currentDirectory isDirectory:&isDirectory];
if (!exists) {
// Try to create the directory if it does not yet exist
if (![fileManager createDirectoryAtPath:currentDirectory attributes:nil]) {
@throw [NSException exceptionWithUnderlyingError:[NSError errorWithDomain:PipeApplicationErrorDomain code:PipeApplicationInitialSetupError localizedDescription:[NSString stringWithFormat:NSLocalizedString(@"Failed to create directory '%@'.", @"Failed to create support directory during app launch (ERR)"), currentDirectory] userInfo:nil]];
}
}
else if (!isDirectory) {
@throw [NSException exceptionWithUnderlyingError:[NSError errorWithDomain:PipeApplicationErrorDomain code:PipeApplicationInitialSetupError localizedDescription:[NSString stringWithFormat:NSLocalizedString(@"'%@' is not a directory (but should be).", @"Failed to create support directory during app launch (ERR)"), currentDirectory] userInfo:nil]];
}
}
}
- (void)registerInitialDefaultValues
{
[[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:0], PipeStartupActionDefaultKey,
[NSNumber numberWithBool:YES], JGAutoSoftwareUpdateEnabledDefaultKey,
[NSNumber numberWithInt:0], PipeMaximumScriptExecutionTimeDefaultKey,
[NSNumber numberWithInt:0], PipeMaximumScriptOutputSizeDefaultKey,
[NSNumber numberWithBool:NO], PipeAutoRunScriptsDefaultKey,
[NSNumber numberWithInt:0], PipeInputLineEndingsConversionDefaultKey,
[NSNumber numberWithBool:NO], PipeDidShowWelcomeMessageDefaultKey,
[NSNumber numberWithUnsignedInt:NSUTF8StringEncoding], PipeLastSelectedTextEncodingInFilePanelDefaultKey,
[NSNumber numberWithUnsignedInt:NSUTF8StringEncoding], PipeTextEncodingDefaultKey,
@"BBEdit", PipeExternalEditorDefaultKey,
[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]], PipeScriptBackgroundColorDefaultKey,
[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]], PipeInputBackgroundColorDefaultKey,
[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]], PipeOutputBackgroundColorDefaultKey,
[NSArchiver archivedDataWithRootObject:[NSFont fontWithName:@"Monaco" size:10]], PipeFontDefaultKey,
nil]];
}
- (void)setupEnvironment
{
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSMutableString *shortVersionString;
NSCharacterSet *versionCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
NSRange nonVersionCharacterRange;
shortVersionString = [NSMutableString stringWithString:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
// Strip away version modifiers like "rc"
nonVersionCharacterRange = [shortVersionString rangeOfCharacterFromSet:[versionCharacterSet invertedSet]];
if (nonVersionCharacterRange.location != NSNotFound) {
[shortVersionString deleteCharactersInRange:NSMakeRange(nonVersionCharacterRange.location, [shortVersionString length] - nonVersionCharacterRange.location)];
}
[shortVersionString replaceOccurrencesOfString:@"." withString:@"" options:0 range:NSMakeRange(0, [shortVersionString length])];
[processInfo setValue:shortVersionString forEnvironmentKey:PipeVersionEnvironmentKey];
[processInfo setValue:[[ScriptSessionController sharedController] connectionName] forEnvironmentKey:PipeSessionServerEnvironmentKey];
}
- (void)setupLicensing
{
SoftwareLicenseController *licenseController;
NSDate *firstLaunchDate;
licenseController = [SoftwareLicenseController sharedController];
[licenseController setProductKey:[NSData dataWithBytes:ProductKey length:128]];
[licenseController setAllowedTrialPeriod:TrialPeriodInSeconds];
[licenseController setLicenseKey:JGUserDefaultValue(PipeLicenseKeyDefaultKey)];
if ((firstLaunchDate = JGUserDefaultValue(PipeFirstLaunchDateDefaultKey)))
[licenseController setFirstLaunchDate:firstLaunchDate];
[[KwikiController sharedController] loadKwikiList:self];
}
- (void)verifyLicense
{
SoftwareLicenseController *softwareLicenseController = [SoftwareLicenseController sharedController];
BOOL shouldRequireLicense = NO;
if ([softwareLicenseController warningFlag] && [softwareLicenseController softwareIsTrialVersion]) {
shouldRequireLicense = YES;
}
else shouldRequireLicense = ![softwareLicenseController softwareIsLicensed];
if (shouldRequireLicense) {
if ([[LicenseWindowController sharedController] runModal] != NSOKButton) {
[NSApp terminate:self];
return;
}
else {
[softwareLicenseController setLicenseKey:JGUserDefaultValue(PipeLicenseKeyDefaultKey)];
if ([NSApp mainWindow] == nil) {
[self applicationOpenUntitledFile:NSApp];
}
}
}
// Only when the license checks are satisfied, enable saving of the script browser list.
[[KwikiController sharedController] setSavesKwikiList:YES];
}
- (void)registerServices
{
[NSApp setServicesProvider:[ServicesController sharedController]];
NSUpdateDynamicServices();
}
- (void)configureExternalEditor:(id)sender
{
NSString *appPath, *appIdentifier;
NSBundle *appBundle;
appPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:JGUserDefaultValue(PipeExternalEditorDefaultKey)];
appBundle = [NSBundle bundleWithPath:appPath];
appIdentifier = [appBundle bundleIdentifier];
if (appIdentifier != nil)
[[ODBEditor sharedODBEditor] setEditorBundleIdentifier:appIdentifier];
}
- (IBAction)openReleaseNotes:(id)sender
{
NSString *versionString;
versionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.kcore.de/software/pipe/releasenotes-%@", versionString]]];
}
- (IBAction)showWelcomeMessage:(id)sender
{
WelcomeWindowController *windowController;
windowController = [[WelcomeWindowController alloc] init];
[windowController runModal];
[windowController release];
JGSetUserDefaultValue(PipeDidShowWelcomeMessageDefaultKey, [NSNumber numberWithBool:YES]);
}
#pragma mark Actions
- (IBAction)doNothing:(id)sender
{
// Some menu items have their "state" bound to a user default (such as soft wrap). They will automatically update the default when they are selected. This action is only necessary to make the items enabled.
}
- (IBAction)enterLicense:(id)sender
{
[[LicenseWindowController sharedController] runModal];
}
- (IBAction)showScriptBrowser:(id)sender
{
[[ScriptBrowserDocument sharedDocument] showWindows];
}
- (IBAction)switchInputLineEndingsConversion:(id)sender
{
JGSetUserDefaultValue(PipeInputLineEndingsConversionDefaultKey, [NSNumber numberWithInt:[sender tag]]);
}
- (IBAction)newDocumentFromTemplate:(id)sender
{
ScriptEditorDocument *newDocument;
NSString *templatePath;
templatePath = [sender representedObject];
if ([NSEvent isCommandKeyDown]) {
[[NSWorkspace sharedWorkspace] selectFile:templatePath inFileViewerRootedAtPath:nil];
}
else if ([NSEvent isOptionKeyDown]) {
[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfFile:templatePath display:YES];
}
else {
newDocument = [[ScriptEditorDocument alloc] initWithTemplatePath:templatePath];
[[NSDocumentController sharedDocumentController] addDocument:newDocument];
[newDocument makeWindowControllers];
[newDocument showWindows];
[newDocument release];
}
}
- (IBAction)checkForSoftwareUpdates:(id)sender
{
NSBundle *mainBundle;
id propertyList;
NSError *error;
int myVersion;
NSAlert *alert;
mainBundle = [NSBundle mainBundle];
myVersion = [[[mainBundle infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey] intValue];
propertyList = [[JGSoftwareUpdateChecker checkerWithBundle:mainBundle client:nil] runSynchronouslyReturningError:&error];
if (error) {
alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"Could not check for updates", @"Alert message text")];
[alert setAlertStyle:NSWarningAlertStyle];
[alert setInformativeText:[error localizedDescription]];
[alert runModal];
[alert release];
}
else if (myVersion < [[propertyList objectForKey:JGSoftwareUpdateBundleVersionKey] intValue]) {
alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"A new version of Pipe (%@) is now available for download.\nDo you want to update your copy?", @"Alert text when new updates are available (manual check)"), [propertyList objectForKey:JGSoftwareUpdateHumanReadableVersionKey]]];
[alert setInformativeText:NSLocalizedString(@"If you do not want to update now, simply check for updates at a later time to display this message again.", @"Informative text when new updates are available (manual check)")];
[alert addButtonWithTitle:NSLocalizedString(@"Update Now", @"Software update alert button (manual check)")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Software update alert button (manual check)")];
if ([alert runModal] == NSAlertFirstButtonReturn) {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[propertyList objectForKey:JGSoftwareUpdateReleaseNotesURLKey]]];
}
}
else {
alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:NSLocalizedString(@"No updates available", @"Alert message text")];
[alert setInformativeText:NSLocalizedString(@"Your copy of Pipe is up-to-date.", @"Alert informative text")];
[alert runModal];
[alert release];
}
}
#pragma mark Accessors
- (KwikiController *)kwikiController
{
return [KwikiController sharedController];
}
- (ScriptBrowserDocument *)scriptBrowser
{
return [ScriptBrowserDocument sharedDocument];
}
#pragma mark Menu Delegate
- (void)menuNeedsUpdate:(NSMenu *)menu
{
NSString *templatesDirectory, *currentTemplate;
NSDirectoryEnumerator *templateEnumerator;
NSDictionary *templateAttributes;
NSMenuItem *newItem;
NSAssert(menu == templatesMenu, @"menuNeedsUpdate called for unknown menu");
// Remove all items
while ([menu numberOfItems])
[menu removeItemAtIndex:0];
templatesDirectory = [NSString stringWithFormat:@"%@/Library/Application Support/%@/Templates", NSHomeDirectory(), [[NSProcessInfo processInfo] processName]];
templateEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:templatesDirectory];
while ((currentTemplate = [templateEnumerator nextObject])) {
templateAttributes = [templateEnumerator fileAttributes];
if ([[templateAttributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]) {
[templateEnumerator skipDescendents];
if ([[currentTemplate pathExtension] isEqualToString:@"pipe"]) {
newItem = (NSMenuItem *)[menu addItemWithTitle:[currentTemplate stringByDeletingPathExtension] action:@selector(newDocumentFromTemplate:) keyEquivalent:@""];
[newItem setRepresentedObject:[templatesDirectory stringByAppendingPathComponent:currentTemplate]];
[newItem setEnabled:[self validateMenuItem:newItem]];
}
}
}
if ([menu numberOfItems] > 0)
[menu addItem:[NSMenuItem separatorItem]];
templatesDirectory = [NSString stringWithFormat:@"%@/Templates", [[NSBundle mainBundle] resourcePath]];
templateEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:templatesDirectory];
while ((currentTemplate = [templateEnumerator nextObject])) {
templateAttributes = [templateEnumerator fileAttributes];
if ([[templateAttributes objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]) {
[templateEnumerator skipDescendents];
if ([[currentTemplate pathExtension] isEqualToString:@"pipe"]) {
newItem = (NSMenuItem *)[menu addItemWithTitle:[currentTemplate stringByDeletingPathExtension] action:@selector(newDocumentFromTemplate:) keyEquivalent:@""];
[newItem setRepresentedObject:[templatesDirectory stringByAppendingPathComponent:currentTemplate]];
[newItem setEnabled:[self validateMenuItem:newItem]];
}
}
}
}
#pragma mark User Interface Validation
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
SEL action = [menuItem action];
// Disable all menu items when the license window is shown.
if ([NSApp modalWindow] == [[LicenseWindowController sharedController] window]) {
return NO;
}
else {
if (action == @selector(switchInputLineEndingsConversion:)) {
[menuItem setState:([menuItem tag] == [JGUserDefaultValue(PipeInputLineEndingsConversionDefaultKey) intValue])];
}
return YES;
}
}
#pragma mark NSApplication delegate
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
return [[SoftwareLicenseController sharedController] softwareIsLicensed];
}
- (BOOL)applicationOpenUntitledFile:(NSApplication *)theApplication
{
switch ([JGUserDefaultValue(PipeStartupActionDefaultKey) intValue]) {
case 0:
[[NSDocumentController sharedDocumentController] openUntitledDocumentOfType:PipeScriptDocumentType display:YES];
return YES;
case 1:
[self showScriptBrowser:self];
return YES;
default:
NSLog(@"Unknown startup action: %@", [JGUserDefaultValue(PipeStartupActionDefaultKey) intValue]);
return NO;
}
}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
// Ignore SIGPIPE from launched subtasks.
signal(SIGPIPE, SIG_IGN);
@try {
[self registerInitialDefaultValues];
[[JGPreferenceWindowController sharedController] setDelegate:self];
[self setupLicensing];
[self createSupportDirectories];
[self configureExternalEditor:self];
[self setupEnvironment];
}
@catch (NSException *exception) {
NSAlert *alert;
alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"Fatal error", @"Error message when an exception is raised during the application launch phase")];
[alert setInformativeText:[exception description]];
[alert setAlertStyle:NSCriticalAlertStyle];
[alert runModal];
[alert release];
[NSApp terminate:self];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
hasLaunchedCompletely = YES;
[self verifyLicense];
[self registerServices];
if (![JGUserDefaultValue(PipeDidShowWelcomeMessageDefaultKey) boolValue])
[self showWelcomeMessage:self];
}
#pragma mark NSDocumentController delegate
- (void)documentController:(JGDocumentController *)documentController prepareOpenPanel:(NSOpenPanel *)openPanel
{
[openPanel setDelegate:self];
[openPanel setAccessoryView:[[EncodingManager sharedInstance] encodingAccessory:[JGUserDefaultValue(PipeLastSelectedTextEncodingInFilePanelDefaultKey) unsignedIntValue] includeDefaultEntry:NO enableIgnoreRichTextButton:NO encodingPopUp:NULL ignoreRichTextButton:NULL]];
}
- (void)panelSelectionDidChange:(NSOpenPanel *)panel
{
NSPopUpButton *popUpButton;
JGDocumentController *documentController = [NSDocumentController sharedDocumentController];
NSString *selectedType;
popUpButton = [[panel accessoryView] viewWithTag:1];
selectedType = [documentController typeFromFileExtension:[[panel filename] pathExtension]];
if ([selectedType isEqualToString:PipeScriptDocumentType] || [selectedType isEqualToString:PipeScriptFlatDocumentType])
[popUpButton setEnabled:NO];
else
[popUpButton setEnabled:YES];
}
#pragma mark Preference Window Controller Delegate
- (NSArray *)panesForPreferenceWindowController:(JGPreferenceWindowController *)aController
{
static NSArray *preferencePanes = nil;
if (preferencePanes == nil) {
preferencePanes = [[NSArray alloc] initWithObjects:
[[[GeneralPreferencePane alloc] init] autorelease],
[[[AppearancePreferencePane alloc] init] autorelease],
[[[RunningPreferencePane alloc] init] autorelease],
nil];
}
return preferencePanes;
}
#pragma mark Software Update
- (BOOL)application:(JGApplication *)application softwareUpdatesAvailable:(NSDictionary *)updateInfo
{
return [self presentSoftwareUpdateDialogForPropertyList:updateInfo];
}
- (BOOL)presentSoftwareUpdateDialogForPropertyList:(id)propertyList
{
NSAlert *alert;
BOOL result = NO;
if ([NSApp modalWindow] == nil) {
alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSInformationalAlertStyle];
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"A new version of Pipe (%@) is now available for download.\nDo you want to update your copy?", @"Notification alert when a new version of Pipe is available for download"), [propertyList objectForKey:JGSoftwareUpdateHumanReadableVersionKey]]];
[alert setInformativeText:NSLocalizedString(@"You can turn off automatic update checks in the preferences if you do not wish to be notified of new versions in the future.", @"Informative text when a new version of Pipe is available for download")];
[alert addButtonWithTitle:NSLocalizedString(@"Update Now", @"Software update alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Ask Again Later", @"Software update alert")];
[alert addButtonWithTitle:NSLocalizedString(@"Change Preferences...", @"Software update alert")];
switch ([alert runModal]) {
case NSAlertFirstButtonReturn:
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[propertyList objectForKey:JGSoftwareUpdateReleaseNotesURLKey]]];
result = YES;
break;
case NSAlertSecondButtonReturn:
result = NO;
break;
case NSAlertThirdButtonReturn:
result = YES;
[[JGPreferenceWindowController sharedController] showWindow:self];
[[JGPreferenceWindowController sharedController] setSelectedPaneIndex:0];
break;
}
[alert release];
return result;
}
else return NO; // modal window is open; don't interfere
}
@end