summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/mainwindowimp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index b9fff56..6440bd4 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -209,93 +209,85 @@ void MainWindowImp::removeClicked(){
209 } 209 }
210 else{ 210 else{
211 if(!i->getModuleOwner()->remove(i)) 211 if(!i->getModuleOwner()->remove(i))
212 QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); 212 QMessageBox::information(this, "Error", "Unable to remove.", "Ok");
213 else{ 213 else{
214 QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); 214 QMessageBox::information(this, "Success", "Interface was removed.", "Ok");
215 // TODO memory managment.... 215 // TODO memory managment....
216 // who deletes the interface? 216 // who deletes the interface?
217 } 217 }
218 } 218 }
219} 219}
220 220
221/** 221/**
222 * Pull up the configure about the currently selected interface. 222 * Pull up the configure about the currently selected interface.
223 * Report an error if no interface is selected. 223 * Report an error if no interface is selected.
224 * If the interface has a module owner then request its configure. 224 * If the interface has a module owner then request its configure.
225 */ 225 */
226void MainWindowImp::configureClicked(){ 226void MainWindowImp::configureClicked(){
227 QListViewItem *item = connectionList->currentItem(); 227 QListViewItem *item = connectionList->currentItem();
228 if(!item){ 228 if(!item){
229 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 229 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
230 return; 230 return;
231 } 231 }
232 232
233 QString currentProfile = currentProfileLabel->text();
234 if(profilesList->count() <= 1 || currentProfile == "All"){
235 currentProfile = "";
236 }
237
238 Interface *i = interfaceItems[item]; 233 Interface *i = interfaceItems[item];
239 if(i->getModuleOwner()){ 234 if(i->getModuleOwner()){
240 i->getModuleOwner()->setProfile(currentProfile);
241 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 235 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
242 if(moduleConfigure != NULL){ 236 if(moduleConfigure != NULL){
243 moduleConfigure->showMaximized(); 237 moduleConfigure->showMaximized();
244 moduleConfigure->show(); 238 moduleConfigure->show();
245 return; 239 return;
246 } 240 }
247 } 241 }
248 242
249 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); 243 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose);
250 //configure->setProfile(currentProfile); 244 QString currentProfileText = currentProfileLabel->text();
245 if(currentProfileText.upper() == "ALL");
246 currentProfileText = "";
247 configure->setProfile(currentProfileText);
251 configure->showMaximized(); 248 configure->showMaximized();
252 configure->show(); 249 configure->show();
253} 250}
254 251
255/** 252/**
256 * Pull up the information about the currently selected interface. 253 * Pull up the information about the currently selected interface.
257 * Report an error if no interface is selected. 254 * Report an error if no interface is selected.
258 * If the interface has a module owner then request its configure. 255 * If the interface has a module owner then request its configure.
259 */ 256 */
260void MainWindowImp::informationClicked(){ 257void MainWindowImp::informationClicked(){
261 QListViewItem *item = connectionList->currentItem(); 258 QListViewItem *item = connectionList->currentItem();
262 if(!item){ 259 if(!item){
263 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 260 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
264 return; 261 return;
265 } 262 }
266 263
267 Interface *i = interfaceItems[item]; 264 Interface *i = interfaceItems[item];
268 if(!i->isAttached()){ 265 if(!i->isAttached()){
269 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 266 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
270 return; 267 return;
271 } 268 }
272 269
273 QStringList list;
274 for(uint i = 0; i < profilesList->count(); i++){
275 list.append(profilesList->text(i));
276 }
277
278 if(i->getModuleOwner()){ 270 if(i->getModuleOwner()){
279 QWidget *moduleInformation = i->getModuleOwner()->information(i); 271 QWidget *moduleInformation = i->getModuleOwner()->information(i);
280 if(moduleInformation != NULL){ 272 if(moduleInformation != NULL){
281 moduleInformation->showMaximized(); 273 moduleInformation->showMaximized();
282 moduleInformation->show(); 274 moduleInformation->show();
283 return; 275 return;
284 } 276 }
285 } 277 }
286 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); 278 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true);
287 information->showMaximized(); 279 information->showMaximized();
288 information->show(); 280 information->show();
289} 281}
290 282
291/** 283/**
292 * Aquire the list of active interfaces from ifconfig 284 * Aquire the list of active interfaces from ifconfig
293 * Call ifconfig and ifconfig -a 285 * Call ifconfig and ifconfig -a
294 */ 286 */
295void MainWindowImp::getInterfaceList(){ 287void MainWindowImp::getInterfaceList(){
296 KShellProcess *processAll = new KShellProcess(); 288 KShellProcess *processAll = new KShellProcess();
297 *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; 289 *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL;
298 connect(processAll, SIGNAL(processExited(KProcess *)), 290 connect(processAll, SIGNAL(processExited(KProcess *)),
299 this, SLOT(jobDone(KProcess *))); 291 this, SLOT(jobDone(KProcess *)));
300 threads.insert(processAll, TEMP_ALL); 292 threads.insert(processAll, TEMP_ALL);
301 293
@@ -517,28 +509,29 @@ void MainWindowImp::changeProfile(){
517 if(profilesList->currentItem() == -1){ 509 if(profilesList->currentItem() == -1){
518 QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok"); 510 QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok");
519 return; 511 return;
520 } 512 }
521 QString newProfile = profilesList->text(profilesList->currentItem()); 513 QString newProfile = profilesList->text(profilesList->currentItem());
522 if(newProfile != currentProfileLabel->text()){ 514 if(newProfile != currentProfileLabel->text()){
523 currentProfileLabel->setText(newProfile); 515 currentProfileLabel->setText(newProfile);
524 QFile::remove(scheme); 516 QFile::remove(scheme);
525 QFile file(scheme); 517 QFile file(scheme);
526 if ( file.open(IO_ReadWrite) ) { 518 if ( file.open(IO_ReadWrite) ) {
527 QTextStream stream( &file ); 519 QTextStream stream( &file );
528 stream << QString("SCHEME=%1").arg(newProfile); 520 stream << QString("SCHEME=%1").arg(newProfile);
529 file.close(); 521 file.close();
530 } 522 }
531 // restart all up devices? 523 // restart all up devices?
532 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ 524 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
533 // Go through them one by one 525 // Go through them one by one
534 QMap<Interface*, QListViewItem*>::Iterator it; 526 QMap<Interface*, QListViewItem*>::Iterator it;
535 for( it = items.begin(); it != items.end(); ++it ){ 527 for( it = items.begin(); it != items.end(); ++it ){
536 if(it.key()->getStatus() == true) 528 if(it.key()->getStatus() == true)
537 it.key()->restart(); 529 it.key()->restart();
538 } 530 }
539 } 531 }
540 } 532 }
533 // TODO change the profile in the modules
541} 534}
542 535
543// mainwindowimp.cpp 536// mainwindowimp.cpp
544 537