summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp36
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp36
2 files changed, 46 insertions, 26 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
@@ -241,4 +241,8 @@ void MainWindowImp::informationClicked(){
Interface *i = interfaceItems[item];
+ if(!i->isAttached()){
+ QMessageBox::information(this, "Error","No information about\na disconnected interface.", QMessageBox::Ok);
+ return;
+ }
if(i->getModuleOwner()){
QTabWidget *tabWidget = NULL;
@@ -270,5 +274,4 @@ void MainWindowImp::getInterfaceList(){
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
- processAll->start(KShellProcess::NotifyOnExit);
KShellProcess *process = new KShellProcess();
@@ -277,4 +280,6 @@ void MainWindowImp::getInterfaceList(){
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
+
+ processAll->start(KShellProcess::NotifyOnExit);
process->start(KShellProcess::NotifyOnExit);
}
@@ -299,8 +304,4 @@ void MainWindowImp::jobDone(KProcess *process){
// We have found an interface
QString interfaceName = line.mid(0, space);
- if(!advancedUserMode){
- if(interfaceName == "lo")
- break;
- }
Interface *i;
// See if we already have it
@@ -335,4 +336,5 @@ void MainWindowImp::jobDone(KProcess *process){
file.close();
QFile::remove(fileName);
+
if(threads.count() == 0){
Interfaces i;
@@ -340,13 +342,16 @@ void MainWindowImp::jobDone(KProcess *process){
QMap<QString, Interface*>::Iterator it;
for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
+ bool found = false;
for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
- if(it.key() == (*ni)){
- Interface *i = new Interface(*ni, false);
- i->setAttached(false);
- i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
- i->setInterfaceName(*ni);
- interfaceNames.insert(i->getInterfaceName(), i);
- updateInterface(i);
- }
+ if(it.key() == (*ni))
+ found = true;
+ }
+ if(!found){
+ Interface *i = new Interface(*ni, false);
+ i->setAttached(false);
+ i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
+ i->setInterfaceName(*ni);
+ interfaceNames.insert(i->getInterfaceName(), i);
+ updateInterface(i);
}
}
@@ -359,4 +364,9 @@ void MainWindowImp::jobDone(KProcess *process){
*/
void MainWindowImp::updateInterface(Interface *i){
+ if(!advancedUserMode){
+ if(i->getInterfaceName() == "lo")
+ return;
+ }
+
QListViewItem *item = NULL;
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 24af1ec..b46362f 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -241,4 +241,8 @@ void MainWindowImp::informationClicked(){
Interface *i = interfaceItems[item];
+ if(!i->isAttached()){
+ QMessageBox::information(this, "Error","No information about\na disconnected interface.", QMessageBox::Ok);
+ return;
+ }
if(i->getModuleOwner()){
QTabWidget *tabWidget = NULL;
@@ -270,5 +274,4 @@ void MainWindowImp::getInterfaceList(){
this, SLOT(jobDone(KProcess *)));
threads.insert(processAll, TEMP_ALL);
- processAll->start(KShellProcess::NotifyOnExit);
KShellProcess *process = new KShellProcess();
@@ -277,4 +280,6 @@ void MainWindowImp::getInterfaceList(){
this, SLOT(jobDone(KProcess *)));
threads.insert(process, TEMP_UP);
+
+ processAll->start(KShellProcess::NotifyOnExit);
process->start(KShellProcess::NotifyOnExit);
}
@@ -299,8 +304,4 @@ void MainWindowImp::jobDone(KProcess *process){
// We have found an interface
QString interfaceName = line.mid(0, space);
- if(!advancedUserMode){
- if(interfaceName == "lo")
- break;
- }
Interface *i;
// See if we already have it
@@ -335,4 +336,5 @@ void MainWindowImp::jobDone(KProcess *process){
file.close();
QFile::remove(fileName);
+
if(threads.count() == 0){
Interfaces i;
@@ -340,13 +342,16 @@ void MainWindowImp::jobDone(KProcess *process){
QMap<QString, Interface*>::Iterator it;
for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
+ bool found = false;
for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
- if(it.key() == (*ni)){
- Interface *i = new Interface(*ni, false);
- i->setAttached(false);
- i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
- i->setInterfaceName(*ni);
- interfaceNames.insert(i->getInterfaceName(), i);
- updateInterface(i);
- }
+ if(it.key() == (*ni))
+ found = true;
+ }
+ if(!found){
+ Interface *i = new Interface(*ni, false);
+ i->setAttached(false);
+ i->setHardwareName(QString("Disconnected (%1)").arg(*ni));
+ i->setInterfaceName(*ni);
+ interfaceNames.insert(i->getInterfaceName(), i);
+ updateInterface(i);
}
}
@@ -359,4 +364,9 @@ void MainWindowImp::jobDone(KProcess *process){
*/
void MainWindowImp::updateInterface(Interface *i){
+ if(!advancedUserMode){
+ if(i->getInterfaceName() == "lo")
+ return;
+ }
+
QListViewItem *item = NULL;