[PC-BSD Commits] r17926 - pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray

svn at pcbsd.org svn at pcbsd.org
Tue Jul 24 13:42:27 PDT 2012


Author: kris
Date: 2012-07-24 20:42:27 +0000 (Tue, 24 Jul 2012)
New Revision: 17926

Modified:
   pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
Log:

Fix a bug getting the IP address to show on the tray app



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2012-07-24 20:32:35 UTC (rev 17925)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2012-07-24 20:42:27 UTC (rev 17926)
@@ -151,21 +151,25 @@
   QString inputLine = ifconfigOutput;
   QString ip= "";
   QString tDev;
-  if ( usingLagg )
+  if ( usingLagg ) {
     tDev = "lagg0";
-  else
-    tDev = DeviceName;
+    QString cmd = IFCONFIG + " " + tDev + " | grep " + DeviceName;
+    QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
+    if ( ! checkLagg.isEmpty() ) {
+      cmd = IFCONFIG + " " + tDev + " | grep 'inet ' ";
+      inputLine = getLineFromCommandOutput(cmd.toLatin1());
+    }
 
-  QString cmd = IFCONFIG + " " + tDev + " | grep " + DeviceName;
-  QString checkLagg = getLineFromCommandOutput(cmd.toLatin1());
-  if ( ! checkLagg.isEmpty() ) {
-    cmd = IFCONFIG + " " + tDev + " | grep 'inet ' ";
-    inputLine = getLineFromCommandOutput(cmd.toLatin1());
+    if (inputLine != "" && inputLine.indexOf("inet ") != -1){
+      ip = inputLine.remove(0, inputLine.indexOf("inet ") + 5);
+      ip.truncate(inputLine.indexOf(" "));
+    }
+    return ip;
   }
 
   if (inputLine != "" && inputLine.indexOf("inet ") != -1){
     ip = inputLine.remove(0, inputLine.indexOf("inet ") + 5);
-    ip.truncate(ip.indexOf(" "));
+    ip.truncate(inputLine.indexOf(" "));
   }
 	
   return ip;



More information about the Commits mailing list