[PC-BSD Commits] r6202 - in pcbsd/trunk/pcbsd-netmanager/src: NetworkManager ethernetconfig wificonfig
svn at pcbsd.org
svn at pcbsd.org
Mon Feb 8 12:45:16 PST 2010
Author: kris
Date: 2010-02-08 12:45:16 -0800 (Mon, 08 Feb 2010)
New Revision: 6202
Modified:
pcbsd/trunk/pcbsd-netmanager/src/NetworkManager/networkman.cpp
pcbsd/trunk/pcbsd-netmanager/src/ethernetconfig/ethernetconfig.cpp
pcbsd/trunk/pcbsd-netmanager/src/wificonfig/wificonfigwidgetbase.cpp
Log:
Fixed up a bunch of bugs in the network GUI, fixing issues with loading info
when using our new lagg interface
Modified: pcbsd/trunk/pcbsd-netmanager/src/NetworkManager/networkman.cpp
===================================================================
--- pcbsd/trunk/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-02-08 16:10:38 UTC (rev 6201)
+++ pcbsd/trunk/pcbsd-netmanager/src/NetworkManager/networkman.cpp 2010-02-08 20:45:16 UTC (rev 6202)
@@ -192,6 +192,7 @@
textGlobalError->setText("");
refreshDevices();
+ DevSelectionChanged();
}
// Function which locates the parent device of a wlan child device
@@ -301,7 +302,7 @@
void NetworkMan::DevSelectionChanged()
{
- int sel = listNetDev->currentRow();
+ int sel = listNetDev->currentRow();
if ( sel != -1 ) {
Modified: pcbsd/trunk/pcbsd-netmanager/src/ethernetconfig/ethernetconfig.cpp
===================================================================
--- pcbsd/trunk/pcbsd-netmanager/src/ethernetconfig/ethernetconfig.cpp 2010-02-08 16:10:38 UTC (rev 6201)
+++ pcbsd/trunk/pcbsd-netmanager/src/ethernetconfig/ethernetconfig.cpp 2010-02-08 20:45:16 UTC (rev 6202)
@@ -167,9 +167,9 @@
}
if ( checkMAC->isChecked() )
- ifConfigLine="inet " + lineIP->text() + " netmask " + lineNetmask->text();
+ ifConfigLine=lineIP->text() + " netmask " + lineNetmask->text();
else
- ifConfigLine="inet " + lineIP->text() \
+ ifConfigLine=lineIP->text() \
+" netmask " + lineNetmask->text() \
+ " ether " + lineMAC->text();
@@ -458,19 +458,25 @@
void ethernetconfig::loadInfo()
{
+ QString tmp;
+
// Get all the device information for the info tab
if ( textInfoName->text().isEmpty() ) {
- textInfoName->setText(getNameForIdent(DeviceName) );
+ tmp = getNameForIdent(DeviceName);
+ tmp.truncate(25);
+ textInfoName->setText(tmp);
}
- textIP->setText(getIpForIdent(DeviceName) );
- textNetmask->setText(getNetmaskForIdent( DeviceName ) );
+ textIP->setText(getIpForIdent("lagg0") );
+ textNetmask->setText(getNetmaskForIdent( "lagg0" ) );
textMac->setText(getMacForIdent( DeviceName ) );
textStatus->setText(getStatusForIdent( DeviceName ) );
textIPv6->setText(getIPv6ForIdent( DeviceName) );
- textGateway->setText(getGatewayForIdent(DeviceName) );
- textMedia->setText(getMediaForIdent(DeviceName) );
+ textGateway->setText(getGatewayForIdent("lagg0") );
+ tmp = getMediaForIdent(DeviceName);
+ tmp.truncate(20);
+ textMedia->setText(tmp);
// Get the packet status for this device
textPacketsIn->setText(getInPacketsForIdent( DeviceName) );
@@ -490,7 +496,7 @@
QString ethernetconfig::getIpForIdent( QString ident )
{
- NetworkInterface ifr(ident);
+ NetworkInterface ifr(ident);
return ifr.ipAsString();
}
@@ -592,19 +598,22 @@
}
} else {
- if ( tmp.indexOf("inet") == 0)
+ // Look for an IP configuration
+ tmp2 = tmp;
+ tmp2.remove(0, tmp2.lastIndexOf("laggport") + 9);
+ tmp2 = tmp2.simplified();
+ tmp2.remove(0, tmp2.indexOf(" "));
+ tmp2 = tmp2.simplified();
+ tmp2.truncate(tmp2.indexOf(" "));
+
+ if ( ! tmp2.isEmpty())
{
- // Get the IP address first
- tmp2 = tmp;
- tmp2 = tmp2.remove(0, tmp.indexOf("inet") + 5 );
- //tmp2 = tmp2.remove(0, tmp.indexOf(" ") );
- tmp2.truncate(tmp.indexOf("netmask") -1 );
- lineIP->setText(tmp2);
+ lineIP->setText(tmp2);
- // Look for the netmask
- if ( tmp.indexOf("netmask") != -1 ) {
+ // Look for the netmask
+ if ( tmp.indexOf("netmask") != -1 ) {
tmp2 = tmp;
- tmp2.simplified();
+ tmp2 = tmp2.simplified();
tmp2 = tmp2.remove(0, tmp.indexOf("netmask") + 8 );
if ( tmp.indexOf("ether") != -1 ) {
tmp2.truncate(tmp.indexOf("ether") );
@@ -618,9 +627,7 @@
if ( tmp.indexOf("ether") != -1 ) {
tmp2 = tmp;
tmp2 = tmp2.remove(0, tmp.indexOf("ether") + 6 );
- //if ( tmp.indexOf(" ") != -1 ) {
- // tmp2.truncate(tmp.indexOf(" ") );
- //}
+ tmp2 = tmp2.simplified();
lineMAC->setText(tmp2);
checkMAC->setChecked(FALSE);
groupMAC->setEnabled(TRUE);
Modified: pcbsd/trunk/pcbsd-netmanager/src/wificonfig/wificonfigwidgetbase.cpp
===================================================================
--- pcbsd/trunk/pcbsd-netmanager/src/wificonfig/wificonfigwidgetbase.cpp 2010-02-08 16:10:38 UTC (rev 6201)
+++ pcbsd/trunk/pcbsd-netmanager/src/wificonfig/wificonfigwidgetbase.cpp 2010-02-08 20:45:16 UTC (rev 6202)
@@ -147,9 +147,9 @@
}
if ( checkMAC->isChecked() ) {
- ifConfigLine="inet " + lineIP->text() + " netmask " + lineNetmask->text();
+ ifConfigLine=lineIP->text() + " netmask " + lineNetmask->text();
} else {
- ifConfigLine="inet " + lineIP->text() + " netmask " + lineNetmask->text() + " ether " + lineMAC->text();
+ ifConfigLine=lineIP->text() + " netmask " + lineNetmask->text() + " ether " + lineMAC->text();
}
} else {
@@ -158,7 +158,6 @@
saveLaggLine(DeviceName, "WPA " + ifConfigLine);
- //saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1);
// Now create the wpa_supplicant file based on saved configuration
QFile fileout( "/etc/wpa_supplicant.conf" );
@@ -1066,6 +1065,7 @@
tmp = tr("Unknown Wireless Device");
}
+ tmp.truncate(20);
textInfoName->setText(tmp);
} else {
@@ -1074,13 +1074,15 @@
}
- textIP->setText(getIpForIdent(DeviceName) );
- textNetmask->setText(getNetmaskForIdent( DeviceName ) );
+ textIP->setText(getIpForIdent("lagg0") );
+ textNetmask->setText(getNetmaskForIdent( "lagg0" ) );
textMac->setText(getMacForIdent( DeviceName ) );
textStatus->setText(getStatusForIdent( DeviceName ) );
textIPv6->setText(getIPv6ForIdent( DeviceName) );
- textGateway->setText(getGatewayForIdent(DeviceName) );
- textMedia->setText(getMediaForIdent(DeviceName ) );
+ textGateway->setText(getGatewayForIdent( "lagg0" ) );
+ tmp = getMediaForIdent(DeviceName);
+ tmp.truncate(20);
+ textMedia->setText(tmp);
// Get the packet status for this device
textPacketsIn->setText(getInPacketsForIdent( DeviceName) );
@@ -1112,7 +1114,7 @@
if ( tmp.indexOf("OFF") != -1 ) {
checkDisableWireless->setChecked(TRUE);
tabMainWidget->setEnabled(FALSE);
- } else if ( tmp.indexOf("inet") == -1 )
+ } else if ( tmp.indexOf("DHCP") != -1 )
{
checkDHCP->setChecked(TRUE);
lineNetmask->setText("255.255.255.0");
@@ -1131,29 +1133,36 @@
}
- } else if ( tmp.indexOf("inet") != -1 ) {
+ } else {
+ // Look for an IP configuration
+ tmp2 = tmp;
+ tmp2.remove(0, tmp2.lastIndexOf("laggport") + 9);
+ tmp2 = tmp2.simplified();
+ tmp2.remove(0, tmp2.indexOf(" "));
+ tmp2 = tmp2.simplified();
+ tmp2.truncate(tmp2.indexOf(" "));
+
+ if ( ! tmp2.isEmpty()) {
// Get the IP address first
- tmp2 = tmp;
- tmp2 = tmp2.remove(0, tmp.indexOf("inet") + 5 );
- tmp2.truncate(tmp2.indexOf(" "));
- tmp2 = tmp2.simplified();
lineIP->setText(tmp2);
- // Look for the netmask
- if ( tmp.indexOf("netmask") != -1 ) {
- tmp2 = tmp;
- tmp2 = tmp2.remove(0, tmp.indexOf("netmask") + 8 );
- if ( tmp.indexOf("ether") != -1 ) {
- tmp2.truncate(tmp.indexOf("ether") );
- }
+ // Look for the netmask
+ if ( tmp.indexOf("netmask") != -1 ) {
+ tmp2 = tmp;
+ tmp2 = tmp2.remove(0, tmp.indexOf("netmask") + 8 );
+ if ( tmp.indexOf("ether") != -1 ) {
+ tmp2.truncate(tmp.indexOf("ether") );
+ }
+ tmp2 = tmp2.simplified();
- lineNetmask->setText(tmp2);
+ lineNetmask->setText(tmp2);
- } else {
- // No netmask specified, default it instead
- lineNetmask->setText("255.255.255.0");
+ } else {
+ // No netmask specified, default it instead
+ lineNetmask->setText("255.255.255.0");
+ }
}
- }
+ }
}
@@ -1390,22 +1399,12 @@
QString wificonfigwidgetbase::getMediaForIdent( QString ident )
{
- QString command = "nice ifconfig " +ident + " | grep \"media:\"";
+ QString command = "nice ifconfig " +ident + " | grep media:";
QString inputLine = getLineFromCommandOutput(command);
QString status = "";
if (inputLine != "" && inputLine.indexOf("media:") != -1){
-
- status = inputLine.remove(0, inputLine.indexOf("media:") + 7);
- status.truncate(inputLine.indexOf("\n") );
- if ( status.indexOf("(") != -1)
- {
- status.remove(0, status.indexOf("(") + 1);
- }
- if ( status.indexOf(")") != -1)
- {
- status.truncate(status.indexOf(")"));
- }
+ status = inputLine.remove(0, inputLine.indexOf("media:") + 7);
}
return status;
More information about the Commits
mailing list