author | benmeyer <benmeyer> | 2002-10-17 15:03:35 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-17 15:03:35 (UTC) |
commit | 1fa7ebd9512ac0497c3ede198621899a10e961af (patch) (unidiff) | |
tree | 45be4e45b5408f46c3f2e59b1241aebf9a9bf869 /noncore/settings/networksettings/mainwindowimp.cpp | |
parent | 6c8ae3c8af454c87f5f467fe17cbdffe4c8f5494 (diff) | |
download | opie-1fa7ebd9512ac0497c3ede198621899a10e961af.zip opie-1fa7ebd9512ac0497c3ede198621899a10e961af.tar.gz opie-1fa7ebd9512ac0497c3ede198621899a10e961af.tar.bz2 |
added interface listing
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 36f12e0..24af1ec 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -1,16 +1,18 @@ | |||
1 | #include "mainwindowimp.h" | 1 | #include "mainwindowimp.h" |
2 | #include "addconnectionimp.h" | 2 | #include "addconnectionimp.h" |
3 | #include "interfaceinformationimp.h" | 3 | #include "interfaceinformationimp.h" |
4 | #include "interfacesetupimp.h" | 4 | #include "interfacesetupimp.h" |
5 | #include "interfaces.h" | ||
6 | |||
5 | #include "module.h" | 7 | #include "module.h" |
6 | 8 | ||
7 | #include "kprocess.h" | 9 | #include "kprocess.h" |
8 | 10 | ||
9 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
10 | #include <qtabwidget.h> | 12 | #include <qtabwidget.h> |
11 | #include <qlistbox.h> | 13 | #include <qlistbox.h> |
12 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
13 | #include <qlistview.h> | 15 | #include <qlistview.h> |
14 | #include <qheader.h> | 16 | #include <qheader.h> |
15 | #include <qlabel.h> | 17 | #include <qlabel.h> |
16 | 18 | ||
@@ -323,24 +325,41 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
323 | if(macAddress == -1) | 325 | if(macAddress == -1) |
324 | macAddress = line.length(); | 326 | macAddress = line.length(); |
325 | if(hardwareName != -1) | 327 | if(hardwareName != -1) |
326 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); | 328 | i->setHardwareName(line.mid(hardwareName+11, macAddress-(hardwareName+11)) + QString(" (%1)").arg(i->getInterfaceName())); |
327 | // We have found an interface | 329 | // We have found an interface |
328 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); | 330 | //qDebug(QString("MainWindowImp: Found Interface: %1").arg(line).latin1()); |
329 | interfaceNames.insert(i->getInterfaceName(), i); | 331 | interfaceNames.insert(i->getInterfaceName(), i); |
330 | updateInterface(i); | 332 | updateInterface(i); |
331 | } | 333 | } |
332 | } | 334 | } |
333 | file.close(); | 335 | file.close(); |
334 | QFile::remove(fileName); | 336 | QFile::remove(fileName); |
337 | if(threads.count() == 0){ | ||
338 | Interfaces i; | ||
339 | QStringList list = i.getInterfaceList(); | ||
340 | QMap<QString, Interface*>::Iterator it; | ||
341 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | ||
342 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | ||
343 | if(it.key() == (*ni)){ | ||
344 | Interface *i = new Interface(*ni, false); | ||
345 | i->setAttached(false); | ||
346 | i->setHardwareName(QString("Disconnected (%1)").arg(*ni)); | ||
347 | i->setInterfaceName(*ni); | ||
348 | interfaceNames.insert(i->getInterfaceName(), i); | ||
349 | updateInterface(i); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | } | ||
335 | } | 354 | } |
336 | 355 | ||
337 | /** | 356 | /** |
338 | * Update this interface. If no QListViewItem exists create one. | 357 | * Update this interface. If no QListViewItem exists create one. |
339 | * @param Interface* pointer to the interface that needs to be updated. | 358 | * @param Interface* pointer to the interface that needs to be updated. |
340 | */ | 359 | */ |
341 | void MainWindowImp::updateInterface(Interface *i){ | 360 | void MainWindowImp::updateInterface(Interface *i){ |
342 | QListViewItem *item = NULL; | 361 | QListViewItem *item = NULL; |
343 | 362 | ||
344 | // Find the interface, making it if needed. | 363 | // Find the interface, making it if needed. |
345 | if(items.find(i) == items.end()){ | 364 | if(items.find(i) == items.end()){ |
346 | item = new QListViewItem(connectionList, "", "", ""); | 365 | item = new QListViewItem(connectionList, "", "", ""); |
@@ -357,24 +376,27 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
357 | item = items[i]; | 376 | item = items[i]; |
358 | 377 | ||
359 | // Update the icons and information | 378 | // Update the icons and information |
360 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); | 379 | item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); |
361 | 380 | ||
362 | QString typeName = "lan"; | 381 | QString typeName = "lan"; |
363 | if(i->getHardwareName().contains("Local Loopback")) | 382 | if(i->getHardwareName().contains("Local Loopback")) |
364 | typeName = "lo"; | 383 | typeName = "lo"; |
365 | if(i->getInterfaceName().contains("irda")) | 384 | if(i->getInterfaceName().contains("irda")) |
366 | typeName = "irda"; | 385 | typeName = "irda"; |
367 | if(i->getInterfaceName().contains("wlan")) | 386 | if(i->getInterfaceName().contains("wlan")) |
368 | typeName = "wlan"; | 387 | typeName = "wlan"; |
388 | |||
389 | if(!i->isAttached()) | ||
390 | typeName = "connect_no"; | ||
369 | // Actually try to use the Module | 391 | // Actually try to use the Module |
370 | if(i->getModuleOwner() != NULL) | 392 | if(i->getModuleOwner() != NULL) |
371 | typeName = i->getModuleOwner()->getPixmapName(i); | 393 | typeName = i->getModuleOwner()->getPixmapName(i); |
372 | 394 | ||
373 | item->setPixmap(1, (Resource::loadPixmap(typeName))); | 395 | item->setPixmap(1, (Resource::loadPixmap(typeName))); |
374 | item->setText(2, i->getHardwareName()); | 396 | item->setText(2, i->getHardwareName()); |
375 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); | 397 | item->setText(3, (i->getStatus()) ? i->getIp() : QString("")); |
376 | } | 398 | } |
377 | 399 | ||
378 | void MainWindowImp::newProfileChanged(const QString& newText){ | 400 | void MainWindowImp::newProfileChanged(const QString& newText){ |
379 | if(newText.length() > 0) | 401 | if(newText.length() > 0) |
380 | newProfileButton->setEnabled(true); | 402 | newProfileButton->setEnabled(true); |