-rw-r--r-- | noncore/net/networksetup/interfacesetupimp.cpp | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/interfacesetupimp.h | 2 | ||||
-rw-r--r-- | noncore/net/networksetup/mainwindowimp.cpp | 13 | ||||
-rw-r--r-- | noncore/net/networksetup/networksetup.pro | 6 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlan.pro | 6 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 9 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 3 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfacesetupimp.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/interfacesetupimp.h | 2 | ||||
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 13 | ||||
-rw-r--r-- | noncore/settings/networksettings/networksetup.pro | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlan.pro | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.h | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 7 |
16 files changed, 38 insertions, 58 deletions
diff --git a/noncore/net/networksetup/interfacesetupimp.cpp b/noncore/net/networksetup/interfacesetupimp.cpp index 1327726..a8731a9 100644 --- a/noncore/net/networksetup/interfacesetupimp.cpp +++ b/noncore/net/networksetup/interfacesetupimp.cpp | |||
@@ -1,105 +1,105 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | #include "interfaces.h" | 3 | #include "interfaces.h" |
4 | 4 | ||
5 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qspinbox.h> | 8 | #include <qspinbox.h> |
9 | #include <qgroupbox.h> | 9 | #include <qgroupbox.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | 11 | ||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | 13 | ||
14 | #include <assert.h> | 14 | #include <assert.h> |
15 | 15 | ||
16 | #define DNSSCRIPT "interfacednsscript" | 16 | #define DNSSCRIPT "interfacednsscript" |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Constuctor. Set up the connection and load the first profile. | 19 | * Constuctor. Set up the connection and load the first profile. |
20 | */ | 20 | */ |
21 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ | 21 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ |
22 | assert(i); | 22 | assert(i); |
23 | interface = i; | 23 | interface = i; |
24 | interfaces = new Interfaces(); | 24 | interfaces = new Interfaces(); |
25 | bool error = false; | 25 | bool error = false; |
26 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 26 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
27 | staticGroupBox->hide(); | 27 | staticGroupBox->hide(); |
28 | dhcpCheckBox->hide(); | 28 | dhcpCheckBox->hide(); |
29 | leaseTime->hide(); | 29 | leaseTime->hide(); |
30 | leaseHoursLabel->hide(); | 30 | leaseHoursLabel->hide(); |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Save the current settings, then write out the interfaces file and close. | 35 | * Save the current settings, then write out the interfaces file and close. |
36 | */ | 36 | */ |
37 | void InterfaceSetupImp::accept(){ | 37 | void InterfaceSetupImp::accept(){ |
38 | if(!saveSettings()) | 38 | if(!saveSettings()) |
39 | return; | 39 | return; |
40 | interfaces->write(); | 40 | interfaces->write(); |
41 | close(true); | 41 | QDialog::accept(); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Save the settings for the current Interface. | 45 | * Save the settings for the current Interface. |
46 | * @return bool true if successfull, false otherwise | 46 | * @return bool true if successfull, false otherwise |
47 | */ | 47 | */ |
48 | bool InterfaceSetupImp::saveSettings(){ | 48 | bool InterfaceSetupImp::saveSettings(){ |
49 | // eh can't really do anything about it other then return. :-D | 49 | // eh can't really do anything about it other then return. :-D |
50 | if(!interfaces->isInterfaceSet()) | 50 | if(!interfaces->isInterfaceSet()) |
51 | return true; | 51 | return true; |
52 | 52 | ||
53 | bool error = false; | 53 | bool error = false; |
54 | // Loopback case | 54 | // Loopback case |
55 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 55 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
56 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 56 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
57 | return true; | 57 | return true; |
58 | } | 58 | } |
59 | 59 | ||
60 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ | 60 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ |
61 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); | 61 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); |
62 | return false; | 62 | return false; |
63 | } | 63 | } |
64 | interfaces->removeAllInterfaceOptions(); | 64 | interfaces->removeAllInterfaceOptions(); |
65 | 65 | ||
66 | // DHCP | 66 | // DHCP |
67 | if(dhcpCheckBox->isChecked()){ | 67 | if(dhcpCheckBox->isChecked()){ |
68 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 68 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
69 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 69 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
70 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 70 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
71 | } | 71 | } |
72 | else{ | 72 | else{ |
73 | interfaces->setInterfaceMethod("static"); | 73 | interfaces->setInterfaceMethod("static"); |
74 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 74 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
75 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 75 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
76 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 76 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
77 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 77 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
78 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); | 78 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); |
79 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); | 79 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); |
80 | } | 80 | } |
81 | 81 | ||
82 | // IP Information | 82 | // IP Information |
83 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 83 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
84 | return true; | 84 | return true; |
85 | } | 85 | } |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * The Profile has changed. | 88 | * The Profile has changed. |
89 | * @profile the new profile. | 89 | * @profile the new profile. |
90 | */ | 90 | */ |
91 | void InterfaceSetupImp::setProfile(const QString &profile){ | 91 | void InterfaceSetupImp::setProfile(const QString &profile){ |
92 | QString newInterfaceName = interface->getInterfaceName(); | 92 | QString newInterfaceName = interface->getInterfaceName(); |
93 | if(profile.length() > 0) | 93 | if(profile.length() > 0) |
94 | newInterfaceName += "_" + profile; | 94 | newInterfaceName += "_" + profile; |
95 | // See if we have to make a interface. | 95 | // See if we have to make a interface. |
96 | if(!interfaces->setInterface(newInterfaceName)){ | 96 | if(!interfaces->setInterface(newInterfaceName)){ |
97 | // Add making for this new interface if need too | 97 | // Add making for this new interface if need too |
98 | if(profile != ""){ | 98 | if(profile != ""){ |
99 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 99 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
100 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 100 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
101 | interfaces->addMapping(interface->getInterfaceName()); | 101 | interfaces->addMapping(interface->getInterfaceName()); |
102 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 102 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
103 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); | 103 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); |
104 | return; | 104 | return; |
105 | } | 105 | } |
diff --git a/noncore/net/networksetup/interfacesetupimp.h b/noncore/net/networksetup/interfacesetupimp.h index 7df0d46..a0bec32 100644 --- a/noncore/net/networksetup/interfacesetupimp.h +++ b/noncore/net/networksetup/interfacesetupimp.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef INTERFACESETUPIMP_H | 1 | #ifndef INTERFACESETUPIMP_H |
2 | #define INTERFACESETUPIMP_H | 2 | #define INTERFACESETUPIMP_H |
3 | 3 | ||
4 | #include "interfacesetup.h" | 4 | #include "interfacesetup.h" |
5 | 5 | ||
6 | class Interface; | 6 | class Interface; |
7 | class Interfaces; | 7 | class Interfaces; |
8 | 8 | ||
9 | class InterfaceSetupImp : public InterfaceSetup { | 9 | class InterfaceSetupImp : public InterfaceSetup { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0); | 13 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0); |
14 | 14 | ||
15 | protected slots: | 15 | protected slots: |
16 | void accept(); | 16 | void accept(); |
17 | 17 | ||
18 | public slots: | 18 | public slots: |
19 | void setProfile(const QString &profile); | 19 | void setProfile(const QString &profile); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | bool saveSettings(); | 22 | bool saveSettings(); |
23 | Interfaces *interfaces; | 23 | Interfaces *interfaces; |
24 | Interface *interface; | 24 | Interface *interface; |
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | // interfacesetupimp.h | 30 | // interfacesetupimp.h |
31 | 31 | ||
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index c86acdc..4a088cb 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -17,148 +17,148 @@ | |||
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | 18 | ||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | 21 | ||
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qlibrary.h> | 23 | #include <qpe/qlibrary.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | 26 | ||
27 | #include <qlist.h> | 27 | #include <qlist.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | 31 | ||
32 | #define TEMP_ALL "/tmp/ifconfig-a" | 32 | #define TEMP_ALL "/tmp/ifconfig-a" |
33 | #define TEMP_UP "/tmp/ifconfig" | 33 | #define TEMP_UP "/tmp/ifconfig" |
34 | 34 | ||
35 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 35 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
36 | 36 | ||
37 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ | 37 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ |
38 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 38 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
39 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 39 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
40 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 40 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
41 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 41 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
42 | 42 | ||
43 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 43 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
44 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 44 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
45 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); | 45 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); |
46 | 46 | ||
47 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); | 47 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); |
48 | // Load connections. | 48 | // Load connections. |
49 | loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); | 49 | loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); |
50 | getInterfaceList(); | 50 | getInterfaceList(); |
51 | connectionList->header()->hide(); | 51 | connectionList->header()->hide(); |
52 | 52 | ||
53 | 53 | ||
54 | Config cfg("NetworkSetup"); | 54 | Config cfg("NetworkSetup"); |
55 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 55 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
56 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 56 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
57 | profilesList->insertItem((*it)); | 57 | profilesList->insertItem((*it)); |
58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
61 | 61 | ||
62 | QFile file(scheme); | 62 | QFile file(scheme); |
63 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | 63 | if ( file.open(IO_ReadOnly) ) { // file opened successfully |
64 | QTextStream stream( &file ); // use a text stream | 64 | QTextStream stream( &file ); // use a text stream |
65 | while ( !stream.eof() ) { // until end of file... | 65 | while ( !stream.eof() ) { // until end of file... |
66 | QString line = stream.readLine(); // line of text excluding '\n' | 66 | QString line = stream.readLine(); // line of text excluding '\n' |
67 | if(line.contains("SCHEME")){ | 67 | if(line.contains("SCHEME")){ |
68 | line = line.mid(7, line.length()); | 68 | line = line.mid(7, line.length()); |
69 | currentProfileLabel->setText(line); | 69 | currentProfileLabel->setText(line); |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | file.close(); | 73 | file.close(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Deconstructor. Save profiles. Delete loaded libraries. | 78 | * Deconstructor. Save profiles. Delete loaded libraries. |
79 | */ | 79 | */ |
80 | MainWindowImp::~MainWindowImp(){ | 80 | MainWindowImp::~MainWindowImp(){ |
81 | qDebug("start Saving mainwindow"); | 81 | qDebug("Deleting main window"); |
82 | // Save profiles. | 82 | // Save profiles. |
83 | Config cfg("NetworkSetup"); | 83 | Config cfg("NetworkSetup"); |
84 | cfg.setGroup("General"); | 84 | cfg.setGroup("General"); |
85 | cfg.writeEntry("Profiles", profiles.join(" ")); | 85 | cfg.writeEntry("Profiles", profiles.join(" ")); |
86 | 86 | ||
87 | // Delete all interfaces that don't have owners. | 87 | // Delete all interfaces that don't have owners. |
88 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 88 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
89 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 89 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ |
90 | if(iIt.key()->getModuleOwner() == NULL) | 90 | if(iIt.key()->getModuleOwner() == NULL) |
91 | delete iIt.key(); | 91 | delete iIt.key(); |
92 | } | 92 | } |
93 | 93 | ||
94 | // Delete Modules and Libraries | 94 | // Delete Modules and Libraries |
95 | QMap<Module*, QLibrary*>::Iterator it; | 95 | QMap<Module*, QLibrary*>::Iterator it; |
96 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 96 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
97 | delete it.key(); | 97 | delete it.key(); |
98 | delete it.data(); | 98 | //delete it.data(); |
99 | } | 99 | } |
100 | qDebug("done Saving mainwindow"); | 100 | qDebug("Done deleting main window"); |
101 | } | 101 | } |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Load all modules that are found in the path | 104 | * Load all modules that are found in the path |
105 | * @param path a directory that is scaned for any plugins that can be loaded | 105 | * @param path a directory that is scaned for any plugins that can be loaded |
106 | * and attempts to load them | 106 | * and attempts to load them |
107 | */ | 107 | */ |
108 | void MainWindowImp::loadModules(QString path){ | 108 | void MainWindowImp::loadModules(QString path){ |
109 | //qDebug(path.latin1()); | 109 | //qDebug(path.latin1()); |
110 | QDir d(path); | 110 | QDir d(path); |
111 | if(!d.exists()) | 111 | if(!d.exists()) |
112 | return; | 112 | return; |
113 | 113 | ||
114 | // Don't want sym links | 114 | // Don't want sym links |
115 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 115 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
116 | const QFileInfoList *list = d.entryInfoList(); | 116 | const QFileInfoList *list = d.entryInfoList(); |
117 | QFileInfoListIterator it( *list ); | 117 | QFileInfoListIterator it( *list ); |
118 | QFileInfo *fi; | 118 | QFileInfo *fi; |
119 | while ( (fi=it.current()) ) { | 119 | while ( (fi=it.current()) ) { |
120 | if(fi->fileName().contains(".so")){ | 120 | if(fi->fileName().contains(".so")){ |
121 | loadPlugin(path + "/" + fi->fileName()); | 121 | loadPlugin(path + "/" + fi->fileName()); |
122 | } | 122 | } |
123 | ++it; | 123 | ++it; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Attempt to load a function and resolve a function. | 128 | * Attempt to load a function and resolve a function. |
129 | * @param pluginFileName - the name of the file in which to attempt to load | 129 | * @param pluginFileName - the name of the file in which to attempt to load |
130 | * @param resolveString - function pointer to resolve | 130 | * @param resolveString - function pointer to resolve |
131 | * @return pointer to the function with name resolveString or NULL | 131 | * @return pointer to the function with name resolveString or NULL |
132 | */ | 132 | */ |
133 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 133 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ |
134 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); | 134 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); |
135 | QLibrary *lib = new QLibrary(pluginFileName); | 135 | QLibrary *lib = new QLibrary(pluginFileName); |
136 | void *functionPointer = lib->resolve(resolveString); | 136 | void *functionPointer = lib->resolve(resolveString); |
137 | if( !functionPointer ){ | 137 | if( !functionPointer ){ |
138 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 138 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
139 | delete lib; | 139 | delete lib; |
140 | return NULL; | 140 | return NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | // Try to get an object. | 143 | // Try to get an object. |
144 | Module *object = ((Module* (*)()) functionPointer)(); | 144 | Module *object = ((Module* (*)()) functionPointer)(); |
145 | if(object == NULL){ | 145 | if(object == NULL){ |
146 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 146 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
147 | delete lib; | 147 | delete lib; |
148 | return NULL; | 148 | return NULL; |
149 | } | 149 | } |
150 | 150 | ||
151 | // Store for deletion later | 151 | // Store for deletion later |
152 | libraries.insert(object, lib); | 152 | libraries.insert(object, lib); |
153 | return object; | 153 | return object; |
154 | } | 154 | } |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 157 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
158 | * load the plugin and append it to the list | 158 | * load the plugin and append it to the list |
159 | */ | 159 | */ |
160 | void MainWindowImp::addClicked(){ | 160 | void MainWindowImp::addClicked(){ |
161 | QMap<Module*, QLibrary*>::Iterator it; | 161 | QMap<Module*, QLibrary*>::Iterator it; |
162 | QMap<QString, QString> list; | 162 | QMap<QString, QString> list; |
163 | QMap<QString, Module*> newInterfaceOwners; | 163 | QMap<QString, Module*> newInterfaceOwners; |
164 | list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); | 164 | list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); |
@@ -183,140 +183,139 @@ void MainWindowImp::addClicked(){ | |||
183 | 183 | ||
184 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 184 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
185 | if(it.key()){ | 185 | if(it.key()){ |
186 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 186 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
187 | if(i){ | 187 | if(i){ |
188 | interfaceNames.insert(i->getInterfaceName(), i); | 188 | interfaceNames.insert(i->getInterfaceName(), i); |
189 | updateInterface(i); | 189 | updateInterface(i); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Prompt the user to see if they really want to do this. | 197 | * Prompt the user to see if they really want to do this. |
198 | * If they do then remove from the list and unload. | 198 | * If they do then remove from the list and unload. |
199 | */ | 199 | */ |
200 | void MainWindowImp::removeClicked(){ | 200 | void MainWindowImp::removeClicked(){ |
201 | QListViewItem *item = connectionList->currentItem(); | 201 | QListViewItem *item = connectionList->currentItem(); |
202 | if(!item) { | 202 | if(!item) { |
203 | QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok"); | 203 | QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok"); |
204 | return; | 204 | return; |
205 | } | 205 | } |
206 | 206 | ||
207 | Interface *i = interfaceItems[item]; | 207 | Interface *i = interfaceItems[item]; |
208 | if(i->getModuleOwner() == NULL){ | 208 | if(i->getModuleOwner() == NULL){ |
209 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 209 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
210 | } | 210 | } |
211 | else{ | 211 | else{ |
212 | if(!i->getModuleOwner()->remove(i)) | 212 | if(!i->getModuleOwner()->remove(i)) |
213 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); | 213 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); |
214 | else{ | 214 | else{ |
215 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); | 215 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); |
216 | // TODO memory managment.... | 216 | // TODO memory managment.... |
217 | // who deletes the interface? | 217 | // who deletes the interface? |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | /** | 222 | /** |
223 | * Pull up the configure about the currently selected interface. | 223 | * Pull up the configure about the currently selected interface. |
224 | * Report an error if no interface is selected. | 224 | * Report an error if no interface is selected. |
225 | * If the interface has a module owner then request its configure with a empty | 225 | * If the interface has a module owner then request its configure with a empty |
226 | * tab. If tab is !NULL then append the interfaces setup widget to it. | 226 | * tab. If tab is !NULL then append the interfaces setup widget to it. |
227 | */ | 227 | */ |
228 | void MainWindowImp::configureClicked(){ | 228 | void MainWindowImp::configureClicked(){ |
229 | QListViewItem *item = connectionList->currentItem(); | 229 | QListViewItem *item = connectionList->currentItem(); |
230 | if(!item){ | 230 | if(!item){ |
231 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 231 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | 234 | ||
235 | QString currentProfile = currentProfileLabel->text(); | 235 | QString currentProfile = currentProfileLabel->text(); |
236 | if(profilesList->count() <= 1 || currentProfile == "All"){ | 236 | if(profilesList->count() <= 1 || currentProfile == "All"){ |
237 | currentProfile = ""; | 237 | currentProfile = ""; |
238 | } | 238 | } |
239 | 239 | ||
240 | Interface *i = interfaceItems[item]; | 240 | Interface *i = interfaceItems[item]; |
241 | if(i->getModuleOwner()){ | 241 | if(i->getModuleOwner()){ |
242 | i->getModuleOwner()->setProfile(currentProfile); | 242 | i->getModuleOwner()->setProfile(currentProfile); |
243 | QTabWidget *tabWidget = NULL; | 243 | QTabWidget *tabWidget = NULL; |
244 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget); | 244 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget); |
245 | if(moduleConfigure != NULL){ | 245 | if(moduleConfigure != NULL){ |
246 | if(tabWidget != NULL){ | 246 | if(tabWidget != NULL){ |
247 | InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true); | 247 | InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, false, Qt::WDestructiveClose); |
248 | configure->setProfile(currentProfile); | 248 | configure->setProfile(currentProfile); |
249 | tabWidget->insertTab(configure, "TCP/IP"); | 249 | tabWidget->insertTab(configure, "TCP/IP"); |
250 | |||
251 | } | 250 | } |
252 | moduleConfigure->showMaximized(); | 251 | moduleConfigure->showMaximized(); |
253 | moduleConfigure->show(); | 252 | moduleConfigure->show(); |
254 | return; | 253 | return; |
255 | } | 254 | } |
256 | } | 255 | } |
257 | 256 | ||
258 | InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true); | 257 | InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, false, Qt::WDestructiveClose); |
259 | configure->setProfile(currentProfile); | 258 | configure->setProfile(currentProfile); |
260 | configure->showMaximized(); | 259 | configure->showMaximized(); |
261 | configure->show(); | 260 | configure->show(); |
262 | } | 261 | } |
263 | 262 | ||
264 | /** | 263 | /** |
265 | * Pull up the information about the currently selected interface. | 264 | * Pull up the information about the currently selected interface. |
266 | * Report an error if no interface is selected. | 265 | * Report an error if no interface is selected. |
267 | * If the interface has a module owner then request its configure with a empty | 266 | * If the interface has a module owner then request its configure with a empty |
268 | * tab. If tab is !NULL then append the interfaces setup widget to it. | 267 | * tab. If tab is !NULL then append the interfaces setup widget to it. |
269 | */ | 268 | */ |
270 | void MainWindowImp::informationClicked(){ | 269 | void MainWindowImp::informationClicked(){ |
271 | QListViewItem *item = connectionList->currentItem(); | 270 | QListViewItem *item = connectionList->currentItem(); |
272 | if(!item){ | 271 | if(!item){ |
273 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 272 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
274 | return; | 273 | return; |
275 | } | 274 | } |
276 | 275 | ||
277 | Interface *i = interfaceItems[item]; | 276 | Interface *i = interfaceItems[item]; |
278 | if(!i->isAttached()){ | 277 | if(!i->isAttached()){ |
279 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 278 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
280 | return; | 279 | return; |
281 | } | 280 | } |
282 | 281 | ||
283 | QStringList list; | 282 | QStringList list; |
284 | for(uint i = 0; i < profilesList->count(); i++){ | 283 | for(uint i = 0; i < profilesList->count(); i++){ |
285 | list.append(profilesList->text(i)); | 284 | list.append(profilesList->text(i)); |
286 | } | 285 | } |
287 | 286 | ||
288 | if(i->getModuleOwner()){ | 287 | if(i->getModuleOwner()){ |
289 | QTabWidget *tabWidget = NULL; | 288 | QTabWidget *tabWidget = NULL; |
290 | QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget); | 289 | QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget); |
291 | if(moduleInformation != NULL){ | 290 | if(moduleInformation != NULL){ |
292 | if(tabWidget != NULL){ | 291 | if(tabWidget != NULL){ |
293 | InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true); | 292 | InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true); |
294 | tabWidget->insertTab(information, "TCP/IP"); | 293 | tabWidget->insertTab(information, "TCP/IP"); |
295 | } | 294 | } |
296 | moduleInformation->showMaximized(); | 295 | moduleInformation->showMaximized(); |
297 | moduleInformation->show(); | 296 | moduleInformation->show(); |
298 | return; | 297 | return; |
299 | } | 298 | } |
300 | } | 299 | } |
301 | 300 | ||
302 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); | 301 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); |
303 | information->showMaximized(); | 302 | information->showMaximized(); |
304 | information->show(); | 303 | information->show(); |
305 | } | 304 | } |
306 | 305 | ||
307 | /** | 306 | /** |
308 | * Aquire the list of active interfaces from ifconfig | 307 | * Aquire the list of active interfaces from ifconfig |
309 | * Call ifconfig and ifconfig -a | 308 | * Call ifconfig and ifconfig -a |
310 | */ | 309 | */ |
311 | void MainWindowImp::getInterfaceList(){ | 310 | void MainWindowImp::getInterfaceList(){ |
312 | KShellProcess *processAll = new KShellProcess(); | 311 | KShellProcess *processAll = new KShellProcess(); |
313 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 312 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
314 | connect(processAll, SIGNAL(processExited(KProcess *)), | 313 | connect(processAll, SIGNAL(processExited(KProcess *)), |
315 | this, SLOT(jobDone(KProcess *))); | 314 | this, SLOT(jobDone(KProcess *))); |
316 | threads.insert(processAll, TEMP_ALL); | 315 | threads.insert(processAll, TEMP_ALL); |
317 | 316 | ||
318 | KShellProcess *process = new KShellProcess(); | 317 | KShellProcess *process = new KShellProcess(); |
319 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 318 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
320 | connect(process, SIGNAL(processExited(KProcess *)), | 319 | connect(process, SIGNAL(processExited(KProcess *)), |
321 | this, SLOT(jobDone(KProcess *))); | 320 | this, SLOT(jobDone(KProcess *))); |
322 | threads.insert(process, TEMP_UP); | 321 | threads.insert(process, TEMP_UP); |
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index f09db93..7299cc6 100644 --- a/noncore/net/networksetup/networksetup.pro +++ b/noncore/net/networksetup/networksetup.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | #DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | CONFIG = qt warn_on release | 4 | #CONFIG = qt warn_on release |
5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include | 7 | INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |
diff --git a/noncore/net/networksetup/wlan/wlan.pro b/noncore/net/networksetup/wlan/wlan.pro index 432a096..814a0b4 100644 --- a/noncore/net/networksetup/wlan/wlan.pro +++ b/noncore/net/networksetup/wlan/wlan.pro | |||
@@ -1,12 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | #CONFIG += qt warn_on release |
3 | #CONFIG += qt warn_on debug | 3 | CONFIG += qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/plugins/networksetup | 4 | #DESTDIR = $(OPIEDIR)/plugins/networksetup |
5 | HEADERS = wlanimp.h wlanmodule.h wextensions.h | 5 | HEADERS = wlanimp.h wlanmodule.h wextensions.h |
6 | SOURCES = wlanimp.cpp wlanmodule.cpp wextensions.cpp | 6 | SOURCES = wlanimp.cpp wlanmodule.cpp wextensions.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include ../ | 7 | INCLUDEPATH+= $(OPIEDIR)/include ../ |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= wlan.ui info.ui | 10 | INTERFACES= wlan.ui info.ui |
11 | TARGET = wlanplugin | 11 | TARGET = wlanplugin |
12 | VERSION = 1.0.0 | 12 | VERSION = 1.0.0 |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 94c7518..45952b9 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -1,184 +1,179 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | 2 | ||
3 | /* Config class */ | 3 | /* Config class */ |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | /* Global namespace */ | 5 | /* Global namespace */ |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | /* system() */ | 7 | /* system() */ |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 14 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 15 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | 17 | #include <qregexp.h> |
18 | 18 | ||
19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name, Qt::WDestructiveClose){ | 19 | WLANImp::WLANImp( QWidget* parent, const char* name, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ |
20 | config = new Config("wireless"); | 20 | config = new Config("wireless"); |
21 | readConfig(); | 21 | readConfig(); |
22 | } | 22 | } |
23 | 23 | ||
24 | WLANImp::~WLANImp( ){ | 24 | WLANImp::~WLANImp( ){ |
25 | delete config; | 25 | delete config; |
26 | } | 26 | } |
27 | 27 | ||
28 | void WLANImp::readConfig() | 28 | void WLANImp::readConfig() |
29 | { | 29 | { |
30 | qWarning( "WLANImp::readConfig() called." ); | 30 | qWarning( "WLANImp::readConfig() called." ); |
31 | config->setGroup( "Properties" ); | 31 | config->setGroup( "Properties" ); |
32 | QString ssid = config->readEntry( "SSID", "any" ); | 32 | QString ssid = config->readEntry( "SSID", "any" ); |
33 | if( ssid == "any" || ssid == "ANY" ){ | 33 | if( ssid == "any" || ssid == "ANY" ){ |
34 | essNon->setChecked( true ); | 34 | essNon->setChecked( true ); |
35 | } else { | 35 | } else { |
36 | essSpecific->setChecked( true ); | 36 | essSpecific->setChecked( true ); |
37 | essSpecificLineEdit->setText( ssid ); | 37 | essSpecificLineEdit->setText( ssid ); |
38 | } | 38 | } |
39 | QString mode = config->readEntry( "Mode", "Managed" ); | 39 | QString mode = config->readEntry( "Mode", "Managed" ); |
40 | if( mode == "adhoc" ) { | 40 | if( mode == "adhoc" ) { |
41 | network802->setChecked( true ); | 41 | network802->setChecked( true ); |
42 | } else { | 42 | } else { |
43 | networkInfrastructure->setChecked( true ); | 43 | networkInfrastructure->setChecked( true ); |
44 | } | 44 | } |
45 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 45 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
46 | // config->readEntry( "RATE", "auto" ); | 46 | // config->readEntry( "RATE", "auto" ); |
47 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 47 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
48 | config->readEntry( "AuthType", "opensystem" ); | 48 | config->readEntry( "AuthType", "opensystem" ); |
49 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 49 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
50 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 50 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
51 | switch( defaultkey ){ | 51 | switch( defaultkey ){ |
52 | case 0: | 52 | case 0: |
53 | keyRadio0->setChecked( true ); | 53 | keyRadio0->setChecked( true ); |
54 | break; | 54 | break; |
55 | case 1: | 55 | case 1: |
56 | keyRadio1->setChecked( true ); | 56 | keyRadio1->setChecked( true ); |
57 | break; | 57 | break; |
58 | case 2: | 58 | case 2: |
59 | keyRadio2->setChecked( true ); | 59 | keyRadio2->setChecked( true ); |
60 | break; | 60 | break; |
61 | case 3: | 61 | case 3: |
62 | keyRadio3->setChecked( true ); | 62 | keyRadio3->setChecked( true ); |
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); | 65 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); |
66 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); | 66 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); |
67 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); | 67 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); |
68 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); | 68 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | 71 | ||
72 | bool WLANImp::writeConfig() | 72 | bool WLANImp::writeConfig() |
73 | { | 73 | { |
74 | qWarning( "WLANImp::writeConfig() called." ); | 74 | qWarning( "WLANImp::writeConfig() called." ); |
75 | config->setGroup( "Properties" ); | 75 | config->setGroup( "Properties" ); |
76 | if( essNon->isChecked() ) { | 76 | if( essNon->isChecked() ) { |
77 | config->writeEntry( "SSID", "any" ); | 77 | config->writeEntry( "SSID", "any" ); |
78 | } else { | 78 | } else { |
79 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); | 79 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); |
80 | } | 80 | } |
81 | if( networkInfrastructure->isChecked() ){ | 81 | if( networkInfrastructure->isChecked() ){ |
82 | config->writeEntry( "Mode", "Managed" ); | 82 | config->writeEntry( "Mode", "Managed" ); |
83 | } else if( network802->isChecked() ){ | 83 | } else if( network802->isChecked() ){ |
84 | config->writeEntry( "Mode", "adhoc" ); | 84 | config->writeEntry( "Mode", "adhoc" ); |
85 | } | 85 | } |
86 | config->writeEntry( "CHANNEL", networkChannel->value() ); | 86 | config->writeEntry( "CHANNEL", networkChannel->value() ); |
87 | // config->readEntry( "RATE", "auto" ); | 87 | // config->readEntry( "RATE", "auto" ); |
88 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); | 88 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); |
89 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); | 89 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); |
90 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); | 90 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); |
91 | if( keyRadio0->isChecked() ){ | 91 | if( keyRadio0->isChecked() ){ |
92 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); | 92 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); |
93 | } else if( keyRadio1->isChecked() ){ | 93 | } else if( keyRadio1->isChecked() ){ |
94 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); | 94 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); |
95 | } else if( keyRadio2->isChecked() ){ | 95 | } else if( keyRadio2->isChecked() ){ |
96 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); | 96 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); |
97 | } else if( keyRadio3->isChecked() ){ | 97 | } else if( keyRadio3->isChecked() ){ |
98 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); | 98 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); |
99 | } | 99 | } |
100 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 100 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
101 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 101 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
102 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 102 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
103 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 103 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
104 | return true; | ||
104 | return writeWirelessOpts( ); | 105 | return writeWirelessOpts( ); |
105 | } | 106 | } |
106 | 107 | ||
107 | /** | 108 | /** |
108 | */ | 109 | */ |
109 | void WLANImp::accept() | 110 | void WLANImp::accept() |
110 | { | 111 | { |
111 | if ( writeConfig() ) | 112 | if ( writeConfig() ) |
112 | QDialog::accept(); | 113 | QDialog::accept(); |
113 | } | 114 | } |
114 | 115 | ||
115 | void WLANImp::done ( int r ) | ||
116 | { | ||
117 | QDialog::done ( r ); | ||
118 | close ( ); | ||
119 | } | ||
120 | |||
121 | bool WLANImp::writeWirelessOpts( QString scheme ) | 116 | bool WLANImp::writeWirelessOpts( QString scheme ) |
122 | { | 117 | { |
123 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 118 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
124 | QString prev = "/etc/pcmcia/wireless.opts"; | 119 | QString prev = "/etc/pcmcia/wireless.opts"; |
125 | QFile prevFile(prev); | 120 | QFile prevFile(prev); |
126 | if ( !prevFile.open( IO_ReadOnly ) ) | 121 | if ( !prevFile.open( IO_ReadOnly ) ) |
127 | return false; | 122 | return false; |
128 | 123 | ||
129 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 124 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |
130 | QFile tmpFile(tmp); | 125 | QFile tmpFile(tmp); |
131 | if ( !tmpFile.open( IO_WriteOnly ) ) | 126 | if ( !tmpFile.open( IO_WriteOnly ) ) |
132 | return false; | 127 | return false; |
133 | 128 | ||
134 | bool retval = true; | 129 | bool retval = true; |
135 | 130 | ||
136 | QTextStream in( &prevFile ); | 131 | QTextStream in( &prevFile ); |
137 | QTextStream out( &tmpFile ); | 132 | QTextStream out( &tmpFile ); |
138 | 133 | ||
139 | config->setGroup("Properties"); | 134 | config->setGroup("Properties"); |
140 | 135 | ||
141 | QString line; | 136 | QString line; |
142 | bool found=false; | 137 | bool found=false; |
143 | bool done=false; | 138 | bool done=false; |
144 | while ( !in.atEnd() ) { | 139 | while ( !in.atEnd() ) { |
145 | QString line = in.readLine(); | 140 | QString line = in.readLine(); |
146 | QString wline = line.simplifyWhiteSpace(); | 141 | QString wline = line.simplifyWhiteSpace(); |
147 | if ( !done ) { | 142 | if ( !done ) { |
148 | if ( found ) { | 143 | if ( found ) { |
149 | // skip existing entry for this scheme, and write our own. | 144 | // skip existing entry for this scheme, and write our own. |
150 | if ( wline == ";;" ) { | 145 | if ( wline == ";;" ) { |
151 | found = false; | 146 | found = false; |
152 | continue; | 147 | continue; |
153 | } else { | 148 | } else { |
154 | continue; | 149 | continue; |
155 | } | 150 | } |
156 | } else { | 151 | } else { |
157 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | 152 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { |
158 | found=true; | 153 | found=true; |
159 | continue; // skip this line | 154 | continue; // skip this line |
160 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | 155 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { |
161 | // end - add new entry | 156 | // end - add new entry |
162 | // Not all fields have a GUI, but all are supported | 157 | // Not all fields have a GUI, but all are supported |
163 | // in the letwork configuration files. | 158 | // in the letwork configuration files. |
164 | static const char* txtfields[] = { | 159 | static const char* txtfields[] = { |
165 | 0 | 160 | 0 |
166 | }; | 161 | }; |
167 | QString readmode = config->readEntry( "Mode", "Managed" ); | 162 | QString readmode = config->readEntry( "Mode", "Managed" ); |
168 | QString mode; | 163 | QString mode; |
169 | if( readmode == "Managed" ){ | 164 | if( readmode == "Managed" ){ |
170 | mode = readmode; | 165 | mode = readmode; |
171 | } else if( readmode == "adhoc" ){ | 166 | } else if( readmode == "adhoc" ){ |
172 | mode = "Ad-Hoc"; | 167 | mode = "Ad-Hoc"; |
173 | } | 168 | } |
174 | QString key; | 169 | QString key; |
175 | if( wepEnabled->isChecked() ){ | 170 | if( wepEnabled->isChecked() ){ |
176 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 171 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
177 | switch( defaultkey ){ | 172 | switch( defaultkey ){ |
178 | case 0: | 173 | case 0: |
179 | key += keyLineEdit0->text(); | 174 | key += keyLineEdit0->text(); |
180 | break; | 175 | break; |
181 | case 1: | 176 | case 1: |
182 | key += keyLineEdit1->text(); | 177 | key += keyLineEdit1->text(); |
183 | break; | 178 | break; |
184 | case 2: | 179 | case 2: |
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index 22ce143..59b7c59 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -1,28 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | 5 | ||
6 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | 7 | ||
8 | class WLANImp : public WLAN { | 8 | class WLANImp : public WLAN { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANImp( QWidget* parent = 0, const char* name = 0); | 12 | WLANImp( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
13 | ~WLANImp( ); | 13 | ~WLANImp( ); |
14 | 14 | ||
15 | protected: | 15 | protected: |
16 | void accept(); | 16 | void accept(); |
17 | void done ( int r ); | ||
18 | 17 | ||
19 | private: | 18 | private: |
20 | void readConfig(); | 19 | void readConfig(); |
21 | bool writeConfig(); | 20 | bool writeConfig(); |
22 | bool writeWirelessOpts( QString scheme = "*" ); | 21 | bool writeWirelessOpts( QString scheme = "*" ); |
23 | bool writeWlanngOpts( QString scheme = "*" ); | 22 | bool writeWlanngOpts( QString scheme = "*" ); |
24 | Config* config; | 23 | Config* config; |
25 | }; | 24 | }; |
26 | 25 | ||
27 | #endif | 26 | #endif |
28 | 27 | ||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index 7507c54..3363b8a 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -1,129 +1,126 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
3 | #include "info.h" | 3 | #include "info.h" |
4 | #include "wextensions.h" | 4 | #include "wextensions.h" |
5 | 5 | ||
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qprogressbar.h> | 7 | #include <qprogressbar.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | */ | 16 | */ |
17 | WLANModule::~WLANModule(){ | 17 | WLANModule::~WLANModule(){ |
18 | qDebug("Deleting module"); | ||
18 | Interface *i; | 19 | Interface *i; |
19 | for ( i=list.first(); i != 0; i=list.next() ) | 20 | for ( i=list.first(); i != 0; i=list.next() ) |
20 | delete i; | 21 | delete i; |
21 | } | 22 | } |
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Change the current profile | 25 | * Change the current profile |
25 | */ | 26 | */ |
26 | void WLANModule::setProfile(QString newProfile){ | 27 | void WLANModule::setProfile(QString newProfile){ |
27 | profile = newProfile; | 28 | profile = newProfile; |
28 | } | 29 | } |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * get the icon name for this device. | 32 | * get the icon name for this device. |
32 | * @param Interface* can be used in determining the icon. | 33 | * @param Interface* can be used in determining the icon. |
33 | * @return QString the icon name (minus .png, .gif etc) | 34 | * @return QString the icon name (minus .png, .gif etc) |
34 | */ | 35 | */ |
35 | QString WLANModule::getPixmapName(Interface* ){ | 36 | QString WLANModule::getPixmapName(Interface* ){ |
36 | return "wlan"; | 37 | return "wlan"; |
37 | } | 38 | } |
38 | 39 | ||
39 | /** | 40 | /** |
40 | * Check to see if the interface i is owned by this module. | 41 | * Check to see if the interface i is owned by this module. |
41 | * @param Interface* interface to check against | 42 | * @param Interface* interface to check against |
42 | * @return bool true if i is owned by this module, false otherwise. | 43 | * @return bool true if i is owned by this module, false otherwise. |
43 | */ | 44 | */ |
44 | bool WLANModule::isOwner(Interface *i){ | 45 | bool WLANModule::isOwner(Interface *i){ |
45 | WExtensions we(i->getInterfaceName()); | 46 | WExtensions we(i->getInterfaceName()); |
46 | if(!we.doesHaveWirelessExtensions()) | 47 | if(!we.doesHaveWirelessExtensions()) |
47 | return false; | 48 | return false; |
48 | 49 | ||
49 | i->setHardwareName("802.11b"); | 50 | i->setHardwareName("802.11b"); |
50 | list.append(i); | 51 | list.append(i); |
51 | return true; | 52 | return true; |
52 | } | 53 | } |
53 | 54 | ||
54 | /** | 55 | /** |
55 | * Create, set tabWiget and return the WLANConfigure Module | 56 | * Create, set tabWiget and return the WLANConfigure Module |
56 | * @param tabWidget a pointer to the tab widget that this configure has. | 57 | * @param tabWidget a pointer to the tab widget that this configure has. |
57 | * @return QWidget* pointer to the tab widget in this modules configure. | 58 | * @return QWidget* pointer to the tab widget in this modules configure. |
58 | */ | 59 | */ |
59 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ | 60 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ |
60 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); | 61 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose); |
61 | (*tabWidget) = wlanconfig->tabWidget; | 62 | (*tabWidget) = wlanconfig->tabWidget; |
62 | return wlanconfig; | 63 | return wlanconfig; |
63 | } | 64 | } |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Create, set tabWiget and return the Information Module | 67 | * Create, set tabWiget and return the Information Module |
67 | * @param tabWidget a pointer to the tab widget that this information has. | 68 | * @param tabWidget a pointer to the tab widget that this information has. |
68 | * @return QWidget* pointer to the tab widget in this modules info. | 69 | * @return QWidget* pointer to the tab widget in this modules info. |
69 | */ | 70 | */ |
70 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 71 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
71 | WExtensions we(i->getInterfaceName()); | 72 | WExtensions we(i->getInterfaceName()); |
72 | if(!we.doesHaveWirelessExtensions()) | 73 | if(!we.doesHaveWirelessExtensions()) |
73 | return NULL; | 74 | return NULL; |
74 | 75 | ||
75 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); | 76 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); |
76 | (*tabWidget) = info->tabWidget; | 77 | (*tabWidget) = info->tabWidget; |
77 | 78 | ||
78 | info->essidLabel->setText(we.essid()); | 79 | info->essidLabel->setText(we.essid()); |
79 | info->apLabel->setText(we.ap()); | 80 | info->apLabel->setText(we.ap()); |
80 | info->stationLabel->setText(we.station()); | 81 | info->stationLabel->setText(we.station()); |
81 | info->modeLabel->setText(we.mode()); | 82 | info->modeLabel->setText(we.mode()); |
82 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); | 83 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); |
83 | int signal = 0; | 84 | int signal = 0; |
84 | int noise = 0; | 85 | int noise = 0; |
85 | int quality = 0; | 86 | int quality = 0; |
86 | we.stats(signal, noise, quality); | 87 | we.stats(signal, noise, quality); |
87 | info->signalProgressBar->setProgress(signal); | 88 | info->signalProgressBar->setProgress(signal); |
88 | info->noiseProgressBar->setProgress(noise); | 89 | info->noiseProgressBar->setProgress(noise); |
89 | info->qualityProgressBar->setProgress(quality); | 90 | info->qualityProgressBar->setProgress(quality); |
90 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); | 91 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); |
91 | //WlanInfo info (0, "wireless info", true); | ||
92 | //info.show(); | ||
93 | //return NULL; | ||
94 | |||
95 | return info; | 92 | return info; |
96 | } | 93 | } |
97 | 94 | ||
98 | /** | 95 | /** |
99 | * Get all active (up or down) interfaces | 96 | * Get all active (up or down) interfaces |
100 | * @return QList<Interface> A list of interfaces that exsist that havn't | 97 | * @return QList<Interface> A list of interfaces that exsist that havn't |
101 | * been called by isOwner() | 98 | * been called by isOwner() |
102 | */ | 99 | */ |
103 | QList<Interface> WLANModule::getInterfaces(){ | 100 | QList<Interface> WLANModule::getInterfaces(){ |
104 | return list; | 101 | return list; |
105 | } | 102 | } |
106 | 103 | ||
107 | /** | 104 | /** |
108 | * Attempt to add a new interface as defined by name | 105 | * Attempt to add a new interface as defined by name |
109 | * @param name the name of the type of interface that should be created given | 106 | * @param name the name of the type of interface that should be created given |
110 | * by possibleNewInterfaces(); | 107 | * by possibleNewInterfaces(); |
111 | * @return Interface* NULL if it was unable to be created. | 108 | * @return Interface* NULL if it was unable to be created. |
112 | */ | 109 | */ |
113 | Interface *WLANModule::addNewInterface(QString ){ | 110 | Interface *WLANModule::addNewInterface(QString ){ |
114 | // We can't add a 802.11 interface, either the hardware will be there | 111 | // We can't add a 802.11 interface, either the hardware will be there |
115 | // or it wont. | 112 | // or it wont. |
116 | return NULL; | 113 | return NULL; |
117 | } | 114 | } |
118 | 115 | ||
119 | /** | 116 | /** |
120 | * Attempts to remove the interface, doesn't delete i | 117 | * Attempts to remove the interface, doesn't delete i |
121 | * @return bool true if successfull, false otherwise. | 118 | * @return bool true if successfull, false otherwise. |
122 | */ | 119 | */ |
123 | bool WLANModule::remove(Interface*){ | 120 | bool WLANModule::remove(Interface*){ |
124 | // Can't remove a hardware device, you can stop it though. | 121 | // Can't remove a hardware device, you can stop it though. |
125 | return false; | 122 | return false; |
126 | } | 123 | } |
127 | 124 | ||
128 | // wlanmodule.cpp | 125 | // wlanmodule.cpp |
129 | 126 | ||
diff --git a/noncore/settings/networksettings/interfacesetupimp.cpp b/noncore/settings/networksettings/interfacesetupimp.cpp index 1327726..a8731a9 100644 --- a/noncore/settings/networksettings/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfacesetupimp.cpp | |||
@@ -1,105 +1,105 @@ | |||
1 | #include "interfacesetupimp.h" | 1 | #include "interfacesetupimp.h" |
2 | #include "interface.h" | 2 | #include "interface.h" |
3 | #include "interfaces.h" | 3 | #include "interfaces.h" |
4 | 4 | ||
5 | #include <qcombobox.h> | 5 | #include <qcombobox.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qspinbox.h> | 8 | #include <qspinbox.h> |
9 | #include <qgroupbox.h> | 9 | #include <qgroupbox.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | 11 | ||
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | 13 | ||
14 | #include <assert.h> | 14 | #include <assert.h> |
15 | 15 | ||
16 | #define DNSSCRIPT "interfacednsscript" | 16 | #define DNSSCRIPT "interfacednsscript" |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Constuctor. Set up the connection and load the first profile. | 19 | * Constuctor. Set up the connection and load the first profile. |
20 | */ | 20 | */ |
21 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ | 21 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : InterfaceSetup(parent, name, modal, fl){ |
22 | assert(i); | 22 | assert(i); |
23 | interface = i; | 23 | interface = i; |
24 | interfaces = new Interfaces(); | 24 | interfaces = new Interfaces(); |
25 | bool error = false; | 25 | bool error = false; |
26 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 26 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
27 | staticGroupBox->hide(); | 27 | staticGroupBox->hide(); |
28 | dhcpCheckBox->hide(); | 28 | dhcpCheckBox->hide(); |
29 | leaseTime->hide(); | 29 | leaseTime->hide(); |
30 | leaseHoursLabel->hide(); | 30 | leaseHoursLabel->hide(); |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Save the current settings, then write out the interfaces file and close. | 35 | * Save the current settings, then write out the interfaces file and close. |
36 | */ | 36 | */ |
37 | void InterfaceSetupImp::accept(){ | 37 | void InterfaceSetupImp::accept(){ |
38 | if(!saveSettings()) | 38 | if(!saveSettings()) |
39 | return; | 39 | return; |
40 | interfaces->write(); | 40 | interfaces->write(); |
41 | close(true); | 41 | QDialog::accept(); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Save the settings for the current Interface. | 45 | * Save the settings for the current Interface. |
46 | * @return bool true if successfull, false otherwise | 46 | * @return bool true if successfull, false otherwise |
47 | */ | 47 | */ |
48 | bool InterfaceSetupImp::saveSettings(){ | 48 | bool InterfaceSetupImp::saveSettings(){ |
49 | // eh can't really do anything about it other then return. :-D | 49 | // eh can't really do anything about it other then return. :-D |
50 | if(!interfaces->isInterfaceSet()) | 50 | if(!interfaces->isInterfaceSet()) |
51 | return true; | 51 | return true; |
52 | 52 | ||
53 | bool error = false; | 53 | bool error = false; |
54 | // Loopback case | 54 | // Loopback case |
55 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 55 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
56 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 56 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
57 | return true; | 57 | return true; |
58 | } | 58 | } |
59 | 59 | ||
60 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ | 60 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty() || firstDNSLineEdit->text().isEmpty())){ |
61 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); | 61 | QMessageBox::information(this, "Empy Fields.", "Please fill in address, subnet,\n gateway and the first dns entries.", "Ok"); |
62 | return false; | 62 | return false; |
63 | } | 63 | } |
64 | interfaces->removeAllInterfaceOptions(); | 64 | interfaces->removeAllInterfaceOptions(); |
65 | 65 | ||
66 | // DHCP | 66 | // DHCP |
67 | if(dhcpCheckBox->isChecked()){ | 67 | if(dhcpCheckBox->isChecked()){ |
68 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 68 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
69 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 69 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
70 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 70 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
71 | } | 71 | } |
72 | else{ | 72 | else{ |
73 | interfaces->setInterfaceMethod("static"); | 73 | interfaces->setInterfaceMethod("static"); |
74 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 74 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
75 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 75 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
76 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 76 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
77 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 77 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
78 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); | 78 | interfaces->setInterfaceOption("up "DNSSCRIPT" add ", dns); |
79 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); | 79 | interfaces->setInterfaceOption("down "DNSSCRIPT" remove ", dns); |
80 | } | 80 | } |
81 | 81 | ||
82 | // IP Information | 82 | // IP Information |
83 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 83 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
84 | return true; | 84 | return true; |
85 | } | 85 | } |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * The Profile has changed. | 88 | * The Profile has changed. |
89 | * @profile the new profile. | 89 | * @profile the new profile. |
90 | */ | 90 | */ |
91 | void InterfaceSetupImp::setProfile(const QString &profile){ | 91 | void InterfaceSetupImp::setProfile(const QString &profile){ |
92 | QString newInterfaceName = interface->getInterfaceName(); | 92 | QString newInterfaceName = interface->getInterfaceName(); |
93 | if(profile.length() > 0) | 93 | if(profile.length() > 0) |
94 | newInterfaceName += "_" + profile; | 94 | newInterfaceName += "_" + profile; |
95 | // See if we have to make a interface. | 95 | // See if we have to make a interface. |
96 | if(!interfaces->setInterface(newInterfaceName)){ | 96 | if(!interfaces->setInterface(newInterfaceName)){ |
97 | // Add making for this new interface if need too | 97 | // Add making for this new interface if need too |
98 | if(profile != ""){ | 98 | if(profile != ""){ |
99 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 99 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
100 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 100 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
101 | interfaces->addMapping(interface->getInterfaceName()); | 101 | interfaces->addMapping(interface->getInterfaceName()); |
102 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 102 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
103 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); | 103 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); |
104 | return; | 104 | return; |
105 | } | 105 | } |
diff --git a/noncore/settings/networksettings/interfacesetupimp.h b/noncore/settings/networksettings/interfacesetupimp.h index 7df0d46..a0bec32 100644 --- a/noncore/settings/networksettings/interfacesetupimp.h +++ b/noncore/settings/networksettings/interfacesetupimp.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef INTERFACESETUPIMP_H | 1 | #ifndef INTERFACESETUPIMP_H |
2 | #define INTERFACESETUPIMP_H | 2 | #define INTERFACESETUPIMP_H |
3 | 3 | ||
4 | #include "interfacesetup.h" | 4 | #include "interfacesetup.h" |
5 | 5 | ||
6 | class Interface; | 6 | class Interface; |
7 | class Interfaces; | 7 | class Interfaces; |
8 | 8 | ||
9 | class InterfaceSetupImp : public InterfaceSetup { | 9 | class InterfaceSetupImp : public InterfaceSetup { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0); | 13 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0); |
14 | 14 | ||
15 | protected slots: | 15 | protected slots: |
16 | void accept(); | 16 | void accept(); |
17 | 17 | ||
18 | public slots: | 18 | public slots: |
19 | void setProfile(const QString &profile); | 19 | void setProfile(const QString &profile); |
20 | 20 | ||
21 | private: | 21 | private: |
22 | bool saveSettings(); | 22 | bool saveSettings(); |
23 | Interfaces *interfaces; | 23 | Interfaces *interfaces; |
24 | Interface *interface; | 24 | Interface *interface; |
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | // interfacesetupimp.h | 30 | // interfacesetupimp.h |
31 | 31 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index c86acdc..4a088cb 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -17,148 +17,148 @@ | |||
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | 18 | ||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | 21 | ||
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qlibrary.h> | 23 | #include <qpe/qlibrary.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | 26 | ||
27 | #include <qlist.h> | 27 | #include <qlist.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | 31 | ||
32 | #define TEMP_ALL "/tmp/ifconfig-a" | 32 | #define TEMP_ALL "/tmp/ifconfig-a" |
33 | #define TEMP_UP "/tmp/ifconfig" | 33 | #define TEMP_UP "/tmp/ifconfig" |
34 | 34 | ||
35 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" | 35 | #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" |
36 | 36 | ||
37 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ | 37 | MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, true), advancedUserMode(false){ |
38 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); | 38 | connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); |
39 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); | 39 | connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); |
40 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); | 40 | connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); |
41 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); | 41 | connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); |
42 | 42 | ||
43 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); | 43 | connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); |
44 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); | 44 | connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); |
45 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); | 45 | connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); |
46 | 46 | ||
47 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); | 47 | connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); |
48 | // Load connections. | 48 | // Load connections. |
49 | loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); | 49 | loadModules(QPEApplication::qpeDir() + "/plugins/networksetup"); |
50 | getInterfaceList(); | 50 | getInterfaceList(); |
51 | connectionList->header()->hide(); | 51 | connectionList->header()->hide(); |
52 | 52 | ||
53 | 53 | ||
54 | Config cfg("NetworkSetup"); | 54 | Config cfg("NetworkSetup"); |
55 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); | 55 | profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); |
56 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) | 56 | for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) |
57 | profilesList->insertItem((*it)); | 57 | profilesList->insertItem((*it)); |
58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); | 58 | currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); |
59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); | 59 | advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); |
60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); | 60 | scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); |
61 | 61 | ||
62 | QFile file(scheme); | 62 | QFile file(scheme); |
63 | if ( file.open(IO_ReadOnly) ) { // file opened successfully | 63 | if ( file.open(IO_ReadOnly) ) { // file opened successfully |
64 | QTextStream stream( &file ); // use a text stream | 64 | QTextStream stream( &file ); // use a text stream |
65 | while ( !stream.eof() ) { // until end of file... | 65 | while ( !stream.eof() ) { // until end of file... |
66 | QString line = stream.readLine(); // line of text excluding '\n' | 66 | QString line = stream.readLine(); // line of text excluding '\n' |
67 | if(line.contains("SCHEME")){ | 67 | if(line.contains("SCHEME")){ |
68 | line = line.mid(7, line.length()); | 68 | line = line.mid(7, line.length()); |
69 | currentProfileLabel->setText(line); | 69 | currentProfileLabel->setText(line); |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | } | 72 | } |
73 | file.close(); | 73 | file.close(); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Deconstructor. Save profiles. Delete loaded libraries. | 78 | * Deconstructor. Save profiles. Delete loaded libraries. |
79 | */ | 79 | */ |
80 | MainWindowImp::~MainWindowImp(){ | 80 | MainWindowImp::~MainWindowImp(){ |
81 | qDebug("start Saving mainwindow"); | 81 | qDebug("Deleting main window"); |
82 | // Save profiles. | 82 | // Save profiles. |
83 | Config cfg("NetworkSetup"); | 83 | Config cfg("NetworkSetup"); |
84 | cfg.setGroup("General"); | 84 | cfg.setGroup("General"); |
85 | cfg.writeEntry("Profiles", profiles.join(" ")); | 85 | cfg.writeEntry("Profiles", profiles.join(" ")); |
86 | 86 | ||
87 | // Delete all interfaces that don't have owners. | 87 | // Delete all interfaces that don't have owners. |
88 | QMap<Interface*, QListViewItem*>::Iterator iIt; | 88 | QMap<Interface*, QListViewItem*>::Iterator iIt; |
89 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ | 89 | for( iIt = items.begin(); iIt != items.end(); ++iIt ){ |
90 | if(iIt.key()->getModuleOwner() == NULL) | 90 | if(iIt.key()->getModuleOwner() == NULL) |
91 | delete iIt.key(); | 91 | delete iIt.key(); |
92 | } | 92 | } |
93 | 93 | ||
94 | // Delete Modules and Libraries | 94 | // Delete Modules and Libraries |
95 | QMap<Module*, QLibrary*>::Iterator it; | 95 | QMap<Module*, QLibrary*>::Iterator it; |
96 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 96 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
97 | delete it.key(); | 97 | delete it.key(); |
98 | delete it.data(); | 98 | //delete it.data(); |
99 | } | 99 | } |
100 | qDebug("done Saving mainwindow"); | 100 | qDebug("Done deleting main window"); |
101 | } | 101 | } |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Load all modules that are found in the path | 104 | * Load all modules that are found in the path |
105 | * @param path a directory that is scaned for any plugins that can be loaded | 105 | * @param path a directory that is scaned for any plugins that can be loaded |
106 | * and attempts to load them | 106 | * and attempts to load them |
107 | */ | 107 | */ |
108 | void MainWindowImp::loadModules(QString path){ | 108 | void MainWindowImp::loadModules(QString path){ |
109 | //qDebug(path.latin1()); | 109 | //qDebug(path.latin1()); |
110 | QDir d(path); | 110 | QDir d(path); |
111 | if(!d.exists()) | 111 | if(!d.exists()) |
112 | return; | 112 | return; |
113 | 113 | ||
114 | // Don't want sym links | 114 | // Don't want sym links |
115 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 115 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
116 | const QFileInfoList *list = d.entryInfoList(); | 116 | const QFileInfoList *list = d.entryInfoList(); |
117 | QFileInfoListIterator it( *list ); | 117 | QFileInfoListIterator it( *list ); |
118 | QFileInfo *fi; | 118 | QFileInfo *fi; |
119 | while ( (fi=it.current()) ) { | 119 | while ( (fi=it.current()) ) { |
120 | if(fi->fileName().contains(".so")){ | 120 | if(fi->fileName().contains(".so")){ |
121 | loadPlugin(path + "/" + fi->fileName()); | 121 | loadPlugin(path + "/" + fi->fileName()); |
122 | } | 122 | } |
123 | ++it; | 123 | ++it; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Attempt to load a function and resolve a function. | 128 | * Attempt to load a function and resolve a function. |
129 | * @param pluginFileName - the name of the file in which to attempt to load | 129 | * @param pluginFileName - the name of the file in which to attempt to load |
130 | * @param resolveString - function pointer to resolve | 130 | * @param resolveString - function pointer to resolve |
131 | * @return pointer to the function with name resolveString or NULL | 131 | * @return pointer to the function with name resolveString or NULL |
132 | */ | 132 | */ |
133 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ | 133 | Module* MainWindowImp::loadPlugin(QString pluginFileName, QString resolveString){ |
134 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); | 134 | //qDebug(QString("MainWindowImp::loadPlugin: %1").arg(pluginFileName).latin1()); |
135 | QLibrary *lib = new QLibrary(pluginFileName); | 135 | QLibrary *lib = new QLibrary(pluginFileName); |
136 | void *functionPointer = lib->resolve(resolveString); | 136 | void *functionPointer = lib->resolve(resolveString); |
137 | if( !functionPointer ){ | 137 | if( !functionPointer ){ |
138 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); | 138 | qDebug(QString("MainWindowImp: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); |
139 | delete lib; | 139 | delete lib; |
140 | return NULL; | 140 | return NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | // Try to get an object. | 143 | // Try to get an object. |
144 | Module *object = ((Module* (*)()) functionPointer)(); | 144 | Module *object = ((Module* (*)()) functionPointer)(); |
145 | if(object == NULL){ | 145 | if(object == NULL){ |
146 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); | 146 | qDebug("MainWindowImp: Couldn't create object, but did load library!"); |
147 | delete lib; | 147 | delete lib; |
148 | return NULL; | 148 | return NULL; |
149 | } | 149 | } |
150 | 150 | ||
151 | // Store for deletion later | 151 | // Store for deletion later |
152 | libraries.insert(object, lib); | 152 | libraries.insert(object, lib); |
153 | return object; | 153 | return object; |
154 | } | 154 | } |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * The Add button was clicked. Bring up the add dialog and if OK is hit | 157 | * The Add button was clicked. Bring up the add dialog and if OK is hit |
158 | * load the plugin and append it to the list | 158 | * load the plugin and append it to the list |
159 | */ | 159 | */ |
160 | void MainWindowImp::addClicked(){ | 160 | void MainWindowImp::addClicked(){ |
161 | QMap<Module*, QLibrary*>::Iterator it; | 161 | QMap<Module*, QLibrary*>::Iterator it; |
162 | QMap<QString, QString> list; | 162 | QMap<QString, QString> list; |
163 | QMap<QString, Module*> newInterfaceOwners; | 163 | QMap<QString, Module*> newInterfaceOwners; |
164 | list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); | 164 | list.insert("USB (PPP) / (ADD_TEST)", "A dialup connection over the USB port"); |
@@ -183,140 +183,139 @@ void MainWindowImp::addClicked(){ | |||
183 | 183 | ||
184 | for( it = libraries.begin(); it != libraries.end(); ++it ){ | 184 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
185 | if(it.key()){ | 185 | if(it.key()){ |
186 | Interface *i = (it.key())->addNewInterface(item->text(0)); | 186 | Interface *i = (it.key())->addNewInterface(item->text(0)); |
187 | if(i){ | 187 | if(i){ |
188 | interfaceNames.insert(i->getInterfaceName(), i); | 188 | interfaceNames.insert(i->getInterfaceName(), i); |
189 | updateInterface(i); | 189 | updateInterface(i); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Prompt the user to see if they really want to do this. | 197 | * Prompt the user to see if they really want to do this. |
198 | * If they do then remove from the list and unload. | 198 | * If they do then remove from the list and unload. |
199 | */ | 199 | */ |
200 | void MainWindowImp::removeClicked(){ | 200 | void MainWindowImp::removeClicked(){ |
201 | QListViewItem *item = connectionList->currentItem(); | 201 | QListViewItem *item = connectionList->currentItem(); |
202 | if(!item) { | 202 | if(!item) { |
203 | QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok"); | 203 | QMessageBox::information(this, "Sorry","Please select an interface First.", "Ok"); |
204 | return; | 204 | return; |
205 | } | 205 | } |
206 | 206 | ||
207 | Interface *i = interfaceItems[item]; | 207 | Interface *i = interfaceItems[item]; |
208 | if(i->getModuleOwner() == NULL){ | 208 | if(i->getModuleOwner() == NULL){ |
209 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 209 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
210 | } | 210 | } |
211 | else{ | 211 | else{ |
212 | if(!i->getModuleOwner()->remove(i)) | 212 | if(!i->getModuleOwner()->remove(i)) |
213 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); | 213 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); |
214 | else{ | 214 | else{ |
215 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); | 215 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); |
216 | // TODO memory managment.... | 216 | // TODO memory managment.... |
217 | // who deletes the interface? | 217 | // who deletes the interface? |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | /** | 222 | /** |
223 | * Pull up the configure about the currently selected interface. | 223 | * Pull up the configure about the currently selected interface. |
224 | * Report an error if no interface is selected. | 224 | * Report an error if no interface is selected. |
225 | * If the interface has a module owner then request its configure with a empty | 225 | * If the interface has a module owner then request its configure with a empty |
226 | * tab. If tab is !NULL then append the interfaces setup widget to it. | 226 | * tab. If tab is !NULL then append the interfaces setup widget to it. |
227 | */ | 227 | */ |
228 | void MainWindowImp::configureClicked(){ | 228 | void MainWindowImp::configureClicked(){ |
229 | QListViewItem *item = connectionList->currentItem(); | 229 | QListViewItem *item = connectionList->currentItem(); |
230 | if(!item){ | 230 | if(!item){ |
231 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 231 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | 234 | ||
235 | QString currentProfile = currentProfileLabel->text(); | 235 | QString currentProfile = currentProfileLabel->text(); |
236 | if(profilesList->count() <= 1 || currentProfile == "All"){ | 236 | if(profilesList->count() <= 1 || currentProfile == "All"){ |
237 | currentProfile = ""; | 237 | currentProfile = ""; |
238 | } | 238 | } |
239 | 239 | ||
240 | Interface *i = interfaceItems[item]; | 240 | Interface *i = interfaceItems[item]; |
241 | if(i->getModuleOwner()){ | 241 | if(i->getModuleOwner()){ |
242 | i->getModuleOwner()->setProfile(currentProfile); | 242 | i->getModuleOwner()->setProfile(currentProfile); |
243 | QTabWidget *tabWidget = NULL; | 243 | QTabWidget *tabWidget = NULL; |
244 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget); | 244 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i, &tabWidget); |
245 | if(moduleConfigure != NULL){ | 245 | if(moduleConfigure != NULL){ |
246 | if(tabWidget != NULL){ | 246 | if(tabWidget != NULL){ |
247 | InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, true); | 247 | InterfaceSetupImp *configure = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, false, Qt::WDestructiveClose); |
248 | configure->setProfile(currentProfile); | 248 | configure->setProfile(currentProfile); |
249 | tabWidget->insertTab(configure, "TCP/IP"); | 249 | tabWidget->insertTab(configure, "TCP/IP"); |
250 | |||
251 | } | 250 | } |
252 | moduleConfigure->showMaximized(); | 251 | moduleConfigure->showMaximized(); |
253 | moduleConfigure->show(); | 252 | moduleConfigure->show(); |
254 | return; | 253 | return; |
255 | } | 254 | } |
256 | } | 255 | } |
257 | 256 | ||
258 | InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, true); | 257 | InterfaceSetupImp *configure = new InterfaceSetupImp(0, "InterfaceSetupImp", i, false, Qt::WDestructiveClose); |
259 | configure->setProfile(currentProfile); | 258 | configure->setProfile(currentProfile); |
260 | configure->showMaximized(); | 259 | configure->showMaximized(); |
261 | configure->show(); | 260 | configure->show(); |
262 | } | 261 | } |
263 | 262 | ||
264 | /** | 263 | /** |
265 | * Pull up the information about the currently selected interface. | 264 | * Pull up the information about the currently selected interface. |
266 | * Report an error if no interface is selected. | 265 | * Report an error if no interface is selected. |
267 | * If the interface has a module owner then request its configure with a empty | 266 | * If the interface has a module owner then request its configure with a empty |
268 | * tab. If tab is !NULL then append the interfaces setup widget to it. | 267 | * tab. If tab is !NULL then append the interfaces setup widget to it. |
269 | */ | 268 | */ |
270 | void MainWindowImp::informationClicked(){ | 269 | void MainWindowImp::informationClicked(){ |
271 | QListViewItem *item = connectionList->currentItem(); | 270 | QListViewItem *item = connectionList->currentItem(); |
272 | if(!item){ | 271 | if(!item){ |
273 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 272 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
274 | return; | 273 | return; |
275 | } | 274 | } |
276 | 275 | ||
277 | Interface *i = interfaceItems[item]; | 276 | Interface *i = interfaceItems[item]; |
278 | if(!i->isAttached()){ | 277 | if(!i->isAttached()){ |
279 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 278 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
280 | return; | 279 | return; |
281 | } | 280 | } |
282 | 281 | ||
283 | QStringList list; | 282 | QStringList list; |
284 | for(uint i = 0; i < profilesList->count(); i++){ | 283 | for(uint i = 0; i < profilesList->count(); i++){ |
285 | list.append(profilesList->text(i)); | 284 | list.append(profilesList->text(i)); |
286 | } | 285 | } |
287 | 286 | ||
288 | if(i->getModuleOwner()){ | 287 | if(i->getModuleOwner()){ |
289 | QTabWidget *tabWidget = NULL; | 288 | QTabWidget *tabWidget = NULL; |
290 | QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget); | 289 | QWidget *moduleInformation = i->getModuleOwner()->information(i, &tabWidget); |
291 | if(moduleInformation != NULL){ | 290 | if(moduleInformation != NULL){ |
292 | if(tabWidget != NULL){ | 291 | if(tabWidget != NULL){ |
293 | InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true); | 292 | InterfaceInformationImp *information = new InterfaceInformationImp(tabWidget, "InterfaceSetupImp", i, true); |
294 | tabWidget->insertTab(information, "TCP/IP"); | 293 | tabWidget->insertTab(information, "TCP/IP"); |
295 | } | 294 | } |
296 | moduleInformation->showMaximized(); | 295 | moduleInformation->showMaximized(); |
297 | moduleInformation->show(); | 296 | moduleInformation->show(); |
298 | return; | 297 | return; |
299 | } | 298 | } |
300 | } | 299 | } |
301 | 300 | ||
302 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); | 301 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); |
303 | information->showMaximized(); | 302 | information->showMaximized(); |
304 | information->show(); | 303 | information->show(); |
305 | } | 304 | } |
306 | 305 | ||
307 | /** | 306 | /** |
308 | * Aquire the list of active interfaces from ifconfig | 307 | * Aquire the list of active interfaces from ifconfig |
309 | * Call ifconfig and ifconfig -a | 308 | * Call ifconfig and ifconfig -a |
310 | */ | 309 | */ |
311 | void MainWindowImp::getInterfaceList(){ | 310 | void MainWindowImp::getInterfaceList(){ |
312 | KShellProcess *processAll = new KShellProcess(); | 311 | KShellProcess *processAll = new KShellProcess(); |
313 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 312 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
314 | connect(processAll, SIGNAL(processExited(KProcess *)), | 313 | connect(processAll, SIGNAL(processExited(KProcess *)), |
315 | this, SLOT(jobDone(KProcess *))); | 314 | this, SLOT(jobDone(KProcess *))); |
316 | threads.insert(processAll, TEMP_ALL); | 315 | threads.insert(processAll, TEMP_ALL); |
317 | 316 | ||
318 | KShellProcess *process = new KShellProcess(); | 317 | KShellProcess *process = new KShellProcess(); |
319 | *process << "/sbin/ifconfig" << " > " TEMP_UP; | 318 | *process << "/sbin/ifconfig" << " > " TEMP_UP; |
320 | connect(process, SIGNAL(processExited(KProcess *)), | 319 | connect(process, SIGNAL(processExited(KProcess *)), |
321 | this, SLOT(jobDone(KProcess *))); | 320 | this, SLOT(jobDone(KProcess *))); |
322 | threads.insert(process, TEMP_UP); | 321 | threads.insert(process, TEMP_UP); |
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index f09db93..7299cc6 100644 --- a/noncore/settings/networksettings/networksetup.pro +++ b/noncore/settings/networksettings/networksetup.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | #DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | CONFIG = qt warn_on release | 4 | #CONFIG = qt warn_on release |
5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h interface.h interfaceinformationimp.h interfacesetupimp.h interfaces.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp interface.cpp interfaceinformationimp.cpp interfacesetupimp.cpp kprocctrl.cpp kprocess.cpp interfaces.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include | 7 | INCLUDEPATH+= $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui | 10 | INTERFACES= mainwindow.ui addconnection.ui interfaceinformation.ui interfaceadvanced.ui interfacesetup.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro index 432a096..814a0b4 100644 --- a/noncore/settings/networksettings/wlan/wlan.pro +++ b/noncore/settings/networksettings/wlan/wlan.pro | |||
@@ -1,12 +1,12 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | #CONFIG += qt warn_on release |
3 | #CONFIG += qt warn_on debug | 3 | CONFIG += qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/plugins/networksetup | 4 | #DESTDIR = $(OPIEDIR)/plugins/networksetup |
5 | HEADERS = wlanimp.h wlanmodule.h wextensions.h | 5 | HEADERS = wlanimp.h wlanmodule.h wextensions.h |
6 | SOURCES = wlanimp.cpp wlanmodule.cpp wextensions.cpp | 6 | SOURCES = wlanimp.cpp wlanmodule.cpp wextensions.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include ../ | 7 | INCLUDEPATH+= $(OPIEDIR)/include ../ |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= wlan.ui info.ui | 10 | INTERFACES= wlan.ui info.ui |
11 | TARGET = wlanplugin | 11 | TARGET = wlanplugin |
12 | VERSION = 1.0.0 | 12 | VERSION = 1.0.0 |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 94c7518..45952b9 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -1,184 +1,179 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | 2 | ||
3 | /* Config class */ | 3 | /* Config class */ |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | /* Global namespace */ | 5 | /* Global namespace */ |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | /* system() */ | 7 | /* system() */ |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 14 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 15 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | 17 | #include <qregexp.h> |
18 | 18 | ||
19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name, Qt::WDestructiveClose){ | 19 | WLANImp::WLANImp( QWidget* parent, const char* name, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ |
20 | config = new Config("wireless"); | 20 | config = new Config("wireless"); |
21 | readConfig(); | 21 | readConfig(); |
22 | } | 22 | } |
23 | 23 | ||
24 | WLANImp::~WLANImp( ){ | 24 | WLANImp::~WLANImp( ){ |
25 | delete config; | 25 | delete config; |
26 | } | 26 | } |
27 | 27 | ||
28 | void WLANImp::readConfig() | 28 | void WLANImp::readConfig() |
29 | { | 29 | { |
30 | qWarning( "WLANImp::readConfig() called." ); | 30 | qWarning( "WLANImp::readConfig() called." ); |
31 | config->setGroup( "Properties" ); | 31 | config->setGroup( "Properties" ); |
32 | QString ssid = config->readEntry( "SSID", "any" ); | 32 | QString ssid = config->readEntry( "SSID", "any" ); |
33 | if( ssid == "any" || ssid == "ANY" ){ | 33 | if( ssid == "any" || ssid == "ANY" ){ |
34 | essNon->setChecked( true ); | 34 | essNon->setChecked( true ); |
35 | } else { | 35 | } else { |
36 | essSpecific->setChecked( true ); | 36 | essSpecific->setChecked( true ); |
37 | essSpecificLineEdit->setText( ssid ); | 37 | essSpecificLineEdit->setText( ssid ); |
38 | } | 38 | } |
39 | QString mode = config->readEntry( "Mode", "Managed" ); | 39 | QString mode = config->readEntry( "Mode", "Managed" ); |
40 | if( mode == "adhoc" ) { | 40 | if( mode == "adhoc" ) { |
41 | network802->setChecked( true ); | 41 | network802->setChecked( true ); |
42 | } else { | 42 | } else { |
43 | networkInfrastructure->setChecked( true ); | 43 | networkInfrastructure->setChecked( true ); |
44 | } | 44 | } |
45 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 45 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
46 | // config->readEntry( "RATE", "auto" ); | 46 | // config->readEntry( "RATE", "auto" ); |
47 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 47 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
48 | config->readEntry( "AuthType", "opensystem" ); | 48 | config->readEntry( "AuthType", "opensystem" ); |
49 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 49 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
50 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 50 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
51 | switch( defaultkey ){ | 51 | switch( defaultkey ){ |
52 | case 0: | 52 | case 0: |
53 | keyRadio0->setChecked( true ); | 53 | keyRadio0->setChecked( true ); |
54 | break; | 54 | break; |
55 | case 1: | 55 | case 1: |
56 | keyRadio1->setChecked( true ); | 56 | keyRadio1->setChecked( true ); |
57 | break; | 57 | break; |
58 | case 2: | 58 | case 2: |
59 | keyRadio2->setChecked( true ); | 59 | keyRadio2->setChecked( true ); |
60 | break; | 60 | break; |
61 | case 3: | 61 | case 3: |
62 | keyRadio3->setChecked( true ); | 62 | keyRadio3->setChecked( true ); |
63 | break; | 63 | break; |
64 | } | 64 | } |
65 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); | 65 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); |
66 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); | 66 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); |
67 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); | 67 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); |
68 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); | 68 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | 71 | ||
72 | bool WLANImp::writeConfig() | 72 | bool WLANImp::writeConfig() |
73 | { | 73 | { |
74 | qWarning( "WLANImp::writeConfig() called." ); | 74 | qWarning( "WLANImp::writeConfig() called." ); |
75 | config->setGroup( "Properties" ); | 75 | config->setGroup( "Properties" ); |
76 | if( essNon->isChecked() ) { | 76 | if( essNon->isChecked() ) { |
77 | config->writeEntry( "SSID", "any" ); | 77 | config->writeEntry( "SSID", "any" ); |
78 | } else { | 78 | } else { |
79 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); | 79 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); |
80 | } | 80 | } |
81 | if( networkInfrastructure->isChecked() ){ | 81 | if( networkInfrastructure->isChecked() ){ |
82 | config->writeEntry( "Mode", "Managed" ); | 82 | config->writeEntry( "Mode", "Managed" ); |
83 | } else if( network802->isChecked() ){ | 83 | } else if( network802->isChecked() ){ |
84 | config->writeEntry( "Mode", "adhoc" ); | 84 | config->writeEntry( "Mode", "adhoc" ); |
85 | } | 85 | } |
86 | config->writeEntry( "CHANNEL", networkChannel->value() ); | 86 | config->writeEntry( "CHANNEL", networkChannel->value() ); |
87 | // config->readEntry( "RATE", "auto" ); | 87 | // config->readEntry( "RATE", "auto" ); |
88 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); | 88 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); |
89 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); | 89 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); |
90 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); | 90 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); |
91 | if( keyRadio0->isChecked() ){ | 91 | if( keyRadio0->isChecked() ){ |
92 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); | 92 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); |
93 | } else if( keyRadio1->isChecked() ){ | 93 | } else if( keyRadio1->isChecked() ){ |
94 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); | 94 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); |
95 | } else if( keyRadio2->isChecked() ){ | 95 | } else if( keyRadio2->isChecked() ){ |
96 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); | 96 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); |
97 | } else if( keyRadio3->isChecked() ){ | 97 | } else if( keyRadio3->isChecked() ){ |
98 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); | 98 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); |
99 | } | 99 | } |
100 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 100 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
101 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 101 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
102 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 102 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
103 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 103 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
104 | return true; | ||
104 | return writeWirelessOpts( ); | 105 | return writeWirelessOpts( ); |
105 | } | 106 | } |
106 | 107 | ||
107 | /** | 108 | /** |
108 | */ | 109 | */ |
109 | void WLANImp::accept() | 110 | void WLANImp::accept() |
110 | { | 111 | { |
111 | if ( writeConfig() ) | 112 | if ( writeConfig() ) |
112 | QDialog::accept(); | 113 | QDialog::accept(); |
113 | } | 114 | } |
114 | 115 | ||
115 | void WLANImp::done ( int r ) | ||
116 | { | ||
117 | QDialog::done ( r ); | ||
118 | close ( ); | ||
119 | } | ||
120 | |||
121 | bool WLANImp::writeWirelessOpts( QString scheme ) | 116 | bool WLANImp::writeWirelessOpts( QString scheme ) |
122 | { | 117 | { |
123 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 118 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
124 | QString prev = "/etc/pcmcia/wireless.opts"; | 119 | QString prev = "/etc/pcmcia/wireless.opts"; |
125 | QFile prevFile(prev); | 120 | QFile prevFile(prev); |
126 | if ( !prevFile.open( IO_ReadOnly ) ) | 121 | if ( !prevFile.open( IO_ReadOnly ) ) |
127 | return false; | 122 | return false; |
128 | 123 | ||
129 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 124 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |
130 | QFile tmpFile(tmp); | 125 | QFile tmpFile(tmp); |
131 | if ( !tmpFile.open( IO_WriteOnly ) ) | 126 | if ( !tmpFile.open( IO_WriteOnly ) ) |
132 | return false; | 127 | return false; |
133 | 128 | ||
134 | bool retval = true; | 129 | bool retval = true; |
135 | 130 | ||
136 | QTextStream in( &prevFile ); | 131 | QTextStream in( &prevFile ); |
137 | QTextStream out( &tmpFile ); | 132 | QTextStream out( &tmpFile ); |
138 | 133 | ||
139 | config->setGroup("Properties"); | 134 | config->setGroup("Properties"); |
140 | 135 | ||
141 | QString line; | 136 | QString line; |
142 | bool found=false; | 137 | bool found=false; |
143 | bool done=false; | 138 | bool done=false; |
144 | while ( !in.atEnd() ) { | 139 | while ( !in.atEnd() ) { |
145 | QString line = in.readLine(); | 140 | QString line = in.readLine(); |
146 | QString wline = line.simplifyWhiteSpace(); | 141 | QString wline = line.simplifyWhiteSpace(); |
147 | if ( !done ) { | 142 | if ( !done ) { |
148 | if ( found ) { | 143 | if ( found ) { |
149 | // skip existing entry for this scheme, and write our own. | 144 | // skip existing entry for this scheme, and write our own. |
150 | if ( wline == ";;" ) { | 145 | if ( wline == ";;" ) { |
151 | found = false; | 146 | found = false; |
152 | continue; | 147 | continue; |
153 | } else { | 148 | } else { |
154 | continue; | 149 | continue; |
155 | } | 150 | } |
156 | } else { | 151 | } else { |
157 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | 152 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { |
158 | found=true; | 153 | found=true; |
159 | continue; // skip this line | 154 | continue; // skip this line |
160 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | 155 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { |
161 | // end - add new entry | 156 | // end - add new entry |
162 | // Not all fields have a GUI, but all are supported | 157 | // Not all fields have a GUI, but all are supported |
163 | // in the letwork configuration files. | 158 | // in the letwork configuration files. |
164 | static const char* txtfields[] = { | 159 | static const char* txtfields[] = { |
165 | 0 | 160 | 0 |
166 | }; | 161 | }; |
167 | QString readmode = config->readEntry( "Mode", "Managed" ); | 162 | QString readmode = config->readEntry( "Mode", "Managed" ); |
168 | QString mode; | 163 | QString mode; |
169 | if( readmode == "Managed" ){ | 164 | if( readmode == "Managed" ){ |
170 | mode = readmode; | 165 | mode = readmode; |
171 | } else if( readmode == "adhoc" ){ | 166 | } else if( readmode == "adhoc" ){ |
172 | mode = "Ad-Hoc"; | 167 | mode = "Ad-Hoc"; |
173 | } | 168 | } |
174 | QString key; | 169 | QString key; |
175 | if( wepEnabled->isChecked() ){ | 170 | if( wepEnabled->isChecked() ){ |
176 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 171 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
177 | switch( defaultkey ){ | 172 | switch( defaultkey ){ |
178 | case 0: | 173 | case 0: |
179 | key += keyLineEdit0->text(); | 174 | key += keyLineEdit0->text(); |
180 | break; | 175 | break; |
181 | case 1: | 176 | case 1: |
182 | key += keyLineEdit1->text(); | 177 | key += keyLineEdit1->text(); |
183 | break; | 178 | break; |
184 | case 2: | 179 | case 2: |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index 22ce143..59b7c59 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h | |||
@@ -1,28 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | 5 | ||
6 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
7 | 7 | ||
8 | class WLANImp : public WLAN { | 8 | class WLANImp : public WLAN { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANImp( QWidget* parent = 0, const char* name = 0); | 12 | WLANImp( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
13 | ~WLANImp( ); | 13 | ~WLANImp( ); |
14 | 14 | ||
15 | protected: | 15 | protected: |
16 | void accept(); | 16 | void accept(); |
17 | void done ( int r ); | ||
18 | 17 | ||
19 | private: | 18 | private: |
20 | void readConfig(); | 19 | void readConfig(); |
21 | bool writeConfig(); | 20 | bool writeConfig(); |
22 | bool writeWirelessOpts( QString scheme = "*" ); | 21 | bool writeWirelessOpts( QString scheme = "*" ); |
23 | bool writeWlanngOpts( QString scheme = "*" ); | 22 | bool writeWlanngOpts( QString scheme = "*" ); |
24 | Config* config; | 23 | Config* config; |
25 | }; | 24 | }; |
26 | 25 | ||
27 | #endif | 26 | #endif |
28 | 27 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 7507c54..3363b8a 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,129 +1,126 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
3 | #include "info.h" | 3 | #include "info.h" |
4 | #include "wextensions.h" | 4 | #include "wextensions.h" |
5 | 5 | ||
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qprogressbar.h> | 7 | #include <qprogressbar.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Constructor, find all of the possible interfaces | 10 | * Constructor, find all of the possible interfaces |
11 | */ | 11 | */ |
12 | WLANModule::WLANModule() : Module() { | 12 | WLANModule::WLANModule() : Module() { |
13 | } | 13 | } |
14 | 14 | ||
15 | /** | 15 | /** |
16 | */ | 16 | */ |
17 | WLANModule::~WLANModule(){ | 17 | WLANModule::~WLANModule(){ |
18 | qDebug("Deleting module"); | ||
18 | Interface *i; | 19 | Interface *i; |
19 | for ( i=list.first(); i != 0; i=list.next() ) | 20 | for ( i=list.first(); i != 0; i=list.next() ) |
20 | delete i; | 21 | delete i; |
21 | } | 22 | } |
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Change the current profile | 25 | * Change the current profile |
25 | */ | 26 | */ |
26 | void WLANModule::setProfile(QString newProfile){ | 27 | void WLANModule::setProfile(QString newProfile){ |
27 | profile = newProfile; | 28 | profile = newProfile; |
28 | } | 29 | } |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * get the icon name for this device. | 32 | * get the icon name for this device. |
32 | * @param Interface* can be used in determining the icon. | 33 | * @param Interface* can be used in determining the icon. |
33 | * @return QString the icon name (minus .png, .gif etc) | 34 | * @return QString the icon name (minus .png, .gif etc) |
34 | */ | 35 | */ |
35 | QString WLANModule::getPixmapName(Interface* ){ | 36 | QString WLANModule::getPixmapName(Interface* ){ |
36 | return "wlan"; | 37 | return "wlan"; |
37 | } | 38 | } |
38 | 39 | ||
39 | /** | 40 | /** |
40 | * Check to see if the interface i is owned by this module. | 41 | * Check to see if the interface i is owned by this module. |
41 | * @param Interface* interface to check against | 42 | * @param Interface* interface to check against |
42 | * @return bool true if i is owned by this module, false otherwise. | 43 | * @return bool true if i is owned by this module, false otherwise. |
43 | */ | 44 | */ |
44 | bool WLANModule::isOwner(Interface *i){ | 45 | bool WLANModule::isOwner(Interface *i){ |
45 | WExtensions we(i->getInterfaceName()); | 46 | WExtensions we(i->getInterfaceName()); |
46 | if(!we.doesHaveWirelessExtensions()) | 47 | if(!we.doesHaveWirelessExtensions()) |
47 | return false; | 48 | return false; |
48 | 49 | ||
49 | i->setHardwareName("802.11b"); | 50 | i->setHardwareName("802.11b"); |
50 | list.append(i); | 51 | list.append(i); |
51 | return true; | 52 | return true; |
52 | } | 53 | } |
53 | 54 | ||
54 | /** | 55 | /** |
55 | * Create, set tabWiget and return the WLANConfigure Module | 56 | * Create, set tabWiget and return the WLANConfigure Module |
56 | * @param tabWidget a pointer to the tab widget that this configure has. | 57 | * @param tabWidget a pointer to the tab widget that this configure has. |
57 | * @return QWidget* pointer to the tab widget in this modules configure. | 58 | * @return QWidget* pointer to the tab widget in this modules configure. |
58 | */ | 59 | */ |
59 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ | 60 | QWidget *WLANModule::configure(Interface *, QTabWidget **tabWidget){ |
60 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig"); | 61 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", false, Qt::WDestructiveClose); |
61 | (*tabWidget) = wlanconfig->tabWidget; | 62 | (*tabWidget) = wlanconfig->tabWidget; |
62 | return wlanconfig; | 63 | return wlanconfig; |
63 | } | 64 | } |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Create, set tabWiget and return the Information Module | 67 | * Create, set tabWiget and return the Information Module |
67 | * @param tabWidget a pointer to the tab widget that this information has. | 68 | * @param tabWidget a pointer to the tab widget that this information has. |
68 | * @return QWidget* pointer to the tab widget in this modules info. | 69 | * @return QWidget* pointer to the tab widget in this modules info. |
69 | */ | 70 | */ |
70 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 71 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
71 | WExtensions we(i->getInterfaceName()); | 72 | WExtensions we(i->getInterfaceName()); |
72 | if(!we.doesHaveWirelessExtensions()) | 73 | if(!we.doesHaveWirelessExtensions()) |
73 | return NULL; | 74 | return NULL; |
74 | 75 | ||
75 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); | 76 | WlanInfo *info = new WlanInfo(0, "wireless info", Qt::WDestructiveClose); |
76 | (*tabWidget) = info->tabWidget; | 77 | (*tabWidget) = info->tabWidget; |
77 | 78 | ||
78 | info->essidLabel->setText(we.essid()); | 79 | info->essidLabel->setText(we.essid()); |
79 | info->apLabel->setText(we.ap()); | 80 | info->apLabel->setText(we.ap()); |
80 | info->stationLabel->setText(we.station()); | 81 | info->stationLabel->setText(we.station()); |
81 | info->modeLabel->setText(we.mode()); | 82 | info->modeLabel->setText(we.mode()); |
82 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); | 83 | info->freqLabel->setText(QString("%1 GHz").arg(we.frequency())); |
83 | int signal = 0; | 84 | int signal = 0; |
84 | int noise = 0; | 85 | int noise = 0; |
85 | int quality = 0; | 86 | int quality = 0; |
86 | we.stats(signal, noise, quality); | 87 | we.stats(signal, noise, quality); |
87 | info->signalProgressBar->setProgress(signal); | 88 | info->signalProgressBar->setProgress(signal); |
88 | info->noiseProgressBar->setProgress(noise); | 89 | info->noiseProgressBar->setProgress(noise); |
89 | info->qualityProgressBar->setProgress(quality); | 90 | info->qualityProgressBar->setProgress(quality); |
90 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); | 91 | info->rateLabel->setText(QString("%1 Mb/s").arg(we.rate())); |
91 | //WlanInfo info (0, "wireless info", true); | ||
92 | //info.show(); | ||
93 | //return NULL; | ||
94 | |||
95 | return info; | 92 | return info; |
96 | } | 93 | } |
97 | 94 | ||
98 | /** | 95 | /** |
99 | * Get all active (up or down) interfaces | 96 | * Get all active (up or down) interfaces |
100 | * @return QList<Interface> A list of interfaces that exsist that havn't | 97 | * @return QList<Interface> A list of interfaces that exsist that havn't |
101 | * been called by isOwner() | 98 | * been called by isOwner() |
102 | */ | 99 | */ |
103 | QList<Interface> WLANModule::getInterfaces(){ | 100 | QList<Interface> WLANModule::getInterfaces(){ |
104 | return list; | 101 | return list; |
105 | } | 102 | } |
106 | 103 | ||
107 | /** | 104 | /** |
108 | * Attempt to add a new interface as defined by name | 105 | * Attempt to add a new interface as defined by name |
109 | * @param name the name of the type of interface that should be created given | 106 | * @param name the name of the type of interface that should be created given |
110 | * by possibleNewInterfaces(); | 107 | * by possibleNewInterfaces(); |
111 | * @return Interface* NULL if it was unable to be created. | 108 | * @return Interface* NULL if it was unable to be created. |
112 | */ | 109 | */ |
113 | Interface *WLANModule::addNewInterface(QString ){ | 110 | Interface *WLANModule::addNewInterface(QString ){ |
114 | // We can't add a 802.11 interface, either the hardware will be there | 111 | // We can't add a 802.11 interface, either the hardware will be there |
115 | // or it wont. | 112 | // or it wont. |
116 | return NULL; | 113 | return NULL; |
117 | } | 114 | } |
118 | 115 | ||
119 | /** | 116 | /** |
120 | * Attempts to remove the interface, doesn't delete i | 117 | * Attempts to remove the interface, doesn't delete i |
121 | * @return bool true if successfull, false otherwise. | 118 | * @return bool true if successfull, false otherwise. |
122 | */ | 119 | */ |
123 | bool WLANModule::remove(Interface*){ | 120 | bool WLANModule::remove(Interface*){ |
124 | // Can't remove a hardware device, you can stop it though. | 121 | // Can't remove a hardware device, you can stop it though. |
125 | return false; | 122 | return false; |
126 | } | 123 | } |
127 | 124 | ||
128 | // wlanmodule.cpp | 125 | // wlanmodule.cpp |
129 | 126 | ||