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

svn at pcbsd.org svn at pcbsd.org
Tue Jul 3 10:02:24 PDT 2012


Author: kris
Date: 2012-07-03 17:02:23 +0000 (Tue, 03 Jul 2012)
New Revision: 17597

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

Simplify the ifconfig scanning, and remove an unused function



Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2012-07-03 16:34:25 UTC (rev 17596)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.cpp	2012-07-03 17:02:23 UTC (rev 17597)
@@ -483,37 +483,6 @@
   Utils::runShellCommand(arguments);
 }
 
-QString NetworkTray::getValue( QString File, QString Key, int occur ) {
-
-  int found = 1;
-  QFile file( File );
-  if ( file.open( QIODevice::ReadOnly ) ) {
-    QTextStream stream( &file );
-    QString line;
-    while ( !stream.atEnd() ) {
-      line = stream.readLine(); // line of text excluding '\n'
-      // If the KEY is found in the line, continue processing 
-      if ( line.indexOf(Key, 0) != -1 && line.indexOf("#", 0) != 0) {
-         if ( found == occur) {
-         line.remove(line.indexOf(Key, 0), Key.length());
-	 // Remove any quotes
-	 if ( line.indexOf('"') == 0 )
-	 line = line.remove(0, 1);
-	    
-  	  if ( line.indexOf('"') != -1  )
-	    line.truncate(line.indexOf('"'));
-	  return line;
-        } else {
-          found++;  
-        }
-      }
-    }
-    file.close();
-  }
-
-  return "";
-}
-
 void  NetworkTray::openDeviceInfo() {
 
   QString program = "sudo";
@@ -596,11 +565,14 @@
 {
    QProcess *getIfProc = new QProcess();
    getIfProc->start(IFCONFIG, QStringList() << ident);
-   if (getIfProc->waitForFinished(2000)) {
-     ifconfigOutput.clear();
-     ifconfigOutput = getIfProc->readAllStandardOutput().simplified();
+   while(getIfProc->state() == QProcess::Starting || getIfProc->state() == QProcess::Running) {
+      getIfProc->waitForFinished(200);
+      QCoreApplication::processEvents();
    }
 
+   ifconfigOutput.clear();
+   ifconfigOutput = getIfProc->readAllStandardOutput().simplified();
+
    //qDebug() << IFCONFIG + " output: " << ifconfigOutput <<"\n";
 
    getIfProc->kill();
@@ -609,8 +581,6 @@
 
 void NetworkTray::slotCheckWifiAvailability(){
   if(DeviceType == "Wireless"){
-    // Update the ifconfig output of this device
-    updateIfStatus(DeviceName);
     // Get the device up status
     DeviceStatus = getStatusForIdent();
     //Show a message if the wifi is down

Modified: pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h
===================================================================
--- pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2012-07-03 16:34:25 UTC (rev 17596)
+++ pcbsd/current/src-qt4/pc-netmanager/src/NetworkTray/NetworkTray.h	2012-07-03 17:02:23 UTC (rev 17597)
@@ -53,7 +53,6 @@
    QString getNetmaskForIdent();
    QString getSignalStrengthForIdent( QString ident );
    QString getWirelessSpeedForIdent( QString ident );
-   QString getValue( QString File, QString Key, int occur );
    QString getUpStatusForIdent();
    QString getStatusForIdent();
    QString getMediaForIdent();



More information about the Commits mailing list