Network: added notify settings updated method.
* And call it from the DNS client -- this is the only add-on that does not trigger a configuration or settings update, so we have to notify the changes manually.
This commit is contained in:
@@ -27,10 +27,6 @@ enum BNetworkSettingsType {
|
|||||||
B_NETWORK_SETTINGS_TYPE_OTHER = 'othr'
|
B_NETWORK_SETTINGS_TYPE_OTHER = 'othr'
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
kMsgSettingsItemUpdated = 'SIup'
|
|
||||||
};
|
|
||||||
|
|
||||||
class BNetworkProfile;
|
class BNetworkProfile;
|
||||||
class BNetworkSettings;
|
class BNetworkSettings;
|
||||||
|
|
||||||
@@ -70,6 +66,8 @@ public:
|
|||||||
virtual void SettingsUpdated(uint32 type);
|
virtual void SettingsUpdated(uint32 type);
|
||||||
virtual void ConfigurationUpdated(const BMessage& message);
|
virtual void ConfigurationUpdated(const BMessage& message);
|
||||||
|
|
||||||
|
virtual void NotifySettingsUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const BNetworkProfile*
|
const BNetworkProfile*
|
||||||
fProfile;
|
fProfile;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ BView*
|
|||||||
DNSClientServiceItem::View()
|
DNSClientServiceItem::View()
|
||||||
{
|
{
|
||||||
if (fView == NULL)
|
if (fView == NULL)
|
||||||
fView = new DNSSettingsView();
|
fView = new DNSSettingsView(this);
|
||||||
|
|
||||||
return fView;
|
return fView;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,10 @@ static const int32 kMsgApply = 'aply';
|
|||||||
#define B_TRANSLATION_CONTEXT "DNSSettingsView"
|
#define B_TRANSLATION_CONTEXT "DNSSettingsView"
|
||||||
|
|
||||||
|
|
||||||
DNSSettingsView::DNSSettingsView()
|
DNSSettingsView::DNSSettingsView(BNetworkSettingsItem* item)
|
||||||
:
|
:
|
||||||
BView("dns", 0)
|
BView("dns", 0),
|
||||||
|
fItem(item)
|
||||||
{
|
{
|
||||||
fServerListView = new BListView("nameservers");
|
fServerListView = new BListView("nameservers");
|
||||||
fTextControl = new IPAddressControl(AF_UNSPEC, "server", "");
|
fTextControl = new IPAddressControl(AF_UNSPEC, "server", "");
|
||||||
@@ -158,7 +159,8 @@ DNSSettingsView::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kMsgApply:
|
case kMsgApply:
|
||||||
_SaveDNSConfiguration();
|
if (_SaveDNSConfiguration() == B_OK)
|
||||||
|
fItem->NotifySettingsUpdated();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -9,10 +9,13 @@
|
|||||||
#define DNS_SETTINGS_VIEW_H
|
#define DNS_SETTINGS_VIEW_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <NetworkSettingsAddOn.h>
|
||||||
#include <StringList.h>
|
#include <StringList.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace BNetworkKit;
|
||||||
|
|
||||||
class BButton;
|
class BButton;
|
||||||
class BListView;
|
class BListView;
|
||||||
class BTextControl;
|
class BTextControl;
|
||||||
@@ -20,7 +23,7 @@ class BTextControl;
|
|||||||
|
|
||||||
class DNSSettingsView : public BView {
|
class DNSSettingsView : public BView {
|
||||||
public:
|
public:
|
||||||
DNSSettingsView();
|
DNSSettingsView(BNetworkSettingsItem* item);
|
||||||
~DNSSettingsView();
|
~DNSSettingsView();
|
||||||
|
|
||||||
status_t Revert();
|
status_t Revert();
|
||||||
@@ -33,6 +36,8 @@ private:
|
|||||||
status_t _SaveDNSConfiguration();
|
status_t _SaveDNSConfiguration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
BNetworkSettingsItem*
|
||||||
|
fItem;
|
||||||
BListView* fServerListView;
|
BListView* fServerListView;
|
||||||
BStringList fRevertList;
|
BStringList fRevertList;
|
||||||
BTextControl* fTextControl;
|
BTextControl* fTextControl;
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
#include <NetworkInterface.h>
|
#include <NetworkInterface.h>
|
||||||
#include <NetworkSettings.h>
|
#include <NetworkSettings.h>
|
||||||
|
|
||||||
|
#include "NetworkWindow.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace BNetworkKit;
|
using namespace BNetworkKit;
|
||||||
|
|
||||||
@@ -57,6 +59,16 @@ BNetworkSettingsItem::ConfigurationUpdated(const BMessage& message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BNetworkSettingsItem::NotifySettingsUpdated()
|
||||||
|
{
|
||||||
|
// TODO: post to network window
|
||||||
|
BMessage updated(kMsgSettingsItemUpdated);
|
||||||
|
updated.AddPointer("item", this);
|
||||||
|
gNetworkWindow.SendMessage(&updated);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ static const uint32 kMsgRevert = 'rvrt';
|
|||||||
static const uint32 kMsgToggleReplicant = 'trep';
|
static const uint32 kMsgToggleReplicant = 'trep';
|
||||||
static const uint32 kMsgItemSelected = 'ItSl';
|
static const uint32 kMsgItemSelected = 'ItSl';
|
||||||
|
|
||||||
|
BMessenger gNetworkWindow;
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
#undef B_TRANSLATION_CONTEXT
|
||||||
#define B_TRANSLATION_CONTEXT "NetworkWindow"
|
#define B_TRANSLATION_CONTEXT "NetworkWindow"
|
||||||
@@ -152,6 +154,8 @@ NetworkWindow::NetworkWindow()
|
|||||||
.AddGlue()
|
.AddGlue()
|
||||||
.End();
|
.End();
|
||||||
|
|
||||||
|
gNetworkWindow = this;
|
||||||
|
|
||||||
_ScanInterfaces();
|
_ScanInterfaces();
|
||||||
_ScanAddOns();
|
_ScanAddOns();
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ class InterfaceListItem;
|
|||||||
class InterfaceView;
|
class InterfaceView;
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
kMsgSettingsItemUpdated = 'SIup'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class NetworkWindow : public BWindow {
|
class NetworkWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
NetworkWindow();
|
NetworkWindow();
|
||||||
@@ -62,7 +67,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<BNetworkSettingsAddOn> AddOnList;
|
typedef BObjectList<BNetworkSettingsAddOn> AddOnList;
|
||||||
typedef BObjectList<BNetworkSettingsItem> ItemList;
|
|
||||||
typedef std::map<BString, BListItem*> ItemMap;
|
typedef std::map<BString, BListItem*> ItemMap;
|
||||||
typedef std::map<BListItem*, BNetworkSettingsItem*> SettingsMap;
|
typedef std::map<BListItem*, BNetworkSettingsItem*> SettingsMap;
|
||||||
|
|
||||||
@@ -84,4 +88,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern BMessenger gNetworkWindow;
|
||||||
|
|
||||||
|
|
||||||
#endif // NETWORK_WINDOW_H
|
#endif // NETWORK_WINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user