rename the following methods:

tqfind find
tqreplace replace
tqcontains contains


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/wlassistant@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent a568c330af
commit 197fa69548

@ -252,7 +252,7 @@ public:
if ( (!mCmd.isEmpty()) && (!quiet) ) {//mCmd = TQStringList();
TQString mCmdString = mCmd.join(" ");
if (!np.wepKey.isEmpty()) mCmdString.tqreplace(np.wepKey, "xxxxxxxxxx");
if (!np.wepKey.isEmpty()) mCmdString.replace(np.wepKey, "xxxxxxxxxx");
std::cout << action << ": " << mCmdString << std::endl;
}
return mCmd;

@ -346,7 +346,7 @@ void WirelessAssistant::netScan( const WANetParams & np )
//runCommand( Commands.cmd("ifdown", NetParams) ); //Commented out b/c it seems to cause more problems than it solves. (like no scan results)
std::cout << "No networks found!" << std::endl;
statusLabel->setText( i18n("No networks found.") );
if ( result.tqfind("Resource temporarily unavailable")>-1 ) {
if ( result.find("Resource temporarily unavailable")>-1 ) {
std::cout << "Radio switch seems to be off." << std::endl;
KMessageBox::information(0, i18n("Radio of your wireless card seems to be turned off using an external switch on your computer.\nYou need turn it on to be able to use wireless networks.") );
}
@ -429,8 +429,8 @@ void WirelessAssistant::parseScan( const TQString & output )
enc = true;
wpaSettings.clear();
if ( section.tqcontains("WPA2 Version") ) wpaSettings << "WPA2"; //prefer WPA2 over WPA
else if ( section.tqcontains("WPA Version") ) wpaSettings << "WPA";
if ( section.contains("WPA2 Version") ) wpaSettings << "WPA2"; //prefer WPA2 over WPA
else if ( section.contains("WPA Version") ) wpaSettings << "WPA";
wpa = ( !wpaSettings.isEmpty() );
if (wpa) {
@ -442,7 +442,7 @@ void WirelessAssistant::parseScan( const TQString & output )
// CHECK IF SAME ESSID ALREADY FOUND, if necessary
if (groupAPs) {
if ( !hidden && essidList.tqcontains(essid) ) {
if ( !hidden && essidList.contains(essid) ) {
NetListViewItem* sameEssid = static_cast<NetListViewItem*>(getItemByEssid(essid));
sameEssid->setAp("any");
if (sameEssid->quality() < qualInt) {
@ -503,7 +503,7 @@ bool WirelessAssistant::setNetParamsFromConfig( const TQString & s )
for (TQStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
if ( (*nps).section(",",2,2)==s || ( (*nps).section(",",1,1)==s && (*nps).section(",",2,2)=="any") ) {
NetParams.loadNetParamsString( *nps );
if (!s.tqcontains(":")) NetParams.ap = "any"; //if searched by essid
if (!s.contains(":")) NetParams.ap = "any"; //if searched by essid
return 1;
}
}
@ -654,7 +654,7 @@ void WirelessAssistant::netConnect( const WANetParams & np )
statusLabel->tqrepaint();
if (!WATools::isUp(np.iface) ) WATools::setUp( true, np.iface );
//runCommand( Commands.cmd("ifup", np) );
if ( runCommand( Commands.cmd("iwconfig_set", np) ).tqfind("8B04") > -1 ) { // error 8B04 - Request 'Set Frequency' not supported.
if ( runCommand( Commands.cmd("iwconfig_set", np) ).find("8B04") > -1 ) { // error 8B04 - Request 'Set Frequency' not supported.
WANetParams np2 = np;
np2.channel = "0";
runCommand( Commands.cmd("iwconfig_set", np2) );
@ -680,7 +680,7 @@ void WirelessAssistant::netConnect( const WANetParams & np )
///// CONFIGURE IP ADDRESS etc.
if (np.dhcp) { //DHCP config
TQString dhcp_out = runCommand( Commands.cmd("ifconfig_dhcp", np), DhcpTimeout );
if ( dhcp_out.tqcontains("::ERR::") && !dhcp_out.tqcontains("bound to ") ) { // 'bound to' is a check for dhclient, which gives some output to stderr even when succeeded
if ( dhcp_out.contains("::ERR::") && !dhcp_out.contains("bound to ") ) { // 'bound to' is a check for dhclient, which gives some output to stderr even when succeeded
if ( dhcpClientRunning() )
runCommand( Commands.cmd("kill_dhcp", np) ); //kill any stale DHCP client running (seems it's dhclient only)
setUi(1);
@ -738,7 +738,7 @@ void WirelessAssistant::setConnectedItem( const TQString & netid )
}
if (!netid.isEmpty()) {
TQListViewItem* lvi;
if (netid.tqcontains(":")) lvi = getItemByAp( netid ); //netid is an AP address
if (netid.contains(":")) lvi = getItemByAp( netid ); //netid is an AP address
else lvi = getItemByEssid( netid );
if (lvi) {
NetListViewItem* nvi = static_cast<NetListViewItem*>(lvi);
@ -858,7 +858,7 @@ void WirelessAssistant::togglePage(bool options)
buttonScan->setDisabled(options);
buttonConnect->setDisabled(options);
if (options) {
if (WAConfig::self()->config()->groupList().tqcontains("Notification Messages")>0)
if (WAConfig::self()->config()->groupList().contains("Notification Messages")>0)
buttonEnableAllMessages->setEnabled(true);
else
buttonEnableAllMessages->setEnabled(false);
@ -1134,7 +1134,7 @@ bool WirelessAssistant::generateWpaConfigFile( const TQString& essid, const TQSt
//WPA authentication suite
c.append("key_mgmt=");
if ( wpaSettings[3].tqcontains("PSK") ) c.append("WPA-PSK\n");
if ( wpaSettings[3].contains("PSK") ) c.append("WPA-PSK\n");
else return TQString(); // not supported
//WPA pairwise cipher
@ -1185,28 +1185,28 @@ bool WirelessAssistant::generateWpaConfigFile( const TQString& essid, const TQSt
bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQString driver )
{
if (!e) {
if ( runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "terminate" ).tqcontains("OK") ) {
if ( runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "terminate" ).contains("OK") ) {
TQFile( wpaConfigFile ).remove();
return 1;
} else
return 0; // wpa client was not running.
}
if ( !runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" ).tqcontains("Failed to connect") ) {
if ( !runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" ).contains("Failed to connect") ) {
std::cout << "WPA client already running. Reconfiguring..." << std::endl;
runCommand( TQStringList(Commands.wpa_cli) << "reconfigure" );
} else {
if ( driver.isEmpty() ) { //detect needed driver
TQString k = WATools::kernelModule( iface );
if ( k.tqcontains("hermes") ) driver = "hermes";
else if ( k.tqcontains("atmel") ) driver = "atmel";
if ( k.contains("hermes") ) driver = "hermes";
else if ( k.contains("atmel") ) driver = "atmel";
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
else if ( k.tqcontains("ipw") ) driver = "ipw"; //wext should be used for kernels newer than 2.6.12
else if ( k.contains("ipw") ) driver = "ipw"; //wext should be used for kernels newer than 2.6.12
#endif
//Commented out, because ndiswrapper newer than 1.13 works with wext driver.
//else if ( k.tqcontains("ndiswrapper") ) driver = "ndiswrapper";
//else if ( k.contains("ndiswrapper") ) driver = "ndiswrapper";
//Commented out, because madwifi-ng works with wext driver.
//else if ( k.tqcontains("ath") ) driver = "madwifi";
//else if ( k.contains("ath") ) driver = "madwifi";
else driver = "wext";
std::cout << "Using wpa_supplicant driver: " << driver << std::endl;
}
@ -1231,7 +1231,7 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQSt
TQString o;
int i = 0;
while ( !(o =runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" )).tqcontains("Failed to connect") ) {
while ( !(o =runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" )).contains("Failed to connect") ) {
for (int c = 0; c < 15; c++) {
usleep(75*1000); //75msec
KApplication::eventLoop()->processEvents( TQEventLoop::AllEvents );
@ -1241,7 +1241,7 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQSt
runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "terminate" );
return 0;
}
if ( o.tqcontains("wpa_state=COMPLETED") ) {
if ( o.contains("wpa_state=COMPLETED") ) {
std::cout << "WPA Authorisation successful." << std::endl;
return 1;
}

Loading…
Cancel
Save