| 394 | | if(_terminateServerOnQuitButton) |
|---|
| 395 | | [_terminateServerOnQuitButton setState:[WCSettings boolForKey:WCTerminateServerOnQuit]]; |
|---|
| 396 | | |
|---|
| 397 | | if(_limitNewsButton) |
|---|
| 398 | | [_limitNewsButton setState:[WCSettings boolForKey:WCLimitNews]]; |
|---|
| 399 | | |
|---|
| 400 | | if(_logMethodMatrix) |
|---|
| 401 | | [_logMethodMatrix selectCellWithTag:[WCSettings intForKey:WCLogMethod]]; |
|---|
| 402 | | if(_syslogPopUpButton) |
|---|
| 403 | | [_syslogPopUpButton selectItemWithTitle:[WCSettings objectForKey:WCSyslogFacility]]; |
|---|
| 404 | | if(_logFileTextField) |
|---|
| 405 | | [_logFileTextField setStringValue:[WCSettings objectForKey:WCLogFile]]; |
|---|
| 406 | | if(_limitLogFileButton) |
|---|
| 407 | | [_limitLogFileButton setState:[WCSettings boolForKey:WCLimitLogFile]]; |
|---|
| 408 | | |
|---|
| 409 | | if(_limitLogFileTextField && [WCSettings intForKey:WCLimitLogFileLines] > 0) |
|---|
| | 394 | [_limitNewsButton setState:[WCSettings boolForKey:WCLimitNews]]; |
|---|
| | 395 | |
|---|
| | 396 | [_logMethodMatrix selectCellWithTag:[WCSettings intForKey:WCLogMethod]]; |
|---|
| | 397 | [_syslogPopUpButton selectItemWithTitle:[WCSettings objectForKey:WCSyslogFacility]]; |
|---|
| | 398 | [_logFileTextField setStringValue:[WCSettings objectForKey:WCLogFile]]; |
|---|
| | 399 | [_limitLogFileButton setState:[WCSettings boolForKey:WCLimitLogFile]]; |
|---|
| | 400 | |
|---|
| | 401 | if([WCSettings intForKey:WCLimitLogFileLines] > 0) |
|---|
| 421 | | if(_descriptionTextField) |
|---|
| 422 | | [_descriptionTextField setStringValue:[_config stringForKey:@"description"]]; |
|---|
| 423 | | if(_bannerImageView) |
|---|
| 424 | | [_bannerImageView setImage:[_config imageForKey:@"banner"]]; |
|---|
| 425 | | if(_useRendezvousButton) |
|---|
| 426 | | [_useRendezvousButton setState:[_config boolForKey:@"zeroconf"]]; |
|---|
| 427 | | if(_launchAtBootButton) { |
|---|
| 428 | | [_launchAtBootButton setState:[[NSFileManager defaultManager] fileExistsAtPath: |
|---|
| 429 | | WCExpandWiredPath(@"etc/wired.startup")]]; |
|---|
| 430 | | } |
|---|
| 431 | | |
|---|
| 432 | | if(_totalDownloadsTextField) |
|---|
| 433 | | [_totalDownloadsTextField setStringValue:[_config stringForKey:@"total downloads"]]; |
|---|
| 434 | | if(_clientDownloadsTextField) |
|---|
| 435 | | [_clientDownloadsTextField setStringValue:[_config stringForKey:@"client downloads"]]; |
|---|
| 436 | | |
|---|
| 437 | | if(_downloadSpeedTextField && [_config intForKey:@"total download speed"] > 0) { |
|---|
| 438 | | [_downloadSpeedTextField setIntValue: |
|---|
| 439 | | [_config doubleForKey:@"total download speed"] / 1024]; |
|---|
| 440 | | } |
|---|
| 441 | | |
|---|
| 442 | | if(_totalUploadsTextField) |
|---|
| 443 | | [_totalUploadsTextField setStringValue:[_config stringForKey:@"total uploads"]]; |
|---|
| 444 | | if(_clientUploadsTextField) |
|---|
| 445 | | [_clientUploadsTextField setStringValue:[_config stringForKey:@"client uploads"]]; |
|---|
| 446 | | |
|---|
| 447 | | if(_uploadSpeedTextField && [_config intForKey:@"total upload speed"] > 0) { |
|---|
| 448 | | [_uploadSpeedTextField setIntValue: |
|---|
| 449 | | [_config doubleForKey:@"total upload speed"] / 1024]; |
|---|
| 450 | | } |
|---|
| 451 | | |
|---|
| 452 | | if(_filesTextField) |
|---|
| 453 | | [_filesTextField setStringValue:[_config pathForKey:@"files"]]; |
|---|
| | 411 | [_descriptionTextField setStringValue:[_config stringForKey:@"description"]]; |
|---|
| | 412 | [_bannerImageView setImage:[_config imageForKey:@"banner"]]; |
|---|
| | 413 | [_useRendezvousButton setState:[_config boolForKey:@"zeroconf"]]; |
|---|
| | 414 | [_launchAtBootButton setState:[[NSFileManager defaultManager] fileExistsAtPath: |
|---|
| | 415 | WCExpandWiredPath(@"etc/wired.startup")]]; |
|---|
| | 416 | |
|---|
| | 417 | [_totalDownloadsTextField setStringValue:[_config stringForKey:@"total downloads"]]; |
|---|
| | 418 | [_clientDownloadsTextField setStringValue:[_config stringForKey:@"client downloads"]]; |
|---|
| | 419 | |
|---|
| | 420 | if([_config intForKey:@"total download speed"] > 0) |
|---|
| | 421 | [_downloadSpeedTextField setIntValue:[_config doubleForKey:@"total download speed"] / 1024]; |
|---|
| | 422 | |
|---|
| | 423 | [_totalUploadsTextField setStringValue:[_config stringForKey:@"total uploads"]]; |
|---|
| | 424 | [_clientUploadsTextField setStringValue:[_config stringForKey:@"client uploads"]]; |
|---|
| | 425 | |
|---|
| | 426 | if([_config intForKey:@"total upload speed"] > 0) |
|---|
| | 427 | [_uploadSpeedTextField setIntValue:[_config doubleForKey:@"total upload speed"] / 1024]; |
|---|
| | 428 | |
|---|
| | 429 | [_filesTextField setStringValue:[_config pathForKey:@"files"]]; |
|---|
| 463 | | if(_searchMethodMatrix) { |
|---|
| 464 | | if([[_config stringForKey:@"search method"] isEqualToString:@"live"]) |
|---|
| 465 | | [_searchMethodMatrix selectCellWithTag:0]; |
|---|
| | 437 | if([[_config stringForKey:@"search method"] isEqualToString:@"live"]) |
|---|
| | 438 | [_searchMethodMatrix selectCellWithTag:0]; |
|---|
| | 439 | else |
|---|
| | 440 | [_searchMethodMatrix selectCellWithTag:1]; |
|---|
| | 441 | |
|---|
| | 442 | if([[_config stringForKey:@"index"] length] == 0) { |
|---|
| | 443 | [_indexPopUpButton selectItemAtIndex:0]; |
|---|
| | 444 | } else { |
|---|
| | 445 | if([_config intForKey:@"index time"] == 3600) |
|---|
| | 446 | [_indexPopUpButton selectItemAtIndex:2]; |
|---|
| | 447 | else if([_config intForKey:@"index time"] == 86400) |
|---|
| | 448 | [_indexPopUpButton selectItemAtIndex:3]; |
|---|
| 467 | | [_searchMethodMatrix selectCellWithTag:1]; |
|---|
| 468 | | } |
|---|
| 469 | | |
|---|
| 470 | | if(_indexPopUpButton) { |
|---|
| 471 | | if([[_config stringForKey:@"index"] length] == 0) { |
|---|
| 472 | | [_indexPopUpButton selectItemAtIndex:0]; |
|---|
| 473 | | } else { |
|---|
| 474 | | if([_config intForKey:@"index time"] == 3600) |
|---|
| 475 | | [_indexPopUpButton selectItemAtIndex:2]; |
|---|
| 476 | | else if([_config intForKey:@"index time"] == 86400) |
|---|
| 477 | | [_indexPopUpButton selectItemAtIndex:3]; |
|---|
| 478 | | else |
|---|
| 479 | | [_indexPopUpButton selectItemAtIndex:1]; |
|---|
| 480 | | } |
|---|
| 481 | | } |
|---|
| 482 | | |
|---|
| 483 | | if(_showInvisibleButton) |
|---|
| 484 | | [_showInvisibleButton setState:[_config boolForKey:@"show invisible files"]]; |
|---|
| 485 | | if(_showDotFilesButton) |
|---|
| 486 | | [_showDotFilesButton setState:[_config boolForKey:@"show dot files"]]; |
|---|
| 487 | | |
|---|
| 488 | | if(_allowUnencryptedButton) { |
|---|
| 489 | | [_allowUnencryptedButton setState: |
|---|
| 490 | | ([[_config stringForKey:@"transfer cipher"] rangeOfString:@"NULL"].location != NSNotFound)]; |
|---|
| 491 | | } |
|---|
| 492 | | |
|---|
| 493 | | if(_showDotFilesButton) |
|---|
| 494 | | [_showDotFilesButton setStringValue:[_config stringForKey:@"news limit"]]; |
|---|
| | 450 | [_indexPopUpButton selectItemAtIndex:1]; |
|---|
| | 451 | } |
|---|
| | 452 | |
|---|
| | 453 | [_showInvisibleButton setState:[_config boolForKey:@"show invisible files"]]; |
|---|
| | 454 | [_showDotFilesButton setState:[_config boolForKey:@"show dot files"]]; |
|---|
| | 455 | |
|---|
| | 456 | [_allowUnencryptedButton setState: |
|---|
| | 457 | ([[_config stringForKey:@"transfer cipher"] rangeOfString:@"NULL"].location != NSNotFound)]; |
|---|
| | 458 | |
|---|
| | 459 | [_showDotFilesButton setStringValue:[_config stringForKey:@"news limit"]]; |
|---|
| 511 | | if(_terminateServerOnQuitButton) |
|---|
| 512 | | [WCSettings setBool:([_terminateServerOnQuitButton state] == NSOnState) forKey:WCTerminateServerOnQuit]; |
|---|
| 513 | | |
|---|
| 514 | | if(_limitNewsButton) |
|---|
| 515 | | [WCSettings setBool:([_limitNewsButton state] == NSOnState) forKey:WCLimitNews]; |
|---|
| 516 | | |
|---|
| 517 | | if(_logMethodMatrix) |
|---|
| 518 | | [WCSettings setInt:[[_logMethodMatrix selectedCell] tag] forKey:WCLogMethod]; |
|---|
| 519 | | if(_syslogPopUpButton) |
|---|
| 520 | | [WCSettings setObject:[_syslogPopUpButton titleOfSelectedItem] forKey:WCSyslogFacility]; |
|---|
| 521 | | if(_logFileTextField) |
|---|
| 522 | | [WCSettings setObject:[_logFileTextField stringValue] forKey:WCLogFile]; |
|---|
| 523 | | if(_limitLogFileButton) |
|---|
| 524 | | [WCSettings setBool:([_limitLogFileButton state] == NSOnState) forKey:WCLimitLogFile]; |
|---|
| 525 | | if(_limitLogFileTextField) |
|---|
| 526 | | [WCSettings setInt:[_limitLogFileTextField intValue] forKey:WCLimitLogFileLines]; |
|---|
| | 474 | [WCSettings setBool:([_limitNewsButton state] == NSOnState) forKey:WCLimitNews]; |
|---|
| | 475 | |
|---|
| | 476 | [WCSettings setInt:[[_logMethodMatrix selectedCell] tag] forKey:WCLogMethod]; |
|---|
| | 477 | [WCSettings setObject:[_syslogPopUpButton titleOfSelectedItem] forKey:WCSyslogFacility]; |
|---|
| | 478 | [WCSettings setObject:[_logFileTextField stringValue] forKey:WCLogFile]; |
|---|
| | 479 | [WCSettings setBool:([_limitLogFileButton state] == NSOnState) forKey:WCLimitLogFile]; |
|---|
| | 480 | [WCSettings setInt:[_limitLogFileTextField intValue] forKey:WCLimitLogFileLines]; |
|---|
| 529 | | if(_nameTextField) |
|---|
| 530 | | [_config setString:[_nameTextField stringValue] forKey:@"name"]; |
|---|
| 531 | | if(_controlPortTextField) |
|---|
| 532 | | [_config setString:[_controlPortTextField stringValue] forKey:@"port"]; |
|---|
| 533 | | if(_descriptionTextField) |
|---|
| 534 | | [_config setString:[_descriptionTextField stringValue] forKey:@"description"]; |
|---|
| 535 | | if(_useRendezvousButton) |
|---|
| 536 | | [_config setBool:([_useRendezvousButton state] == NSOnState) forKey:@"zeroconf"]; |
|---|
| 537 | | |
|---|
| 538 | | if(_totalDownloadsTextField) |
|---|
| 539 | | [_config setString:[_totalDownloadsTextField stringValue] forKey:@"total downloads"]; |
|---|
| 540 | | if(_clientDownloadsTextField) |
|---|
| 541 | | [_config setString:[_clientDownloadsTextField stringValue] forKey:@"client downloads"]; |
|---|
| 542 | | if(_downloadSpeedTextField) |
|---|
| 543 | | [_config setInt:[_downloadSpeedTextField intValue] * 1024 forKey:@"total download speed"]; |
|---|
| 544 | | if(_totalUploadsTextField) |
|---|
| 545 | | [_config setString:[_totalUploadsTextField stringValue] forKey:@"total uploads"]; |
|---|
| 546 | | if(_clientUploadsTextField) |
|---|
| 547 | | [_config setString:[_clientUploadsTextField stringValue] forKey:@"client uploads"]; |
|---|
| 548 | | if(_uploadSpeedTextField) |
|---|
| 549 | | [_config setInt:[_uploadSpeedTextField intValue] * 1024 forKey:@"total upload speed"]; |
|---|
| 550 | | |
|---|
| 551 | | if(_filesTextField) |
|---|
| 552 | | [_config setString:[_filesTextField stringValue] forKey:@"files"]; |
|---|
| | 483 | [_config setString:[_nameTextField stringValue] forKey:@"name"]; |
|---|
| | 484 | [_config setString:[_controlPortTextField stringValue] forKey:@"port"]; |
|---|
| | 485 | [_config setString:[_descriptionTextField stringValue] forKey:@"description"]; |
|---|
| | 486 | [_config setBool:([_useRendezvousButton state] == NSOnState) forKey:@"zeroconf"]; |
|---|
| | 487 | |
|---|
| | 488 | [_config setString:[_totalDownloadsTextField stringValue] forKey:@"total downloads"]; |
|---|
| | 489 | [_config setString:[_clientDownloadsTextField stringValue] forKey:@"client downloads"]; |
|---|
| | 490 | [_config setInt:[_downloadSpeedTextField intValue] * 1024 forKey:@"total download speed"]; |
|---|
| | 491 | [_config setString:[_totalUploadsTextField stringValue] forKey:@"total uploads"]; |
|---|
| | 492 | [_config setString:[_clientUploadsTextField stringValue] forKey:@"client uploads"]; |
|---|
| | 493 | [_config setInt:[_uploadSpeedTextField intValue] * 1024 forKey:@"total upload speed"]; |
|---|
| | 494 | |
|---|
| | 495 | [_config setString:[_filesTextField stringValue] forKey:@"files"]; |
|---|
| 555 | | if(_urlTextField) |
|---|
| 556 | | [_config setString:[_urlTextField stringValue] forKey:@"url"]; |
|---|
| 557 | | if(_bandwidthPopUpButton) |
|---|
| 558 | | [_config setInt:[[_bandwidthPopUpButton selectedItem] tag] forKey:@"bandwidth"]; |
|---|
| 559 | | |
|---|
| 560 | | if(_searchMethodMatrix) { |
|---|
| 561 | | if([[_searchMethodMatrix selectedCell] tag] == 0) |
|---|
| 562 | | [_config setString:@"live" forKey:@"search method"]; |
|---|
| 563 | | else |
|---|
| 564 | | [_config setString:@"index" forKey:@"search method"]; |
|---|
| 565 | | } |
|---|
| 566 | | |
|---|
| 567 | | if(_indexPopUpButton) { |
|---|
| 568 | | switch([_indexPopUpButton indexOfSelectedItem]) { |
|---|
| 569 | | case 0: |
|---|
| 570 | | [_config setString:@"" forKey:@"index"]; |
|---|
| 571 | | [_config setString:@"" forKey:@"index time"]; |
|---|
| 572 | | break; |
|---|
| 573 | | |
|---|
| 574 | | case 1: |
|---|
| 575 | | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| 576 | | [_config setString:@"" forKey:@"index time"]; |
|---|
| 577 | | break; |
|---|
| 578 | | |
|---|
| 579 | | case 2: |
|---|
| 580 | | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| 581 | | [_config setInt:3600 forKey:@"index time"]; |
|---|
| 582 | | break; |
|---|
| 583 | | |
|---|
| 584 | | case 3: |
|---|
| 585 | | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| 586 | | [_config setInt:86400 forKey:@"index time"]; |
|---|
| 587 | | break; |
|---|
| 588 | | } |
|---|
| 589 | | } |
|---|
| 590 | | |
|---|
| 591 | | if(_showDotFilesButton) |
|---|
| 592 | | [_config setBool:([_showInvisibleButton state] == NSOnState) forKey:@"show invisible files"]; |
|---|
| 593 | | if(_showDotFilesButton) |
|---|
| 594 | | [_config setBool:([_showDotFilesButton state] == NSOnState) forKey:@"show dot files"]; |
|---|
| 595 | | |
|---|
| 596 | | if(_allowUnencryptedButton) { |
|---|
| 597 | | if([_allowUnencryptedButton state] == NSOnState) |
|---|
| 598 | | [_config setString:@"ALL:NULL:!MD5:@STRENGTH" forKey:@"transfer cipher"]; |
|---|
| 599 | | else |
|---|
| 600 | | [_config setString:@"ALL:!MD5:@STRENGTH" forKey:@"transfer cipher"]; |
|---|
| 601 | | } |
|---|
| 602 | | |
|---|
| 603 | | if(_limitNewsButton) { |
|---|
| 604 | | if([_limitNewsButton state] == NSOnState) |
|---|
| 605 | | [_config setString:[_limitNewsTextField stringValue] forKey:@"news limit"]; |
|---|
| 606 | | else |
|---|
| 607 | | [_config setString:@"" forKey:@"news limit"]; |
|---|
| 608 | | } |
|---|
| | 498 | [_config setString:[_urlTextField stringValue] forKey:@"url"]; |
|---|
| | 499 | [_config setInt:[[_bandwidthPopUpButton selectedItem] tag] forKey:@"bandwidth"]; |
|---|
| | 500 | |
|---|
| | 501 | if([[_searchMethodMatrix selectedCell] tag] == 0) |
|---|
| | 502 | [_config setString:@"live" forKey:@"search method"]; |
|---|
| | 503 | else |
|---|
| | 504 | [_config setString:@"index" forKey:@"search method"]; |
|---|
| | 505 | |
|---|
| | 506 | switch([_indexPopUpButton indexOfSelectedItem]) { |
|---|
| | 507 | case 0: |
|---|
| | 508 | [_config setString:@"" forKey:@"index"]; |
|---|
| | 509 | [_config setString:@"" forKey:@"index time"]; |
|---|
| | 510 | break; |
|---|
| | 511 | |
|---|
| | 512 | case 1: |
|---|
| | 513 | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| | 514 | [_config setString:@"" forKey:@"index time"]; |
|---|
| | 515 | break; |
|---|
| | 516 | |
|---|
| | 517 | case 2: |
|---|
| | 518 | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| | 519 | [_config setInt:3600 forKey:@"index time"]; |
|---|
| | 520 | break; |
|---|
| | 521 | |
|---|
| | 522 | case 3: |
|---|
| | 523 | [_config setString:@"files.index" forKey:@"index"]; |
|---|
| | 524 | [_config setInt:86400 forKey:@"index time"]; |
|---|
| | 525 | break; |
|---|
| | 526 | } |
|---|
| | 527 | |
|---|
| | 528 | [_config setBool:([_showInvisibleButton state] == NSOnState) forKey:@"show invisible files"]; |
|---|
| | 529 | [_config setBool:([_showDotFilesButton state] == NSOnState) forKey:@"show dot files"]; |
|---|
| | 530 | |
|---|
| | 531 | if([_allowUnencryptedButton state] == NSOnState) |
|---|
| | 532 | [_config setString:@"ALL:NULL:!MD5:@STRENGTH" forKey:@"transfer cipher"]; |
|---|
| | 533 | else |
|---|
| | 534 | [_config setString:@"ALL:!MD5:@STRENGTH" forKey:@"transfer cipher"]; |
|---|
| | 535 | |
|---|
| | 536 | if([_limitNewsButton state] == NSOnState) |
|---|
| | 537 | [_config setString:[_limitNewsTextField stringValue] forKey:@"news limit"]; |
|---|
| | 538 | else |
|---|
| | 539 | [_config setString:@"" forKey:@"news limit"]; |
|---|