summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp7
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h4
2 files changed, 3 insertions, 8 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 581b7e3..da21c05 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1,46 +1,45 @@
1#include "mainwindowimp.h" 1#include "mainwindowimp.h"
2#include "addconnectionimp.h" 2#include "addconnectionimp.h"
3#include "interfaceinformationimp.h" 3#include "interfaceinformationimp.h"
4#include "interfacesetupimp.h" 4#include "interfacesetupimp.h"
5#include "interfaces.h" 5#include "interfaces.h"
6#include "module.h" 6#include "module.h"
7 7
8#include <qpushbutton.h> 8#include <qpushbutton.h>
9#include <qlistbox.h> 9#include <qlistbox.h>
10#include <qlineedit.h> 10#include <qlineedit.h>
11#include <qlistview.h> 11#include <qlistview.h>
12#include <qheader.h> 12#include <qheader.h>
13#include <qlabel.h> 13#include <qlabel.h>
14 14
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16 16
17#ifdef QWS 17#ifdef QWS
18 #include <qpe/config.h> 18 #include <qpe/config.h>
19 #include <qpe/qlibrary.h> 19 #include <qpe/qlibrary.h>
20 #include <qpe/resource.h> 20 #include <qpe/resource.h>
21 #include <qpe/qpeapplication.h> 21 #include <qpe/qpeapplication.h>
22// #define QLibrary Library
23#else 22#else
24 #include <klibloader.h> 23 #include <klibloader.h>
25 #define QLibrary KLibrary 24 #define QLibrary KLibrary
26 #include <kconfig.h> 25 #include <kconfig.h>
27 #define Config KConfig 26 #define Config KConfig
28 #include <kapplication.h> 27 #include <kapplication.h>
29 #include <kstandarddirs.h> 28 #include <kstandarddirs.h>
30 #include <kiconloader.h> 29 #include <kiconloader.h>
31 #define showMaximized show 30 #define showMaximized show
32#endif 31#endif
33 32
34#if QT_VERSION < 300 33#if QT_VERSION < 300
35#include <qlist.h> 34#include <qlist.h>
36#else 35#else
37#include <qptrlist.h> 36#include <qptrlist.h>
38#endif 37#endif
39#include <qdir.h> 38#include <qdir.h>
40#include <qfile.h> 39#include <qfile.h>
41#include <qtextstream.h> 40#include <qtextstream.h>
42#include <qregexp.h> 41#include <qregexp.h>
43 42
44#include <net/if.h> 43#include <net/if.h>
45#include <sys/ioctl.h> 44#include <sys/ioctl.h>
46 45
@@ -361,85 +360,85 @@ void MainWindowImp::removeClicked(){
361 } 360 }
362} 361}
363 362
364/** 363/**
365 * Pull up the configure about the currently selected interface. 364 * Pull up the configure about the currently selected interface.
366 * Report an error if no interface is selected. 365 * Report an error if no interface is selected.
367 * If the interface has a module owner then request its configure. 366 * If the interface has a module owner then request its configure.
368 */ 367 */
369void MainWindowImp::configureClicked(){ 368void MainWindowImp::configureClicked(){
370 QListViewItem *item = connectionList->currentItem(); 369 QListViewItem *item = connectionList->currentItem();
371 if(!item){ 370 if(!item){
372 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 371 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
373 return; 372 return;
374 } 373 }
375 374
376 Interface *i = interfaceItems[item]; 375 Interface *i = interfaceItems[item];
377 if(i->getModuleOwner()){ 376 if(i->getModuleOwner()){
378 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 377 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
379 if(moduleConfigure != NULL){ 378 if(moduleConfigure != NULL){
380 moduleConfigure->showMaximized(); 379 moduleConfigure->showMaximized();
381 return; 380 return;
382 } 381 }
383 } 382 }
384 383
385 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 384 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose );
386 QString currentProfileText = currentProfileLabel->text(); 385 QString currentProfileText = currentProfileLabel->text();
387 if(currentProfileText.upper() == "ALL"); 386 if(currentProfileText.upper() == "ALL");
388 currentProfileText = ""; 387 currentProfileText = "";
389 configure->setProfile(currentProfileText); 388 configure->setProfile(currentProfileText);
390 configure->showMaximized(); 389 configure->showMaximized();
391} 390}
392 391
393/** 392/**
394 * Pull up the information about the currently selected interface. 393 * Pull up the information about the currently selected interface.
395 * Report an error if no interface is selected. 394 * Report an error if no interface is selected.
396 * If the interface has a module owner then request its configure. 395 * If the interface has a module owner then request its configure.
397 */ 396 */
398void MainWindowImp::informationClicked(){ 397void MainWindowImp::informationClicked(){
399 QListViewItem *item = connectionList->currentItem(); 398 QListViewItem *item = connectionList->currentItem();
400 if(!item){ 399 if(!item){
401 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 400 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
402 return; 401 return;
403 } 402 }
404 403
405 Interface *i = interfaceItems[item]; 404 Interface *i = interfaceItems[item];
406 if(!i->isAttached()){ 405 if(!i->isAttached()){
407 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);
408 return; 407 return;
409 } 408 }
410 409
411 if(i->getModuleOwner()){ 410 if(i->getModuleOwner()){
412 QWidget *moduleInformation = i->getModuleOwner()->information(i); 411 QWidget *moduleInformation = i->getModuleOwner()->information(i);
413 if(moduleInformation != NULL){ 412 if(moduleInformation != NULL){
414 moduleInformation->showMaximized(); 413 moduleInformation->showMaximized();
415#ifdef DEBUG 414#ifdef DEBUG
416 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 415 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
417#endif 416#endif
418 return; 417 return;
419 } 418 }
420 } 419 }
421 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 420 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WType_Dialog);
422 information->showMaximized(); 421 information->showMaximized();
423} 422}
424 423
425/** 424/**
426 * Update this interface. If no QListViewItem exists create one. 425 * Update this interface. If no QListViewItem exists create one.
427 * @param Interface* pointer to the interface that needs to be updated. 426 * @param Interface* pointer to the interface that needs to be updated.
428 */ 427 */
429void MainWindowImp::updateInterface(Interface *i){ 428void MainWindowImp::updateInterface(Interface *i){
430 if(!advancedUserMode){ 429 if(!advancedUserMode){
431 if(i->getInterfaceName() == "lo") 430 if(i->getInterfaceName() == "lo")
432 return; 431 return;
433 } 432 }
434 433
435 QListViewItem *item = NULL; 434 QListViewItem *item = NULL;
436 435
437 // Find the interface, making it if needed. 436 // Find the interface, making it if needed.
438 if(items.find(i) == items.end()){ 437 if(items.find(i) == items.end()){
439 item = new QListViewItem(connectionList, "", "", ""); 438 item = new QListViewItem(connectionList, "", "", "");
440 // 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
441 QMap<Module*, QLibrary*>::Iterator it; 440 QMap<Module*, QLibrary*>::Iterator it;
442 for( it = libraries.begin(); it != libraries.end(); ++it ){ 441 for( it = libraries.begin(); it != libraries.end(); ++it ){
443 if(it.key()->isOwner(i)) 442 if(it.key()->isOwner(i))
444 i->setModuleOwner(it.key()); 443 i->setModuleOwner(it.key());
445 } 444 }
@@ -565,26 +564,24 @@ void MainWindowImp::changeProfile(){
565 } 564 }
566 QString newProfile = profilesList->text(profilesList->currentItem()); 565 QString newProfile = profilesList->text(profilesList->currentItem());
567 if(newProfile != currentProfileLabel->text()){ 566 if(newProfile != currentProfileLabel->text()){
568 currentProfileLabel->setText(newProfile); 567 currentProfileLabel->setText(newProfile);
569 QFile::remove(scheme); 568 QFile::remove(scheme);
570 QFile file(scheme); 569 QFile file(scheme);
571 if ( file.open(IO_ReadWrite) ) { 570 if ( file.open(IO_ReadWrite) ) {
572 QTextStream stream( &file ); 571 QTextStream stream( &file );
573 stream << QString("SCHEME=%1").arg(newProfile); 572 stream << QString("SCHEME=%1").arg(newProfile);
574 file.close(); 573 file.close();
575 } 574 }
576 // restart all up devices? 575 // restart all up devices?
577 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ 576 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){
578 // Go through them one by one 577 // Go through them one by one
579 QMap<Interface*, QListViewItem*>::Iterator it; 578 QMap<Interface*, QListViewItem*>::Iterator it;
580 for( it = items.begin(); it != items.end(); ++it ){ 579 for( it = items.begin(); it != items.end(); ++it ){
581 if(it.key()->getStatus() == true) 580 if(it.key()->getStatus() == true)
582 it.key()->restart(); 581 it.key()->restart();
583 } 582 }
584 } 583 }
585 } 584 }
586 // TODO change the profile in the modules 585 // TODO change the profile in the modules
587} 586}
588 587
589// mainwindowimp.cpp
590
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h
index 49f3eea..c045fe6 100644
--- a/noncore/settings/networksettings/mainwindowimp.h
+++ b/noncore/settings/networksettings/mainwindowimp.h
@@ -42,28 +42,26 @@ private slots:
42 42
43private: 43private:
44 void loadModules(const QString &path); 44 void loadModules(const QString &path);
45 45
46 Module* loadPlugin(const QString &pluginFileName, 46 Module* loadPlugin(const QString &pluginFileName,
47 const QString &resolveString = "create_plugin"); 47 const QString &resolveString = "create_plugin");
48 48
49 // For our local list of names 49 // For our local list of names
50 QMap<QString, Interface*> interfaceNames; 50 QMap<QString, Interface*> interfaceNames;
51 51
52 QMap<Module*, QLibrary*> libraries; 52 QMap<Module*, QLibrary*> libraries;
53 QMap<Interface*, QListViewItem*> items; 53 QMap<Interface*, QListViewItem*> items;
54 QMap<QListViewItem*, Interface*> interfaceItems; 54 QMap<QListViewItem*, Interface*> interfaceItems;
55 55
56 QMap<KProcess*, QString> threads; 56 QMap<KProcess*, QString> threads;
57 QStringList profiles; 57 QStringList profiles;
58 58
59 bool advancedUserMode; 59 bool advancedUserMode;
60 QString scheme; 60 QString scheme;
61#ifndef QWS 61#ifndef QWS
62 KLibLoader *loader; 62 KLibLoader *loader;
63#endif 63#endif
64}; 64};
65 65
66#endif 66#endif // MAINWINOWIMP_H
67
68// mainwindowimp.h
69 67