[PC-BSD Commits] r5992 - pcbsd/trunk/pcbsd-netmanager/src/NetworkTray

svn at pcbsd.org svn at pcbsd.org
Wed Jan 13 10:58:36 PST 2010


Author: kris
Date: 2010-01-13 10:58:36 -0800 (Wed, 13 Jan 2010)
New Revision: 5992

Modified:
   pcbsd/trunk/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
Log:

Updated networkTray to also use lagg0 device when need be



Modified: pcbsd/trunk/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/trunk/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp	2010-01-13 18:42:14 UTC (rev 5991)
+++ pcbsd/trunk/pcbsd-netmanager/src/NetworkTray/NetworkTray.cpp	2010-01-13 18:58:36 UTC (rev 5992)
@@ -185,7 +185,13 @@
 {
   QString inputLine = ifconfigOutput;
   QString ip= "";
-	
+  QString cmd = "ifconfig lagg0 | grep " + DeviceName;
+  QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
+  if ( ! checkLagg.isEmpty() ) {
+    cmd = "ifconfig lagg0 | grep 'inet ' ";
+    inputLine = getLineFromCommandOutput(cmd.toLatin1());
+  }
+
   if (inputLine != "" && inputLine.indexOf("inet ") != -1){
     ip = inputLine.remove(0, inputLine.indexOf("inet ") + 5);
     ip.truncate(ip.indexOf(" "));
@@ -207,7 +213,7 @@
   QString SSID = "";
 	
   if (inputLine != "" && inputLine.indexOf("ssid ") != -1){
-    SSID = inputLine.remove(0, inputLine.indexOf(" ") + 1);
+    SSID = inputLine.remove(0, inputLine.indexOf("ssid ") + 5);
     SSID.truncate(inputLine.indexOf("channel") - 1 );
   }
 	
@@ -229,7 +235,7 @@
 
 QString NetworkTray::getSignalStrengthForIdent( QString ident )
 {
-  QString command = "ifconfig " + ident + " scan | grep " + DeviceSSID;
+  QString command = "ifconfig " + ident + " list scan | grep " + DeviceSSID;
   QString line = getLineFromCommandOutput(command);
   QString tmp;
 	
@@ -237,12 +243,11 @@
   tmp = line.simplified();
 
   // First remove the SSID which may have spaces in it
-  tmp.remove(0, tmp.indexOf(":"));
+  tmp.remove(tmp.lastIndexOf(":"), tmp.size());
+  tmp = tmp.simplified();
+  tmp.remove(0, tmp.lastIndexOf(" "));
+  tmp = tmp.simplified();
 
-  // Now find the strength section
-  tmp = tmp.section(" ", 3, 3);
-  tmp.truncate(tmp.indexOf(":"));
-
   return tmp;	
 }
 
@@ -418,6 +423,7 @@
        bool ok;
        // Get the strength of the signal
        tmp = getSignalStrengthForIdent( DeviceName );
+       DeviceSignalStrength = tmp;
        // Figure out if we need to change the strength icon
        tmp.toInt(&ok);
        if ( ok ) {



More information about the Commits mailing list