[haiku-commits] r40523 - haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Feb 2011 22:34:01 +0100 (CET)

Author: kallisti5
Date: 2011-02-15 22:34:00 +0100 (Tue, 15 Feb 2011)
New Revision: 40523
Changeset: http://dev.haiku-os.org/changeset/40523

Modified:
   
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp
   haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h
Log:
add a quick "None" option to the Address mode setting as proposed by DeadYak

Modified: 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp
===================================================================
--- 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp 
    2011-02-15 20:34:47 UTC (rev 40522)
+++ 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.cpp 
    2011-02-15 21:34:00 UTC (rev 40523)
@@ -35,6 +35,9 @@
                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 @@
                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 @@
 InterfaceAddressView::RevertFields()
 {
        // Populate address fields with current settings
+
        const char* currMode = fSettings->AutoConfigure() ? "Automatic" : 
"Static";
+
+       _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);
 
-       _EnableFields(!fSettings->AutoConfigure());
-               // if Autoconfigured, disable address fields until changed
-
        fAddressField->SetText(fSettings->IP(fFamily));
        fNetmaskField->SetText(fSettings->Netmask(fFamily));
        fGatewayField->SetText(fSettings->Gateway(fFamily));

Modified: 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h
===================================================================
--- 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h   
    2011-02-15 20:34:47 UTC (rev 40522)
+++ 
haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn/InterfaceAddressView.h   
    2011-02-15 21:34:00 UTC (rev 40523)
@@ -20,7 +20,8 @@
 
 enum {
     AUTOSEL_MSG = 'iato',
-    STATICSEL_MSG = 'istc'
+    STATICSEL_MSG = 'istc',
+    NONESEL_MSG = 'inon'
 };
 
 


Other related posts: