[PC-BSD Commits] r18406 - pcbsd/current/src-qt4/libpcbsd
svn at pcbsd.org
svn at pcbsd.org
Sat Aug 11 08:13:22 PDT 2012
Author: kenmoore
Date: 2012-08-11 15:13:22 +0000 (Sat, 11 Aug 2012)
New Revision: 18406
Modified:
pcbsd/current/src-qt4/libpcbsd/netif.cpp
Log:
Recommit the fix for wifiQuickCOnnect. It now properly overwrites an SSID configuration instead of adding duplicate entries.
Modified: pcbsd/current/src-qt4/libpcbsd/netif.cpp
===================================================================
--- pcbsd/current/src-qt4/libpcbsd/netif.cpp 2012-08-11 14:51:20 UTC (rev 18405)
+++ pcbsd/current/src-qt4/libpcbsd/netif.cpp 2012-08-11 15:13:22 UTC (rev 18406)
@@ -439,38 +439,37 @@
else if(line.contains("}")){eEnd = true; }
//Save the file by entry temporarily
- //if(eStart){ tmpEntry = line; inEntry = true; }
- //else if(eEnd){ tmpEntry.append(" ::: "+line); tmpFileList << tmpEntry; inEntry=false; }
- //else if(inEntry){ tmpEntry.append(" ::: "+line); }
- //else{ tmpFileList << line; }
+ if(eStart){ tmpEntry = line; inEntry = true; }
+ else if(eEnd){ tmpEntry.append(" ::: "+line); tmpFileList << tmpEntry; inEntry=false; }
+ else if(inEntry){ tmpEntry.append(" ::: "+line); }
+ else{ tmpFileList << line; }
}
fileout.close();
}
//If the desired SSID already has an entry, remove it from wpa_supplicant.conf
- /* if(existingSSID){
- qDebug() << "Overwriting Existing configuration for "+SSID;
+ if(existingSSID){
QFile tmpFile( "/etc/wpa_supplicant.conf.tmp" );
if(tmpFile.open(QIODevice::WriteOnly | QIODevice::Text )){
QTextStream oStr(&tmpFile);
for(int i=0; i<tmpFileList.length(); i++){
- qDebug() << "tmpFileList[i]:" << tmpFileList[i];
if(tmpFileList[i].contains("network={")){
- QStringList tmp = tmpFileList[i].split(" ::: ");
+ QStringList tmp = tmpFileList[i].split(" ::: ");
//skip it if the new SSID
- if( !tmp[tmp.indexOf("ssid=")].contains(SSID) ){
+ int idx = tmp.indexOf("ssid=");
+ if( (idx!= -1) && !tmp[idx].contains(SSID) ){
for(int j=0; j<tmp.length(); j++){
- oStr << tmp[j] + "/n";
+ oStr << tmp[j] + "\n";
}
}
}else{
- oStr << tmpFileList[i] + "/n";
+ oStr << tmpFileList[i] + "\n";
}
}
}
tmpFile.close();
Utils::runShellCommand("mv /etc/wpa_supplicant.conf.tmp /etc/wpa_supplicant.conf");
}
- */
+
// Create the wpa_supplicant file based on saved configuration
if ( fileout.open( QIODevice::Append ) ) {
QTextStream streamout( &fileout );
More information about the Commits
mailing list