summaryrefslogtreecommitdiffstats
path: root/src/wlassistant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wlassistant.cpp')
-rw-r--r--src/wlassistant.cpp412
1 files changed, 206 insertions, 206 deletions
diff --git a/src/wlassistant.cpp b/src/wlassistant.cpp
index bf58914..6149e47 100644
--- a/src/wlassistant.cpp
+++ b/src/wlassistant.cpp
@@ -27,16 +27,16 @@
#include <iostream>
#include <linux/version.h> //provides LINUX_VERSION* macros
-#include <qregexp.h>
-#include <qlabel.h>
-#include <qprocess.h>
-#include <qcursor.h>
-#include <qeventloop.h>
-#include <qtimer.h>
-#include <qcheckbox.h>
-#include <qspinbox.h>
-#include <qwidgetstack.h>
-#include <qtooltip.h>
+#include <tqregexp.h>
+#include <tqlabel.h>
+#include <tqprocess.h>
+#include <tqcursor.h>
+#include <tqeventloop.h>
+#include <tqtimer.h>
+#include <tqcheckbox.h>
+#include <tqspinbox.h>
+#include <tqwidgetstack.h>
+#include <tqtooltip.h>
#include <kpushbutton.h>
#include <kcombobox.h>
@@ -48,8 +48,8 @@
#include <klocale.h>
#include <kstandarddirs.h>
-WirelessAssistant::WirelessAssistant(QWidget* parent, const char* name, bool modal, WFlags fl)
- : mainWindow(parent,name, modal,fl)
+WirelessAssistant::WirelessAssistant(TQWidget* tqparent, const char* name, bool modal, WFlags fl)
+ : mainWindow(tqparent,name, modal,fl)
{
buttonScan->setIconSet( SmallIconSet("reload") );
buttonConnect->setIconSet( SmallIconSet("connect_creating") );
@@ -61,35 +61,35 @@ WirelessAssistant::WirelessAssistant(QWidget* parent, const char* name, bool mod
frameDevice->hide();
/// Network List Widget
- connect( buttonScan, SIGNAL(clicked()),
- this, SLOT(netScan()) );
+ connect( buttonScan, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(netScan()) );
- connect( buttonConnect, SIGNAL(clicked()),
- this, SLOT(itemAction()) );
+ connect( buttonConnect, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(itemAction()) );
- connect( buttonClose, SIGNAL(clicked()),
- this, SLOT(close()) );
+ connect( buttonClose, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(close()) );
- connect( devCombo, SIGNAL(activated( const QString & )),
- this, SLOT(setDev( const QString & )) );
+ connect( devCombo, TQT_SIGNAL(activated( const TQString & )),
+ this, TQT_SLOT(setDev( const TQString & )) );
- connect( netList, SIGNAL(rightButtonPressed( QListViewItem*, const QPoint&, int )),
- SLOT(showItemContextMenu( QListViewItem*, const QPoint&, int )) );
+ connect( netList, TQT_SIGNAL(rightButtonPressed( TQListViewItem*, const TQPoint&, int )),
+ TQT_SLOT(showItemContextMenu( TQListViewItem*, const TQPoint&, int )) );
/// Settings Widget
- connect( buttonOptions, SIGNAL(toggled(bool)),
- this, SLOT(togglePage(bool)) );
+ connect( buttonOptions, TQT_SIGNAL(toggled(bool)),
+ this, TQT_SLOT(togglePage(bool)) );
- connect( buttonEnableAllMessages, SIGNAL(clicked()),
- this, SLOT(enableAllMessages()) );
+ connect( buttonEnableAllMessages, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(enableAllMessages()) );
/// Global KDE Options
- connect( KApplication::kApplication(), SIGNAL(settingsChanged(int)),
- this, SLOT(updateConfiguration(int)) );
+ connect( KApplication::kApplication(), TQT_SIGNAL(settingsChanged(int)),
+ this, TQT_SLOT(updateConfiguration(int)) );
setMouseBehaviour();
- QTimer::singleShot(10, this, SLOT(init()) ); //WAIT FOR THE UI TO BE READY BEFORE FURTHER SETUP (msec)
+ TQTimer::singleShot(10, this, TQT_SLOT(init()) ); //WAIT FOR THE UI TO BE READY BEFORE FURTHER SETUP (msec)
}
WirelessAssistant::~WirelessAssistant()
@@ -101,11 +101,11 @@ WirelessAssistant::~WirelessAssistant()
void WirelessAssistant::init()
{
statusLabel->setText(i18n("Initializing..."));
- statusLabel->repaint();
+ statusLabel->tqrepaint();
////////////////////////////////////////
///// CHECK FOR SYSFS (KERNEL 2.6) /////
- if ( !QFile::exists("/sys") ) {
+ if ( !TQFile::exists("/sys") ) {
std::cout << "Sysfs not present. Exiting." << std::endl;
KMessageBox::error( 0, i18n("Kernel 2.6 or later not present.\nWireless Assistant will now quit.") );
close();
@@ -150,7 +150,7 @@ void WirelessAssistant::init()
///////////////////////////////////
///// DETECT WIRELESS DEVICES /////
- QStringList devList = interfaceList();
+ TQStringList devList = interfaceList();
if ( devList.count()==0 ) {
std::cout << "No wireless interfaces found. Exiting." << std::endl;
KMessageBox::error(0, i18n("No usable wireless devices found.\nWireless Assistant will now quit."));
@@ -174,7 +174,7 @@ void WirelessAssistant::init()
//////////////////////////////////
///// CHECK FILE PERMISSIONS /////
- if (!QFileInfo("/etc/resolv.conf").isWritable()) {
+ if (!TQFileInfo("/etc/resolv.conf").isWritable()) {
std::cout << "warning: /etc/resolv.conf not writable" << std::endl;
KMessageBox::information(0, i18n("<qt><p>You might have insufficient permissions for Wireless Assistant to function properly.</p><p>Did you run it using '<tt>sudo</tt>'?</p></qt>") );
}
@@ -188,16 +188,16 @@ void WirelessAssistant::init()
///// INITIALIZE GLOBAL VARIABLES /////
wpaAvailable = ( !( Commands.wpa_supplicant.isEmpty() || Commands.wpa_cli.isEmpty() ) );
connectedItem = 0;
- timerGui = new QTimer();
- timerConnectionCheck = new QTimer();
- connect( timerGui, SIGNAL(timeout()), SLOT(updateConnectedItem()) );
- connect( timerConnectionCheck, SIGNAL(timeout()), SLOT(checkConnectionStatus()) );
+ timerGui = new TQTimer();
+ timerConnectionCheck = new TQTimer();
+ connect( timerGui, TQT_SIGNAL(timeout()), TQT_SLOT(updateConnectedItem()) );
+ connect( timerConnectionCheck, TQT_SIGNAL(timeout()), TQT_SLOT(checkConnectiontqStatus()) );
////////////////////////
///// DETECT & SET PATHS /////
if (!Commands.allFound) { //all ok or ONLY dhcpcd not found (i.e. dhclient present).
std::cout << "Missing executables (" << Commands.notFound.join("', '") << "). Exiting." << std::endl;
- KMessageBox::error(0, i18n("Executable(s) '%1' could not be found.\nWireless Assistant will now quit.").arg(Commands.notFound.join("', '")) );
+ KMessageBox::error(0, i18n("Executable(s) '%1' could not be found.\nWireless Assistant will now quit.").tqarg(Commands.notFound.join("', '")) );
close();
return;
}
@@ -208,14 +208,14 @@ void WirelessAssistant::init()
///////////////////////////////////////
///// SCAN FOR AVAILABLE NETWORKS /////
if ( autoConnect )
- QTimer::singleShot( 0, this, SLOT(netAutoConnect()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(netAutoConnect()) );
else
- QTimer::singleShot( 0, this, SLOT(netScan()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(netScan()) );
}
-void WirelessAssistant::checkConnectionStatus()
+void WirelessAssistant::checkConnectiontqStatus()
{
- QListViewItem* lvi;
+ TQListViewItem* lvi;
if (groupAPs) lvi = getItemByEssid( WATools::essid(NetParams.iface));
else lvi = getItemByAp( WATools::ap(NetParams.iface ));
bool needsKey;
@@ -235,7 +235,7 @@ void WirelessAssistant::checkConnectionStatus()
} else if (connectedItem) { //connection LOST
setConnectedItem(0);
timerConnectionCheck->stop();
- if ( autoReconnect || KMessageBox::questionYesNo(0, i18n("Connection to '%1' has been lost!\nWould you like to reconnect?").arg(NetParams.essid), i18n("Connection Lost") , KStdGuiItem::yes(), KStdGuiItem::no() ) == KMessageBox::Yes ) {
+ if ( autoReconnect || KMessageBox::questionYesNo(0, i18n("Connection to '%1' has been lost!\nWould you like to reconnect?").tqarg(NetParams.essid), i18n("Connection Lost") , KStdGuiItem::yes(), KStdGuiItem::no() ) == KMessageBox::Yes ) {
netDisconnect( true );
netConnect();
}
@@ -246,10 +246,10 @@ void WirelessAssistant::checkConnectionStatus()
void WirelessAssistant::removeNetParams()
{
NetListViewItem *nvi = static_cast<NetListViewItem*>(netList->selectedItem());
- QString ap = nvi->ap(); QString essid = nvi->essid();
- for (QStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
+ TQString ap = nvi->ap(); TQString essid = nvi->essid();
+ for (TQStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
if ( (*nps).section(",",2,2)==ap && (*nps).section(",",1,1)==essid) {
- if ( KMessageBox::warningContinueCancel(0, i18n("<qt><p>Settings for network '<b>%1</b>' are about to be deleted.</p><p>Would you like to continue?</p></qt>").arg(essid)) == KMessageBox::Continue ) {
+ if ( KMessageBox::warningContinueCancel(0, i18n("<qt><p>Settings for network '<b>%1</b>' are about to be deleted.</p><p>Would you like to continue?</p></qt>").tqarg(essid)) == KMessageBox::Continue ) {
if (nvi->hidden()) // hiddenEssid = 1
nvi->setEssid("<hidden>");
NetParamsList.remove(nps);
@@ -264,25 +264,25 @@ void WirelessAssistant::removeNetParams()
void WirelessAssistant::setDNS( const WANetParams & np )
{
- QFile f("/etc/resolv.conf");
+ TQFile f("/etc/resolv.conf");
if (f.open( IO_WriteOnly | IO_Truncate )) {
- QTextStream s( &f );
+ TQTextStream s( &f );
if (!np.domain.isEmpty()) {
- s << QString("domain " + np.domain + "\n");
+ s << TQString("domain " + np.domain + "\n");
std::cout << "resolv.conf: domain " << np.domain << std::endl;
}
if (!np.dns1.isEmpty()) {
- s << QString("nameserver " + np.dns1 + "\n");
+ s << TQString("nameserver " + np.dns1 + "\n");
std::cout << "resolv.conf: nameserver " << np.dns1 << std::endl;
}
if (!np.dns2.isEmpty()) {
- s << QString("nameserver " + np.dns2 + "\n");
+ s << TQString("nameserver " + np.dns2 + "\n");
std::cout << "resolv.conf: nameserver " << np.dns2 << std::endl;
}
f.close();
} else {
std::cout << "dns setup error: " << f.name() << " is not writeable." << std::endl;
- KMessageBox::error(0, i18n("<qt><p>File '<i>%1</i>' could not be opened for writing.</p><p>Nameserver(s) and/or domain are not set.</p></qt>").arg(f.name()) );
+ KMessageBox::error(0, i18n("<qt><p>File '<i>%1</i>' could not be opened for writing.</p><p>Nameserver(s) and/or domain are not set.</p></qt>").tqarg(f.name()) );
}
}
@@ -291,7 +291,7 @@ void WirelessAssistant::netScan()
timerConnectionCheck->stop(); //stop while scanning.
netScan( NetParams );
if (netList->childCount() > 0) {
- QTimer::singleShot( 0, this, SLOT(checkConnectionStatus()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(checkConnectiontqStatus()) );
timerConnectionCheck->start(WA_CONNECTION_CHECK_INTERVAL);
}
}
@@ -314,30 +314,30 @@ void WirelessAssistant::netScan( const WANetParams & np )
}
if ( !WATools::isUp(np.iface) ) {
- statusLabel->setText(i18n("Bringing interface %1 up...").arg(np.iface));
+ statusLabel->setText(i18n("Bringing interface %1 up...").tqarg(np.iface));
//runCommand( Commands.cmd("ifup",np) );
WATools::setUp(true, np.iface);
if (DelayBeforeScanning>0) {
statusLabel->setText(i18n("Waiting before scanning..."));
- statusLabel->repaint();
- KApplication::eventLoop()->processEvents( QEventLoop::ExcludeUserInput );
+ statusLabel->tqrepaint();
+ KApplication::eventLoop()->processEvents( TQEventLoop::ExcludeUserInput );
usleep(DelayBeforeScanning * 1000000); // delay * 1000ms
}
}
statusLabel->setText(i18n("Scanning..."));
- statusLabel->repaint();
+ statusLabel->tqrepaint();
netList->clear();
- QString result;
+ TQString result;
statusLabel->setText(i18n("Scanning..."));
result = runCommand( Commands.cmd("scan",np) );
parseScan( result );
if (netList->childCount() > 0) {
- std::cout << "Networks found: " << QString::number( netList->childCount() ) << std::endl;
+ std::cout << "Networks found: " << TQString::number( netList->childCount() ) << std::endl;
if (wasConnected)
groupAPs ? setConnectedItem( WATools::essid() ) : setConnectedItem( WATools::ap() ); //mark item as connected.
statusLabel->setText( i18n("Done.") );
@@ -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.find("Resource temporarily unavailable")>-1 ) {
+ if ( result.tqfind("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.") );
}
@@ -354,25 +354,25 @@ void WirelessAssistant::netScan( const WANetParams & np )
setNetListColumns();
}
-void WirelessAssistant::parseScan( const QString & output )
+void WirelessAssistant::parseScan( const TQString & output )
{
- QString essid;
- QStringList essidList;
- QString channel;
- QString mode;
+ TQString essid;
+ TQStringList essidList;
+ TQString channel;
+ TQString mode;
int qualInt;
bool enc; //default to false
bool hidden; //default to false
- QString ap;
+ TQString ap;
// security parameters
bool wpa;
- QStringList wpaSettings;
- //QString wpaVersion, wpaGroupCipher, wpaPairwiseCipher, wpaAuthenticationSuite;
+ TQStringList wpaSettings;
+ //TQString wpaVersion, wpaGroupCipher, wpaPairwiseCipher, wpaAuthenticationSuite;
bool ok_channel = true; //does iwlist return channel?
- QString section;
+ TQString section;
netList->setUpdatesEnabled( false ); //do not redraw while adding items to avoid flicker.
@@ -410,7 +410,7 @@ void WirelessAssistant::parseScan( const QString & output )
} else
hidden=false;
- // GET QUALITY
+ // GET TQUALITY
int wsignal;
//check if driver reports quality directly
qualInt = getVal(section, "Quality\\D+(\\d+)").toInt();
@@ -429,8 +429,8 @@ void WirelessAssistant::parseScan( const QString & output )
enc = true;
wpaSettings.clear();
- if ( section.contains("WPA2 Version") ) wpaSettings << "WPA2"; //prefer WPA2 over WPA
- else if ( section.contains("WPA Version") ) wpaSettings << "WPA";
+ if ( section.tqcontains("WPA2 Version") ) wpaSettings << "WPA2"; //prefer WPA2 over WPA
+ else if ( section.tqcontains("WPA Version") ) wpaSettings << "WPA";
wpa = ( !wpaSettings.isEmpty() );
if (wpa) {
@@ -442,7 +442,7 @@ void WirelessAssistant::parseScan( const QString & output )
// CHECK IF SAME ESSID ALREADY FOUND, if necessary
if (groupAPs) {
- if ( !hidden && essidList.contains(essid) ) {
+ if ( !hidden && essidList.tqcontains(essid) ) {
NetListViewItem* sameEssid = static_cast<NetListViewItem*>(getItemByEssid(essid));
sameEssid->setAp("any");
if (sameEssid->quality() < qualInt) {
@@ -485,7 +485,7 @@ bool WirelessAssistant::radioEnabled()
return r;
}
-void WirelessAssistant::setNetParamsFromList( QListViewItem* lvi )
+void WirelessAssistant::setNetParamsFromList( TQListViewItem* lvi )
{
NetListViewItem *nvi = static_cast<NetListViewItem*>(lvi);
NetParams.essid = nvi->essid();
@@ -498,12 +498,12 @@ void WirelessAssistant::setNetParamsFromList( QListViewItem* lvi )
NetParams.wpa = ( nvi->enc() && !NetParams.wpaSettings.isEmpty() );
}
-bool WirelessAssistant::setNetParamsFromConfig( const QString & s )
+bool WirelessAssistant::setNetParamsFromConfig( const TQString & s )
{
- for (QStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
+ 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.contains(":")) NetParams.ap = "any"; //if searched by essid
+ if (!s.tqcontains(":")) NetParams.ap = "any"; //if searched by essid
return 1;
}
}
@@ -512,7 +512,7 @@ bool WirelessAssistant::setNetParamsFromConfig( const QString & s )
void WirelessAssistant::itemAction()
{
- QListViewItem* lvi = netList->selectedItem();
+ TQListViewItem* lvi = netList->selectedItem();
if (!lvi)
return;
@@ -539,7 +539,7 @@ void WirelessAssistant::netAutoConnect()
int bestQuality = 0;
for ( int i = 0; i < netList->childCount(); i++ ) {
NetListViewItem* nvi = static_cast<NetListViewItem*>( netList->itemAtIndex(i) );
- QString search = nvi->ap();
+ TQString search = nvi->ap();
if (search == "any") search = nvi->essid();
if ( setNetParamsFromConfig(search) ) {
if ( nvi->quality() > bestQuality ) {
@@ -552,7 +552,7 @@ void WirelessAssistant::netAutoConnect()
if ( bestItem != -1 ) {
NetListViewItem* nvi = static_cast<NetListViewItem*>( netList->itemAtIndex( bestItem ) );
setNetParamsFromList( nvi );
- QString search = nvi->ap();
+ TQString search = nvi->ap();
if (search == "any") search = nvi->essid();
setNetParamsFromConfig( search );
timerConnectionCheck->stop();
@@ -570,21 +570,21 @@ void WirelessAssistant::netConnect()
setNetParamsFromList( netList->selectedItem() );
//can't connect if WPA needed, and wpa_supplicant and wpa_cli not available
if ( NetParams.wpa && !wpaAvailable ) {
- KMessageBox::error(0, i18n("<qt><p><b>Can not connect to network '%1'.<b></p><p>The network you are trying to connect to requires WPA authentication. The necessary executables <i>wpa_supplicant</i> and <i>wpa_cli</i> could not be found. Install <i>wpa_supplicant</i> and restart Wireless Assistant to connect.</p></qt>").arg(NetParams.essid) );
+ KMessageBox::error(0, i18n("<qt><p><b>Can not connect to network '%1'.<b></p><p>The network you are trying to connect to requires WPA authentication. The necessary executables <i>wpa_supplicant</i> and <i>wpa_cli</i> could not be found. Install <i>wpa_supplicant</i> and restart Wireless Assistant to connect.</p></qt>").tqarg(NetParams.essid) );
timerConnectionCheck->start(WA_CONNECTION_CHECK_INTERVAL); //resume connection checking
return;
}
- QString search = NetParams.ap;
+ TQString search = NetParams.ap;
if (search == "any") search = NetParams.essid;
if ( (NetParams.essid=="<hidden>") || (!setNetParamsFromConfig( search )) ) {
ui_NetParamsWizard *netwiz = new ui_NetParamsWizard;
if (!NetParams.hiddenEssid)
- netwiz->setCaption( i18n("%1 - First Connection Wizard").arg(NetParams.essid) );
+ netwiz->setCaption( i18n("%1 - First Connection Wizard").tqarg(NetParams.essid) );
netwiz->setEssidEnabled( NetParams.hiddenEssid );
netwiz->setWepEnabled( NetParams.wep );
netwiz->setWpaEnabled( NetParams.wpa, NetParams.wpaSettings );
netwiz->exec();
- if (netwiz->result()==QDialog::Rejected) {
+ if (netwiz->result()==TQDialog::Rejected) {
delete netwiz;
timerConnectionCheck->start(WA_CONNECTION_CHECK_INTERVAL); //resume connection checking
return;
@@ -609,9 +609,9 @@ void WirelessAssistant::netConnect()
void WirelessAssistant::updateNetParams()
{
- for (QStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
+ for (TQStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
if ( (*nps).section(",",2,2)==NetParams.ap ) {
- QString newNps = NetParams.netParamsString();
+ TQString newNps = NetParams.netParamsString();
if ( newNps!=(*nps) ) {
(*nps) = newNps;
WAConfig::self()->writeConfig();
@@ -623,9 +623,9 @@ void WirelessAssistant::updateNetParams()
}
}
-QString WirelessAssistant::matchEssidForAp( const QString & ap )
+TQString WirelessAssistant::matchEssidForAp( const TQString & ap )
{
- for (QStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
+ for (TQStringList::Iterator nps = NetParamsList.begin(); nps != NetParamsList.end(); nps++) {
if ( (*nps).section(",",2,2)==ap ) {
return (*nps).section(",",1,1); //essid
}
@@ -645,16 +645,16 @@ void WirelessAssistant::netConnect( const WANetParams & np )
if ( !np.preConnectionCommand.isEmpty() ) {
std::cout << "Running pre-connection command: " << np.preConnectionCommand << std::endl;
statusLabel->setText( i18n("Running pre-connection command...") );
- runCommand( QStringList::split( " ", np.preConnectionCommand ), np.preConnectionTimeout, np.preConnectionDetached );
+ runCommand( TQStringList::split( " ", np.preConnectionCommand ), np.preConnectionTimeout, np.preConnectionDetached );
} else
std::cout << "No pre-connection command specified." << std::endl;
- statusLabel->setText( i18n("Connecting to '%1'...").arg(np.essid) );
- statusLabel->repaint();
+ statusLabel->setText( i18n("Connecting to '%1'...").tqarg(np.essid) );
+ statusLabel->tqrepaint();
if (!WATools::isUp(np.iface) ) WATools::setUp( true, np.iface );
//runCommand( Commands.cmd("ifup", np) );
- if ( runCommand( Commands.cmd("iwconfig_set", np) ).find("8B04") > -1 ) { // error 8B04 - Request 'Set Frequency' not supported.
+ if ( runCommand( Commands.cmd("iwconfig_set", np) ).tqfind("8B04") > -1 ) { // error 8B04 - Request 'Set Frequency' not supported.
WANetParams np2 = np;
np2.channel = "0";
runCommand( Commands.cmd("iwconfig_set", np2) );
@@ -679,8 +679,8 @@ void WirelessAssistant::netConnect( const WANetParams & np )
////////////////////////
///// CONFIGURE IP ADDRESS etc.
if (np.dhcp) { //DHCP config
- QString dhcp_out = runCommand( Commands.cmd("ifconfig_dhcp", np), DhcpTimeout );
- 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
+ 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 ( dhcpClientRunning() )
runCommand( Commands.cmd("kill_dhcp", np) ); //kill any stale DHCP client running (seems it's dhclient only)
setUi(1);
@@ -698,7 +698,7 @@ void WirelessAssistant::netConnect( const WANetParams & np )
if ( !np.postConnectionCommand.isEmpty() ) {
std::cout << "Running post-connection command: " << np.postConnectionCommand << std::endl;
statusLabel->setText( i18n("Running post-connection command...") );
- runCommand( QStringList::split( " ", np.postConnectionCommand ), np.postConnectionTimeout, np.postConnectionDetached );
+ runCommand( TQStringList::split( " ", np.postConnectionCommand ), np.postConnectionTimeout, np.postConnectionDetached );
} else
std::cout << "No post-connection command specified." << std::endl;
@@ -710,7 +710,7 @@ void WirelessAssistant::netConnect( const WANetParams & np )
if (autoQuit)
this->close();
groupAPs ? setConnectedItem( np.essid ) : setConnectedItem( np.ap );
- statusLabel->setText( i18n("Successfully connected to '%1'.").arg(np.essid) );
+ statusLabel->setText( i18n("Successfully connected to '%1'.").tqarg(np.essid) );
setUi(1);
} else {
std::cout << "CONNECTION FAILED." << std::endl;
@@ -728,7 +728,7 @@ void WirelessAssistant::updateConnectedItem()
connectedItem->setQuality( WATools::quality() );
}
-void WirelessAssistant::setConnectedItem( const QString & netid )
+void WirelessAssistant::setConnectedItem( const TQString & netid )
{
timerConnectionCheck->stop(); //stop timer while changing currentItem
if (connectedItem) {
@@ -737,8 +737,8 @@ void WirelessAssistant::setConnectedItem( const QString & netid )
connectedItem = 0;
}
if (!netid.isEmpty()) {
- QListViewItem* lvi;
- if (netid.contains(":")) lvi = getItemByAp( netid ); //netid is an AP address
+ TQListViewItem* lvi;
+ if (netid.tqcontains(":")) lvi = getItemByAp( netid ); //netid is an AP address
else lvi = getItemByEssid( netid );
if (lvi) {
NetListViewItem* nvi = static_cast<NetListViewItem*>(lvi);
@@ -757,29 +757,29 @@ void WirelessAssistant::setConnectedItem( const QString & netid )
void WirelessAssistant::netDisconnect( const bool & quiet )
{
- if ( (quiet) || (KMessageBox::warningContinueCancel(0, i18n("<qt><p>You are about to disconnect from '<b>%1</b>'.</p><p>Would you like to continue?<p></qt>").arg(connectedItem->essid()) )== KMessageBox::Continue ) ) {
+ if ( (quiet) || (KMessageBox::warningContinueCancel(0, i18n("<qt><p>You are about to disconnect from '<b>%1</b>'.</p><p>Would you like to continue?<p></qt>").tqarg(connectedItem->essid()) )== KMessageBox::Continue ) ) {
timerConnectionCheck->stop(); //stop while disconnecting.
if ( !NetParams.preDisconnectionCommand.isEmpty() ) {
std::cout << "Running pre-disconnection command: " << NetParams.preDisconnectionCommand << std::endl;
statusLabel->setText( i18n("Running pre-disconnection command...") );
- runCommand( QStringList::split( " ", NetParams.preDisconnectionCommand ), NetParams.preDisconnectionTimeout, NetParams.preDisconnectionDetached );
+ runCommand( TQStringList::split( " ", NetParams.preDisconnectionCommand ), NetParams.preDisconnectionTimeout, NetParams.preDisconnectionDetached );
} else
std::cout << "No pre-disconnection command specified." << std::endl;
statusLabel->setText( i18n("Disconnecting...") );
- statusLabel->repaint();
+ statusLabel->tqrepaint();
setConnectedItem( 0 );
if ( NetParams.dhcp ) {
if ( dhcpClientRunning() ) {
runCommand( Commands.cmd( "kill_dhcp", NetParams ) );
statusLabel->setText( i18n("Waiting for DHCP client to shut down...") );
- statusLabel->repaint();
- QTimer* tmr = new QTimer();
+ statusLabel->tqrepaint();
+ TQTimer* tmr = new TQTimer();
tmr->start(1500, true); //wait 1.5sec for dhcp client to really shutdown, single shot.
while ( tmr->isActive() ) {
- KApplication::eventLoop()->processEvents( QEventLoop::AllEvents );
+ KApplication::eventLoop()->processEvents( TQEventLoop::AllEvents );
usleep(75*1000); //75msec on Linux
}
delete tmr;
@@ -798,7 +798,7 @@ void WirelessAssistant::netDisconnect( const bool & quiet )
if ( !NetParams.postDisconnectionCommand.isEmpty() ) {
std::cout << "Running post-disconnection command: " << NetParams.postDisconnectionCommand << std::endl;
statusLabel->setText( i18n("Running post-disconnection command...") );
- runCommand( QStringList::split( " ", NetParams.postDisconnectionCommand ), NetParams.postDisconnectionTimeout, NetParams.postDisconnectionDetached );
+ runCommand( TQStringList::split( " ", NetParams.postDisconnectionCommand ), NetParams.postDisconnectionTimeout, NetParams.postDisconnectionDetached );
} else
std::cout << "No post-disconnection command specified." << std::endl;
@@ -810,9 +810,9 @@ void WirelessAssistant::netDisconnect( const bool & quiet )
}
}
-QListViewItem* WirelessAssistant::getItemByAp( const QString & ap )
+TQListViewItem* WirelessAssistant::getItemByAp( const TQString & ap )
{
- QListViewItem* lvi = netList->firstChild();
+ TQListViewItem* lvi = netList->firstChild();
while (lvi) {
if ( static_cast<NetListViewItem*>(lvi)->
ap() == ap ) {
@@ -823,9 +823,9 @@ QListViewItem* WirelessAssistant::getItemByAp( const QString & ap )
return lvi;
}
-QListViewItem* WirelessAssistant::getItemByEssid( const QString & essid )
+TQListViewItem* WirelessAssistant::getItemByEssid( const TQString & essid )
{
- QListViewItem* lvi = netList->firstChild();
+ TQListViewItem* lvi = netList->firstChild();
while (lvi) {
if ( static_cast<NetListViewItem*>(lvi)->
essid() == essid ) {
@@ -858,7 +858,7 @@ void WirelessAssistant::togglePage(bool options)
buttonScan->setDisabled(options);
buttonConnect->setDisabled(options);
if (options) {
- if (WAConfig::self()->config()->groupList().contains("Notification Messages")>0)
+ if (WAConfig::self()->config()->groupList().tqcontains("Notification Messages")>0)
buttonEnableAllMessages->setEnabled(true);
else
buttonEnableAllMessages->setEnabled(false);
@@ -878,43 +878,43 @@ void WirelessAssistant::enableAllMessages()
void WirelessAssistant::setMouseBehaviour()
{
if ( KGlobalSettings::singleClick() ) {
- disconnect( netList, SIGNAL(selectionChanged(QListViewItem*)),
- this, SLOT(updateConnectButton(QListViewItem*)) );
- disconnect( netList, SIGNAL(doubleClicked(QListViewItem*, const QPoint &, int)),
- this, SLOT(itemAction()) );
- connect( netList, SIGNAL(clicked(QListViewItem*, const QPoint &, int)),
- this, SLOT(itemAction()) );
+ disconnect( netList, TQT_SIGNAL(selectionChanged(TQListViewItem*)),
+ this, TQT_SLOT(updateConnectButton(TQListViewItem*)) );
+ disconnect( netList, TQT_SIGNAL(doubleClicked(TQListViewItem*, const TQPoint &, int)),
+ this, TQT_SLOT(itemAction()) );
+ connect( netList, TQT_SIGNAL(clicked(TQListViewItem*, const TQPoint &, int)),
+ this, TQT_SLOT(itemAction()) );
buttonConnect->hide();
} else {
- disconnect( netList, SIGNAL(clicked(QListViewItem*, const QPoint &, int)),
- this, SLOT(itemAction()) );
+ disconnect( netList, TQT_SIGNAL(clicked(TQListViewItem*, const TQPoint &, int)),
+ this, TQT_SLOT(itemAction()) );
- connect( netList, SIGNAL(selectionChanged(QListViewItem*)),
- this, SLOT(updateConnectButton(QListViewItem*)) );
- connect( netList, SIGNAL(doubleClicked(QListViewItem*, const QPoint &, int)),
- this, SLOT(itemAction()) );
+ connect( netList, TQT_SIGNAL(selectionChanged(TQListViewItem*)),
+ this, TQT_SLOT(updateConnectButton(TQListViewItem*)) );
+ connect( netList, TQT_SIGNAL(doubleClicked(TQListViewItem*, const TQPoint &, int)),
+ this, TQT_SLOT(itemAction()) );
buttonConnect->show();
}
}
-void WirelessAssistant::updateConnectButton(QListViewItem* lvi)
+void WirelessAssistant::updateConnectButton(TQListViewItem* lvi)
{
- QToolTip::remove
+ TQToolTip::remove
(buttonConnect);
if ( lvi == connectedItem ) {
buttonConnect->setText( i18n("&Disconnect") );
- QToolTip::add
+ TQToolTip::add
( buttonConnect, i18n("Disconnect from the selected network") );
} else {
buttonConnect->setText( i18n("&Connect") );
- QToolTip::add
+ TQToolTip::add
( buttonConnect, i18n("Connect to the selected network") );
}
}
-void WirelessAssistant::setDev( const QString & ifname)
+void WirelessAssistant::setDev( const TQString & ifname)
{
NetParams.iface = ifname;
WATools::setInterface( ifname );
@@ -922,67 +922,67 @@ void WirelessAssistant::setDev( const QString & ifname)
netScan();
}
-QString WirelessAssistant::runCommand( const QStringList & cmd, int timeout, bool detached )
+TQString WirelessAssistant::runCommand( const TQStringList & cmd, int timeout, bool detached )
{
if (cmd.isEmpty())
- return QString::null;
+ return TQString();
// a very basic and easy-to-workaround attepmt to restrict using dangerous commands via custom commands setting. This *REALLY* needs a working solution.
- if ( cmd[0] == "rm" || cmd[0] == "mv" || cmd[0] == "cp" || cmd[0] == "ln" ) return QString::null;
+ if ( cmd[0] == "rm" || cmd[0] == "mv" || cmd[0] == "cp" || cmd[0] == "ln" ) return TQString();
- QProcess* p = new QProcess( this );
+ TQProcess* p = new TQProcess( TQT_TQOBJECT(this) );
p->setArguments( cmd );
p->start();
if (detached) {
p = 0;
- return QString::null;
+ return TQString();
}
- QTimer* timerProc = new QTimer(); //timeout timer
+ TQTimer* timerProc = new TQTimer(); //timeout timer
if ( timeout>0 && !detached ) {
- connect( timerProc, SIGNAL(timeout()), p, SLOT(kill()) );
+ connect( timerProc, TQT_SIGNAL(timeout()), p, TQT_SLOT(kill()) );
timerProc->start(timeout*1000); //convert sec to msec
}
- connect(buttonClose, SIGNAL(clicked()),
- p, SLOT(kill()) );
+ connect(buttonClose, TQT_SIGNAL(clicked()),
+ p, TQT_SLOT(kill()) );
int i = 0;
while ( p->isRunning() ) { // PROCESS USER EVENTS
- KApplication::eventLoop()->processEvents( QEventLoop::AllEvents );
+ KApplication::eventLoop()->processEvents( TQEventLoop::AllEvents );
usleep(75*1000); //75msec on Linux (75000msec on Windows...)
if (i==27) { // ca 2sec have passed and the process is still running. Replace the 'Close' button with 'Stop'.
- disconnect(buttonClose, SIGNAL(clicked()),
- this, SLOT(close()) );
+ disconnect(buttonClose, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(close()) );
buttonClose->setIconSet( SmallIconSet("stop") );
buttonClose->setText( i18n("&Stop") );
- QToolTip::remove
+ TQToolTip::remove
(buttonClose);
- QToolTip::add
- ( buttonClose, i18n("Terminate current process\n(%1)").arg( p->arguments().join(" ") ) );
+ TQToolTip::add
+ ( buttonClose, i18n("Terminate current process\n(%1)").tqarg( p->arguments().join(" ") ) );
}
i++;
}
- disconnect(buttonClose, SIGNAL(clicked()),
- p, SLOT(kill()) );
+ disconnect(buttonClose, TQT_SIGNAL(clicked()),
+ p, TQT_SLOT(kill()) );
if (i>27) {//set 'stop' back to 'close' if needed
- connect(buttonClose, SIGNAL(clicked()),
- this, SLOT(close()) );
+ connect(buttonClose, TQT_SIGNAL(clicked()),
+ this, TQT_SLOT(close()) );
buttonClose->setIconSet( SmallIconSet("fileclose") );
buttonClose->setText( i18n("&Quit") );
- QToolTip::remove
+ TQToolTip::remove
(buttonClose);
- QToolTip::add
+ TQToolTip::add
( buttonClose, i18n("Quit the application") );
}
if (timerProc->isActive())
timerProc->stop();
delete timerProc;
- QString e = QString( p->readStderr() );
- QString o = QString( p->readStdout() );
+ TQString e = TQString( p->readStderr() );
+ TQString o = TQString( p->readStdout() );
if (!p->normalExit()) {
o.append("::ERR::killed");
//std::cout << "Process terminated (timed out)." << std::endl; //too much output when checking for internet when it's not available.
@@ -1006,7 +1006,7 @@ void WirelessAssistant::setUi(int uiState)
buttonScan->setEnabled( false );
buttonConnect->setEnabled( false );
buttonOptions->setEnabled( false );
- KApplication::setOverrideCursor( QCursor(Qt::BusyCursor) );
+ KApplication::setOverrideCursor( TQCursor(TQt::BusyCursor) );
} else {
if (devCombo->count() > 0) {
devCombo->setEnabled( true );
@@ -1019,14 +1019,14 @@ void WirelessAssistant::setUi(int uiState)
}
}
-void WirelessAssistant::showItemContextMenu( QListViewItem* i, const QPoint& p, int c )
+void WirelessAssistant::showItemContextMenu( TQListViewItem* i, const TQPoint& p, int c )
{
if (!i)
return;
NetListViewItem *nvi = static_cast<NetListViewItem*>(i);
- QString search = nvi->ap();
+ TQString search = nvi->ap();
if (search == "any") search = nvi->essid();
bool isConfigured = setNetParamsFromConfig(search);
@@ -1034,21 +1034,21 @@ void WirelessAssistant::showItemContextMenu( QListViewItem* i, const QPoint& p,
icm->insertTitle(nvi->essid());
if (isConfigured) {
if (nvi->isConnected()) {
- icm->insertItem( SmallIcon("connect_no"), i18n("Disconnect..."), this, SLOT(netDisconnect()) );
- //icm->insertItem( SmallIcon("reload"), i18n("Reconnect"), this, SLOT(netConnect()) );
+ icm->insertItem( SmallIcon("connect_no"), i18n("Disconnect..."), this, TQT_SLOT(netDisconnect()) );
+ //icm->insertItem( SmallIcon("reload"), i18n("Reconnect"), this, TQT_SLOT(netConnect()) );
} else
- icm->insertItem( SmallIcon("connect_creating"), i18n("Connect"), this, SLOT(netConnect()) );
+ icm->insertItem( SmallIcon("connect_creating"), i18n("Connect"), this, TQT_SLOT(netConnect()) );
icm->insertSeparator();
- icm->insertItem(i18n("Forget Settings..."), this, SLOT(removeNetParams()) );
- icm->insertItem(i18n("Edit Settings..."), this, SLOT(editNetParams()) );
+ icm->insertItem(i18n("Forget Settings..."), this, TQT_SLOT(removeNetParams()) );
+ icm->insertItem(i18n("Edit Settings..."), this, TQT_SLOT(editNetParams()) );
} else {
if (nvi->isConnected()) {
- icm->insertItem( SmallIcon("connect_no"), i18n("Disconnect..."), this, SLOT(netDisconnect()) );
- //icm->insertItem( SmallIcon("reload"), i18n("Configure and Reconnect..."), this, SLOT(netConnect()) );
+ icm->insertItem( SmallIcon("connect_no"), i18n("Disconnect..."), this, TQT_SLOT(netDisconnect()) );
+ //icm->insertItem( SmallIcon("reload"), i18n("Configure and Reconnect..."), this, TQT_SLOT(netConnect()) );
} else
- icm->insertItem( SmallIcon("connect_creating"), i18n("Configure and Connect..."), this, SLOT(netConnect()) );
+ icm->insertItem( SmallIcon("connect_creating"), i18n("Configure and Connect..."), this, TQT_SLOT(netConnect()) );
}
- icm->exec( QCursor::pos() );
+ icm->exec( TQCursor::pos() );
}
void WirelessAssistant::editNetParams()
@@ -1059,9 +1059,9 @@ void WirelessAssistant::editNetParams()
ui_NetParamsEdit *netedit = new ui_NetParamsEdit();
netedit->setValues( NetParams );
- netedit->setCaption( i18n("%1 Settings").arg(NetParams.essid) );
+ netedit->setCaption( i18n("%1 Settings").tqarg(NetParams.essid) );
netedit->exec();
- if (netedit->result() == QDialog::Rejected) {
+ if (netedit->result() == TQDialog::Rejected) {
delete netedit;
return;
} else { //accepted
@@ -1081,16 +1081,16 @@ void WirelessAssistant::setNetListColumns()
bool WirelessAssistant::dhcpClientRunning()
{
- QStringList pidPaths;
- QString pidFile;
+ TQStringList pidPaths;
+ TQString pidFile;
pidPaths << "/etc/" << "/etc/dhcpc/" << "/var/run/";
if ( Commands.dhcpClient=="dhcpcd" )
- pidFile = QString("dhcpcd-%1.pid").arg(NetParams.iface);
+ pidFile = TQString("dhcpcd-%1.pid").tqarg(NetParams.iface);
else
- pidFile = QString("dhclient.pid");
+ pidFile = TQString("dhclient.pid");
- for ( QStringList::Iterator it = pidPaths.begin(); it != pidPaths.end(); ++it ) {
- if ( QFile( QString(*it).append(pidFile) ).exists() ) {
+ for ( TQStringList::Iterator it = pidPaths.begin(); it != pidPaths.end(); ++it ) {
+ if ( TQFile( TQString(*it).append(pidFile) ).exists() ) {
std::cout << "Running DHCP client found." << std::endl;
return true;
}
@@ -1099,13 +1099,13 @@ bool WirelessAssistant::dhcpClientRunning()
return false;
}
-QStringList WirelessAssistant::interfaceList()
+TQStringList WirelessAssistant::interfaceList()
{
- QDir d("/sys/class/net");
- QStringList ifList = d.entryList( QDir::Dirs );
+ TQDir d("/sys/class/net");
+ TQStringList ifList = d.entryList( TQDir::Dirs );
ifList.remove("."); ifList.remove(".."); ifList.remove("lo");
std::cout << "All interfaces: " << ifList.join(", ") << std::endl;
- for (QStringList::Iterator nps = ifList.begin(); nps != ifList.end(); nps++) {
+ for (TQStringList::Iterator nps = ifList.begin(); nps != ifList.end(); nps++) {
const char* i = *nps;
bool w = WATools::isWireless( i );
if ( !WATools::isWireless( (const char*)*nps ) ) {
@@ -1115,18 +1115,18 @@ QStringList WirelessAssistant::interfaceList()
return ifList;
}
-QString WirelessAssistant::getVal(const QString & str, const QString & rxs)
+TQString WirelessAssistant::getVal(const TQString & str, const TQString & rxs)
{
- QRegExp rx(rxs);
+ TQRegExp rx(rxs);
rx.search(str);
return rx.cap(1).stripWhiteSpace();
}
-bool WirelessAssistant::generateWpaConfigFile( const QString& essid, const QStringList& wpaSettings, const QString& wpaKey )
+bool WirelessAssistant::generateWpaConfigFile( const TQString& essid, const TQStringList& wpaSettings, const TQString& wpaKey )
{
// 0 WPA version (1 or 2), 1 group, 2 pairwise, 3 suite
- if ( wpaSettings.isEmpty() ) return QString();
- QString c = "ctrl_interface=/var/run/wpa_supplicant\nnetwork={\nscan_ssid=0\nssid=\""; //fast_reauth=1\n
+ if ( wpaSettings.isEmpty() ) return TQString();
+ TQString c = "ctrl_interface=/var/run/wpa_supplicant\nnetwork={\nscan_ssid=0\nssid=\""; //fast_reauth=1\n
c.append(essid).append("\"\n");
// WPA version
@@ -1134,8 +1134,8 @@ bool WirelessAssistant::generateWpaConfigFile( const QString& essid, const QStri
//WPA authentication suite
c.append("key_mgmt=");
- if ( wpaSettings[3].contains("PSK") ) c.append("WPA-PSK\n");
- else return QString(); // not supported
+ if ( wpaSettings[3].tqcontains("PSK") ) c.append("WPA-PSK\n");
+ else return TQString(); // not supported
//WPA pairwise cipher
c.append("pairwise=");
@@ -1146,7 +1146,7 @@ bool WirelessAssistant::generateWpaConfigFile( const QString& essid, const QStri
c.append( wpaSettings[1] ).append("\n");
//WPA key
- QString k = QString();
+ TQString k = TQString();
if (wpaKey.left(2)=="s:") { // PASSPHRASE
k.append("\"");
k.append( wpaKey.right( wpaKey.length() - 2 ) );
@@ -1170,10 +1170,10 @@ bool WirelessAssistant::generateWpaConfigFile( const QString& essid, const QStri
// psk=your_psk_here
// }
- QFile file( wpaConfigFile );
+ TQFile file( wpaConfigFile );
if (file.exists()) file.remove();
if ( file.open( IO_WriteOnly ) ) {
- QTextStream stream( &file );
+ TQTextStream stream( &file );
stream << c;
file.close();
//std::cout << "Wrote WPA config: " << wpaConfigFile << std::endl;
@@ -1182,42 +1182,42 @@ bool WirelessAssistant::generateWpaConfigFile( const QString& essid, const QStri
return 0;
}
-bool WirelessAssistant::setWpaClientEnabled( bool e, const QString& iface, QString driver )
+bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQString driver )
{
if (!e) {
- if ( runCommand( QStringList(Commands.wpa_cli) << QString("-i%1").arg(NetParams.iface) << "terminate" ).contains("OK") ) {
- QFile( wpaConfigFile ).remove();
+ if ( runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "terminate" ).tqcontains("OK") ) {
+ TQFile( wpaConfigFile ).remove();
return 1;
} else
return 0; // wpa client was not running.
}
- if ( !runCommand( QStringList(Commands.wpa_cli) << QString("-i%1").arg(NetParams.iface) << "status" ).contains("Failed to connect") ) {
+ if ( !runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" ).tqcontains("Failed to connect") ) {
std::cout << "WPA client already running. Reconfiguring..." << std::endl;
- runCommand( QStringList(Commands.wpa_cli) << "reconfigure" );
+ runCommand( TQStringList(Commands.wpa_cli) << "reconfigure" );
} else {
if ( driver.isEmpty() ) { //detect needed driver
- QString k = WATools::kernelModule( iface );
- if ( k.contains("hermes") ) driver = "hermes";
- else if ( k.contains("atmel") ) driver = "atmel";
+ TQString k = WATools::kernelModule( iface );
+ if ( k.tqcontains("hermes") ) driver = "hermes";
+ else if ( k.tqcontains("atmel") ) driver = "atmel";
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13)
- else if ( k.contains("ipw") ) driver = "ipw"; //wext should be used for kernels newer than 2.6.12
+ else if ( k.tqcontains("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.contains("ndiswrapper") ) driver = "ndiswrapper";
+ //else if ( k.tqcontains("ndiswrapper") ) driver = "ndiswrapper";
//Commented out, because madwifi-ng works with wext driver.
- //else if ( k.contains("ath") ) driver = "madwifi";
+ //else if ( k.tqcontains("ath") ) driver = "madwifi";
else driver = "wext";
std::cout << "Using wpa_supplicant driver: " << driver << std::endl;
}
- QProcess* wp = new QProcess( this );
+ TQProcess* wp = new TQProcess( TQT_TQOBJECT(this) );
wp->clearArguments();
wp->addArgument( Commands.wpa_supplicant );
wp->addArgument( "-W" ); //wait for control interface
- wp->addArgument( QString("-D%1").arg(driver) );
- wp->addArgument( QString("-i%1").arg(iface) );
- wp->addArgument( QString("-c%1").arg(wpaConfigFile) );
+ wp->addArgument( TQString("-D%1").tqarg(driver) );
+ wp->addArgument( TQString("-i%1").tqarg(iface) );
+ wp->addArgument( TQString("-c%1").tqarg(wpaConfigFile) );
//std::cout << "Starting WPA client: " << wp->arguments().join(" ") << std::endl;
if ( !wp->start() ) {
std::cout << "Failed to start WPA client." << std::endl;
@@ -1229,19 +1229,19 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const QString& iface, QStri
usleep(200*1000); //200msec for wpa_supplicant to initiate
- QString o;
+ TQString o;
int i = 0;
- while ( !(o =runCommand( QStringList(Commands.wpa_cli) << QString("-i%1").arg(NetParams.iface) << "status" )).contains("Failed to connect") ) {
+ while ( !(o =runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "status" )).tqcontains("Failed to connect") ) {
for (int c = 0; c < 15; c++) {
usleep(75*1000); //75msec
- KApplication::eventLoop()->processEvents( QEventLoop::AllEvents );
+ KApplication::eventLoop()->processEvents( TQEventLoop::AllEvents );
i++;
}
if (i>400) { //more than 30sec have passed
- runCommand( QStringList(Commands.wpa_cli) << QString("-i%1").arg(NetParams.iface) << "terminate" );
+ runCommand( TQStringList(Commands.wpa_cli) << TQString("-i%1").tqarg(NetParams.iface) << "terminate" );
return 0;
}
- if ( o.contains("wpa_state=COMPLETED") ) {
+ if ( o.tqcontains("wpa_state=COMPLETED") ) {
std::cout << "WPA Authorisation successful." << std::endl;
return 1;
}
@@ -1257,7 +1257,7 @@ bool WirelessAssistant::close()
std::cout << "Application options saved." << std::endl;
WATools::cleanup();
std::cout << "Kernel socket closed." << std::endl;
- return QWidget::close();
+ return TQWidget::close();
}