2 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/types.h>
9 #include <utility/tagitem.h>
10 #include <libraries/asl.h>
11 #include <libraries/locale.h>
12 #include <libraries/mui.h>
13 #include <prefs/prefhdr.h>
14 #include <zune/customclasses.h>
15 #include <zune/prefseditor.h>
17 #include <proto/exec.h>
18 #include <proto/intuition.h>
19 #include <proto/utility.h>
20 #include <proto/muimaster.h>
21 #include <proto/dos.h>
22 #include <proto/iffparse.h>
29 #include "netpeditor.h"
30 #include "prefsdata.h"
32 #include <proto/alib.h>
33 #include <utility/hooks.h>
35 static CONST_STRPTR NetworkTabs
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
36 static CONST_STRPTR DHCPCycle
[] = { NULL
, NULL
, NULL
};
37 static CONST_STRPTR EncCycle
[] = { NULL
, NULL
, NULL
, NULL
};
38 static CONST_STRPTR KeyCycle
[] = { NULL
, NULL
, NULL
};
39 static CONST_STRPTR ServiceTypeCycle
[] = { NULL
, NULL
};
40 static const TEXT max_ip_str
[] = "255.255.255.255 ";
42 static struct Hook netpeditor_displayHook
,
43 netpeditor_constructHook
,
44 netpeditor_destructHook
;
45 static struct Hook hosts_displayHook
,
48 static struct Hook wireless_displayHook
,
49 wireless_constructHook
,
50 wireless_destructHook
;
51 static struct Hook server_displayHook
,
55 /*** Instance Data **********************************************************/
56 struct NetPEditor_DATA
59 Object
*netped_interfaceList
,
71 *netped_hostAddButton
,
72 *netped_hostEditButton
,
73 *netped_hostRemoveButton
,
76 *netped_netEditButton
,
77 *netped_netRemoveButton
,
78 *netped_MBBInitString
[MAXATCOMMANDS
],
79 *netped_MBBDeviceString
,
84 *netped_serverAddButton
,
85 *netped_serverEditButton
,
86 *netped_serverRemoveButton
;
89 Object
*netped_ifWindow
,
101 Object
*netped_hostWindow
,
102 *netped_hostNamesString
,
103 *netped_hostAddressString
,
104 *netped_hostApplyButton
,
105 *netped_hostCloseButton
;
107 // Wireless network window
108 Object
*netped_netWindow
,
115 *netped_netApplyButton
,
116 *netped_netCloseButton
;
118 // File-server window
119 Object
*netped_serverWindow
,
120 *netped_serverServiceType
,
121 *netped_serverDevice
,
122 *netped_serverActive
,
124 *netped_serverService
,
128 *netped_serverApplyButton
,
129 *netped_serverCloseButton
;
132 AROS_UFH3S(APTR
, constructFunc
,
133 AROS_UFHA(struct Hook
*, hook
, A0
),
134 AROS_UFHA(APTR
, pool
, A2
),
135 AROS_UFHA(struct Interface
*, entry
, A1
))
139 struct Interface
*new;
141 if ((new = AllocPooled(pool
, sizeof(*new))))
150 AROS_UFH3S(void, destructFunc
,
151 AROS_UFHA(struct Hook
*, hook
, A0
),
152 AROS_UFHA(APTR
, pool
, A2
),
153 AROS_UFHA(struct Interface
*, entry
, A1
))
157 FreePooled(pool
, entry
, sizeof(struct Interface
));
162 AROS_UFH3S(LONG
, displayFunc
,
163 AROS_UFHA(struct Hook
*, hook
, A0
),
164 AROS_UFHA(char **, array
, A2
),
165 AROS_UFHA(struct Interface
*, entry
, A1
))
170 static char unitbuffer
[20];
171 sprintf(unitbuffer
, "%d", (int)entry
->unit
);
172 *array
++ = entry
->name
;
173 *array
++ = entry
->up
? "*" : "";
174 *array
++ = FilePart(entry
->device
);
175 *array
++ = unitbuffer
;
176 *array
= entry
->ifDHCP
? (STRPTR
)_(MSG_IP_MODE_DHCP
) : entry
->IP
;
180 *array
++ = (STRPTR
)_(MSG_IFNAME
);
181 *array
++ = (STRPTR
)_(MSG_UP
);
182 *array
++ = (STRPTR
)_(MSG_DEVICE
);
183 *array
++ = (STRPTR
)_(MSG_UNIT
);
184 *array
= (STRPTR
)_(MSG_IP
);
192 AROS_UFH3S(APTR
, hostsConstructFunc
,
193 AROS_UFHA(struct Hook
*, hook
, A0
),
194 AROS_UFHA(APTR
, pool
, A2
),
195 AROS_UFHA(struct Host
*, entry
, A1
))
201 if ((new = AllocPooled(pool
, sizeof(*new))))
210 AROS_UFH3S(void, hostsDestructFunc
,
211 AROS_UFHA(struct Hook
*, hook
, A0
),
212 AROS_UFHA(APTR
, pool
, A2
),
213 AROS_UFHA(struct Host
*, entry
, A1
))
217 FreePooled(pool
, entry
, sizeof(struct Host
));
222 AROS_UFH3S(LONG
, hostsDisplayFunc
,
223 AROS_UFHA(struct Hook
*, hook
, A0
),
224 AROS_UFHA(char **, array
, A2
),
225 AROS_UFHA(struct Host
*, entry
, A1
))
230 *array
++ = entry
->address
;
231 *array
++ = entry
->names
;
235 *array
++ = (STRPTR
)_(MSG_IP
);
236 *array
++ = (STRPTR
)_(MSG_HOST_NAMES
);
244 AROS_UFH3S(APTR
, netConstructFunc
,
245 AROS_UFHA(struct Hook
*, hook
, A0
),
246 AROS_UFHA(APTR
, pool
, A2
),
247 AROS_UFHA(struct Network
*, entry
, A1
))
253 if ((new = AllocPooled(pool
, sizeof(*new))))
262 AROS_UFH3S(void, netDestructFunc
,
263 AROS_UFHA(struct Hook
*, hook
, A0
),
264 AROS_UFHA(APTR
, pool
, A2
),
265 AROS_UFHA(struct Network
*, entry
, A1
))
269 FreePooled(pool
, entry
, sizeof(struct Network
));
274 AROS_UFH3S(LONG
, netDisplayFunc
,
275 AROS_UFHA(struct Hook
*, hook
, A0
),
276 AROS_UFHA(char **, array
, A2
),
277 AROS_UFHA(struct Network
*, entry
, A1
))
282 *array
++ = entry
->name
;
283 switch(entry
->encType
)
286 *array
++ = (STRPTR
)_(MSG_ENC_WPA
);
289 *array
++ = (STRPTR
)_(MSG_ENC_WEP
);
292 *array
++ = (STRPTR
)_(MSG_ENC_NONE
);
294 *array
++ = (STRPTR
)L_(entry
->hidden
? YESSTR
: NOSTR
);
295 *array
++ = (STRPTR
)L_(entry
->adHoc
? YESSTR
: NOSTR
);
299 *array
++ = (STRPTR
)_(MSG_SSID
);
300 *array
++ = (STRPTR
)_(MSG_ENCTYPE
);
301 *array
++ = (STRPTR
)_(MSG_HIDDEN
);
302 *array
++ = (STRPTR
)_(MSG_ADHOC
);
310 AROS_UFH3S(APTR
, serverConstructFunc
,
311 AROS_UFHA(struct Hook
*, hook
, A0
),
312 AROS_UFHA(APTR
, pool
, A2
),
313 AROS_UFHA(struct Server
*, entry
, A1
))
319 if ((new = AllocPooled(pool
, sizeof(*new))))
328 AROS_UFH3S(void, serverDestructFunc
,
329 AROS_UFHA(struct Hook
*, hook
, A0
),
330 AROS_UFHA(APTR
, pool
, A2
),
331 AROS_UFHA(struct Server
*, entry
, A1
))
335 FreePooled(pool
, entry
, sizeof(struct Server
));
340 AROS_UFH3S(LONG
, serverDisplayFunc
,
341 AROS_UFHA(struct Hook
*, hook
, A0
),
342 AROS_UFHA(char **, array
, A2
),
343 AROS_UFHA(struct Server
*, entry
, A1
))
348 *array
++ = entry
->device
;
349 *array
++ = entry
->active
? "*" : "";
350 *array
++ = entry
->host
;
351 *array
++ = entry
->group
;
352 *array
++ = entry
->service
;
353 *array
++ = entry
->user
;
357 *array
++ = (STRPTR
)_(MSG_DEVICE
);
358 *array
++ = (STRPTR
)_(MSG_UP
);
359 *array
++ = (STRPTR
)_(MSG_HOST_NAME
);
360 *array
++ = (STRPTR
)_(MSG_WORKGROUP
);
361 *array
++ = (STRPTR
)_(MSG_SERVICE
);
362 *array
++ = (STRPTR
)_(MSG_USERNAME
);
370 BOOL
Gadgets2NetworkPrefs(struct NetPEditor_DATA
*data
)
376 LONG entries
= XGET(data
->netped_interfaceList
, MUIA_List_Entries
);
377 for(i
= 0; i
< entries
; i
++)
379 struct Interface
*iface
= GetInterface(i
);
380 struct Interface
*ifaceentry
;
383 data
->netped_interfaceList
,
384 MUIM_List_GetEntry
, i
, &ifaceentry
386 SetName(iface
, ifaceentry
->name
);
387 SetUp(iface
, ifaceentry
->up
);
388 SetIfDHCP(iface
, ifaceentry
->ifDHCP
);
389 SetDevice(iface
, ifaceentry
->device
);
390 SetUnit(iface
, ifaceentry
->unit
);
391 SetIP(iface
, ifaceentry
->IP
);
392 SetMask(iface
, ifaceentry
->mask
);
394 SetInterfaceCount(entries
);
396 GET(data
->netped_gateString
, MUIA_String_Contents
, &str
);
398 GET(data
->netped_DNSString
[0], MUIA_String_Contents
, &str
);
400 GET(data
->netped_DNSString
[1], MUIA_String_Contents
, &str
);
402 GET(data
->netped_hostString
, MUIA_String_Contents
, &str
);
404 GET(data
->netped_domainString
, MUIA_String_Contents
, &str
);
406 GET(data
->netped_Autostart
, MUIA_Selected
, &lng
);
408 GET(data
->netped_DHCPState
, MUIA_Cycle_Active
, &lng
);
411 entries
= XGET(data
->netped_hostList
, MUIA_List_Entries
);
412 for(i
= 0; i
< entries
; i
++)
414 struct Host
*host
= GetHost(i
);
415 struct Host
*hostentry
;
418 data
->netped_hostList
,
419 MUIM_List_GetEntry
, i
, &hostentry
421 SetHostAddress(host
, hostentry
->address
);
422 SetHostNames(host
, hostentry
->names
);
424 SetHostCount(entries
);
426 entries
= XGET(data
->netped_networkList
, MUIA_List_Entries
);
427 for(i
= 0; i
< entries
; i
++)
429 struct Network
*net
= GetNetwork(i
);
430 struct Network
*netentry
;
433 data
->netped_networkList
,
434 MUIM_List_GetEntry
, i
, &netentry
436 SetNetworkName(net
, netentry
->name
);
437 SetEncType(net
, netentry
->encType
);
438 SetKey(net
, netentry
->key
, netentry
->keyIsHex
);
439 SetHidden(net
, netentry
->hidden
);
440 SetAdHoc(net
, netentry
->adHoc
);
442 SetNetworkCount(entries
);
444 for(i
= 0 ; i
< MAXATCOMMANDS
; i
++) SetMobile_atcommand(i
,"");
447 for(i
= 0 ; i
< MAXATCOMMANDS
; i
++)
449 GET(data
->netped_MBBInitString
[i
], MUIA_String_Contents
, &str
);
450 if( strlen(str
) > 0 ) SetMobile_atcommand( a
++ , str
);
452 GET(data
->netped_MBBDeviceString
, MUIA_String_Contents
, &str
);
453 SetMobile_devicename(str
);
454 GET(data
->netped_MBBUnit
, MUIA_Numeric_Value
, &lng
);
456 GET(data
->netped_MBBUsername
, MUIA_String_Contents
, &str
);
457 SetMobile_username(str
);
458 GET(data
->netped_MBBPassword
, MUIA_String_Contents
, &str
);
459 SetMobile_password(str
);
461 entries
= XGET(data
->netped_serverList
, MUIA_List_Entries
);
462 for(i
= 0; i
< entries
; i
++)
464 struct Server
*server
= GetServer(i
);
465 struct Server
*serverentry
;
468 data
->netped_serverList
,
469 MUIM_List_GetEntry
, i
, &serverentry
471 SetServerDevice(server
, serverentry
->device
);
472 SetServerHost(server
, serverentry
->host
);
473 SetServerService(server
, serverentry
->service
);
474 SetServerUser(server
, serverentry
->user
);
475 SetServerGroup(server
, serverentry
->group
);
476 SetServerPass(server
, serverentry
->pass
);
477 SetServerActive(server
, serverentry
->active
);
479 SetServerCount(entries
);
484 BOOL NetworkPrefs2Gadgets
486 struct NetPEditor_DATA
*data
490 LONG entries
= GetInterfaceCount();
492 SET(data
->netped_interfaceList
, MUIA_List_Quiet
, TRUE
);
493 DoMethod(data
->netped_interfaceList
, MUIM_List_Clear
);
494 for(i
= 0; i
< entries
; i
++)
496 struct Interface
*iface
= GetInterface(i
);
497 struct Interface ifaceentry
;
513 data
->netped_interfaceList
,
514 MUIM_List_InsertSingle
, &ifaceentry
, MUIV_List_Insert_Bottom
518 SET(data
->netped_interfaceList
, MUIA_List_Quiet
, FALSE
);
520 NNSET(data
->netped_gateString
, MUIA_String_Contents
, (IPTR
)GetGate());
521 NNSET(data
->netped_DNSString
[0], MUIA_String_Contents
, (IPTR
)GetDNS(0));
522 NNSET(data
->netped_DNSString
[1], MUIA_String_Contents
, (IPTR
)GetDNS(1));
523 NNSET(data
->netped_hostString
, MUIA_String_Contents
, (IPTR
)GetHostname());
524 NNSET(data
->netped_domainString
, MUIA_String_Contents
, (IPTR
)GetDomain());
525 NNSET(data
->netped_Autostart
, MUIA_Selected
, (IPTR
)GetAutostart());
526 NNSET(data
->netped_DHCPState
, MUIA_Cycle_Active
, (IPTR
)GetDHCP() ? 1 : 0);
528 entries
= GetHostCount();
530 SET(data
->netped_hostList
, MUIA_List_Quiet
, TRUE
);
531 DoMethod(data
->netped_hostList
, MUIM_List_Clear
);
532 for(i
= 0; i
< entries
; i
++)
534 struct Host
*host
= GetHost(i
);
535 struct Host hostentry
;
546 data
->netped_hostList
,
547 MUIM_List_InsertSingle
, &hostentry
, MUIV_List_Insert_Bottom
550 SET(data
->netped_hostList
, MUIA_List_Quiet
, FALSE
);
552 SET(data
->netped_networkList
, MUIA_List_Quiet
, TRUE
);
553 DoMethod(data
->netped_networkList
, MUIM_List_Clear
);
554 entries
= GetNetworkCount();
555 for(i
= 0; i
< entries
; i
++)
557 struct Network
*net
= GetNetwork(i
);
558 struct Network netentry
;
573 data
->netped_networkList
,
574 MUIM_List_InsertSingle
, &netentry
, MUIV_List_Insert_Bottom
578 SET(data
->netped_networkList
, MUIA_List_Quiet
, FALSE
);
580 for(i
= 0 ; i
< MAXATCOMMANDS
; i
++)
581 NNSET((data
->netped_MBBInitString
[i
]), MUIA_String_Contents
, "");
583 entries
= GetMobile_atcommandcount();
584 for(i
= 0 ; i
< entries
; i
++)
586 NNSET((data
->netped_MBBInitString
[i
+MAXATCOMMANDS
-entries
]), MUIA_String_Contents
, GetMobile_atcommand(i
));
589 NNSET((data
->netped_MBBDeviceString
), MUIA_String_Contents
, GetMobile_devicename());
590 NNSET((data
->netped_MBBUnit
), MUIA_Numeric_Value
, GetMobile_unit());
591 NNSET((data
->netped_MBBUsername
), MUIA_String_Contents
, GetMobile_username());
592 NNSET((data
->netped_MBBPassword
), MUIA_String_Contents
, GetMobile_password());
594 SET(data
->netped_serverList
, MUIA_List_Quiet
, TRUE
);
595 DoMethod(data
->netped_serverList
, MUIM_List_Clear
);
596 entries
= GetServerCount();
597 for(i
= 0; i
< entries
; i
++)
599 struct Server
*server
= GetServer(i
);
600 struct Server serverentry
;
605 GetServerDevice(server
),
606 GetServerHost(server
),
607 GetServerService(server
),
608 GetServerUser(server
),
609 GetServerGroup(server
),
610 GetServerPass(server
),
611 GetServerActive(server
)
616 data
->netped_serverList
,
617 MUIM_List_InsertSingle
, &serverentry
, MUIV_List_Insert_Bottom
621 SET(data
->netped_serverList
, MUIA_List_Quiet
, FALSE
);
626 void DisplayErrorMessage(Object
* obj
, enum ErrorCode errorcode
)
628 CONST_STRPTR title
= _(MSG_ERROR_TITLE
);
629 CONST_STRPTR errormessage
= NULL
;
630 CONST_STRPTR additionaldata
= NULL
;
634 GET(obj
, MUIA_ApplicationObject
, &app
);
635 GET(obj
, MUIA_Window_Window
, &wnd
);
640 errormessage
= _(MSG_ERR_UNKNOWN_ERROR
);
642 case NOT_RESTARTED_WIRELESS
:
643 errormessage
= _(MSG_ERR_NOT_RESTARTED_WIRELESS
);
645 case NOT_RESTARTED_MOBILE
:
646 errormessage
= _(MSG_ERR_NOT_RESTARTED_MOBILE
);
648 case NOT_RESTARTED_STACK
:
649 errormessage
= _(MSG_ERR_NOT_RESTARTED_STACK
);
651 case NOT_SAVED_PREFS_ENV
:
652 errormessage
= _(MSG_ERR_NOT_SAVED_PREFS
);
653 additionaldata
= PREFS_PATH_ENV
;
655 case NOT_SAVED_PREFS_ENVARC
:
656 errormessage
= _(MSG_ERR_NOT_SAVED_PREFS
);
657 additionaldata
= PREFS_PATH_ENVARC
;
659 case NOT_COPIED_FILES_ENV
:
660 errormessage
= _(MSG_ERR_NOT_COPIED_FILES
);
661 additionaldata
= PREFS_PATH_ENV
;
663 case NOT_COPIED_FILES_ENVARC
:
664 errormessage
= _(MSG_ERR_NOT_COPIED_FILES
);
665 additionaldata
= PREFS_PATH_ENVARC
;
667 case MULTIPLE_IFACES
:
668 errormessage
= _(MSG_WARN_MULTIPLE_IFACES
);
669 title
= _(MSG_WARNING_TITLE
);
675 MUI_Request(app
, wnd
, 0, title
, _(MSG_BUTTON_OK
), errormessage
,
679 /*** Methods ****************************************************************/
680 Object
* NetPEditor__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
683 Object
*gateString
, *DNSString
[2], *hostString
, *domainString
,
684 *autostart
, *interfaceList
, *DHCPState
,
685 *addButton
, *editButton
, *removeButton
, *inputGroup
,
686 *hostList
, *hostAddButton
, *hostEditButton
, *hostRemoveButton
,
687 *networkList
, *netAddButton
, *netEditButton
, *netRemoveButton
,
688 *serverList
, *serverAddButton
, *serverEditButton
, *serverRemoveButton
,
689 *MBBInitString
[MAXATCOMMANDS
], *MBBDeviceString
, *MBBUnit
,
690 *MBBUsername
, *MBBPassword
;
693 Object
*deviceString
, *IPString
, *maskString
,
694 *ifDHCPState
, *unitString
, *nameString
, *upState
,
695 *ifWindow
, *applyButton
, *closeButton
;
698 Object
*hostNamesString
, *hostAddressString
, *hostWindow
,
699 *hostApplyButton
, *hostCloseButton
;
702 Object
*sSIDString
, *keyString
, *encType
, *keyType
, *hiddenState
,
703 *adHocState
, *netWindow
, *netApplyButton
, *netCloseButton
;
705 // file-server window
706 Object
*serverWindow
, *serverServiceType
, *serverDevice
, *serverActive
, *serverHost
,
707 *serverService
, *serverUser
, *serverGroup
, *serverPass
,
708 *serverApplyButton
, *serverCloseButton
;
710 DHCPCycle
[0] = _(MSG_IP_MODE_MANUAL
);
711 DHCPCycle
[1] = _(MSG_IP_MODE_DHCP
);
713 EncCycle
[0] = _(MSG_ENC_NONE
);
714 EncCycle
[1] = _(MSG_ENC_WEP
);
715 EncCycle
[2] = _(MSG_ENC_WPA
);
717 KeyCycle
[0] = _(MSG_KEY_TEXT
);
718 KeyCycle
[1] = _(MSG_KEY_HEX
);
720 ServiceTypeCycle
[0] = _(MSG_SERVICETYPE_CIFS
);
722 NetworkTabs
[0] = _(MSG_TAB_IP_CONFIGURATION
);
723 NetworkTabs
[1] = _(MSG_TAB_COMPUTER_NAMES
);
724 NetworkTabs
[2] = _(MSG_TAB_WIRELESS
);
725 NetworkTabs
[3] = _(MSG_TAB_MOBILE
);
726 NetworkTabs
[4] = _(MSG_TAB_SERVERS
);
728 netpeditor_constructHook
.h_Entry
= (HOOKFUNC
)constructFunc
;
729 netpeditor_destructHook
.h_Entry
= (HOOKFUNC
)destructFunc
;
730 netpeditor_displayHook
.h_Entry
= (HOOKFUNC
)displayFunc
;
732 hosts_constructHook
.h_Entry
= (HOOKFUNC
)hostsConstructFunc
;
733 hosts_destructHook
.h_Entry
= (HOOKFUNC
)hostsDestructFunc
;
734 hosts_displayHook
.h_Entry
= (HOOKFUNC
)hostsDisplayFunc
;
736 wireless_constructHook
.h_Entry
= (HOOKFUNC
)netConstructFunc
;
737 wireless_destructHook
.h_Entry
= (HOOKFUNC
)netDestructFunc
;
738 wireless_displayHook
.h_Entry
= (HOOKFUNC
)netDisplayFunc
;
740 server_constructHook
.h_Entry
= (HOOKFUNC
)serverConstructFunc
;
741 server_destructHook
.h_Entry
= (HOOKFUNC
)serverDestructFunc
;
742 server_displayHook
.h_Entry
= (HOOKFUNC
)serverDisplayFunc
;
744 self
= (Object
*)DoSuperNewTags
748 MUIA_PrefsEditor_Name
, __(MSG_NAME
),
749 MUIA_PrefsEditor_Path
, (IPTR
)"AROSTCP/arostcp.prefs",
751 Child
, RegisterGroup((IPTR
)NetworkTabs
),
754 Child
, (IPTR
)(HGroup
,
756 Child
, (IPTR
)ListviewObject
,
757 MUIA_Listview_List
, (IPTR
)(interfaceList
= (Object
*)ListObject
,
759 MUIA_List_Title
, TRUE
,
760 MUIA_List_Format
, (IPTR
)"BAR,P=\33c BAR,BAR,BAR,",
761 MUIA_List_ConstructHook
, (IPTR
)&netpeditor_constructHook
,
762 MUIA_List_DestructHook
, (IPTR
)&netpeditor_destructHook
,
763 MUIA_List_DisplayHook
, (IPTR
)&netpeditor_displayHook
,
766 Child
, (IPTR
)(VGroup
,
768 Child
, (IPTR
)(addButton
= SimpleButton(_(MSG_BUTTON_ADD
))),
769 Child
, (IPTR
)(editButton
= SimpleButton(_(MSG_BUTTON_EDIT
))),
770 Child
, (IPTR
)(removeButton
= SimpleButton(_(MSG_BUTTON_REMOVE
))),
771 Child
, (IPTR
)HVSpace
,
774 Child
, (IPTR
)(inputGroup
= (Object
*)ColGroup(4),
776 Child
, (IPTR
)Label2(__(MSG_IP_MODE
)),
777 Child
, (IPTR
)(DHCPState
= (Object
*)CycleObject
,
778 MUIA_Cycle_Entries
, (IPTR
)DHCPCycle
,
780 Child
, (IPTR
)Label2(__(MSG_GATE
)),
781 Child
, (IPTR
)(gateString
= (Object
*)StringObject
,
783 MUIA_String_Accept
, (IPTR
)IPCHARS
,
785 MUIA_FixWidthTxt
, (IPTR
)max_ip_str
,
787 Child
, (IPTR
)Label2(__(MSG_HOST_NAME
)),
788 Child
, (IPTR
)(hostString
= (Object
*)StringObject
,
790 MUIA_String_Accept
, (IPTR
)NAMECHARS
,
793 Child
, (IPTR
)Label2(__(MSG_DNS1
)),
794 Child
, (IPTR
)(DNSString
[0] = (Object
*)StringObject
,
796 MUIA_String_Accept
, (IPTR
)IPCHARS
,
798 MUIA_FixWidthTxt
, (IPTR
)max_ip_str
,
800 Child
, (IPTR
)Label2(__(MSG_DOMAIN_NAME
)),
801 Child
, (IPTR
)(domainString
= (Object
*)StringObject
,
803 MUIA_String_Accept
, (IPTR
)NAMECHARS
,
806 Child
, (IPTR
)Label2(__(MSG_DNS2
)),
807 Child
, (IPTR
)(DNSString
[1] = (Object
*)StringObject
,
809 MUIA_String_Accept
, (IPTR
)IPCHARS
,
811 MUIA_FixWidthTxt
, (IPTR
)max_ip_str
,
814 Child
, (IPTR
)ColGroup(2),
815 Child
, (IPTR
)(autostart
= MUI_MakeObject(MUIO_Checkmark
, NULL
)),
817 Child
, (IPTR
)Label2(__(MSG_AUTOSTART_STACK
)),
818 Child
, (IPTR
)HVSpace
,
824 Child
, (IPTR
)(HGroup
,
826 Child
, (IPTR
)ListviewObject
,
827 MUIA_Listview_List
, (IPTR
)(hostList
= (Object
*)ListObject
,
829 MUIA_List_Title
, TRUE
,
830 MUIA_List_Format
, (IPTR
)"BAR,",
831 MUIA_List_ConstructHook
, (IPTR
)&hosts_constructHook
,
832 MUIA_List_DestructHook
, (IPTR
)&hosts_destructHook
,
833 MUIA_List_DisplayHook
, (IPTR
)&hosts_displayHook
,
836 Child
, (IPTR
)(VGroup
,
838 Child
, (IPTR
)(hostAddButton
= SimpleButton(_(MSG_BUTTON_ADD
))),
839 Child
, (IPTR
)(hostEditButton
= SimpleButton(_(MSG_BUTTON_EDIT
))),
840 Child
, (IPTR
)(hostRemoveButton
= SimpleButton(_(MSG_BUTTON_REMOVE
))),
841 Child
, (IPTR
)HVSpace
,
847 Child
, (IPTR
)(HGroup
,
849 Child
, (IPTR
)ListviewObject
,
850 MUIA_Listview_List
, (IPTR
)(networkList
= (Object
*)ListObject
,
852 MUIA_List_Title
, TRUE
,
853 MUIA_List_Format
, (IPTR
)"BAR,BAR,BAR,",
854 MUIA_List_ConstructHook
, (IPTR
)&wireless_constructHook
,
855 MUIA_List_DestructHook
, (IPTR
)&wireless_destructHook
,
856 MUIA_List_DisplayHook
, (IPTR
)&wireless_displayHook
,
859 Child
, (IPTR
)(VGroup
,
861 Child
, (IPTR
)(netAddButton
= SimpleButton(_(MSG_BUTTON_ADD
))),
862 Child
, (IPTR
)(netEditButton
= SimpleButton(_(MSG_BUTTON_EDIT
))),
863 Child
, (IPTR
)(netRemoveButton
= SimpleButton(_(MSG_BUTTON_REMOVE
))),
864 Child
, (IPTR
)HVSpace
,
871 Child
, (IPTR
)ColGroup(2),
874 Child
, (IPTR
)Label2(_(MSG_SERIAL_DEVICE
)),
875 Child
, (IPTR
)(MBBDeviceString
= (Object
*)StringObject
,
880 Child
, (IPTR
)Label2(_(MSG_UNIT_NUMBER
)),
881 Child
, (IPTR
)(MBBUnit
= (Object
*)NumericbuttonObject
,
883 MUIA_Numeric_Max
, 100,
889 Child
, (IPTR
)ColGroup(2),
892 Child
, (IPTR
)Label2(_(MSG_USERNAME
)),
893 Child
, (IPTR
)(MBBUsername
= (Object
*)StringObject
,
897 Child
, (IPTR
)Label2(_(MSG_PASSWORD
)),
898 Child
, (IPTR
)(MBBPassword
= (Object
*)StringObject
,
900 MUIA_String_Secret
, TRUE
,
906 Child
, (IPTR
)ColGroup(2),
908 Child
, (IPTR
)Label2("Init1"),
909 Child
, (IPTR
)(MBBInitString
[0] = (Object
*)StringObject
,
914 Child
, (IPTR
)Label2("Init2"),
915 Child
, (IPTR
)(MBBInitString
[1] = (Object
*)StringObject
,
920 Child
, (IPTR
)Label2("Init3"),
921 Child
, (IPTR
)(MBBInitString
[2] = (Object
*)StringObject
,
926 Child
, (IPTR
)Label2("Init4"),
927 Child
, (IPTR
)(MBBInitString
[3] = (Object
*)StringObject
,
932 Child
, (IPTR
)Label2("Init5"),
933 Child
, (IPTR
)(MBBInitString
[4] = (Object
*)StringObject
,
942 Child
, (IPTR
)(HGroup
,
944 Child
, (IPTR
)ListviewObject
,
945 MUIA_Listview_List
, (IPTR
)(serverList
= (Object
*)ListObject
,
947 MUIA_List_Title
, TRUE
,
948 MUIA_List_Format
, (IPTR
)"BAR,P=\33c BAR,BAR,BAR,BAR,",
949 MUIA_List_ConstructHook
, (IPTR
)&server_constructHook
,
950 MUIA_List_DestructHook
, (IPTR
)&server_destructHook
,
951 MUIA_List_DisplayHook
, (IPTR
)&server_displayHook
,
954 Child
, (IPTR
)(VGroup
,
956 Child
, (IPTR
)(serverAddButton
= SimpleButton(_(MSG_BUTTON_ADD
))),
957 Child
, (IPTR
)(serverEditButton
= SimpleButton(_(MSG_BUTTON_EDIT
))),
958 Child
, (IPTR
)(serverRemoveButton
= SimpleButton(_(MSG_BUTTON_REMOVE
))),
959 Child
, (IPTR
)HVSpace
,
969 ifWindow
= (Object
*)WindowObject
,
970 MUIA_Window_Title
, __(MSG_IFWINDOW_TITLE
),
971 MUIA_Window_ID
, MAKE_ID('I', 'P', 'W', 'I'),
972 MUIA_Window_CloseGadget
, FALSE
,
973 WindowContents
, (IPTR
)VGroup
,
976 Child
, (IPTR
)HVSpace
,
977 Child
, (IPTR
)ImageObject
,
978 MUIA_Image_Spec
, (IPTR
)"3:Images:interface",
982 Child
, (IPTR
)HVSpace
,
984 Child
, (IPTR
)ColGroup(2),
986 Child
, (IPTR
)Label2(_(MSG_IFNAME
)),
988 Child
, (IPTR
)(nameString
= (Object
*)StringObject
,
990 MUIA_String_Accept
, (IPTR
)NAMECHARS
,
993 Child
, (IPTR
)(upState
= MUI_MakeObject(MUIO_Checkmark
, NULL
)),
994 Child
, (IPTR
)Label2(_(MSG_UP
)),
995 Child
, (IPTR
)HVSpace
,
997 Child
, (IPTR
)Label2(__(MSG_DEVICE
)),
998 Child
, (IPTR
)PopaslObject
,
999 MUIA_Popasl_Type
, ASL_FileRequest
,
1000 ASLFO_MaxHeight
, 100,
1001 MUIA_Popstring_String
, (IPTR
)(deviceString
= (Object
*)StringObject
,
1003 MUIA_Background
, MUII_TextBack
,
1006 MUIA_Popstring_Button
, (IPTR
)PopButton(MUII_PopUp
),
1008 Child
, (IPTR
)Label2(_(MSG_UNIT
)),
1009 Child
, (IPTR
)HGroup
,
1010 Child
, (IPTR
)(unitString
= (Object
*)StringObject
,
1012 MUIA_String_Accept
, (IPTR
)"0123456789",
1014 MUIA_FixWidthTxt
, (IPTR
)"0",
1016 Child
, (IPTR
)HVSpace
,
1019 Child
, (IPTR
)ColGroup(4),
1021 Child
, (IPTR
)Label2(__(MSG_IP_MODE
)),
1022 Child
, (IPTR
)(ifDHCPState
= (Object
*)CycleObject
,
1023 MUIA_Cycle_Entries
, (IPTR
)DHCPCycle
,
1025 Child
, (IPTR
)Label2(__(MSG_IP
)),
1026 Child
, (IPTR
)(IPString
= (Object
*)StringObject
,
1028 MUIA_String_Accept
, (IPTR
)IPCHARS
,
1030 MUIA_FixWidthTxt
, (IPTR
)max_ip_str
,
1032 Child
, (IPTR
)HVSpace
,
1033 Child
, (IPTR
)HVSpace
,
1034 Child
, (IPTR
)Label2(__(MSG_MASK
)),
1035 Child
, (IPTR
)(maskString
= (Object
*)StringObject
,
1037 MUIA_String_Accept
, (IPTR
)IPCHARS
,
1039 MUIA_FixWidthTxt
, (IPTR
)max_ip_str
,
1042 Child
, (IPTR
)HGroup
,
1043 Child
, (IPTR
)(applyButton
= ImageButton(_(MSG_BUTTON_APPLY
), "THEME:Images/Gadgets/Prefs/Save")),
1044 Child
, (IPTR
)(closeButton
= ImageButton(_(MSG_BUTTON_CLOSE
), "THEME:Images/Gadgets/Prefs/Cancel")),
1049 hostWindow
= (Object
*)WindowObject
,
1050 MUIA_Window_Title
, __(MSG_HOST_NAMES
),
1051 MUIA_Window_ID
, MAKE_ID('H', 'O', 'S', 'T'),
1052 MUIA_Window_CloseGadget
, FALSE
,
1053 MUIA_Window_SizeGadget
, TRUE
,
1054 WindowContents
, (IPTR
)VGroup
,
1056 Child
, (IPTR
)HGroup
,
1057 Child
, (IPTR
)HVSpace
,
1058 Child
, (IPTR
)ImageObject
,
1059 MUIA_Image_Spec
, (IPTR
)"3:Images:host",
1063 Child
, (IPTR
)HVSpace
,
1065 Child
, (IPTR
)ColGroup(2),
1067 Child
, (IPTR
)Label2(__(MSG_IP
)),
1068 Child
, (IPTR
)(hostAddressString
= (Object
*)StringObject
,
1072 Child
, (IPTR
)Label2(_(MSG_HOSTWINDOW_TITLE
)),
1073 Child
, (IPTR
)(hostNamesString
= (Object
*)StringObject
,
1078 Child
, (IPTR
)HGroup
,
1079 Child
, (IPTR
)(hostApplyButton
= ImageButton(_(MSG_BUTTON_APPLY
), "THEME:Images/Gadgets/Save")),
1080 Child
, (IPTR
)(hostCloseButton
= ImageButton(_(MSG_BUTTON_CLOSE
), "THEME:Images/Gadgets/Cancel")),
1085 netWindow
= (Object
*)WindowObject
,
1086 MUIA_Window_Title
, __(MSG_NETWINDOW_TITLE
),
1087 MUIA_Window_ID
, MAKE_ID('W', 'I', 'F', 'I'),
1088 MUIA_Window_CloseGadget
, FALSE
,
1089 MUIA_Window_SizeGadget
, TRUE
,
1090 WindowContents
, (IPTR
)VGroup
,
1092 Child
, (IPTR
)HGroup
,
1093 Child
, (IPTR
)HVSpace
,
1094 Child
, (IPTR
)ImageObject
,
1095 MUIA_Image_Spec
, (IPTR
)"3:Images:wireless",
1099 Child
, (IPTR
)HVSpace
,
1101 Child
, (IPTR
)ColGroup(2),
1103 Child
, (IPTR
)Label2(_(MSG_SSID
)),
1104 Child
, (IPTR
)(sSIDString
= (Object
*)StringObject
,
1109 Child
, (IPTR
)Label2(__(MSG_ENCTYPE
)),
1110 Child
, (IPTR
)(encType
= (Object
*)CycleObject
,
1111 MUIA_Cycle_Entries
, (IPTR
)EncCycle
,
1113 Child
, (IPTR
)Label2(__(MSG_KEYTYPE
)),
1114 Child
, (IPTR
)(keyType
= (Object
*)CycleObject
,
1115 MUIA_Cycle_Entries
, (IPTR
)KeyCycle
,
1117 Child
, (IPTR
)Label2(__(MSG_KEY
)),
1118 Child
, (IPTR
)(keyString
= (Object
*)StringObject
,
1120 MUIA_String_Secret
, TRUE
,
1123 Child
, (IPTR
)HGroup
,
1124 Child
, (IPTR
)(hiddenState
= MUI_MakeObject(MUIO_Checkmark
, NULL
)),
1125 Child
, (IPTR
)Label2(_(MSG_HIDDEN
)),
1126 Child
, (IPTR
)HVSpace
,
1128 Child
, (IPTR
)HGroup
,
1129 Child
, (IPTR
)(adHocState
= MUI_MakeObject(MUIO_Checkmark
, NULL
)),
1130 Child
, (IPTR
)Label2(_(MSG_ADHOC
)),
1131 Child
, (IPTR
)HVSpace
,
1134 Child
, (IPTR
)HGroup
,
1135 Child
, (IPTR
)(netApplyButton
= ImageButton(_(MSG_BUTTON_APPLY
), "THEME:Images/Gadgets/Save")),
1136 Child
, (IPTR
)(netCloseButton
= ImageButton(_(MSG_BUTTON_CLOSE
), "THEME:Images/Gadgets/Cancel")),
1141 serverWindow
= (Object
*)WindowObject
,
1142 MUIA_Window_Title
, __(MSG_SERVERWINDOW_TITLE
),
1143 MUIA_Window_ID
, MAKE_ID('S', 'H', 'R', 'E'),
1144 MUIA_Window_CloseGadget
, FALSE
,
1145 MUIA_Window_SizeGadget
, TRUE
,
1146 WindowContents
, (IPTR
)VGroup
,
1148 Child
, (IPTR
)HGroup
,
1149 Child
, (IPTR
)HVSpace
,
1150 Child
, (IPTR
)ImageObject
,
1151 MUIA_Image_Spec
, (IPTR
)"3:Images:host",
1155 Child
, (IPTR
)HVSpace
,
1157 Child
, (IPTR
)ColGroup(2),
1159 Child
, (IPTR
)Label2(_(MSG_SERVICE_TYPES
)),
1160 Child
, (IPTR
)(serverServiceType
= (Object
*)CycleObject
,
1161 MUIA_Cycle_Entries
, (IPTR
)ServiceTypeCycle
,
1163 Child
, (IPTR
)Label2(_(MSG_DEVICE
)),
1164 Child
, (IPTR
)(serverDevice
= (Object
*)StringObject
,
1168 Child
, (IPTR
)HVSpace
,
1169 Child
, (IPTR
)HGroup
,
1170 Child
, (IPTR
)(serverActive
= MUI_MakeObject(MUIO_Checkmark
, NULL
)),
1171 Child
, (IPTR
)Label2(_(MSG_UP
)),
1172 Child
, (IPTR
)HVSpace
,
1174 Child
, (IPTR
)Label2(_(MSG_HOST_NAME
)),
1175 Child
, (IPTR
)(serverHost
= (Object
*)StringObject
,
1179 Child
, (IPTR
)Label2(__(MSG_WORKGROUP
)),
1180 Child
, (IPTR
)(serverGroup
= (Object
*)StringObject
,
1184 Child
, (IPTR
)Label2(__(MSG_SERVICE
)),
1185 Child
, (IPTR
)(serverService
= (Object
*)StringObject
,
1189 Child
, (IPTR
)Label2(__(MSG_USERNAME
)),
1190 Child
, (IPTR
)(serverUser
= (Object
*)StringObject
,
1194 Child
, (IPTR
)Label2(__(MSG_PASSWORD
)),
1195 Child
, (IPTR
)(serverPass
= (Object
*)StringObject
,
1197 MUIA_String_Secret
, TRUE
,
1201 Child
, (IPTR
)HGroup
,
1202 Child
, (IPTR
)(serverApplyButton
= ImageButton(_(MSG_BUTTON_APPLY
), "THEME:Images/Gadgets/Save")),
1203 Child
, (IPTR
)(serverCloseButton
= ImageButton(_(MSG_BUTTON_CLOSE
), "THEME:Images/Gadgets/Cancel")),
1208 if (self
!= NULL
&& ifWindow
!= NULL
&& hostWindow
!= NULL
1209 && netWindow
!= NULL
&& serverWindow
!= NULL
)
1211 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1214 data
->netped_DHCPState
= DHCPState
;
1215 data
->netped_gateString
= gateString
;
1216 data
->netped_DNSString
[0] = DNSString
[0];
1217 data
->netped_DNSString
[1] = DNSString
[1];
1218 data
->netped_hostString
= hostString
;
1219 data
->netped_domainString
= domainString
;
1220 data
->netped_Autostart
= autostart
;
1221 data
->netped_interfaceList
= interfaceList
;
1222 data
->netped_inputGroup
= inputGroup
;
1223 data
->netped_addButton
= addButton
;
1224 data
->netped_editButton
= editButton
;
1225 data
->netped_removeButton
= removeButton
;
1226 data
->netped_hostList
= hostList
;
1227 data
->netped_hostAddButton
= hostAddButton
;
1228 data
->netped_hostEditButton
= hostEditButton
;
1229 data
->netped_hostRemoveButton
= hostRemoveButton
;
1230 data
->netped_networkList
= networkList
;
1231 data
->netped_netAddButton
= netAddButton
;
1232 data
->netped_netEditButton
= netEditButton
;
1233 data
->netped_netRemoveButton
= netRemoveButton
;
1234 data
->netped_serverList
= serverList
;
1235 data
->netped_serverAddButton
= serverAddButton
;
1236 data
->netped_serverEditButton
= serverEditButton
;
1237 data
->netped_serverRemoveButton
= serverRemoveButton
;
1239 data
->netped_MBBInitString
[0] = MBBInitString
[0];
1240 data
->netped_MBBInitString
[1] = MBBInitString
[1];
1241 data
->netped_MBBInitString
[2] = MBBInitString
[2];
1242 data
->netped_MBBInitString
[3] = MBBInitString
[3];
1243 data
->netped_MBBInitString
[4] = MBBInitString
[4];
1244 data
->netped_MBBDeviceString
= MBBDeviceString
;
1245 data
->netped_MBBUnit
= MBBUnit
;
1246 data
->netped_MBBUsername
= MBBUsername
;
1247 data
->netped_MBBPassword
= MBBPassword
;
1250 data
->netped_ifWindow
= ifWindow
;
1251 data
->netped_upState
= upState
;
1252 data
->netped_ifDHCPState
= ifDHCPState
;
1253 data
->netped_nameString
= nameString
;
1254 data
->netped_deviceString
= deviceString
;
1255 data
->netped_unitString
= unitString
;
1256 data
->netped_IPString
= IPString
;
1257 data
->netped_maskString
= maskString
;
1258 data
->netped_applyButton
= applyButton
;
1259 data
->netped_closeButton
= closeButton
;
1262 data
->netped_hostWindow
= hostWindow
;
1263 data
->netped_hostAddressString
= hostAddressString
;
1264 data
->netped_hostNamesString
= hostNamesString
;
1265 data
->netped_hostApplyButton
= hostApplyButton
;
1266 data
->netped_hostCloseButton
= hostCloseButton
;
1269 data
->netped_netWindow
= netWindow
;
1270 data
->netped_hiddenState
= hiddenState
;
1271 data
->netped_adHocState
= adHocState
;
1272 data
->netped_sSIDString
= sSIDString
;
1273 data
->netped_encType
= encType
;
1274 data
->netped_keyType
= keyType
;
1275 data
->netped_keyString
= keyString
;
1276 data
->netped_netApplyButton
= netApplyButton
;
1277 data
->netped_netCloseButton
= netCloseButton
;
1279 // file-server window
1280 data
->netped_serverWindow
= serverWindow
;
1281 data
->netped_serverServiceType
= serverServiceType
;
1282 data
->netped_serverDevice
= serverDevice
;
1283 data
->netped_serverActive
= serverActive
;
1284 data
->netped_serverHost
= serverHost
;
1285 data
->netped_serverService
= serverService
;
1286 data
->netped_serverUser
= serverUser
;
1287 data
->netped_serverGroup
= serverGroup
;
1288 data
->netped_serverPass
= serverPass
;
1289 data
->netped_serverApplyButton
= serverApplyButton
;
1290 data
->netped_serverCloseButton
= serverCloseButton
;
1292 SET(removeButton
, MUIA_Disabled
, TRUE
);
1293 SET(editButton
, MUIA_Disabled
, TRUE
);
1295 SET(hostRemoveButton
, MUIA_Disabled
, TRUE
);
1296 SET(hostEditButton
, MUIA_Disabled
, TRUE
);
1298 SET(netRemoveButton
, MUIA_Disabled
, TRUE
);
1299 SET(netEditButton
, MUIA_Disabled
, TRUE
);
1301 SET(serverRemoveButton
, MUIA_Disabled
, TRUE
);
1302 SET(serverEditButton
, MUIA_Disabled
, TRUE
);
1304 /*-- Set up notifications ------------------------------------------*/
1309 interfaceList
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
1310 (IPTR
)self
, 1, MUIM_NetPEditor_ShowEntry
1314 interfaceList
, MUIM_Notify
, MUIA_Listview_DoubleClick
, MUIV_EveryTime
,
1315 (IPTR
)self
, 3, MUIM_NetPEditor_EditEntry
, FALSE
1320 gateString
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1321 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1325 DNSString
[0], MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1326 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1330 DNSString
[1], MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1331 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1335 hostString
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1336 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1340 domainString
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1341 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1345 autostart
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
1346 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1350 DHCPState
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
1351 (IPTR
)self
, 2, MUIM_NetPEditor_IPModeChanged
, FALSE
1356 addButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1357 (IPTR
)self
, 2, MUIM_NetPEditor_EditEntry
, TRUE
1361 editButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1362 (IPTR
)self
, 2, MUIM_NetPEditor_EditEntry
, FALSE
1366 removeButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1367 (IPTR
)interfaceList
, 2, MUIM_List_Remove
, MUIV_List_Remove_Active
1372 hostList
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
1373 (IPTR
)self
, 1, MUIM_NetPEditor_ShowHostEntry
1377 hostList
, MUIM_Notify
, MUIA_Listview_DoubleClick
, MUIV_EveryTime
,
1378 (IPTR
)self
, 3, MUIM_NetPEditor_EditHostEntry
, FALSE
1383 hostAddButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1384 (IPTR
)self
, 2, MUIM_NetPEditor_EditHostEntry
, TRUE
1388 hostEditButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1389 (IPTR
)self
, 1, MUIM_NetPEditor_EditHostEntry
, FALSE
1393 hostRemoveButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1394 (IPTR
)hostList
, 2, MUIM_List_Remove
, MUIV_List_Remove_Active
1399 networkList
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
1400 (IPTR
)self
, 1, MUIM_NetPEditor_ShowNetEntry
1404 networkList
, MUIM_Notify
, MUIA_Listview_DoubleClick
, MUIV_EveryTime
,
1405 (IPTR
)self
, 3, MUIM_NetPEditor_EditNetEntry
, FALSE
1410 netAddButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1411 (IPTR
)self
, 2, MUIM_NetPEditor_EditNetEntry
, TRUE
1415 netEditButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1416 (IPTR
)self
, 1, MUIM_NetPEditor_EditNetEntry
, FALSE
1420 netRemoveButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1421 (IPTR
)networkList
, 2, MUIM_List_Remove
, MUIV_List_Remove_Active
1426 MBBDeviceString
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1427 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1432 MBBUnit
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
1433 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1437 MBBUsername
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1438 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1442 MBBPassword
, MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1443 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1446 for(i
=0;i
<MAXATCOMMANDS
;i
++)
1449 MBBInitString
[i
], MUIM_Notify
, MUIA_String_Acknowledge
, MUIV_EveryTime
,
1450 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1455 serverList
, MUIM_Notify
, MUIA_List_Active
, MUIV_EveryTime
,
1456 (IPTR
)self
, 1, MUIM_NetPEditor_ShowServerEntry
1460 serverList
, MUIM_Notify
, MUIA_Listview_DoubleClick
, MUIV_EveryTime
,
1461 (IPTR
)self
, 3, MUIM_NetPEditor_EditServerEntry
, FALSE
1466 serverAddButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1467 (IPTR
)self
, 2, MUIM_NetPEditor_EditServerEntry
, TRUE
1471 serverEditButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1472 (IPTR
)self
, 1, MUIM_NetPEditor_EditServerEntry
, FALSE
1476 serverRemoveButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1477 (IPTR
)serverList
, 2, MUIM_List_Remove
, MUIV_List_Remove_Active
1483 ifDHCPState
, MUIM_Notify
, MUIA_Cycle_Active
, MUIV_EveryTime
,
1484 (IPTR
)self
, 2, MUIM_NetPEditor_IPModeChanged
, TRUE
1488 upState
, MUIM_Notify
, MUIA_Selected
, MUIV_EveryTime
,
1489 (IPTR
)self
, 3, MUIM_Set
, MUIA_PrefsEditor_Changed
, TRUE
1494 applyButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1495 (IPTR
)self
, 1, MUIM_NetPEditor_ApplyEntry
1499 closeButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1500 (IPTR
)ifWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
1506 hostApplyButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1507 (IPTR
)self
, 1, MUIM_NetPEditor_ApplyHostEntry
1511 hostCloseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1512 (IPTR
)hostWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
1518 netApplyButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1519 (IPTR
)self
, 1, MUIM_NetPEditor_ApplyNetEntry
1523 netCloseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1524 (IPTR
)netWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
1530 serverApplyButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1531 (IPTR
)self
, 1, MUIM_NetPEditor_ApplyServerEntry
1535 serverCloseButton
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
1536 (IPTR
)serverWindow
, 3, MUIM_Set
, MUIA_Window_Open
, FALSE
1543 IPTR NetPEditor__MUIM_Setup
1545 Class
*CLASS
, Object
*self
, Msg message
1548 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1550 if (!DoSuperMethodA(CLASS
, self
, message
)) return FALSE
;
1552 DoMethod(_app(self
), OM_ADDMEMBER
, data
->netped_ifWindow
);
1553 DoMethod(_app(self
), OM_ADDMEMBER
, data
->netped_hostWindow
);
1554 DoMethod(_app(self
), OM_ADDMEMBER
, data
->netped_netWindow
);
1555 DoMethod(_app(self
), OM_ADDMEMBER
, data
->netped_serverWindow
);
1560 IPTR NetPEditor__MUIM_Cleanup
1562 Class
*CLASS
, Object
*self
, Msg message
1565 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1567 DoMethod(_app(self
), OM_REMMEMBER
, data
->netped_ifWindow
);
1568 DoMethod(_app(self
), OM_REMMEMBER
, data
->netped_hostWindow
);
1569 DoMethod(_app(self
), OM_REMMEMBER
, data
->netped_netWindow
);
1570 DoMethod(_app(self
), OM_REMMEMBER
, data
->netped_serverWindow
);
1572 return DoSuperMethodA(CLASS
, self
, message
);
1575 IPTR NetPEditor__MUIM_PrefsEditor_Save
1577 Class
*CLASS
, Object
*self
, Msg message
1580 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1581 enum ErrorCode errorcode
= UNKNOWN_ERROR
;
1583 Gadgets2NetworkPrefs(data
);
1585 if ((errorcode
= SaveNetworkPrefs()) == ALL_OK
)
1587 SET(self
, MUIA_PrefsEditor_Changed
, FALSE
);
1588 SET(self
, MUIA_PrefsEditor_Testing
, FALSE
);
1592 DisplayErrorMessage(self
, errorcode
);
1594 /* Prefs saved to disk, but stack not restarted. Inform about restart will 'apply' changes */
1595 if (errorcode
== NOT_RESTARTED_STACK
)
1597 Object
* app
= NULL
;
1598 Object
* wnd
= NULL
;
1600 GET(self
, MUIA_ApplicationObject
, &app
);
1601 GET(self
, MUIA_Window_Window
, &wnd
);
1603 MUI_Request(app
, wnd
, 0, _(MSG_INFO_TITLE
), _(MSG_BUTTON_OK
),
1604 _(MSG_PREFS_SAVED_RESTART
), PREFS_PATH_ENVARC
);
1612 IPTR NetPEditor__MUIM_PrefsEditor_Use
1614 Class
*CLASS
, Object
*self
, Msg message
1617 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1618 enum ErrorCode errorcode
= UNKNOWN_ERROR
;
1620 Gadgets2NetworkPrefs(data
);
1622 if ((errorcode
= UseNetworkPrefs()) == ALL_OK
)
1624 SET(self
, MUIA_PrefsEditor_Changed
, FALSE
);
1625 SET(self
, MUIA_PrefsEditor_Testing
, FALSE
);
1629 DisplayErrorMessage(self
, errorcode
);
1634 IPTR NetPEditor__MUIM_PrefsEditor_ImportFH
1636 Class
*CLASS
, Object
*self
,
1637 struct MUIP_PrefsEditor_ImportFH
*message
1640 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1641 BOOL success
= TRUE
;
1643 NetworkPrefs2Gadgets(data
);
1645 DoMethod(self
, MUIM_NetPEditor_IPModeChanged
, TRUE
);
1646 DoMethod(self
, MUIM_NetPEditor_IPModeChanged
, FALSE
);
1651 IPTR NetPEditor__MUIM_PrefsEditor_ExportFH
1653 Class
*CLASS
, Object
*self
,
1654 struct MUIP_PrefsEditor_ExportFH
*message
1657 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1658 BOOL success
= TRUE
;
1660 NetworkPrefs2Gadgets(data
);
1662 DoMethod(self
, MUIM_NetPEditor_IPModeChanged
, TRUE
);
1663 DoMethod(self
, MUIM_NetPEditor_IPModeChanged
, FALSE
);
1668 IPTR NetPEditor__MUIM_NetPEditor_IPModeChanged
1670 Class
*CLASS
, Object
*self
,
1671 struct MUIP_NetPEditor_IPModeChanged
*message
1674 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1677 struct Interface
*iface
;
1679 if (message
->interface
)
1683 data
->netped_interfaceList
,
1684 MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &iface
1686 GetAttr(MUIA_Cycle_Active
, data
->netped_ifDHCPState
, &lng
);
1692 /* Clear and disable text boxes, but keep their values for
1695 SET(data
->netped_IPString
, MUIA_Disabled
, TRUE
);
1696 GET(data
->netped_IPString
, MUIA_String_Contents
, &str
);
1698 SET(data
->netped_IPString
, MUIA_String_Contents
, "");
1700 SET(data
->netped_maskString
, MUIA_Disabled
, TRUE
);
1701 GET(data
->netped_maskString
, MUIA_String_Contents
, &str
);
1702 SetMask(iface
, str
);
1703 SET(data
->netped_maskString
, MUIA_String_Contents
, "");
1707 /* Enable text boxes, and reset their previous values */
1709 SET(data
->netped_IPString
, MUIA_Disabled
, FALSE
);
1710 SET(data
->netped_IPString
, MUIA_String_Contents
,
1713 SET(data
->netped_maskString
, MUIA_Disabled
, FALSE
);
1714 SET(data
->netped_maskString
, MUIA_String_Contents
,
1721 GetAttr(MUIA_Cycle_Active
, data
->netped_DHCPState
, &lng
);
1725 /* Clear and disable text boxes, but keep their values for later */
1727 SET(data
->netped_gateString
, MUIA_Disabled
, TRUE
);
1728 GET(data
->netped_gateString
, MUIA_String_Contents
, &str
);
1730 SET(data
->netped_gateString
, MUIA_String_Contents
, "");
1732 SET(data
->netped_DNSString
[0], MUIA_Disabled
, TRUE
);
1733 GET(data
->netped_DNSString
[0], MUIA_String_Contents
, &str
);
1735 SET(data
->netped_DNSString
[0], MUIA_String_Contents
, "");
1737 SET(data
->netped_DNSString
[1], MUIA_Disabled
, TRUE
);
1738 GET(data
->netped_DNSString
[1], MUIA_String_Contents
, &str
);
1740 SET(data
->netped_DNSString
[1], MUIA_String_Contents
, "");
1744 /* Enable text boxes, and reset their previous values */
1746 SET(data
->netped_gateString
, MUIA_Disabled
, FALSE
);
1747 SET(data
->netped_gateString
, MUIA_String_Contents
, GetGate());
1749 SET(data
->netped_DNSString
[0], MUIA_Disabled
, FALSE
);
1750 SET(data
->netped_DNSString
[0], MUIA_String_Contents
, GetDNS(0));
1752 SET(data
->netped_DNSString
[1], MUIA_Disabled
, FALSE
);
1753 SET(data
->netped_DNSString
[1], MUIA_String_Contents
, GetDNS(1));
1757 SET(self
, MUIA_PrefsEditor_Changed
, TRUE
);
1763 Shows content of current list entry in the interface window.
1765 IPTR NetPEditor__MUIM_NetPEditor_ShowEntry
1767 Class
*CLASS
, Object
*self
,
1771 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1773 struct Interface
*iface
;
1777 data
->netped_interfaceList
,
1778 MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &iface
1782 SET(data
->netped_removeButton
, MUIA_Disabled
, FALSE
);
1783 SET(data
->netped_editButton
, MUIA_Disabled
, FALSE
);
1785 if (GetIfDHCP(iface
))
1787 SET(data
->netped_IPString
, MUIA_String_Contents
, "");
1788 SET(data
->netped_maskString
, MUIA_String_Contents
, "");
1792 SET(data
->netped_IPString
, MUIA_String_Contents
, GetIP(iface
));
1793 SET(data
->netped_maskString
, MUIA_String_Contents
, GetMask(iface
));
1795 SET(data
->netped_nameString
, MUIA_String_Contents
, GetName(iface
));
1796 SET(data
->netped_upState
, MUIA_Selected
, GetUp(iface
) ? 1 : 0);
1797 SET(data
->netped_ifDHCPState
, MUIA_Cycle_Active
, GetIfDHCP(iface
) ? 1 : 0);
1798 SET(data
->netped_deviceString
, MUIA_String_Contents
, GetDevice(iface
));
1799 SET(data
->netped_unitString
, MUIA_String_Integer
, GetUnit(iface
));
1803 SET(data
->netped_removeButton
, MUIA_Disabled
, TRUE
);
1804 SET(data
->netped_editButton
, MUIA_Disabled
, TRUE
);
1805 SET(data
->netped_ifWindow
, MUIA_Window_Open
, FALSE
);
1810 IPTR NetPEditor__MUIM_NetPEditor_EditEntry
1812 Class
*CLASS
, Object
*self
,
1813 struct MUIP_NetPEditor_EditEntry
*message
1816 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1818 if (message
->addEntry
)
1821 Create a new entry and make it the current one
1823 LONG entries
= XGET(data
->netped_interfaceList
, MUIA_List_Entries
);
1824 if (entries
< MAXINTERFACES
)
1826 struct Interface iface
;
1827 InitInterface(&iface
);
1828 iface
.name
[strlen(iface
.name
) - 1] += entries
;
1829 SetUp(&iface
, TRUE
); // new entries are UP
1832 data
->netped_interfaceList
,
1833 MUIM_List_InsertSingle
, &iface
, MUIV_List_Insert_Bottom
1837 /* Warn about DHCP limitations with more than one interface */
1839 DisplayErrorMessage(self
, MULTIPLE_IFACES
);
1841 SET(data
->netped_interfaceList
, MUIA_List_Active
, entries
+ 1);
1844 LONG active
= XGET(data
->netped_interfaceList
, MUIA_List_Active
);
1845 if (active
!= MUIV_List_Active_Off
)
1847 SET(data
->netped_ifWindow
, MUIA_Window_Open
, TRUE
);
1854 Store data from interface window back in current list entry
1856 IPTR NetPEditor__MUIM_NetPEditor_ApplyEntry
1858 Class
*CLASS
, Object
*self
,
1862 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1864 LONG active
= XGET(data
->netped_interfaceList
, MUIA_List_Active
);
1865 if (active
!= MUIV_List_Active_Off
)
1867 struct Interface iface
;
1871 (STRPTR
)XGET(data
->netped_nameString
, MUIA_String_Contents
),
1872 XGET(data
->netped_ifDHCPState
, MUIA_Cycle_Active
),
1873 (STRPTR
)XGET(data
->netped_IPString
, MUIA_String_Contents
),
1874 (STRPTR
)XGET(data
->netped_maskString
, MUIA_String_Contents
),
1875 (STRPTR
)XGET(data
->netped_deviceString
, MUIA_String_Contents
),
1876 XGET(data
->netped_unitString
, MUIA_String_Integer
),
1877 XGET(data
->netped_upState
, MUIA_Selected
)
1879 DoMethod(data
->netped_interfaceList
, MUIM_List_Remove
, active
);
1880 DoMethod(data
->netped_interfaceList
, MUIM_List_InsertSingle
, &iface
, active
);
1881 SET(data
->netped_interfaceList
, MUIA_List_Active
, active
);
1882 SET(self
, MUIA_PrefsEditor_Changed
, TRUE
);
1889 Shows content of current list entry in the host window.
1891 IPTR NetPEditor__MUIM_NetPEditor_ShowHostEntry
1893 Class
*CLASS
, Object
*self
,
1897 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1903 data
->netped_hostList
,
1904 MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &host
1908 SET(data
->netped_hostRemoveButton
, MUIA_Disabled
, FALSE
);
1909 SET(data
->netped_hostEditButton
, MUIA_Disabled
, FALSE
);
1911 SET(data
->netped_hostAddressString
, MUIA_String_Contents
, GetHostAddress(host
));
1912 SET(data
->netped_hostNamesString
, MUIA_String_Contents
, GetHostNames(host
));
1916 SET(data
->netped_hostRemoveButton
, MUIA_Disabled
, TRUE
);
1917 SET(data
->netped_hostEditButton
, MUIA_Disabled
, TRUE
);
1918 SET(data
->netped_hostWindow
, MUIA_Window_Open
, FALSE
);
1923 IPTR NetPEditor__MUIM_NetPEditor_EditHostEntry
1925 Class
*CLASS
, Object
*self
,
1926 struct MUIP_NetPEditor_EditEntry
*message
1929 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1931 if (message
->addEntry
)
1934 Create a new entry and make it the current one
1936 LONG entries
= XGET(data
->netped_hostList
, MUIA_List_Entries
);
1937 if (entries
< MAXHOSTS
)
1943 data
->netped_hostList
,
1944 MUIM_List_InsertSingle
, &host
, MUIV_List_Insert_Bottom
1947 SET(data
->netped_hostList
, MUIA_List_Active
, entries
+ 1);
1950 LONG active
= XGET(data
->netped_hostList
, MUIA_List_Active
);
1951 if (active
!= MUIV_List_Active_Off
)
1953 SET(data
->netped_hostWindow
, MUIA_Window_Open
, TRUE
);
1960 Store data from host window back in current list entry
1962 IPTR NetPEditor__MUIM_NetPEditor_ApplyHostEntry
1964 Class
*CLASS
, Object
*self
,
1968 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
1970 LONG active
= XGET(data
->netped_hostList
, MUIA_List_Active
);
1971 if (active
!= MUIV_List_Active_Off
)
1977 (STRPTR
)XGET(data
->netped_hostNamesString
, MUIA_String_Contents
),
1978 (STRPTR
)XGET(data
->netped_hostAddressString
, MUIA_String_Contents
)
1980 DoMethod(data
->netped_hostList
, MUIM_List_Remove
, active
);
1981 DoMethod(data
->netped_hostList
, MUIM_List_InsertSingle
, &host
, active
);
1982 SET(data
->netped_hostList
, MUIA_List_Active
, active
);
1983 SET(self
, MUIA_PrefsEditor_Changed
, TRUE
);
1990 Shows content of current list entry in the network window.
1992 IPTR NetPEditor__MUIM_NetPEditor_ShowNetEntry
1994 Class
*CLASS
, Object
*self
,
1998 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2000 struct Network
*net
;
2004 data
->netped_networkList
,
2005 MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &net
2009 SET(data
->netped_netRemoveButton
, MUIA_Disabled
, FALSE
);
2010 SET(data
->netped_netEditButton
, MUIA_Disabled
, FALSE
);
2012 SET(data
->netped_sSIDString
, MUIA_String_Contents
, GetNetworkName(net
));
2013 SET(data
->netped_encType
, MUIA_Cycle_Active
, GetEncType(net
));
2014 SET(data
->netped_keyType
, MUIA_Cycle_Active
, net
->keyIsHex
? 1 : 0);
2015 SET(data
->netped_keyString
, MUIA_String_Contents
, GetKey(net
));
2016 SET(data
->netped_adHocState
, MUIA_Selected
, GetAdHoc(net
) ? 1 : 0);
2017 SET(data
->netped_hiddenState
, MUIA_Selected
, GetHidden(net
) ? 1 : 0);
2021 SET(data
->netped_netRemoveButton
, MUIA_Disabled
, TRUE
);
2022 SET(data
->netped_netEditButton
, MUIA_Disabled
, TRUE
);
2023 SET(data
->netped_netWindow
, MUIA_Window_Open
, FALSE
);
2028 IPTR NetPEditor__MUIM_NetPEditor_EditNetEntry
2030 Class
*CLASS
, Object
*self
,
2031 struct MUIP_NetPEditor_EditEntry
*message
2034 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2036 if (message
->addEntry
)
2039 Create a new entry and make it the current one
2041 LONG entries
= XGET(data
->netped_networkList
, MUIA_List_Entries
);
2042 if (entries
< MAXNETWORKS
)
2048 data
->netped_networkList
,
2049 MUIM_List_InsertSingle
, &net
, MUIV_List_Insert_Bottom
2052 SET(data
->netped_networkList
, MUIA_List_Active
, entries
+ 1);
2055 LONG active
= XGET(data
->netped_networkList
, MUIA_List_Active
);
2056 if (active
!= MUIV_List_Active_Off
)
2058 SET(data
->netped_netWindow
, MUIA_Window_Open
, TRUE
);
2065 Store data from network window back in current list entry
2067 IPTR NetPEditor__MUIM_NetPEditor_ApplyNetEntry
2069 Class
*CLASS
, Object
*self
,
2073 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2075 LONG active
= XGET(data
->netped_networkList
, MUIA_List_Active
);
2076 if (active
!= MUIV_List_Active_Off
)
2082 (STRPTR
)XGET(data
->netped_sSIDString
, MUIA_String_Contents
),
2083 XGET(data
->netped_encType
, MUIA_Cycle_Active
),
2084 (STRPTR
)XGET(data
->netped_keyString
, MUIA_String_Contents
),
2085 XGET(data
->netped_keyType
, MUIA_Cycle_Active
),
2086 XGET(data
->netped_hiddenState
, MUIA_Selected
),
2087 XGET(data
->netped_adHocState
, MUIA_Selected
)
2089 DoMethod(data
->netped_networkList
, MUIM_List_Remove
, active
);
2090 DoMethod(data
->netped_networkList
, MUIM_List_InsertSingle
, &net
, active
);
2091 SET(data
->netped_networkList
, MUIA_List_Active
, active
);
2092 SET(self
, MUIA_PrefsEditor_Changed
, TRUE
);
2099 Shows content of current list entry in the file-server window.
2101 IPTR NetPEditor__MUIM_NetPEditor_ShowServerEntry
2103 Class
*CLASS
, Object
*self
,
2107 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2109 struct Server
*server
;
2113 data
->netped_serverList
,
2114 MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &server
2118 SET(data
->netped_serverRemoveButton
, MUIA_Disabled
, FALSE
);
2119 SET(data
->netped_serverEditButton
, MUIA_Disabled
, FALSE
);
2121 SET(data
->netped_serverDevice
, MUIA_String_Contents
, GetServerDevice(server
));
2122 SET(data
->netped_serverActive
, MUIA_Selected
, GetServerActive(server
) ? 1 : 0);
2123 SET(data
->netped_serverHost
, MUIA_String_Contents
, GetServerHost(server
));
2124 SET(data
->netped_serverService
, MUIA_String_Contents
, GetServerService(server
));
2125 SET(data
->netped_serverUser
, MUIA_String_Contents
, GetServerUser(server
));
2126 SET(data
->netped_serverGroup
, MUIA_String_Contents
, GetServerGroup(server
));
2127 SET(data
->netped_serverPass
, MUIA_String_Contents
, GetServerPass(server
));
2131 SET(data
->netped_serverRemoveButton
, MUIA_Disabled
, TRUE
);
2132 SET(data
->netped_serverEditButton
, MUIA_Disabled
, TRUE
);
2133 SET(data
->netped_serverWindow
, MUIA_Window_Open
, FALSE
);
2138 IPTR NetPEditor__MUIM_NetPEditor_EditServerEntry
2140 Class
*CLASS
, Object
*self
,
2141 struct MUIP_NetPEditor_EditEntry
*message
2144 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2146 if (message
->addEntry
)
2149 Create a new entry and make it the current one
2151 LONG entries
= XGET(data
->netped_serverList
, MUIA_List_Entries
);
2152 if (entries
< MAXSERVERS
)
2154 struct Server server
;
2156 (STRPTR
)XGET(data
->netped_domainString
, MUIA_String_Contents
));
2157 server
.device
[strlen(server
.device
) - 1] += entries
;
2160 data
->netped_serverList
,
2161 MUIM_List_InsertSingle
, &server
, MUIV_List_Insert_Bottom
2164 SET(data
->netped_serverList
, MUIA_List_Active
, entries
+ 1);
2167 LONG active
= XGET(data
->netped_serverList
, MUIA_List_Active
);
2168 if (active
!= MUIV_List_Active_Off
)
2170 SET(data
->netped_serverWindow
, MUIA_Window_Open
, TRUE
);
2177 Store data from file-server window back in current list entry
2179 IPTR NetPEditor__MUIM_NetPEditor_ApplyServerEntry
2181 Class
*CLASS
, Object
*self
,
2185 struct NetPEditor_DATA
*data
= INST_DATA(CLASS
, self
);
2187 LONG active
= XGET(data
->netped_serverList
, MUIA_List_Active
);
2188 if (active
!= MUIV_List_Active_Off
)
2190 struct Server server
;
2194 (STRPTR
)XGET(data
->netped_serverDevice
, MUIA_String_Contents
),
2195 (STRPTR
)XGET(data
->netped_serverHost
, MUIA_String_Contents
),
2196 (STRPTR
)XGET(data
->netped_serverService
, MUIA_String_Contents
),
2197 (STRPTR
)XGET(data
->netped_serverUser
, MUIA_String_Contents
),
2198 (STRPTR
)XGET(data
->netped_serverGroup
, MUIA_String_Contents
),
2199 (STRPTR
)XGET(data
->netped_serverPass
, MUIA_String_Contents
),
2200 XGET(data
->netped_serverActive
, MUIA_Selected
)
2202 DoMethod(data
->netped_serverList
, MUIM_List_Remove
, active
);
2203 DoMethod(data
->netped_serverList
, MUIM_List_InsertSingle
, &server
, active
);
2204 SET(data
->netped_serverList
, MUIA_List_Active
, active
);
2205 SET(self
, MUIA_PrefsEditor_Changed
, TRUE
);
2211 /*** Setup ******************************************************************/
2214 NetPEditor
, NULL
, MUIC_PrefsEditor
, NULL
,
2215 OM_NEW
, struct opSet
*,
2218 MUIM_PrefsEditor_ImportFH
, struct MUIP_PrefsEditor_ImportFH
*,
2219 MUIM_PrefsEditor_ExportFH
, struct MUIP_PrefsEditor_ExportFH
*,
2220 MUIM_PrefsEditor_Save
, Msg
,
2221 MUIM_PrefsEditor_Use
, Msg
,
2222 MUIM_NetPEditor_IPModeChanged
, struct MUIP_NetPEditor_IPModeChanged
*,
2223 MUIM_NetPEditor_ShowEntry
, Msg
,
2224 MUIM_NetPEditor_EditEntry
, struct MUIP_NetPEditor_EditEntry
*,
2225 MUIM_NetPEditor_ApplyEntry
, Msg
,
2226 MUIM_NetPEditor_ShowHostEntry
, Msg
,
2227 MUIM_NetPEditor_EditHostEntry
, struct MUIP_NetPEditor_EditEntry
*,
2228 MUIM_NetPEditor_ApplyHostEntry
, Msg
,
2229 MUIM_NetPEditor_ShowNetEntry
, Msg
,
2230 MUIM_NetPEditor_EditNetEntry
, struct MUIP_NetPEditor_EditEntry
*,
2231 MUIM_NetPEditor_ApplyNetEntry
, Msg
,
2232 MUIM_NetPEditor_ShowServerEntry
, Msg
,
2233 MUIM_NetPEditor_EditServerEntry
, struct MUIP_NetPEditor_EditEntry
*,
2234 MUIM_NetPEditor_ApplyServerEntry
, Msg