Diffstat (limited to 'noncore/net/networksetup/mainwindowimp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index 24af1ec..b46362f 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -240,6 +240,10 @@ void MainWindowImp::informationClicked(){ | |||
240 | } | 240 | } |
241 | 241 | ||
242 | Interface *i = interfaceItems[item]; | 242 | Interface *i = interfaceItems[item]; |
243 | if(!i->isAttached()){ | ||
244 | QMessageBox::information(this, "Error","No information about\na disconnected interface.", QMessageBox::Ok); | ||
245 | return; | ||
246 | } | ||
243 | if(i->getModuleOwner()){ | 247 | if(i->getModuleOwner()){ |
244 | QTabWidget *tabWidget = NULL; | 248 | QTabWidget *tabWidget = NULL; |
245 | QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget); | 249 | QWidget *moduleInformation = i->getModuleOwner()->information(&tabWidget); |
@@ -269,13 +273,14 @@ void MainWindowImp::getInterfaceList(){ | |||
269 | connect(processAll, SIGNAL(processExited(KProcess *)), | 273 | connect(processAll, SIGNAL(processExited(KProcess *)), |
270 | this, SLOT(jobDone(KProcess *))); | 274 | this, SLOT(jobDone(KProcess *))); |
271 | threads.insert(processAll, TEMP_ALL); | 275 | threads.insert(processAll, TEMP_ALL); |
272 | processAll->start(KShellProcess::NotifyOnExit); | ||
273 | 276 | ||
274 | KShellProcess *process = new KShellProcess(); | 277 | KShellProcess *process = new KShellProcess(); |
275 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 278 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
276 | connect(process, SIGNAL(processExited(KProcess *)), | 279 | connect(process, SIGNAL(processExited(KProcess *)), |
277 | this, SLOT(jobDone(KProcess *))); | 280 | this, SLOT(jobDone(KProcess *))); |
278 | threads.insert(process, TEMP_UP); | 281 | threads.insert(process, TEMP_UP); |
282 | |||
283 | processAll->start(KShellProcess::NotifyOnExit); | ||
279 | process->start(KShellProcess::NotifyOnExit); | 284 | process->start(KShellProcess::NotifyOnExit); |
280 | } | 285 | } |
281 | 286 | ||
@@ -298,10 +303,6 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
298 | if(space > 1){ | 303 | if(space > 1){ |
299 | // We have found an interface | 304 | // We have found an interface |
300 | QString interfaceName = line.mid(0, space); | 305 | QString interfaceName = line.mid(0, space); |
301 | if(!advancedUserMode){ | ||
302 | if(interfaceName == "lo") | ||
303 | break; | ||
304 | } | ||
305 | Interface *i; | 306 | Interface *i; |
306 | // See if we already have it | 307 | // See if we already have it |
307 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ | 308 | if(interfaceNames.find(interfaceName) == interfaceNames.end()){ |
@@ -334,13 +335,18 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
334 | } | 335 | } |
335 | file.close(); | 336 | file.close(); |
336 | QFile::remove(fileName); | 337 | QFile::remove(fileName); |
338 | |||
337 | if(threads.count() == 0){ | 339 | if(threads.count() == 0){ |
338 | Interfaces i; | 340 | Interfaces i; |
339 | QStringList list = i.getInterfaceList(); | 341 | QStringList list = i.getInterfaceList(); |
340 | QMap<QString, Interface*>::Iterator it; | 342 | QMap<QString, Interface*>::Iterator it; |
341 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | 343 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { |
344 | bool found = false; | ||
342 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | 345 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ |
343 | if(it.key() == (*ni)){ | 346 | if(it.key() == (*ni)) |
347 | found = true; | ||
348 | } | ||
349 | if(!found){ | ||
344 | Interface *i = new Interface(*ni, false); | 350 | Interface *i = new Interface(*ni, false); |
345 | i->setAttached(false); | 351 | i->setAttached(false); |
346 | i->setHardwareName(QString("Disconnected (%1)").arg(*ni)); | 352 | i->setHardwareName(QString("Disconnected (%1)").arg(*ni)); |
@@ -351,13 +357,17 @@ void MainWindowImp::jobDone(KProcess *process){ | |||
351 | } | 357 | } |
352 | } | 358 | } |
353 | } | 359 | } |
354 | } | ||
355 | 360 | ||
356 | /** | 361 | /** |
357 | * Update this interface. If no QListViewItem exists create one. | 362 | * Update this interface. If no QListViewItem exists create one. |
358 | * @param Interface* pointer to the interface that needs to be updated. | 363 | * @param Interface* pointer to the interface that needs to be updated. |
359 | */ | 364 | */ |
360 | void MainWindowImp::updateInterface(Interface *i){ | 365 | void MainWindowImp::updateInterface(Interface *i){ |
366 | if(!advancedUserMode){ | ||
367 | if(i->getInterfaceName() == "lo") | ||
368 | return; | ||
369 | } | ||
370 | |||
361 | QListViewItem *item = NULL; | 371 | QListViewItem *item = NULL; |
362 | 372 | ||
363 | // Find the interface, making it if needed. | 373 | // Find the interface, making it if needed. |