From 8c3c490801722e160bdbd1b73733acf42db2e5bd Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 15 Feb 2011 21:34:00 +0000 Subject: [PATCH] add a quick "None" option to the Address mode setting as proposed by DeadYak git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40523 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../InterfacesAddOn/InterfaceAddressView.cpp | 25 ++++++++++++++++--- .../InterfacesAddOn/InterfaceAddressView.h | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp b/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp index 8e2cfe67f2..7c66254f08 100644 --- a/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp +++ b/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp @@ -35,6 +35,9 @@ InterfaceAddressView::InterfaceAddressView(BRect frame, const char* name, new BMessage(AUTOSEL_MSG))); fModePopUpMenu->AddItem(new BMenuItem("Static", new BMessage(STATICSEL_MSG))); + fModePopUpMenu->AddSeparatorItem(); + fModePopUpMenu->AddItem(new BMenuItem("None", + new BMessage(NONESEL_MSG))); fModeField = new BMenuField(frame, "mode", "Mode:", fModePopUpMenu, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW); @@ -92,6 +95,12 @@ InterfaceAddressView::MessageReceived(BMessage* message) case STATICSEL_MSG: _EnableFields(true); break; + case NONESEL_MSG: + _EnableFields(false); + fAddressField->SetText(""); + fNetmaskField->SetText(""); + fGatewayField->SetText(""); + break; default: BView::MessageReceived(message); } @@ -111,14 +120,24 @@ status_t InterfaceAddressView::RevertFields() { // Populate address fields with current settings + const char* currMode = fSettings->AutoConfigure() ? "Automatic" : "Static"; - BMenuItem* item = fModePopUpMenu->FindItem(currMode); - if (item) - item->SetMarked(true); _EnableFields(!fSettings->AutoConfigure()); // if Autoconfigured, disable address fields until changed + // TODO : AutoConfigure needs to be based on family + if (fSettings->IPAddr(fFamily).IsEmpty() + && !fSettings->AutoConfigure()) + { + currMode = "None"; + _EnableFields(false); + } + + BMenuItem* item = fModePopUpMenu->FindItem(currMode); + if (item) + item->SetMarked(true); + fAddressField->SetText(fSettings->IP(fFamily)); fNetmaskField->SetText(fSettings->Netmask(fFamily)); fGatewayField->SetText(fSettings->Gateway(fFamily)); diff --git a/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h b/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h index d31f53a72b..005e0f9e3a 100644 --- a/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h +++ b/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h @@ -20,7 +20,8 @@ enum { AUTOSEL_MSG = 'iato', - STATICSEL_MSG = 'istc' + STATICSEL_MSG = 'istc', + NONESEL_MSG = 'inon' };