summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index da21c05..765b522 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -324,193 +324,193 @@ void MainWindowImp::addClicked(){
324 324
325 for( it = libraries.begin(); it != libraries.end(); ++it ){ 325 for( it = libraries.begin(); it != libraries.end(); ++it ){
326 if(it.key()){ 326 if(it.key()){
327 Interface *i = (it.key())->addNewInterface(item->text(0)); 327 Interface *i = (it.key())->addNewInterface(item->text(0));
328 if(i){ 328 if(i){
329 interfaceNames.insert(i->getInterfaceName(), i); 329 interfaceNames.insert(i->getInterfaceName(), i);
330 updateInterface(i); 330 updateInterface(i);
331 } 331 }
332 } 332 }
333 } 333 }
334 } 334 }
335} 335}
336 336
337/** 337/**
338 * Prompt the user to see if they really want to do this. 338 * Prompt the user to see if they really want to do this.
339 * If they do then remove from the list and unload. 339 * If they do then remove from the list and unload.
340 */ 340 */
341void MainWindowImp::removeClicked(){ 341void MainWindowImp::removeClicked(){
342 QListViewItem *item = connectionList->currentItem(); 342 QListViewItem *item = connectionList->currentItem();
343 if(!item) { 343 if(!item) {
344 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 344 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
345 return; 345 return;
346 } 346 }
347 347
348 Interface *i = interfaceItems[item]; 348 Interface *i = interfaceItems[item];
349 if(i->getModuleOwner() == NULL){ 349 if(i->getModuleOwner() == NULL){
350 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 350 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
351 } 351 }
352 else{ 352 else{
353 if(!i->getModuleOwner()->remove(i)) 353 if(!i->getModuleOwner()->remove(i))
354 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); 354 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
355 else{ 355 else{
356 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 356 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
357 // TODO memory managment.... 357 // TODO memory managment....
358 // who deletes the interface? 358 // who deletes the interface?
359 } 359 }
360 } 360 }
361} 361}
362 362
363/** 363/**
364 * Pull up the configure about the currently selected interface. 364 * Pull up the configure about the currently selected interface.
365 * Report an error if no interface is selected. 365 * Report an error if no interface is selected.
366 * If the interface has a module owner then request its configure. 366 * If the interface has a module owner then request its configure.
367 */ 367 */
368void MainWindowImp::configureClicked(){ 368void MainWindowImp::configureClicked(){
369 QListViewItem *item = connectionList->currentItem(); 369 QListViewItem *item = connectionList->currentItem();
370 if(!item){ 370 if(!item){
371 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 371 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
372 return; 372 return;
373 } 373 }
374 374
375 Interface *i = interfaceItems[item]; 375 Interface *i = interfaceItems[item];
376 if(i->getModuleOwner()){ 376 if(i->getModuleOwner()){
377 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 377 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
378 if(moduleConfigure != NULL){ 378 if(moduleConfigure != NULL){
379 moduleConfigure->showMaximized(); 379 moduleConfigure->showMaximized();
380 return; 380 return;
381 } 381 }
382 } 382 }
383 383
384 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose ); 384 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose );
385 QString currentProfileText = currentProfileLabel->text(); 385 QString currentProfileText = currentProfileLabel->text();
386 if(currentProfileText.upper() == "ALL"); 386 if(currentProfileText.upper() == "ALL");
387 currentProfileText = ""; 387 currentProfileText = "";
388 configure->setProfile(currentProfileText); 388 configure->setProfile(currentProfileText);
389 configure->showMaximized(); 389 configure->showMaximized();
390} 390}
391 391
392/** 392/**
393 * Pull up the information about the currently selected interface. 393 * Pull up the information about the currently selected interface.
394 * Report an error if no interface is selected. 394 * Report an error if no interface is selected.
395 * If the interface has a module owner then request its configure. 395 * If the interface has a module owner then request its configure.
396 */ 396 */
397void MainWindowImp::informationClicked(){ 397void MainWindowImp::informationClicked(){
398 QListViewItem *item = connectionList->currentItem(); 398 QListViewItem *item = connectionList->currentItem();
399 if(!item){ 399 if(!item){
400 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 400 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
401 return; 401 return;
402 } 402 }
403 403
404 Interface *i = interfaceItems[item]; 404 Interface *i = interfaceItems[item];
405 if(!i->isAttached()){ 405 if(!i->isAttached()){
406 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 406 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
407 return; 407 return;
408 } 408 }
409 409
410 if(i->getModuleOwner()){ 410 if(i->getModuleOwner()){
411 QWidget *moduleInformation = i->getModuleOwner()->information(i); 411 QWidget *moduleInformation = i->getModuleOwner()->information(i);
412 if(moduleInformation != NULL){ 412 if(moduleInformation != NULL){
413 moduleInformation->showMaximized(); 413 moduleInformation->showMaximized();
414#ifdef DEBUG 414#ifdef DEBUG
415 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 415 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
416#endif 416#endif
417 return; 417 return;
418 } 418 }
419 } 419 }
420 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WType_Dialog); 420 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
421 information->showMaximized(); 421 information->showMaximized();
422} 422}
423 423
424/** 424/**
425 * Update this interface. If no QListViewItem exists create one. 425 * Update this interface. If no QListViewItem exists create one.
426 * @param Interface* pointer to the interface that needs to be updated. 426 * @param Interface* pointer to the interface that needs to be updated.
427 */ 427 */
428void MainWindowImp::updateInterface(Interface *i){ 428void MainWindowImp::updateInterface(Interface *i){
429 if(!advancedUserMode){ 429 if(!advancedUserMode){
430 if(i->getInterfaceName() == "lo") 430 if(i->getInterfaceName() == "lo")
431 return; 431 return;
432 } 432 }
433 433
434 QListViewItem *item = NULL; 434 QListViewItem *item = NULL;
435 435
436 // Find the interface, making it if needed. 436 // Find the interface, making it if needed.
437 if(items.find(i) == items.end()){ 437 if(items.find(i) == items.end()){
438 item = new QListViewItem(connectionList, "", "", ""); 438 item = new QListViewItem(connectionList, "", "", "");
439 // See if you can't find a module owner for this interface 439 // See if you can't find a module owner for this interface
440 QMap<Module*, QLibrary*>::Iterator it; 440 QMap<Module*, QLibrary*>::Iterator it;
441 for( it = libraries.begin(); it != libraries.end(); ++it ){ 441 for( it = libraries.begin(); it != libraries.end(); ++it ){
442 if(it.key()->isOwner(i)) 442 if(it.key()->isOwner(i))
443 i->setModuleOwner(it.key()); 443 i->setModuleOwner(it.key());
444 } 444 }
445 items.insert(i, item); 445 items.insert(i, item);
446 interfaceItems.insert(item, i); 446 interfaceItems.insert(item, i);
447 } 447 }
448 else 448 else
449 item = items[i]; 449 item = items[i];
450 450
451 // Update the icons and information 451 // Update the icons and information
452#ifdef QWS 452#ifdef QWS
453 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 453 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
454#else 454#else
455 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); 455 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down")));
456#endif 456#endif
457 457
458 QString typeName = "lan"; 458 QString typeName = "lan";
459 if(i->getHardwareName().contains("Local Loopback")) 459 if(i->getHardwareName().contains("Local Loopback"))
460 typeName = "lo"; 460 typeName = "lo";
461 if(i->getInterfaceName().contains("irda")) 461 if(i->getInterfaceName().contains("irda"))
462 typeName = "irda"; 462 typeName = "irda";
463 if(i->getInterfaceName().contains("wlan")) 463 if(i->getInterfaceName().contains("wlan"))
464 typeName = "wlan"; 464 typeName = "wlan";
465 if(i->getInterfaceName().contains("usb")) 465 if(i->getInterfaceName().contains("usb"))
466 typeName = "usb"; 466 typeName = "usb";
467 467
468 if(!i->isAttached()) 468 if(!i->isAttached())
469 typeName = "connect_no"; 469 typeName = "connect_no";
470 // Actually try to use the Module 470 // Actually try to use the Module
471 if(i->getModuleOwner() != NULL) 471 if(i->getModuleOwner() != NULL)
472 typeName = i->getModuleOwner()->getPixmapName(i); 472 typeName = i->getModuleOwner()->getPixmapName(i);
473 473
474#ifdef QWS 474#ifdef QWS
475 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); 475 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName)));
476#else 476#else
477 item->setPixmap(1, (SmallIcon(typeName))); 477 item->setPixmap(1, (SmallIcon(typeName)));
478#endif 478#endif
479 item->setText(2, i->getHardwareName()); 479 item->setText(2, i->getHardwareName());
480 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 480 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
481 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 481 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
482} 482}
483 483
484void MainWindowImp::newProfileChanged(const QString& newText){ 484void MainWindowImp::newProfileChanged(const QString& newText){
485 if(newText.length() > 0) 485 if(newText.length() > 0)
486 newProfileButton->setEnabled(true); 486 newProfileButton->setEnabled(true);
487 else 487 else
488 newProfileButton->setEnabled(false); 488 newProfileButton->setEnabled(false);
489} 489}
490 490
491/** 491/**
492 * Adds a new profile to the list of profiles. 492 * Adds a new profile to the list of profiles.
493 * Don't add profiles that already exists. 493 * Don't add profiles that already exists.
494 * Appends to the list and QStringList 494 * Appends to the list and QStringList
495 */ 495 */
496void MainWindowImp::addProfile(){ 496void MainWindowImp::addProfile(){
497 QString newProfileName = newProfile->text(); 497 QString newProfileName = newProfile->text();
498 if(profiles.grep(newProfileName).count() > 0){ 498 if(profiles.grep(newProfileName).count() > 0){
499 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 499 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
500 return; 500 return;
501 } 501 }
502 profiles.append(newProfileName); 502 profiles.append(newProfileName);
503 profilesList->insertItem(newProfileName); 503 profilesList->insertItem(newProfileName);
504} 504}
505 505
506/** 506/**
507 * Removes the currently selected profile in the combo. 507 * Removes the currently selected profile in the combo.
508 * Doesn't delete if there are less then 2 profiles. 508 * Doesn't delete if there are less then 2 profiles.
509 */ 509 */
510void MainWindowImp::removeProfile(){ 510void MainWindowImp::removeProfile(){
511 if(profilesList->count() <= 1){ 511 if(profilesList->count() <= 1){
512 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); 512 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
513 return; 513 return;
514 } 514 }
515 QString profileToRemove = profilesList->currentText(); 515 QString profileToRemove = profilesList->currentText();
516 if(profileToRemove == "All"){ 516 if(profileToRemove == "All"){