-rw-r--r-- | noncore/net/opiestumbler/opiestumbler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/opiestumbler/opiestumbler.cpp b/noncore/net/opiestumbler/opiestumbler.cpp index 9b0d099..ab0b8d8 100644 --- a/noncore/net/opiestumbler/opiestumbler.cpp +++ b/noncore/net/opiestumbler/opiestumbler.cpp | |||
@@ -297,88 +297,89 @@ void OpieStumbler::slotJoinNetwork() | |||
297 | wiface->setUp(false); | 297 | wiface->setUp(false); |
298 | 298 | ||
299 | odebug << "Setting mode to " << (station->type == "adhoc" ? "adhoc" : "managed") << oendl; | 299 | odebug << "Setting mode to " << (station->type == "adhoc" ? "adhoc" : "managed") << oendl; |
300 | wiface->setMode(station->type == "adhoc" ? "adhoc" : "managed" ); | 300 | wiface->setMode(station->type == "adhoc" ? "adhoc" : "managed" ); |
301 | 301 | ||
302 | odebug << "Setting channel to " << station->channel << oendl; | 302 | odebug << "Setting channel to " << station->channel << oendl; |
303 | wiface->setChannel(station->channel); | 303 | wiface->setChannel(station->channel); |
304 | 304 | ||
305 | odebug << "Setting SSID to " << station->ssid << oendl; | 305 | odebug << "Setting SSID to " << station->ssid << oendl; |
306 | wiface->setSSID(station->ssid); | 306 | wiface->setSSID(station->ssid); |
307 | 307 | ||
308 | wiface->commit(); | 308 | wiface->commit(); |
309 | 309 | ||
310 | odebug << "Bringing interface up" << oendl; | 310 | odebug << "Bringing interface up" << oendl; |
311 | wiface->setUp(true); | 311 | wiface->setUp(true); |
312 | m_pbar->setProgress(1); | 312 | m_pbar->setProgress(1); |
313 | //Wait 5 sec for association | 313 | //Wait 5 sec for association |
314 | QTimer::singleShot(5000, this, SLOT(slotAssociated())); | 314 | QTimer::singleShot(5000, this, SLOT(slotAssociated())); |
315 | } | 315 | } |
316 | 316 | ||
317 | void OpieStumbler::slotAssociated() | 317 | void OpieStumbler::slotAssociated() |
318 | { | 318 | { |
319 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); | 319 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); |
320 | 320 | ||
321 | if( !wiface ) { | 321 | if( !wiface ) { |
322 | slotCleanSplash(); | 322 | slotCleanSplash(); |
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | 325 | ||
326 | if (!wiface->isAssociated()) { | 326 | if (!wiface->isAssociated()) { |
327 | Global::statusMessage(tr("Could not Join")); | 327 | Global::statusMessage(tr("Could not Join")); |
328 | m_infoLabel->setText(tr("Could not Join")); | 328 | m_infoLabel->setText(tr("Could not Join")); |
329 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); | 329 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); |
330 | return; | 330 | return; |
331 | } | 331 | } |
332 | 332 | ||
333 | Global::statusMessage(tr("Joined")); | 333 | Global::statusMessage(tr("Joined")); |
334 | m_pbar->setProgress(2); | 334 | m_pbar->setProgress(2); |
335 | m_infoLabel->setText(QString("<center><b>%1 %2</b></center>").arg(tr("Joined Network")).arg(m_ssid)); | 335 | m_infoLabel->setText(QString("<center><b>%1 %2</b></center>").arg(tr("Joined Network")).arg(m_ssid)); |
336 | 336 | ||
337 | if(m_proc) { | 337 | if(m_proc) { |
338 | m_proc->kill(); | 338 | m_proc->kill(); |
339 | delete m_proc; | 339 | delete m_proc; |
340 | } | 340 | } |
341 | 341 | ||
342 | m_proc = new Opie::Core::OProcess(this); | 342 | m_proc = new Opie::Core::OProcess(this); |
343 | 343 | ||
344 | *m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface; | 344 | *m_proc << "udhcpc" << "-f" << "-n" << "-i" << m_interface; |
345 | m_proc->start(Opie::Core::OProcess::DontCare); | 345 | if (!m_proc->start(Opie::Core::OProcess::DontCare)) |
346 | owarn << "Execution of udhcpc returned false. Are paths correct?" << oendl; | ||
346 | QTimer::singleShot(5000, this, SLOT(slotCheckDHCP())); | 347 | QTimer::singleShot(5000, this, SLOT(slotCheckDHCP())); |
347 | } | 348 | } |
348 | 349 | ||
349 | void OpieStumbler::slotCheckDHCP() | 350 | void OpieStumbler::slotCheckDHCP() |
350 | { | 351 | { |
351 | if(!m_proc->isRunning()) { | 352 | if(!m_proc->isRunning()) { |
352 | Global::statusMessage(tr("Could not Obtain an Address")); | 353 | Global::statusMessage(tr("Could not Obtain an Address")); |
353 | m_infoLabel->setText(QString("<center><b>%1</b></center>").arg(tr("Could not Obtain an Address"))); | 354 | m_infoLabel->setText(QString("<center><b>%1</b></center>").arg(tr("Could not Obtain an Address"))); |
354 | delete m_proc; | 355 | delete m_proc; |
355 | m_proc = NULL; | 356 | m_proc = NULL; |
356 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); | 357 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); |
357 | return; | 358 | return; |
358 | } | 359 | } |
359 | m_listCurrent->show(); | 360 | m_listCurrent->show(); |
360 | m_pbar->setProgress(3); | 361 | m_pbar->setProgress(3); |
361 | 362 | ||
362 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); | 363 | OWirelessNetworkInterface *wiface = static_cast<OWirelessNetworkInterface*>(ONetwork::instance()->interface(m_interface)); |
363 | QString ipv4 = wiface->ipV4Address().toString(); | 364 | QString ipv4 = wiface->ipV4Address().toString(); |
364 | m_infoLabel->setText(QString("<center><b>%1 %2</b></center>").arg(tr("Obtained IP")).arg(ipv4)); | 365 | m_infoLabel->setText(QString("<center><b>%1 %2</b></center>").arg(tr("Obtained IP")).arg(ipv4)); |
365 | Global::statusMessage(tr("Obtained IP") + " " + ipv4); | 366 | Global::statusMessage(tr("Obtained IP") + " " + ipv4); |
366 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); | 367 | QTimer::singleShot(5000, this, SLOT(slotCleanSplash())); |
367 | 368 | ||
368 | } | 369 | } |
369 | 370 | ||
370 | void OpieStumbler::slotCleanSplash() | 371 | void OpieStumbler::slotCleanSplash() |
371 | { | 372 | { |
372 | delete m_pbar; | 373 | delete m_pbar; |
373 | m_pbar = 0; | 374 | m_pbar = 0; |
374 | 375 | ||
375 | delete m_infoLabel; | 376 | delete m_infoLabel; |
376 | m_infoLabel = 0; | 377 | m_infoLabel = 0; |
377 | 378 | ||
378 | delete m_splashBox; | 379 | delete m_splashBox; |
379 | m_splashBox = 0; | 380 | m_splashBox = 0; |
380 | 381 | ||
381 | delete m_splash; | 382 | delete m_splash; |
382 | m_splash = 0; | 383 | m_splash = 0; |
383 | } | 384 | } |
384 | 385 | ||