blob: 2760908f1b6e106b8ee41b43c79180e5a6432982 [file] [log] [blame]
Ilya Moiseenko1dc76da2013-09-30 11:53:36 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * @copyright See LICENCE for copyright and license information.
4 *
5 * @author Alexander Afanasyev <alexander.afanasyev@ucla.edu>
6 * @author Ilya Moiseenko <iliamo@ucla.edu>
7 */
8
Ilya Moiseenko68192502013-09-30 14:27:48 -07009#include "config.h"
Ilya Moiseenko1dc76da2013-09-30 11:53:36 -070010#import "preference-delegate.h"
11
12@implementation PreferenceDelegate
13
14-(IBAction)showPreferencesPanel:(id)sender
15{
16 [preferencesPanel setContentView:generalSettingsView];
17 [preferencesPanel makeKeyAndOrderFront:sender];
18 [preferencesPanel setLevel: NSStatusWindowLevel];
19}
20
21-(IBAction)openGeneralSettings:(id)sender
22{
23 [preferencesPanel setContentView:generalSettingsView];
24}
25
26-(IBAction)openForwardingSettings:(id)sender
27{
28 [preferencesPanel setContentView:forwardingSettingsView];
29}
30
31-(IBAction)openSecuritySettings:(id)sender
32{
33 [preferencesPanel setContentView:securitySettingsView];
34}
35
Ilya Moiseenkoe7058e72013-10-02 15:56:45 -070036-(IBAction)openTestbedSettings:(id)sender
37{
38 [preferencesPanel setContentView:testbedSettingsView];
39}
40
Ilya Moiseenko1dc76da2013-09-30 11:53:36 -070041-(IBAction)switchSoftwareUpdates:(id)sender
42{
43 if ([(NSButton*)sender state] == NSOnState)
44 {
45 _allowSoftwareUpdates = true;
46 }
47 else
48 {
49 _allowSoftwareUpdates = false;
50 }
51}
52
53-(IBAction)switchHubDiscovery:(id)sender
54{
55 if ([(NSButton*)sender state] == NSOnState)
56 {
57 _enableHubDiscovery = true;
58 }
59 else
60 {
61 _enableHubDiscovery = false;
62 }
63}
64
Ilya Moiseenkoe7058e72013-10-02 15:56:45 -070065-(IBAction)restartDaemon:(id)sender
66{
67 /*daemonStarted = false;
68 [sender setTitle:@"Start"];
69 [connectionStatusText setStringValue:@"Disconnected"];
70
71 NSTask *task = [[NSTask alloc] init];
72 [task setLaunchPath: NDND_STOP_COMMAND];
73 [task launch];
74
75 NSBundle *bundle = [NSBundle bundleForClass:[self class]];
76 NSString *path = [bundle pathForResource:@"FlatDisconnected" ofType:@"png"];
77 menuIcon = [[NSImage alloc] initWithContentsOfFile:path];
78 [statusItem setImage:menuIcon];*/
79}
80
Ilya Moiseenko68192502013-09-30 14:27:48 -070081-(IBAction)addFibEntry:(id)sender
82{
83 [NSApp endSheet:prefixRegistrationSheet];
84 [prefixRegistrationSheet orderOut:sender];
85
86 NSString *operationName = @"add";
87
88 NSString *prefixName = [namePrefixText stringValue];
89 NSString *socketType = [tunnelCombobox itemObjectValueAtIndex:[tunnelCombobox indexOfSelectedItem]];
90 NSString *address = [endpointText stringValue];
91
92 NSArray *arguments = [NSArray arrayWithObjects: operationName, prefixName, socketType, address, nil];
93
94 NSTask *task = [[NSTask alloc] init];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070095 [task setLaunchPath: @NDND_FIB_COMMAND];
Ilya Moiseenko68192502013-09-30 14:27:48 -070096 [task setArguments: arguments];
97 [task launch];
98}
99
100-(IBAction)removeFibEntry:(id)sender
101{
102
103}
104
105- (IBAction) showFibEntrySheet:(id)sender
106{
107 [NSApp beginSheet:prefixRegistrationSheet
108 modalForWindow:preferencesPanel
109 modalDelegate:self
110 didEndSelector:nil
111 contextInfo:nil];
112
113 [tunnelCombobox selectItemAtIndex:0];
114}
115
116-(IBAction)hideFibEntrySheet:(id)sender
117{
118 [NSApp endSheet:prefixRegistrationSheet];
119 [prefixRegistrationSheet orderOut:sender];
120}
Ilya Moiseenko1dc76da2013-09-30 11:53:36 -0700121
Ilya Moiseenkoe7058e72013-10-02 15:56:45 -0700122
123-(IBAction)openRoutingStatusPage:(id)sender
124{
125 NSURL *pageURL = [NSURL URLWithString:@"http://netlab.cs.memphis.edu/script/htm/status.htm"];
126
127 [[NSWorkspace sharedWorkspace] openURL: pageURL];
128}
129
130-(IBAction)openTrafficMapPage:(id)sender
131{
132
133 NSURL *pageURL = [NSURL URLWithString:@"http://ndnmap.arl.wustl.edu"];
134
135 [[NSWorkspace sharedWorkspace] openURL: pageURL];
136}
137
138
Ilya Moiseenko1dc76da2013-09-30 11:53:36 -0700139@end