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 <NetworkSettings.h>
12 #include <NetworkSettingsAddOn.h>
13 #include <StringItem.h>
15 #include "DNSSettingsView.h"
18 using namespace BNetworkKit
;
21 #undef B_TRANSLATION_CONTEXT
22 #define B_TRANSLATION_CONTEXT "DNSClientServiceAddOn"
25 class DNSClientServiceAddOn
: public BNetworkSettingsAddOn
{
27 DNSClientServiceAddOn(image_id image
,
28 BNetworkSettings
& settings
);
29 virtual ~DNSClientServiceAddOn();
31 virtual BNetworkSettingsItem
*
32 CreateNextItem(uint32
& cookie
);
36 class DNSClientServiceItem
: public BNetworkSettingsItem
{
39 BNetworkSettings
& settings
);
40 virtual ~DNSClientServiceItem();
42 virtual BNetworkSettingsType
45 virtual BListItem
* ListItem();
46 virtual BView
* View();
48 virtual status_t
Revert();
49 virtual bool IsRevertable();
52 BNetworkSettings
& fSettings
;
54 DNSSettingsView
* fView
;
61 DNSClientServiceItem::DNSClientServiceItem(BNetworkSettings
& settings
)
64 fItem(new BStringItem(B_TRANSLATE("DNS settings"))),
70 DNSClientServiceItem::~DNSClientServiceItem()
72 if (fView
->Parent() == NULL
)
80 DNSClientServiceItem::Type() const
82 return B_NETWORK_SETTINGS_TYPE_SERVICE
;
87 DNSClientServiceItem::ListItem()
94 DNSClientServiceItem::View()
97 fView
= new DNSSettingsView(this);
104 DNSClientServiceItem::Revert()
111 DNSClientServiceItem::IsRevertable()
120 DNSClientServiceAddOn::DNSClientServiceAddOn(image_id image
,
121 BNetworkSettings
& settings
)
123 BNetworkSettingsAddOn(image
, settings
)
128 DNSClientServiceAddOn::~DNSClientServiceAddOn()
133 BNetworkSettingsItem
*
134 DNSClientServiceAddOn::CreateNextItem(uint32
& cookie
)
137 return new DNSClientServiceItem(Settings());
147 BNetworkSettingsAddOn
*
148 instantiate_network_settings_add_on(image_id image
, BNetworkSettings
& settings
)
150 return new DNSClientServiceAddOn(image
, settings
);