2 * Copyright 2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, <axeld@pinc-software.de>
11 #include <NetworkSettingsAddOn.h>
12 #include <StringItem.h>
14 #include "InterfaceAddressView.h"
17 using namespace BNetworkKit
;
20 #undef B_TRANSLATION_CONTEXT
21 #define B_TRANSLATION_CONTEXT "IPv6InterfaceAddOn"
24 class IPv6InterfaceAddOn
: public BNetworkSettingsAddOn
{
26 IPv6InterfaceAddOn(image_id image
,
27 BNetworkSettings
& settings
);
28 virtual ~IPv6InterfaceAddOn();
30 virtual BNetworkSettingsInterfaceItem
*
31 CreateNextInterfaceItem(uint32
& cookie
,
32 const char* interface
);
36 class IPv6InterfaceItem
: public BNetworkSettingsInterfaceItem
{
38 IPv6InterfaceItem(const char* interface
,
39 BNetworkSettings
& settings
);
40 virtual ~IPv6InterfaceItem();
42 virtual BListItem
* ListItem();
43 virtual BView
* View();
45 virtual status_t
Revert();
46 virtual bool IsRevertable();
48 virtual void ConfigurationUpdated(const BMessage
& message
);
51 BNetworkSettings
& fSettings
;
52 BNetworkInterfaceListItem
*
62 IPv6InterfaceItem::IPv6InterfaceItem(const char* interface
,
63 BNetworkSettings
& settings
)
65 BNetworkSettingsInterfaceItem(interface
),
67 fItem(new BNetworkInterfaceListItem(AF_INET6
, Interface(),
68 B_TRANSLATE("IPv6"), settings
)),
74 IPv6InterfaceItem::~IPv6InterfaceItem()
76 if (fView
->Parent() == NULL
)
84 IPv6InterfaceItem::ListItem()
91 IPv6InterfaceItem::View()
94 fView
= new InterfaceAddressView(AF_INET6
, Interface(), fSettings
);
101 IPv6InterfaceItem::Revert()
103 return fView
!= NULL
? fView
->Revert() : B_OK
;
108 IPv6InterfaceItem::IsRevertable()
110 return fView
!= NULL
? fView
->IsRevertable() : false;
115 IPv6InterfaceItem::ConfigurationUpdated(const BMessage
& message
)
118 fView
->ConfigurationUpdated(message
);
125 IPv6InterfaceAddOn::IPv6InterfaceAddOn(image_id image
,
126 BNetworkSettings
& settings
)
128 BNetworkSettingsAddOn(image
, settings
)
133 IPv6InterfaceAddOn::~IPv6InterfaceAddOn()
138 BNetworkSettingsInterfaceItem
*
139 IPv6InterfaceAddOn::CreateNextInterfaceItem(uint32
& cookie
,
140 const char* interface
)
143 return new IPv6InterfaceItem(interface
, Settings());
153 BNetworkSettingsAddOn
*
154 instantiate_network_settings_add_on(image_id image
, BNetworkSettings
& settings
)
156 return new IPv6InterfaceAddOn(image
, settings
);