[PC-BSD Commits] r2670 - pcbsd/trunk/NetworkTray
svn at pcbsd.org
svn at pcbsd.org
Tue Sep 2 08:12:17 PDT 2008
Author: kris
Date: 2008-09-02 08:12:17 -0700 (Tue, 02 Sep 2008)
New Revision: 2670
Modified:
pcbsd/trunk/NetworkTray/NetworkTray.cpp
pcbsd/trunk/NetworkTray/NetworkTray.pro
Log:
Fixed the network tray app to work with SSIDs that have a space in the name also
Modified: pcbsd/trunk/NetworkTray/NetworkTray.cpp
===================================================================
--- pcbsd/trunk/NetworkTray/NetworkTray.cpp 2008-09-02 14:50:25 UTC (rev 2669)
+++ pcbsd/trunk/NetworkTray/NetworkTray.cpp 2008-09-02 15:12:17 UTC (rev 2670)
@@ -223,10 +223,9 @@
QString SSID = "";
if (inputLine != "" && inputLine.find("ssid ") != -1){
-
+
SSID = inputLine.remove(0, inputLine.find(" ") + 1);
- SSID.truncate(inputLine.find(" ") );
-
+ SSID.truncate(inputLine.indexOf("channel") - 1 );
}
return SSID;
@@ -297,35 +296,40 @@
{
QString command = "ifconfig " + ident + " scan | grep " + DeviceSSID;
- QString inputLine = getLineFromCommandOutput(command);
- QString name = "";
+ QString line = getLineFromCommandOutput(command);
+ QString tmp;
- inputLine = inputLine.simplifyWhiteSpace();
- inputLine = inputLine.remove(inputLine.findRev(" "), inputLine.length() );
- inputLine = inputLine.remove(inputLine.findRev(" "), inputLine.length() );
- inputLine = inputLine.remove(0, inputLine.findRev(" "));
- inputLine.truncate(inputLine.find(":"));
- name = inputLine;
+ // Get the signal strength of this device
+ tmp = line;
+ tmp = tmp.simplified();
- return name;
+ // First remove the SSID which may have spaces in it
+ tmp.remove(0, tmp.find(":"));
+
+ // Now find the strength section
+ tmp = tmp.section(" ", 3, 3);
+ tmp.truncate(tmp.find(":"));
+
+ return tmp;
}
QString NetworkTray::getWirelessSpeedForIdent( QString ident )
{
QString command = "ifconfig " + ident + " scan | grep " + DeviceSSID;
- QString inputLine = getLineFromCommandOutput(command);
- QString name = "";
-
- inputLine = inputLine.simplifyWhiteSpace();
- inputLine = inputLine.remove(0, inputLine.find(" ") + 1);
- inputLine = inputLine.remove(0, inputLine.find(" ") + 1);
- inputLine = inputLine.remove(0, inputLine.find(" ") + 1);
- inputLine.truncate(inputLine.find(" ") );
-
- name = inputLine;
+ QString line = getLineFromCommandOutput(command);
+ QString tmp;
- return name;
+ // Get the signal strength of this device
+ tmp = line;
+ tmp = tmp.simplified();
+
+ // First remove the SSID which may have spaces in it
+ tmp.remove(0, tmp.find(":"));
+
+ // Now find the Speed section
+ tmp = tmp.section(" ", 2, 2);
+ return tmp;
}
void NetworkTray::slotTrayActivated(QSystemTrayIcon::ActivationReason reason) {
@@ -414,7 +418,6 @@
QString NotifyText = "";
QString filename = "/home/" + username + "/.kde4/Autostart/tray-" + DeviceName + ".desktop";
-
// First run a check to see if this applet has been disabled in the network manager
QFile testFile(filename);
if ( ! testFile.exists() )
@@ -570,7 +573,7 @@
tmp.toInt(&ok);
if ( ok ) {
newStrength = tmp.toInt(&ok);
- if ( newStrength < 25 )
+ if ( newStrength < 5 )
{
iconStrength = 0;
FileLoad="/PCBSD/networkmanager/pics/tray_wifi.png";
Modified: pcbsd/trunk/NetworkTray/NetworkTray.pro
===================================================================
--- pcbsd/trunk/NetworkTray/NetworkTray.pro 2008-09-02 14:50:25 UTC (rev 2669)
+++ pcbsd/trunk/NetworkTray/NetworkTray.pro 2008-09-02 15:12:17 UTC (rev 2670)
@@ -14,5 +14,7 @@
SOURCES += main.cpp \
NetworkTray.cpp
+QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
+
QT += qt3support
More information about the Commits
mailing list