author | kergoth <kergoth> | 2003-03-28 04:00:35 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-03-28 04:00:35 (UTC) |
commit | 5ceaf5abfb26bb57687eead3201c08034239dd30 (patch) (side-by-side diff) | |
tree | 1bec6c5aece4211abd19248c1bb24731641dc671 | |
parent | 1f7da3774c074c57832c7eaa88dd67fba370db71 (diff) | |
download | opie-5ceaf5abfb26bb57687eead3201c08034239dd30.zip opie-5ceaf5abfb26bb57687eead3201c08034239dd30.tar.gz opie-5ceaf5abfb26bb57687eead3201c08034239dd30.tar.bz2 |
Correct the use of OProcess.
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index db03266..3797e22 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp @@ -133,116 +133,110 @@ void WLANImp::parseSettingFile(){ } } /** * Saves settings to the wireless.opts file using the current profile */ void WLANImp::changeAndSaveSettingFile(){ QString wlanFile = WIRELESS_OPTS; QFile::remove(wlanFile); QFile file(wlanFile); if (!file.open(IO_ReadWrite)){ qDebug(QString("WLANImp::changeAndSaveSettingFile(): Can't open file: %1 for writing.").arg(wlanFile).latin1()); return; } QTextStream stream( &file ); bool foundCase = false; bool found = false; bool output = true; for ( QStringList::Iterator it = settingsFileText.begin(); it != settingsFileText.end(); ++it ) { QString line = (*it).simplifyWhiteSpace(); if(line.contains("case")) foundCase = true; // See if we found our scheme to write or the sceme couldn't be found if((foundCase && line.contains("esac") && !found) || (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')){ // write out scheme found = true; output = false; if(!line.contains("esac")) stream << line << "\n"; if(!essAny->isChecked() == true){ stream << "\tESSID=any\n"; stream << "\tMODE=Managed\n"; } else{ stream << "\tESSID=" << essSpecificLineEdit->text() << '\n'; stream << "\tMODE=" << ( networkType->currentItem() == 0 ? "Managed" : "ad-hoc") << '\n'; stream << "\tCHANNEL=" << networkChannel->value() << "\n"; } stream << "\t#KEY0=" << keyLineEdit0->text() << "\n"; stream << "\t#KEY1=" << keyLineEdit1->text() << "\n"; stream << "\t#KEY2=" << keyLineEdit2->text() << "\n"; stream << "\t#KEY3=" << keyLineEdit3->text() << "\n"; if(wepEnabled->isChecked()){ stream << "\tKEY=\""; if(keyRadio0->isChecked()) stream << keyLineEdit0->text(); if(keyRadio1->isChecked()) stream << keyLineEdit1->text(); if(keyRadio2->isChecked()) stream << keyLineEdit2->text(); if(keyRadio3->isChecked()) stream << keyLineEdit3->text(); if(authOpen->isChecked()) stream << " open"; else stream << " restricted"; stream << "\"\n"; } stream << "\tRATE=auto\n"; if(line.contains("esac")) stream << line << "\n"; } if(line.contains(";;")) output = true; if(output && (*it).length() ) stream << (*it) << '\n'; } file.close(); } /** * Check to see if the current config is valid * Save wireless.opts, save interfaces */ void WLANImp::accept(){ if(wepEnabled->isChecked()){ if(keyLineEdit0->text().isEmpty() && keyLineEdit1->text().isEmpty() && keyLineEdit2->text().isEmpty() && keyLineEdit3->text().isEmpty() ){ QMessageBox::information(this, "Error", "Please enter a key for WEP.", QMessageBox::Ok); return; } } if(essAny->isChecked() && essSpecificLineEdit->text().isEmpty()){ QMessageBox::information(this, "Error", "Please enter a ESS-ID.", QMessageBox::Ok); return; } // Ok settings are good here, save changeAndSaveSettingFile(); // Try to save the interfaces settings. if(!interfaceSetup->saveChanges()) return; - OProcess insert; -// OProcess eject; - - insert << "sh -c \"cardctl insert && cardctl eject\""; -// eject << "cardctl eject"; - -// if (!eject.start(OProcess::Block, OProcess::NoCommunication) ) { -// qWarning("could not start cardctl eject"); -// } + OProcess insert(QString("sh")); + insert << "-c"; + insert << "cardctl eject && cardctl insert"; if (!insert.start(OProcess::DontCare, OProcess::NoCommunication) ) { - qWarning("could not start cardctl insert"); + qWarning("could not start cardctl"); } // Close out the dialog QDialog::accept(); } // wlanimp.cpp |