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
This commit is contained in:
Alexander von Gluck IV 2011-02-15 21:34:00 +00:00
parent 71947e478c
commit 8c3c490801
2 changed files with 24 additions and 4 deletions

View File

@ -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));

View File

@ -20,7 +20,8 @@
enum {
AUTOSEL_MSG = 'iato',
STATICSEL_MSG = 'istc'
STATICSEL_MSG = 'istc',
NONESEL_MSG = 'inon'
};