author | tille <tille> | 2003-06-13 13:32:55 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-13 13:32:55 (UTC) |
commit | e5d826221bab71c39dc8fc89d91509dd16bc2a8a (patch) (unidiff) | |
tree | 4a0ff06e1e6b43d52fe78a9ab14a7a8f98f41327 | |
parent | c48af71638614aaff280178693448916e0e98102 (diff) | |
download | opie-e5d826221bab71c39dc8fc89d91509dd16bc2a8a.zip opie-e5d826221bab71c39dc8fc89d91509dd16bc2a8a.tar.gz opie-e5d826221bab71c39dc8fc89d91509dd16bc2a8a.tar.bz2 |
qcop channels for start, stop wlan interface works now...
... the qcop handling has to become more general, and this handlet in the interface itself.
-rw-r--r-- | noncore/settings/networksettings/TODO | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp2.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 50 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.h | 7 |
4 files changed, 65 insertions, 20 deletions
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 614501f..b28c5a0 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO | |||
@@ -1,24 +1,30 @@ | |||
1 | * make dcop handling portable | ||
2 | * move dcop call for start, stop interfaces from wlan to interface | ||
3 | |||
4 | |||
5 | Old TODO of Benmayer: | ||
6 | |||
1 | Types: | 7 | Types: |
2 | -Ethernet Connection (Done) | 8 | -Ethernet Connection (Done) |
3 | -ISDN Connection | 9 | -ISDN Connection |
4 | -Modem COnnection (Started) | 10 | -Modem COnnection (Started) |
5 | -xDSL connection | 11 | -xDSL connection |
6 | -Token Ring Connection | 12 | -Token Ring Connection |
7 | -CIPE (VPN) connection (ipsec?) | 13 | -CIPE (VPN) connection (ipsec?) |
8 | -Wireless Connection (Done) | 14 | -Wireless Connection (Done) |
9 | -Bluetooth | 15 | -Bluetooth |
10 | -IPChains? | 16 | -IPChains? |
11 | 17 | ||
12 | When Zaurus is in cradle, USB interface is connected and reported as UP by the Network Setting application, clicking on Information button does not popup a window. It used to work before, but now it's broken in the latest feed... | 18 | When Zaurus is in cradle, USB interface is connected and reported as UP by the Network Setting application, clicking on Information button does not popup a window. It used to work before, but now it's broken in the latest feed... |
13 | 19 | ||
14 | -Z hangs on PCMCIA-eject of Symbol 802.11b card (card seems to be in an odd | 20 | -Z hangs on PCMCIA-eject of Symbol 802.11b card (card seems to be in an odd |
15 | state after first boot following reflash; see Additional Info) | 21 | state after first boot following reflash; see Additional Info) |
16 | 22 | ||
17 | test WEP | 23 | test WEP |
18 | Add WEP transimtion rate | 24 | Add WEP transimtion rate |
19 | 1 or 2 | 25 | 1 or 2 |
20 | 5.5 | 26 | 5.5 |
21 | 1 | 27 | 1 |
22 | Auto | 28 | Auto |
23 | 29 | ||
24 | udhcpc needs to output the dhcp information so interfaces can read it | 30 | udhcpc needs to output the dhcp information so interfaces can read it |
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index e7b842b..b988822 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -1,102 +1,102 @@ | |||
1 | #include "wlanimp2.h" | 1 | #include "wlanimp2.h" |
2 | #include "keyedit.h" | 2 | #include "keyedit.h" |
3 | #include "interfacesetupimp.h" | 3 | #include "interfacesetupimp.h" |
4 | 4 | ||
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qtextstream.h> | 7 | #include <qtextstream.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qlabel.h> | 10 | #include <qlabel.h> |
11 | #include <qspinbox.h> | 11 | #include <qspinbox.h> |
12 | #include <qradiobutton.h> | 12 | #include <qradiobutton.h> |
13 | #include <qcheckbox.h> | 13 | #include <qcheckbox.h> |
14 | #include <qtabwidget.h> | 14 | #include <qtabwidget.h> |
15 | #include <qcombobox.h> | 15 | #include <qcombobox.h> |
16 | 16 | ||
17 | #ifdef QWS | 17 | #ifdef QWS |
18 | #include <opie/oprocess.h> | 18 | #include <opie/oprocess.h> |
19 | #else | 19 | #else |
20 | #define OProcess KProcess | 20 | #define OProcess KProcess |
21 | #include <kprocess.h> | 21 | #include <kprocess.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 24 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
25 | #define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools" | 25 | #define PREUP "/etc/netwrok/if-pre-up.d/wireless-tools" |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Constructor, read in the wireless.opts file for parsing later. | 28 | * Constructor, read in the wireless.opts file for parsing later. |
29 | */ | 29 | */ |
30 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) { | 30 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) { |
31 | interfaces = new Interfaces; | 31 | interfaces = new Interfaces; |
32 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 32 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
33 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 33 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
34 | 34 | ||
35 | // Check sanity - the existance of the wireless-tools if-pre-up script | 35 | // Check sanity - the existance of the wireless-tools if-pre-up script |
36 | QFile file(QString(PREUP)); | 36 | QFile file(QString(PREUP)); |
37 | if (file.exists()) { | 37 | if (file.exists()) { |
38 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); | 38 | qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | WLANImp::~WLANImp() { | 42 | WLANImp::~WLANImp() { |
43 | delete interfaces; | 43 | //FIXME: delete interfaces; |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Change the profile for both wireless settings and network settings. | 47 | * Change the profile for both wireless settings and network settings. |
48 | */ | 48 | */ |
49 | void WLANImp::setProfile(const QString &profile){ | 49 | void WLANImp::setProfile(const QString &profile){ |
50 | interfaceSetup->setProfile(profile); | 50 | interfaceSetup->setProfile(profile); |
51 | parseOpts(); | 51 | parseOpts(); |
52 | } | 52 | } |
53 | 53 | ||
54 | void WLANImp::parseOpts() { | 54 | void WLANImp::parseOpts() { |
55 | bool error; | 55 | bool error; |
56 | QString opt; | 56 | QString opt; |
57 | 57 | ||
58 | if (! interfaces->isInterfaceSet()) | 58 | if (! interfaces->isInterfaceSet()) |
59 | return; | 59 | return; |
60 | 60 | ||
61 | 61 | ||
62 | opt = interfaces->getInterfaceOption("wireless_essid", error); | 62 | opt = interfaces->getInterfaceOption("wireless_essid", error); |
63 | if(opt == "any" || opt == "off" || opt.isNull()){ | 63 | if(opt == "any" || opt == "off" || opt.isNull()){ |
64 | essid->setEditText("any"); | 64 | essid->setEditText("any"); |
65 | } else { | 65 | } else { |
66 | essid->setEditText(opt); | 66 | essid->setEditText(opt); |
67 | } | 67 | } |
68 | 68 | ||
69 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); | 69 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); |
70 | if (opt == "Auto") { | 70 | if (opt == "Auto") { |
71 | mode->setCurrentItem(0); | 71 | mode->setCurrentItem(0); |
72 | } else if (opt == "Ad-Hoc") { | 72 | } else if (opt == "Ad-Hoc") { |
73 | mode->setCurrentItem(2); | 73 | mode->setCurrentItem(2); |
74 | } else { | 74 | } else { |
75 | // Managed/Infrastructure mode | 75 | // Managed/Infrastructure mode |
76 | mode->setCurrentItem(1); | 76 | mode->setCurrentItem(1); |
77 | } | 77 | } |
78 | 78 | ||
79 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); | 79 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); |
80 | if (! opt.isNull()) { | 80 | if (! opt.isNull()) { |
81 | specifyAp->setChecked(true); | 81 | specifyAp->setChecked(true); |
82 | macEdit->setText(opt); | 82 | macEdit->setText(opt); |
83 | } | 83 | } |
84 | 84 | ||
85 | opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); | 85 | opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); |
86 | if (! opt.isNull()) { | 86 | if (! opt.isNull()) { |
87 | specifyChan->setChecked(true); | 87 | specifyChan->setChecked(true); |
88 | networkChannel->setValue(opt.toInt()); | 88 | networkChannel->setValue(opt.toInt()); |
89 | } | 89 | } |
90 | 90 | ||
91 | opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); | 91 | opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); |
92 | if (opt.isNull()) | 92 | if (opt.isNull()) |
93 | opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace(); | 93 | opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace(); |
94 | parseKeyStr(opt); | 94 | parseKeyStr(opt); |
95 | } | 95 | } |
96 | 96 | ||
97 | void WLANImp::parseKeyStr(QString keystr) { | 97 | void WLANImp::parseKeyStr(QString keystr) { |
98 | int loc = 0; | 98 | int loc = 0; |
99 | int index = 1; | 99 | int index = 1; |
100 | QString key; | 100 | QString key; |
101 | QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); | 101 | QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); |
102 | int enc = -1; // encryption state | 102 | int enc = -1; // encryption state |
@@ -111,115 +111,115 @@ void WLANImp::parseKeyStr(QString keystr) { | |||
111 | } else if ((*it).left(4) == "open") { | 111 | } else if ((*it).left(4) == "open") { |
112 | // open mode, accept non encrypted packets | 112 | // open mode, accept non encrypted packets |
113 | acceptNonEnc->setChecked(true); | 113 | acceptNonEnc->setChecked(true); |
114 | } else if ((*it).left(10) == "restricted") { | 114 | } else if ((*it).left(10) == "restricted") { |
115 | // restricted mode, only accept encrypted packets | 115 | // restricted mode, only accept encrypted packets |
116 | rejectNonEnc->setChecked(true); | 116 | rejectNonEnc->setChecked(true); |
117 | } else if ((*it).left(3) == "key") { | 117 | } else if ((*it).left(3) == "key") { |
118 | // new set of options | 118 | // new set of options |
119 | } else if ((*it).left(1) == "[") { | 119 | } else if ((*it).left(1) == "[") { |
120 | index = (*it).mid(1, 1).toInt(); | 120 | index = (*it).mid(1, 1).toInt(); |
121 | // switch current key to index | 121 | // switch current key to index |
122 | switch (index) { | 122 | switch (index) { |
123 | case 1: | 123 | case 1: |
124 | keyRadio0->setChecked(true); | 124 | keyRadio0->setChecked(true); |
125 | break; | 125 | break; |
126 | case 2: | 126 | case 2: |
127 | keyRadio1->setChecked(true); | 127 | keyRadio1->setChecked(true); |
128 | break; | 128 | break; |
129 | case 3: | 129 | case 3: |
130 | keyRadio2->setChecked(true); | 130 | keyRadio2->setChecked(true); |
131 | break; | 131 | break; |
132 | case 4: | 132 | case 4: |
133 | keyRadio3->setChecked(true); | 133 | keyRadio3->setChecked(true); |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | } else { | 136 | } else { |
137 | // key | 137 | // key |
138 | key = (*it); | 138 | key = (*it); |
139 | } | 139 | } |
140 | if (! key.isNull()) { | 140 | if (! key.isNull()) { |
141 | if (enc == -1) | 141 | if (enc == -1) |
142 | enc = 1; | 142 | enc = 1; |
143 | QStringList::Iterator next = ++it; | 143 | QStringList::Iterator next = ++it; |
144 | if (it == keys.end()) { | 144 | if (it == keys.end()) { |
145 | break; | 145 | break; |
146 | } | 146 | } |
147 | if ((*(next)).left(1) == "[") { | 147 | if ((*(next)).left(1) == "[") { |
148 | // set key at index | 148 | // set key at index |
149 | index = (*(next)).mid(1, 1).toInt(); | 149 | index = (*(next)).mid(1, 1).toInt(); |
150 | } else { | 150 | } else { |
151 | index = 1; | 151 | index = 1; |
152 | } | 152 | } |
153 | switch (index) { | 153 | switch (index) { |
154 | case 1: | 154 | case 1: |
155 | keyLineEdit0->setText(key); | 155 | keyLineEdit0->setText(key); |
156 | break; | 156 | break; |
157 | case 2: | 157 | case 2: |
158 | keyLineEdit1->setText(key); | 158 | keyLineEdit1->setText(key); |
159 | break; | 159 | break; |
160 | case 3: | 160 | case 3: |
161 | keyLineEdit2->setText(key); | 161 | keyLineEdit2->setText(key); |
162 | break; | 162 | break; |
163 | case 4: | 163 | case 4: |
164 | keyLineEdit3->setText(key); | 164 | keyLineEdit3->setText(key); |
165 | break; | 165 | break; |
166 | } | 166 | } |
167 | key = QString::null; | 167 | key = QString::null; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | if (enc == 1) { | 170 | if (enc == 1) { |
171 | wepEnabled->setChecked(true); | 171 | wepEnabled->setChecked(true); |
172 | } else { | 172 | } else { |
173 | wepEnabled->setChecked(false); | 173 | wepEnabled->setChecked(false); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * Check to see if the current config is valid | 178 | * Check to see if the current config is valid |
179 | * Save interfaces | 179 | * Save interfaces |
180 | */ | 180 | */ |
181 | void WLANImp::accept() { | 181 | void WLANImp::accept() { |
182 | if (wepEnabled->isChecked()) { | 182 | if (wepEnabled->isChecked()) { |
183 | if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) || | 183 | if ((keyRadio0->isChecked() && keyLineEdit0->text().isEmpty()) || |
184 | (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) || | 184 | (keyRadio1->isChecked() && keyLineEdit1->text().isEmpty()) || |
185 | (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) || | 185 | (keyRadio2->isChecked() && keyLineEdit2->text().isEmpty()) || |
186 | (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) { | 186 | (keyRadio3->isChecked() && keyLineEdit3->text().isEmpty())) { |
187 | QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok); | 187 | QMessageBox::information(this, "Error", "Please enter a WEP key.", QMessageBox::Ok); |
188 | return; | 188 | return; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | if (essid->currentText().isEmpty()) { | 192 | if (essid->currentText().isEmpty()) { |
193 | QMessageBox::information(this, "Error", "Please select/enter an ESSID.", QMessageBox::Ok); | 193 | QMessageBox::information(this, "Error", "Please select/enter an ESSID.", QMessageBox::Ok); |
194 | return; | 194 | return; |
195 | } | 195 | } |
196 | 196 | ||
197 | if (specifyAp->isChecked() && macEdit->text().isEmpty()) { | 197 | if (specifyAp->isChecked() && macEdit->text().isEmpty()) { |
198 | QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok); | 198 | QMessageBox::information(this, "Error", "Please enter the MAC address of the Access Point.", QMessageBox::Ok); |
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | 201 | ||
202 | // Try to save the interfaces settings. | 202 | // Try to save the interfaces settings. |
203 | writeOpts(); | 203 | writeOpts(); |
204 | 204 | ||
205 | // Close out the dialog | 205 | // Close out the dialog |
206 | QDialog::accept(); | 206 | QDialog::accept(); |
207 | } | 207 | } |
208 | 208 | ||
209 | void WLANImp::writeOpts() { | 209 | void WLANImp::writeOpts() { |
210 | bool error = false; | 210 | bool error = false; |
211 | 211 | ||
212 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); | 212 | interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText()); |
213 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); | 213 | interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText()); |
214 | 214 | ||
215 | if (specifyAp->isChecked()) { | 215 | if (specifyAp->isChecked()) { |
216 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); | 216 | interfaces->setInterfaceOption(QString("wireless_ap"), macEdit->text()); |
217 | } else { | 217 | } else { |
218 | interfaces->removeInterfaceOption(QString("wireless_ap")); | 218 | interfaces->removeInterfaceOption(QString("wireless_ap")); |
219 | } | 219 | } |
220 | 220 | ||
221 | if (specifyChan->isChecked()) { | 221 | if (specifyChan->isChecked()) { |
222 | interfaces->setInterfaceOption(QString("wireless_channel"), networkChannel->text()); | 222 | interfaces->setInterfaceOption(QString("wireless_channel"), networkChannel->text()); |
223 | } else { | 223 | } else { |
224 | interfaces->removeInterfaceOption(QString("wireless_channel")); | 224 | interfaces->removeInterfaceOption(QString("wireless_channel")); |
225 | } | 225 | } |
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 3c988d5..e6f082c 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,47 +1,51 @@ | |||
1 | #include "wlanmodule.h" | 1 | #include "wlanmodule.h" |
2 | #include "wlanimp.h" | 2 | #include "wlanimp.h" |
3 | #include "infoimp.h" | 3 | #include "infoimp.h" |
4 | #include "wextensions.h" | 4 | #include "wextensions.h" |
5 | #include "interfaceinformationimp.h" | 5 | #include "interfaceinformationimp.h" |
6 | 6 | ||
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qprogressbar.h> | 8 | #include <qprogressbar.h> |
9 | #include <qtabwidget.h> | 9 | #include <qtabwidget.h> |
10 | 10 | ||
11 | |||
12 | |||
13 | |||
11 | /** | 14 | /** |
12 | * Constructor, find all of the possible interfaces | 15 | * Constructor, find all of the possible interfaces |
13 | */ | 16 | */ |
14 | WLANModule::WLANModule() : Module() { | 17 | WLANModule::WLANModule() : Module() { |
15 | } | 18 | } |
16 | 19 | ||
17 | /** | 20 | /** |
18 | * Delete any interfaces that we own. | 21 | * Delete any interfaces that we own. |
19 | */ | 22 | */ |
20 | WLANModule::~WLANModule(){ | 23 | WLANModule::~WLANModule(){ |
21 | Interface *i; | 24 | Interface *i; |
22 | for ( i=list.first(); i != 0; i=list.next() ) | 25 | for ( i=list.first(); i != 0; i=list.next() ) |
23 | delete i; | 26 | delete i; |
27 | |||
24 | } | 28 | } |
25 | 29 | ||
26 | /** | 30 | /** |
27 | * Change the current profile | 31 | * Change the current profile |
28 | */ | 32 | */ |
29 | void WLANModule::setProfile(const QString &newProfile){ | 33 | void WLANModule::setProfile(const QString &newProfile){ |
30 | profile = newProfile; | 34 | profile = newProfile; |
31 | } | 35 | } |
32 | 36 | ||
33 | /** | 37 | /** |
34 | * get the icon name for this device. | 38 | * get the icon name for this device. |
35 | * @param Interface* can be used in determining the icon. | 39 | * @param Interface* can be used in determining the icon. |
36 | * @return QString the icon name (minus .png, .gif etc) | 40 | * @return QString the icon name (minus .png, .gif etc) |
37 | */ | 41 | */ |
38 | QString WLANModule::getPixmapName(Interface* ){ | 42 | QString WLANModule::getPixmapName(Interface* ){ |
39 | return "wlan"; | 43 | return "wlan"; |
40 | } | 44 | } |
41 | 45 | ||
42 | /** | 46 | /** |
43 | * Check to see if the interface i is owned by this module. | 47 | * Check to see if the interface i is owned by this module. |
44 | * @param Interface* interface to check against | 48 | * @param Interface* interface to check against |
45 | * @return bool true if i is owned by this module, false otherwise. | 49 | * @return bool true if i is owned by this module, false otherwise. |
46 | */ | 50 | */ |
47 | bool WLANModule::isOwner(Interface *i){ | 51 | bool WLANModule::isOwner(Interface *i){ |
@@ -52,52 +56,49 @@ bool WLANModule::isOwner(Interface *i){ | |||
52 | i->setHardwareName("802.11b"); | 56 | i->setHardwareName("802.11b"); |
53 | list.append(i); | 57 | list.append(i); |
54 | return true; | 58 | return true; |
55 | } | 59 | } |
56 | 60 | ||
57 | /** | 61 | /** |
58 | * Create, and return the WLANConfigure Module | 62 | * Create, and return the WLANConfigure Module |
59 | * @return QWidget* pointer to this modules configure. | 63 | * @return QWidget* pointer to this modules configure. |
60 | */ | 64 | */ |
61 | QWidget *WLANModule::configure(Interface *i){ | 65 | QWidget *WLANModule::configure(Interface *i){ |
62 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); | 66 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); |
63 | wlanconfig->setProfile(profile); | 67 | wlanconfig->setProfile(profile); |
64 | return wlanconfig; | 68 | return wlanconfig; |
65 | } | 69 | } |
66 | 70 | ||
67 | /** | 71 | /** |
68 | * Create, and return the Information Module | 72 | * Create, and return the Information Module |
69 | * @return QWidget* pointer to this modules info. | 73 | * @return QWidget* pointer to this modules info. |
70 | */ | 74 | */ |
71 | QWidget *WLANModule::information(Interface *i){ | 75 | QWidget *WLANModule::information(Interface *i){ |
72 | WExtensions we(i->getInterfaceName()); | 76 | WExtensions we(i->getInterfaceName()); |
73 | if(!we.doesHaveWirelessExtensions()) | 77 | if(!we.doesHaveWirelessExtensions()) |
74 | return NULL; | 78 | return NULL; |
75 | 79 | ||
76 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | 80 | return getInfo( i ); |
77 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | ||
78 | info->tabWidget->insertTab(information, "TCP/IP"); | ||
79 | return info; | ||
80 | } | 81 | } |
81 | 82 | ||
82 | /** | 83 | /** |
83 | * Get all active (up or down) interfaces | 84 | * Get all active (up or down) interfaces |
84 | * @return QList<Interface> A list of interfaces that exsist that havn't | 85 | * @return QList<Interface> A list of interfaces that exsist that havn't |
85 | * been called by isOwner() | 86 | * been called by isOwner() |
86 | */ | 87 | */ |
87 | QList<Interface> WLANModule::getInterfaces(){ | 88 | QList<Interface> WLANModule::getInterfaces(){ |
88 | return list; | 89 | return list; |
89 | } | 90 | } |
90 | 91 | ||
91 | /** | 92 | /** |
92 | * Attempt to add a new interface as defined by name | 93 | * Attempt to add a new interface as defined by name |
93 | * @param name the name of the type of interface that should be created given | 94 | * @param name the name of the type of interface that should be created given |
94 | * by possibleNewInterfaces(); | 95 | * by possibleNewInterfaces(); |
95 | * @return Interface* NULL if it was unable to be created. | 96 | * @return Interface* NULL if it was unable to be created. |
96 | */ | 97 | */ |
97 | Interface *WLANModule::addNewInterface(const QString &){ | 98 | Interface *WLANModule::addNewInterface(const QString &){ |
98 | // We can't add a 802.11 interface, either the hardware will be there | 99 | // We can't add a 802.11 interface, either the hardware will be there |
99 | // or it wont. | 100 | // or it wont. |
100 | return NULL; | 101 | return NULL; |
101 | } | 102 | } |
102 | 103 | ||
103 | /** | 104 | /** |
@@ -107,47 +108,80 @@ Interface *WLANModule::addNewInterface(const QString &){ | |||
107 | bool WLANModule::remove(Interface*){ | 108 | bool WLANModule::remove(Interface*){ |
108 | // Can't remove a hardware device, you can stop it though. | 109 | // Can't remove a hardware device, you can stop it though. |
109 | return false; | 110 | return false; |
110 | } | 111 | } |
111 | 112 | ||
112 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | 113 | void WLANModule::receive(const QCString ¶m, const QByteArray &arg) |
113 | { | 114 | { |
114 | qDebug("WLANModule::receive "+param); | 115 | qDebug("WLANModule::receive "+param); |
115 | QStringList params = QStringList::split(",",param); | 116 | QStringList params = QStringList::split(",",param); |
116 | int count = params.count(); | 117 | int count = params.count(); |
117 | qDebug("got %i params", count ); | 118 | qDebug("got %i params", count ); |
118 | if (count < 2){ | 119 | if (count < 2){ |
119 | qDebug("Erorr less than 2 parameter"); | 120 | qDebug("Erorr less than 2 parameter"); |
120 | qDebug("RETURNING"); | 121 | qDebug("RETURNING"); |
121 | return; | 122 | return; |
122 | } | 123 | } |
123 | 124 | ||
124 | QDataStream stream(arg,IO_ReadOnly); | 125 | QDataStream stream(arg,IO_ReadOnly); |
125 | QString interface; | 126 | QString interface; |
126 | QString action; | 127 | QString action; |
127 | 128 | ||
128 | stream >> interface; | 129 | stream >> interface; |
129 | stream >> action; | 130 | stream >> action; |
130 | qDebug("got interface %s and acion %s", interface.latin1(), action.latin1()); | 131 | qDebug("got interface %s and acion %s", interface.latin1(), action.latin1()); |
132 | // find interfaces | ||
133 | Interface *ifa=0; | ||
134 | for ( Interface *i=list.first(); i != 0; i=list.next() ){ | ||
135 | if (i->getInterfaceName() == interface){ | ||
136 | qDebug("found interface %s",interface.latin1()); | ||
137 | ifa = i; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | if (ifa == 0){ | ||
142 | qFatal("Did not find %s",interface.latin1()); | ||
143 | } | ||
131 | 144 | ||
132 | if (count == 2){ | 145 | if (count == 2){ |
133 | // those should call the interface | 146 | // those should call the interface directly |
147 | QWidget *info = getInfo( ifa ); | ||
148 | info->showMaximized(); | ||
149 | |||
134 | if ( action.contains("start" ) ){ | 150 | if ( action.contains("start" ) ){ |
135 | qDebug("starting %s not yet implemented",interface.latin1()); | 151 | ifa->start(); |
136 | } else if ( action.contains("restart" ) ){ | 152 | } else if ( action.contains("restart" ) ){ |
137 | qDebug("restarting %s not yet implemented",interface.latin1()); | 153 | ifa->restart(); |
138 | } else if ( action.contains("stop" ) ){ | 154 | } else if ( action.contains("stop" ) ){ |
139 | qDebug("stopping %s not yet implemented",interface.latin1()); | 155 | ifa->stop(); |
156 | }else if ( action.contains("refresh" ) ){ | ||
157 | ifa->refresh(); | ||
140 | } | 158 | } |
141 | }else if (count == 3){ | 159 | }else if (count == 3){ |
142 | QString value; | 160 | QString value; |
143 | stream >> value; | 161 | stream >> value; |
144 | qDebug("setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); | 162 | qDebug("setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); |
163 | if ( action.contains("ESSID") ){ | ||
164 | qDebug("Setting ESSID not yet impl"); | ||
165 | }else if (action.contains("Channel")){ | ||
166 | qDebug("Setting Channel not yet impl"); | ||
167 | }else | ||
168 | qDebug("wlan plugin has no clue"); | ||
145 | } | 169 | } |
146 | // if (param.contains("QString,QString,QString")) { | 170 | // if (param.contains("QString,QString,QString")) { |
147 | // QDataStream stream(arg,IO_ReadOnly); | 171 | // QDataStream stream(arg,IO_ReadOnly); |
148 | // QString arg1, arg2, arg3; | 172 | // QString arg1, arg2, arg3; |
149 | // stream >> arg1 >> arg2 >> arg3 ; | 173 | // stream >> arg1 >> arg2 >> arg3 ; |
150 | // qDebug("interface >%s< setting >%s< value >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1()); | 174 | // qDebug("interface >%s< setting >%s< value >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1()); |
151 | // } | 175 | // } |
152 | } | 176 | } |
153 | 177 | ||
178 | QWidget *WLANModule::getInfo( Interface *i) | ||
179 | { | ||
180 | qDebug("WLANModule::getInfo start"); | ||
181 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | ||
182 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | ||
183 | info->tabWidget->insertTab(information, "TCP/IP", 0); | ||
184 | |||
185 | qDebug("WLANModule::getInfo return"); | ||
186 | return info; | ||
187 | } | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h index a617a90..0963137 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.h +++ b/noncore/settings/networksettings/wlan/wlanmodule.h | |||
@@ -1,44 +1,49 @@ | |||
1 | #ifndef WLAN_MODULE_H | 1 | #ifndef WLAN_MODULE_H |
2 | #define WLAN_MODULE_H | 2 | #define WLAN_MODULE_H |
3 | 3 | ||
4 | #include "module.h" | 4 | #include "module.h" |
5 | 5 | ||
6 | //class WlanInfoImp; | ||
7 | |||
6 | class WLANModule : Module{ | 8 | class WLANModule : Module{ |
7 | 9 | ||
8 | signals: | 10 | signals: |
9 | void updateInterface(Interface *i); | 11 | void updateInterface(Interface *i); |
10 | 12 | ||
11 | public: | 13 | public: |
12 | WLANModule(); | 14 | WLANModule(); |
13 | ~WLANModule(); | 15 | ~WLANModule(); |
14 | 16 | ||
15 | 17 | ||
16 | virtual const QString type() {return "wlan";}; | 18 | virtual const QString type() {return "wlan";}; |
17 | void setProfile(const QString &newProfile); | 19 | void setProfile(const QString &newProfile); |
18 | bool isOwner(Interface *); | 20 | bool isOwner(Interface *); |
19 | QWidget *configure(Interface *i); | 21 | QWidget *configure(Interface *i); |
20 | QWidget *information(Interface *i); | 22 | QWidget *information(Interface *i); |
21 | QList<Interface> getInterfaces(); | 23 | QList<Interface> getInterfaces(); |
22 | void possibleNewInterfaces(QMap<QString, QString> &){}; | 24 | void possibleNewInterfaces(QMap<QString, QString> &){}; |
23 | Interface *addNewInterface(const QString &name); | 25 | Interface *addNewInterface(const QString &name); |
24 | bool remove(Interface* i); | 26 | bool remove(Interface* i); |
25 | QString getPixmapName(Interface* i); | 27 | QString getPixmapName(Interface* i); |
26 | virtual void receive(const QCString&, const QByteArray&); | 28 | virtual void receive(const QCString&, const QByteArray&); |
27 | 29 | ||
28 | private: | 30 | private: |
31 | QWidget *getInfo(Interface*); | ||
32 | |||
29 | QList<Interface> list; | 33 | QList<Interface> list; |
30 | QString profile; | 34 | QString profile; |
31 | 35 | // WlanInfoImp *info; | |
36 | // Interface *iface; | ||
32 | }; | 37 | }; |
33 | 38 | ||
34 | extern "C" | 39 | extern "C" |
35 | { | 40 | { |
36 | void* create_plugin() { | 41 | void* create_plugin() { |
37 | return new WLANModule(); | 42 | return new WLANModule(); |
38 | } | 43 | } |
39 | }; | 44 | }; |
40 | 45 | ||
41 | #endif | 46 | #endif |
42 | 47 | ||
43 | // wlanmodule.h | 48 | // wlanmodule.h |
44 | 49 | ||