-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index abf5663..a0b3113 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -73,33 +73,33 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par | |||
73 | #endif | 73 | #endif |
74 | getAllInterfaces(); | 74 | getAllInterfaces(); |
75 | 75 | ||
76 | Interfaces i; | 76 | Interfaces i; |
77 | QStringList list = i.getInterfaceList(); | 77 | QStringList list = i.getInterfaceList(); |
78 | QMap<QString, Interface*>::Iterator it; | 78 | QMap<QString, Interface*>::Iterator it; |
79 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { | 79 | for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { |
80 | bool found = false; | 80 | bool found = false; |
81 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ | 81 | for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ |
82 | if(it.key() == (*ni)) | 82 | if(it.key() == (*ni)) |
83 | found = true; | 83 | found = true; |
84 | } | 84 | } |
85 | if(!found){ | 85 | if(!found){ |
86 | if(!(*ni).contains("_")){ | 86 | if(!(*ni).contains("_")){ |
87 | Interface *i = new Interface(this, *ni, false); | 87 | Interface *i = new Interface(this, *ni, false); |
88 | i->setAttached(false); | 88 | i->setAttached(false); |
89 | i->setHardwareName("Disconnected"); | 89 | i->setHardwareName(tr("Disconnected")); |
90 | interfaceNames.insert(i->getInterfaceName(), i); | 90 | interfaceNames.insert(i->getInterfaceName(), i); |
91 | updateInterface(i); | 91 | updateInterface(i); |
92 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); | 92 | connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | //getInterfaceList(); | 97 | //getInterfaceList(); |
98 | connectionList->header()->hide(); | 98 | connectionList->header()->hide(); |
99 | 99 | ||
100 | Config cfg("NetworkSetup"); | 100 | Config cfg("NetworkSetup"); |
101 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 101 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
102 | for ( QStringList::Iterator it = profiles.begin(); | 102 | for ( QStringList::Iterator it = profiles.begin(); |
103 | it != profiles.end(); ++it) | 103 | it != profiles.end(); ++it) |
104 | profilesList->insertItem((*it)); | 104 | profilesList->insertItem((*it)); |
105 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 105 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
@@ -375,50 +375,49 @@ void MainWindowImp::addClicked(){ | |||
375 | * Prompt the user to see if they really want to do this. | 375 | * Prompt the user to see if they really want to do this. |
376 | * If they do then remove from the list and unload. | 376 | * If they do then remove from the list and unload. |
377 | */ | 377 | */ |
378 | void MainWindowImp::removeClicked(){ | 378 | void MainWindowImp::removeClicked(){ |
379 | QListViewItem *item = connectionList->currentItem(); | 379 | QListViewItem *item = connectionList->currentItem(); |
380 | if(!item) { | 380 | if(!item) { |
381 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 381 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | 384 | ||
385 | Interface *i = interfaceItems[item]; | 385 | Interface *i = interfaceItems[item]; |
386 | if(i->getModuleOwner() == NULL){ | 386 | if(i->getModuleOwner() == NULL){ |
387 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); | 387 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); |
388 | } | 388 | } |
389 | else{ | 389 | else{ |
390 | if(!i->getModuleOwner()->remove(i)) | 390 | if(!i->getModuleOwner()->remove(i)) |
391 | QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); | 391 | QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); |
392 | else{ | 392 | else{ |
393 | QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); | 393 | delete item; |
394 | // TODO memory managment.... | 394 | // QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); |
395 | // who deletes the interface? | ||
396 | } | 395 | } |
397 | } | 396 | } |
398 | } | 397 | } |
399 | 398 | ||
400 | /** | 399 | /** |
401 | * Pull up the configure about the currently selected interface. | 400 | * Pull up the configure about the currently selected interface. |
402 | * Report an error if no interface is selected. | 401 | * Report an error if no interface is selected. |
403 | * If the interface has a module owner then request its configure. | 402 | * If the interface has a module owner then request its configure. |
404 | */ | 403 | */ |
405 | void MainWindowImp::configureClicked(){ | 404 | void MainWindowImp::configureClicked(){ |
406 | QListViewItem *item = connectionList->currentItem(); | 405 | QListViewItem *item = connectionList->currentItem(); |
407 | if(!item){ | 406 | if(!item){ |
408 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 407 | QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); |
409 | return; | 408 | return; |
410 | } | 409 | } |
411 | 410 | ||
412 | QString currentProfileText = currentProfileLabel->text(); | 411 | QString currentProfileText = currentProfileLabel->text(); |
413 | if(currentProfileText.upper() == "ALL"); | 412 | if(currentProfileText.upper() == "ALL"); |
414 | currentProfileText = ""; | 413 | currentProfileText = ""; |
415 | 414 | ||
416 | Interface *i = interfaceItems[item]; | 415 | Interface *i = interfaceItems[item]; |
417 | 416 | ||
418 | if(i->getModuleOwner()){ | 417 | if(i->getModuleOwner()){ |
419 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); | 418 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); |
420 | if(moduleConfigure != NULL){ | 419 | if(moduleConfigure != NULL){ |
421 | i->getModuleOwner()->setProfile(currentProfileText); | 420 | i->getModuleOwner()->setProfile(currentProfileText); |
422 | moduleConfigure->showMaximized(); | 421 | moduleConfigure->showMaximized(); |
423 | return; | 422 | return; |
424 | } | 423 | } |