diff options
author | Timothy Pearson <[email protected]> | 2011-11-27 19:07:51 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-11-27 19:07:51 -0600 |
commit | ad685997cde1fc6d0a5def0fe8c6dfb0f81ded2c (patch) | |
tree | 5b8ac52e15166c53315992cb2a87cc28643f1ab4 /src | |
parent | bf4f321c3b94af160910a0d7d9cf7b1fa1a76bda (diff) | |
download | wlassistant-ad685997cde1fc6d0a5def0fe8c6dfb0f81ded2c.tar.gz wlassistant-ad685997cde1fc6d0a5def0fe8c6dfb0f81ded2c.zip |
Fix FTBFS
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/netparams.h | 8 | ||||
-rw-r--r-- | src/ui_netparamswizard.h | 6 | ||||
-rw-r--r-- | src/wlassistant.cpp | 78 | ||||
-rw-r--r-- | src/wlassistant.h | 2 |
5 files changed, 51 insertions, 47 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3ebb7c2..c730d31 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -29,11 +29,11 @@ install( FILES wlassistant.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) ##### wlassistant(executable) ################### -tde_add_executable( wlassistant +tde_add_executable( wlassistant AUTOMOC SOURCES main.cpp netlistviewitem.cpp ui_NetParamsEdit.ui ui_netparamsedit.cpp ui_NetParamsWizard.ui ui_netparamswizard.cpp ui_main.ui waconfig.cpp watools.cpp wlassistant.cpp - LINK tdecore-shared tdeui-shared iw-shared + LINK tdecore-shared tdeui-shared iw DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/src/netparams.h b/src/netparams.h index 9cc0d28..fbc2b7b 100644 --- a/src/netparams.h +++ b/src/netparams.h @@ -172,7 +172,7 @@ public: if (!dhcp.isEmpty()) { allFound=1; dhcpClient = dhcp.section("/",-1,-1); - std::cout << "DHCP Client: " << dhcpClient << std::endl; + std::cout << "DHCP Client: " << dhcpClient.ascii() << std::endl; } ifconfig = getPath("ifconfig", binDirs); @@ -182,7 +182,7 @@ public: pidof = getPath("pidof", binDirs); if (!allFound) - std::cout << "Executable(s) not found:" << notFound.join(", ") << std::endl; + std::cout << "Executable(s) not found:" << notFound.join(", ").ascii() << std::endl; else std::cout << "All executables found." << std::endl; } @@ -248,12 +248,12 @@ public: mCmd << route << "del" << "default" << "gw" << np.gateway; } else - std::cout << "Unknown action: " << action << std::endl; + std::cout << "Unknown action: " << action.ascii() << std::endl; if ( (!mCmd.isEmpty()) && (!quiet) ) {//mCmd = TQStringList(); TQString mCmdString = mCmd.join(" "); if (!np.wepKey.isEmpty()) mCmdString.replace(np.wepKey, "xxxxxxxxxx"); - std::cout << action << ": " << mCmdString << std::endl; + std::cout << action.ascii() << ": " << mCmdString.ascii() << std::endl; } return mCmd; } diff --git a/src/ui_netparamswizard.h b/src/ui_netparamswizard.h index 26c9a58..b6b627e 100644 --- a/src/ui_netparamswizard.h +++ b/src/ui_netparamswizard.h @@ -18,8 +18,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef UI_NETPARAMSWIZARD_H -#define UI_NETPARAMSWIZARD_H +#ifndef UI_NETPARAMSWIZARD_IMPL_H +#define UI_NETPARAMSWIZARD_IMPL_H + +#include <tqlistview.h> #include "ui_NetParamsWizard.h" diff --git a/src/wlassistant.cpp b/src/wlassistant.cpp index a179766..caafb37 100644 --- a/src/wlassistant.cpp +++ b/src/wlassistant.cpp @@ -157,7 +157,7 @@ void WirelessAssistant::init() close(); return; } - std::cout << "Wireless interface(s): " << devList.join(", ") << std::endl; + std::cout << "Wireless interface(s): " << devList.join(", ").ascii() << std::endl; devCombo->insertStringList(devList); if (devCombo->count() > 1) { //check if last used (saved) interface is available (only if more that 1 interface present). @@ -170,7 +170,7 @@ void WirelessAssistant::init() frameDevice->show(); //only if more than 1 wireless device. } NetParams.iface = devCombo->currentText(); // set interface name - WATools::setInterface( NetParams.iface ); // set fallback interface for WATools + WATools::setInterface( NetParams.iface.ascii() ); // set fallback interface for WATools ////////////////////////////////// ///// CHECK FILE PERMISSIONS ///// @@ -196,7 +196,7 @@ void WirelessAssistant::init() //////////////////////// ///// 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; + std::cout << "Missing executables (" << Commands.notFound.join("', '").ascii() << "). Exiting." << std::endl; KMessageBox::error(0, i18n("Executable(s) '%1' could not be found.\nWireless Assistant will now quit.").tqarg(Commands.notFound.join("', '")) ); close(); return; @@ -216,19 +216,19 @@ void WirelessAssistant::init() void WirelessAssistant::checkConnectiontqStatus() { TQListViewItem* lvi; - if (groupAPs) lvi = getItemByEssid( WATools::essid(NetParams.iface)); - else lvi = getItemByAp( WATools::ap(NetParams.iface )); + if (groupAPs) lvi = getItemByEssid( WATools::essid(NetParams.iface.ascii())); + else lvi = getItemByAp( WATools::ap(NetParams.iface.ascii() )); bool needsKey; lvi ? needsKey = static_cast<NetListViewItem*>(lvi)->enc() : needsKey = 0; - if ( WATools::isConnected(NetParams.iface) && WATools::hasKey(NetParams.iface)==needsKey ) { //connection OK + if ( WATools::isConnected(NetParams.iface.ascii()) && WATools::hasKey(NetParams.iface.ascii())==needsKey ) { //connection OK if (!connectedItem) { - std::cout << "Now connected to '" << WATools::essid(NetParams.iface) << "'" << std::endl; + std::cout << "Now connected to '" << WATools::essid(NetParams.iface.ascii()) << "'" << std::endl; if (groupAPs && NetParams.ap=="any") { - setConnectedItem( WATools::essid( NetParams.iface ) ); - setNetParamsFromConfig( WATools::essid( NetParams.iface ) ); + setConnectedItem( WATools::essid( NetParams.iface.ascii() ) ); + setNetParamsFromConfig( WATools::essid( NetParams.iface.ascii() ) ); } else { - setConnectedItem( WATools::ap( NetParams.iface ) ); - setNetParamsFromConfig( WATools::ap( NetParams.iface ) ); + setConnectedItem( WATools::ap( NetParams.iface.ascii() ) ); + setNetParamsFromConfig( WATools::ap( NetParams.iface.ascii() ) ); } setNetParamsFromList( connectedItem ); } @@ -269,19 +269,19 @@ void WirelessAssistant::setDNS( const WANetParams & np ) TQTextStream s( &f ); if (!np.domain.isEmpty()) { s << TQString("domain " + np.domain + "\n"); - std::cout << "resolv.conf: domain " << np.domain << std::endl; + std::cout << "resolv.conf: domain " << np.domain.ascii() << std::endl; } if (!np.dns1.isEmpty()) { s << TQString("nameserver " + np.dns1 + "\n"); - std::cout << "resolv.conf: nameserver " << np.dns1 << std::endl; + std::cout << "resolv.conf: nameserver " << np.dns1.ascii() << std::endl; } if (!np.dns2.isEmpty()) { s << TQString("nameserver " + np.dns2 + "\n"); - std::cout << "resolv.conf: nameserver " << np.dns2 << std::endl; + std::cout << "resolv.conf: nameserver " << np.dns2.ascii() << std::endl; } f.close(); } else { - std::cout << "dns setup error: " << f.name() << " is not writeable." << std::endl; + std::cout << "dns setup error: " << f.name().ascii() << " 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>").tqarg(f.name()) ); } } @@ -313,10 +313,10 @@ void WirelessAssistant::netScan( const WANetParams & np ) setConnectedItem( 0 ); } - if ( !WATools::isUp(np.iface) ) { - statusLabel->setText(i18n("Bringing interface %1 up...").tqarg(np.iface)); + if ( !WATools::isUp(np.iface.ascii()) ) { + statusLabel->setText(i18n("Bringing interface %1 up...").tqarg(np.iface.ascii())); //runCommand( Commands.cmd("ifup",np) ); - WATools::setUp(true, np.iface); + WATools::setUp(true, np.iface.ascii()); if (DelayBeforeScanning>0) { statusLabel->setText(i18n("Waiting before scanning...")); statusLabel->tqrepaint(); @@ -337,7 +337,7 @@ void WirelessAssistant::netScan( const WANetParams & np ) parseScan( result ); if (netList->childCount() > 0) { - std::cout << "Networks found: " << TQString::number( netList->childCount() ) << std::endl; + std::cout << "Networks found: " << TQString::number( netList->childCount() ).ascii() << std::endl; if (wasConnected) groupAPs ? setConnectedItem( WATools::essid() ) : setConnectedItem( WATools::ap() ); //mark item as connected. statusLabel->setText( i18n("Done.") ); @@ -533,7 +533,7 @@ void WirelessAssistant::itemAction() void WirelessAssistant::netAutoConnect() { netScan(); - if ( WATools::isConnected(NetParams.iface) ) return; + if ( WATools::isConnected(NetParams.iface.ascii()) ) return; int bestItem = -1; int bestQuality = 0; @@ -643,7 +643,7 @@ void WirelessAssistant::netConnect( const WANetParams & np ) runCommand( Commands.cmd("kill_dhcp", np) ); //kill any stale DHCP client running if ( !np.preConnectionCommand.isEmpty() ) { - std::cout << "Running pre-connection command: " << np.preConnectionCommand << std::endl; + std::cout << "Running pre-connection command: " << np.preConnectionCommand.ascii() << std::endl; statusLabel->setText( i18n("Running pre-connection command...") ); runCommand( TQStringList::split( " ", np.preConnectionCommand ), np.preConnectionTimeout, np.preConnectionDetached ); } else @@ -652,7 +652,7 @@ void WirelessAssistant::netConnect( const WANetParams & np ) statusLabel->setText( i18n("Connecting to '%1'...").tqarg(np.essid) ); statusLabel->tqrepaint(); - if (!WATools::isUp(np.iface) ) WATools::setUp( true, np.iface ); + if (!WATools::isUp(np.iface.ascii()) ) WATools::setUp( true, np.iface.ascii() ); //runCommand( Commands.cmd("ifup", np) ); if ( runCommand( Commands.cmd("iwconfig_set", np) ).find("8B04") > -1 ) { // error 8B04 - Request 'Set Frequency' not supported. WANetParams np2 = np; @@ -696,7 +696,7 @@ void WirelessAssistant::netConnect( const WANetParams & np ) } if ( !np.postConnectionCommand.isEmpty() ) { - std::cout << "Running post-connection command: " << np.postConnectionCommand << std::endl; + std::cout << "Running post-connection command: " << np.postConnectionCommand.ascii() << std::endl; statusLabel->setText( i18n("Running post-connection command...") ); runCommand( TQStringList::split( " ", np.postConnectionCommand ), np.postConnectionTimeout, np.postConnectionDetached ); } else @@ -706,7 +706,7 @@ void WirelessAssistant::netConnect( const WANetParams & np ) ///// CHECK CONNECTION statusLabel->setText(i18n("Testing connection...")); usleep(200*1000); //sleep 200ms to make sure all parameters are set. - if ( WATools::isConnected(np.iface)) { + if ( WATools::isConnected(np.iface.ascii())) { if (autoQuit) this->close(); groupAPs ? setConnectedItem( np.essid ) : setConnectedItem( np.ap ); @@ -761,7 +761,7 @@ void WirelessAssistant::netDisconnect( const bool & quiet ) timerConnectionCheck->stop(); //stop while disconnecting. if ( !NetParams.preDisconnectionCommand.isEmpty() ) { - std::cout << "Running pre-disconnection command: " << NetParams.preDisconnectionCommand << std::endl; + std::cout << "Running pre-disconnection command: " << NetParams.preDisconnectionCommand.ascii() << std::endl; statusLabel->setText( i18n("Running pre-disconnection command...") ); runCommand( TQStringList::split( " ", NetParams.preDisconnectionCommand ), NetParams.preDisconnectionTimeout, NetParams.preDisconnectionDetached ); } else @@ -788,7 +788,7 @@ void WirelessAssistant::netDisconnect( const bool & quiet ) runCommand( Commands.cmd( "route_del", NetParams ) ); } runCommand( Commands.cmd( "disconnect", NetParams ) ); - WATools::setUp( false, NetParams.iface ); + WATools::setUp( false, NetParams.iface.ascii() ); if ( NetParams.wpa ) setWpaClientEnabled( false ); @@ -796,7 +796,7 @@ void WirelessAssistant::netDisconnect( const bool & quiet ) std::cout << "DISCONNECTED." << std::endl; if ( !NetParams.postDisconnectionCommand.isEmpty() ) { - std::cout << "Running post-disconnection command: " << NetParams.postDisconnectionCommand << std::endl; + std::cout << "Running post-disconnection command: " << NetParams.postDisconnectionCommand.ascii() << std::endl; statusLabel->setText( i18n("Running post-disconnection command...") ); runCommand( TQStringList::split( " ", NetParams.postDisconnectionCommand ), NetParams.postDisconnectionTimeout, NetParams.postDisconnectionDetached ); } else @@ -917,8 +917,8 @@ void WirelessAssistant::updateConnectButton(TQListViewItem* lvi) void WirelessAssistant::setDev( const TQString & ifname) { NetParams.iface = ifname; - WATools::setInterface( ifname ); - std::cout << "Selected interface: " << ifname << std::endl; + WATools::setInterface( ifname.ascii() ); + std::cout << "Selected interface: " << ifname.ascii() << std::endl; netScan(); } @@ -990,7 +990,7 @@ TQString WirelessAssistant::runCommand( const TQStringList & cmd, int timeout, b delete p; if (!e.isEmpty()) { - std::cout << "==>stderr: " << e;// << std::endl; + std::cout << "==>stderr: " << e.ascii();// << std::endl; o.append("::ERR::"); o.append(e); } @@ -1085,7 +1085,7 @@ bool WirelessAssistant::dhcpClientRunning() TQString pidFile; pidPaths << "/etc/" << "/etc/dhcpc/" << "/var/run/"; if ( Commands.dhcpClient=="dhcpcd" ) - pidFile = TQString("dhcpcd-%1.pid").tqarg(NetParams.iface); + pidFile = TQString("dhcpcd-%1.pid").tqarg(NetParams.iface.ascii()); else pidFile = TQString("dhclient.pid"); @@ -1104,11 +1104,11 @@ TQStringList WirelessAssistant::interfaceList() 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; + std::cout << "All interfaces: " << ifList.join(", ").ascii() << std::endl; for (TQStringList::Iterator nps = ifList.begin(); nps != ifList.end(); nps++) { - const char* i = *nps; + const char* i = (*nps).ascii(); bool w = WATools::isWireless( i ); - if ( !WATools::isWireless( (const char*)*nps ) ) { + if ( !WATools::isWireless( (*nps).ascii() ) ) { nps = ifList.remove( nps ); nps--; } } @@ -1125,7 +1125,7 @@ TQString WirelessAssistant::getVal(const TQString & str, const TQString & rxs) 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 TQString(); + if ( wpaSettings.isEmpty() ) return false; TQString c = "ctrl_interface=/var/run/wpa_supplicant\nnetwork={\nscan_ssid=0\nssid=\""; //fast_reauth=1\n c.append(essid).append("\"\n"); @@ -1135,7 +1135,7 @@ bool WirelessAssistant::generateWpaConfigFile( const TQString& essid, const TQSt //WPA authentication suite c.append("key_mgmt="); if ( wpaSettings[3].contains("PSK") ) c.append("WPA-PSK\n"); - else return TQString(); // not supported + else return false; // not supported //WPA pairwise cipher c.append("pairwise="); @@ -1197,7 +1197,7 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQSt runCommand( TQStringList(Commands.wpa_cli) << "reconfigure" ); } else { if ( driver.isEmpty() ) { //detect needed driver - TQString k = WATools::kernelModule( iface ); + TQString k = WATools::kernelModule( iface.ascii() ); if ( k.contains("hermes") ) driver = "hermes"; else if ( k.contains("atmel") ) driver = "atmel"; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) @@ -1208,7 +1208,7 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQSt //Commented out, because madwifi-ng works with wext driver. //else if ( k.contains("ath") ) driver = "madwifi"; else driver = "wext"; - std::cout << "Using wpa_supplicant driver: " << driver << std::endl; + std::cout << "Using wpa_supplicant driver: " << driver.ascii() << std::endl; } TQProcess* wp = new TQProcess( TQT_TQOBJECT(this) ); @@ -1218,7 +1218,7 @@ bool WirelessAssistant::setWpaClientEnabled( bool e, const TQString& iface, TQSt 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; + //std::cout << "Starting WPA client: " << wp->arguments().join(" ").ascii() << std::endl; if ( !wp->start() ) { std::cout << "Failed to start WPA client." << std::endl; return 0; diff --git a/src/wlassistant.h b/src/wlassistant.h index 03a9c54..4951e8f 100644 --- a/src/wlassistant.h +++ b/src/wlassistant.h @@ -24,6 +24,8 @@ //connection check interval in msec #define WA_CONNECTION_CHECK_INTERVAL 5000 +#include <tqlistview.h> + #include "ui_main.h" #include "waconfig.h" |