19 files changed, 59 insertions, 47 deletions
diff --git a/noncore/net/networksetup/TODO b/noncore/net/networksetup/TODO index 0584f81..ec6d2c6 100644 --- a/noncore/net/networksetup/TODO +++ b/noncore/net/networksetup/TODO | |||
@@ -1,16 +1,16 @@ | |||
1 | CLEAN UP | 1 | CLEAN UP |
2 | 2 | ||
3 | Fix Profiles | 3 | Fix Profiles |
4 | 4 | ||
5 | Write dns script | 5 | Write dns script |
6 | 6 | ||
7 | |||
8 | WLAN needs to be re-written to not use Config | 7 | WLAN needs to be re-written to not use Config |
9 | WHERE Is DHCP info stored??? | ||
10 | |||
11 | PPP module needs to be written | ||
12 | 8 | ||
13 | Write a class that parses /proc and not ifconfig | 9 | Write a class that parses /proc and not ifconfig |
10 | udchcp needs to output the dhcp information | ||
11 | |||
12 | Possible other modules to write: ppp, ipsec, bluetooth, ipchains | ||
13 | |||
14 | PPP module needs to scan pppd.tdb to see what is currently active | ||
14 | 15 | ||
15 | Possible other modules: ipsec, bluetooth, ipchains | ||
16 | 16 | ||
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp index 97c05cc..d42b45d 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp | |||
@@ -72,48 +72,49 @@ bool InterfaceSetupImp::saveSettings(){ | |||
72 | } | 72 | } |
73 | else{ | 73 | else{ |
74 | interfaces->setInterfaceMethod("static"); | 74 | interfaces->setInterfaceMethod("static"); |
75 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 75 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
76 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 76 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
77 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 77 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
78 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 78 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
79 | interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); | 79 | interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); |
80 | interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); | 80 | interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); |
81 | } | 81 | } |
82 | 82 | ||
83 | // IP Information | 83 | // IP Information |
84 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 84 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
85 | return true; | 85 | return true; |
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * The Profile has changed. | 89 | * The Profile has changed. |
90 | * @profile the new profile. | 90 | * @profile the new profile. |
91 | */ | 91 | */ |
92 | void InterfaceSetupImp::setProfile(const QString &profile){ | 92 | void InterfaceSetupImp::setProfile(const QString &profile){ |
93 | QString newInterfaceName = interface->getInterfaceName(); | 93 | QString newInterfaceName = interface->getInterfaceName(); |
94 | if(profile.length() > 0) | 94 | if(profile.length() > 0) |
95 | newInterfaceName += "_" + profile; | 95 | newInterfaceName += "_" + profile; |
96 | qDebug("InterfaceSetupImp::setProfile"); | ||
96 | // See if we have to make a interface. | 97 | // See if we have to make a interface. |
97 | if(!interfaces->setInterface(newInterfaceName)){ | 98 | if(!interfaces->setInterface(newInterfaceName)){ |
98 | // Add making for this new interface if need too | 99 | // Add making for this new interface if need too |
99 | if(profile != ""){ | 100 | if(profile != ""){ |
100 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 101 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
101 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 102 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
102 | interfaces->addMapping(interface->getInterfaceName()); | 103 | interfaces->addMapping(interface->getInterfaceName()); |
103 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 104 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
104 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); | 105 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); |
105 | return; | 106 | return; |
106 | } | 107 | } |
107 | } | 108 | } |
108 | interfaces->setMap("map", newInterfaceName); | 109 | interfaces->setMap("map", newInterfaceName); |
109 | interfaces->setScript("getprofile.sh"); | 110 | interfaces->setScript("getprofile.sh"); |
110 | } | 111 | } |
111 | else{ | 112 | else{ |
112 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 113 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
113 | if(!interfaces->setInterface(newInterfaceName)){ | 114 | if(!interfaces->setInterface(newInterfaceName)){ |
114 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); | 115 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); |
115 | return; | 116 | return; |
116 | } | 117 | } |
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.h b/noncore/net/networksetup/interfaces/interfacesetupimp.h index 936f2be..3bbf34e 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.h +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.h | |||
@@ -8,42 +8,48 @@ class Interface; | |||
8 | class Interfaces; | 8 | class Interfaces; |
9 | 9 | ||
10 | class InterfaceSetupImp : public InterfaceSetup { | 10 | class InterfaceSetupImp : public InterfaceSetup { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); | 14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); |
15 | void saveChanges(); | 15 | void saveChanges(); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void setProfile(const QString &profile); | 18 | void setProfile(const QString &profile); |
19 | bool saveSettings(); | 19 | bool saveSettings(); |
20 | private: | 20 | private: |
21 | Interfaces *interfaces; | 21 | Interfaces *interfaces; |
22 | Interface *interface; | 22 | Interface *interface; |
23 | 23 | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | 26 | ||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | class InterfaceSetupImpDialog : public QDialog { | 29 | class InterfaceSetupImpDialog : public QDialog { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ | 33 | InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ |
34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); | 34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); |
35 | setCaption("Interface Setup"); | 35 | setCaption("Interface Setup"); |
36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); | 36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); |
37 | InterfaceSetupLayout->addWidget( interfaceSetup ); | 37 | InterfaceSetupLayout->addWidget( interfaceSetup ); |
38 | }; | 38 | }; |
39 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; | ||
39 | 40 | ||
41 | private: | ||
40 | InterfaceSetupImp *interfaceSetup; | 42 | InterfaceSetupImp *interfaceSetup; |
41 | 43 | ||
42 | protected slots: | 44 | protected slots: |
43 | void accept(){ interfaceSetup->saveChanges(); }; | 45 | void accept(){ |
46 | interfaceSetup->saveChanges(); | ||
47 | QDialog::accept(); | ||
48 | }; | ||
49 | |||
44 | }; | 50 | }; |
45 | 51 | ||
46 | #endif | 52 | #endif |
47 | 53 | ||
48 | // interfacesetupimp.h | 54 | // interfacesetupimp.h |
49 | 55 | ||
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp index b9fff56..6440bd4 100644 --- a/noncore/net/networksetup/mainwindowimp.cpp +++ b/noncore/net/networksetup/mainwindowimp.cpp | |||
@@ -209,93 +209,85 @@ void MainWindowImp::removeClicked(){ | |||
209 | } | 209 | } |
210 | else{ | 210 | else{ |
211 | if(!i->getModuleOwner()->remove(i)) | 211 | if(!i->getModuleOwner()->remove(i)) |
212 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); | 212 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); |
213 | else{ | 213 | else{ |
214 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); | 214 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); |
215 | // TODO memory managment.... | 215 | // TODO memory managment.... |
216 | // who deletes the interface? | 216 | // who deletes the interface? |
217 | } | 217 | } |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Pull up the configure about the currently selected interface. | 222 | * Pull up the configure about the currently selected interface. |
223 | * Report an error if no interface is selected. | 223 | * Report an error if no interface is selected. |
224 | * If the interface has a module owner then request its configure. | 224 | * If the interface has a module owner then request its configure. |
225 | */ | 225 | */ |
226 | void MainWindowImp::configureClicked(){ | 226 | void MainWindowImp::configureClicked(){ |
227 | QListViewItem *item = connectionList->currentItem(); | 227 | QListViewItem *item = connectionList->currentItem(); |
228 | if(!item){ | 228 | if(!item){ |
229 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 229 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | 232 | ||
233 | QString currentProfile = currentProfileLabel->text(); | ||
234 | if(profilesList->count() <= 1 || currentProfile == "All"){ | ||
235 | currentProfile = ""; | ||
236 | } | ||
237 | |||
238 | Interface *i = interfaceItems[item]; | 233 | Interface *i = interfaceItems[item]; |
239 | if(i->getModuleOwner()){ | 234 | if(i->getModuleOwner()){ |
240 | i->getModuleOwner()->setProfile(currentProfile); | ||
241 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); | 235 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); |
242 | if(moduleConfigure != NULL){ | 236 | if(moduleConfigure != NULL){ |
243 | moduleConfigure->showMaximized(); | 237 | moduleConfigure->showMaximized(); |
244 | moduleConfigure->show(); | 238 | moduleConfigure->show(); |
245 | return; | 239 | return; |
246 | } | 240 | } |
247 | } | 241 | } |
248 | 242 | ||
249 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); | 243 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); |
250 | //configure->setProfile(currentProfile); | 244 | QString currentProfileText = currentProfileLabel->text(); |
245 | if(currentProfileText.upper() == "ALL"); | ||
246 | currentProfileText = ""; | ||
247 | configure->setProfile(currentProfileText); | ||
251 | configure->showMaximized(); | 248 | configure->showMaximized(); |
252 | configure->show(); | 249 | configure->show(); |
253 | } | 250 | } |
254 | 251 | ||
255 | /** | 252 | /** |
256 | * Pull up the information about the currently selected interface. | 253 | * Pull up the information about the currently selected interface. |
257 | * Report an error if no interface is selected. | 254 | * Report an error if no interface is selected. |
258 | * If the interface has a module owner then request its configure. | 255 | * If the interface has a module owner then request its configure. |
259 | */ | 256 | */ |
260 | void MainWindowImp::informationClicked(){ | 257 | void MainWindowImp::informationClicked(){ |
261 | QListViewItem *item = connectionList->currentItem(); | 258 | QListViewItem *item = connectionList->currentItem(); |
262 | if(!item){ | 259 | if(!item){ |
263 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 260 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
264 | return; | 261 | return; |
265 | } | 262 | } |
266 | 263 | ||
267 | Interface *i = interfaceItems[item]; | 264 | Interface *i = interfaceItems[item]; |
268 | if(!i->isAttached()){ | 265 | if(!i->isAttached()){ |
269 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 266 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
270 | return; | 267 | return; |
271 | } | 268 | } |
272 | 269 | ||
273 | QStringList list; | ||
274 | for(uint i = 0; i < profilesList->count(); i++){ | ||
275 | list.append(profilesList->text(i)); | ||
276 | } | ||
277 | |||
278 | if(i->getModuleOwner()){ | 270 | if(i->getModuleOwner()){ |
279 | QWidget *moduleInformation = i->getModuleOwner()->information(i); | 271 | QWidget *moduleInformation = i->getModuleOwner()->information(i); |
280 | if(moduleInformation != NULL){ | 272 | if(moduleInformation != NULL){ |
281 | moduleInformation->showMaximized(); | 273 | moduleInformation->showMaximized(); |
282 | moduleInformation->show(); | 274 | moduleInformation->show(); |
283 | return; | 275 | return; |
284 | } | 276 | } |
285 | } | 277 | } |
286 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); | 278 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); |
287 | information->showMaximized(); | 279 | information->showMaximized(); |
288 | information->show(); | 280 | information->show(); |
289 | } | 281 | } |
290 | 282 | ||
291 | /** | 283 | /** |
292 | * Aquire the list of active interfaces from ifconfig | 284 | * Aquire the list of active interfaces from ifconfig |
293 | * Call ifconfig and ifconfig -a | 285 | * Call ifconfig and ifconfig -a |
294 | */ | 286 | */ |
295 | void MainWindowImp::getInterfaceList(){ | 287 | void MainWindowImp::getInterfaceList(){ |
296 | KShellProcess *processAll = new KShellProcess(); | 288 | KShellProcess *processAll = new KShellProcess(); |
297 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 289 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
298 | connect(processAll, SIGNAL(processExited(KProcess *)), | 290 | connect(processAll, SIGNAL(processExited(KProcess *)), |
299 | this, SLOT(jobDone(KProcess *))); | 291 | this, SLOT(jobDone(KProcess *))); |
300 | threads.insert(processAll, TEMP_ALL); | 292 | threads.insert(processAll, TEMP_ALL); |
301 | 293 | ||
@@ -517,28 +509,29 @@ void MainWindowImp::changeProfile(){ | |||
517 | if(profilesList->currentItem() == -1){ | 509 | if(profilesList->currentItem() == -1){ |
518 | QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok"); | 510 | QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok"); |
519 | return; | 511 | return; |
520 | } | 512 | } |
521 | QString newProfile = profilesList->text(profilesList->currentItem()); | 513 | QString newProfile = profilesList->text(profilesList->currentItem()); |
522 | if(newProfile != currentProfileLabel->text()){ | 514 | if(newProfile != currentProfileLabel->text()){ |
523 | currentProfileLabel->setText(newProfile); | 515 | currentProfileLabel->setText(newProfile); |
524 | QFile::remove(scheme); | 516 | QFile::remove(scheme); |
525 | QFile file(scheme); | 517 | QFile file(scheme); |
526 | if ( file.open(IO_ReadWrite) ) { | 518 | if ( file.open(IO_ReadWrite) ) { |
527 | QTextStream stream( &file ); | 519 | QTextStream stream( &file ); |
528 | stream << QString("SCHEME=%1").arg(newProfile); | 520 | stream << QString("SCHEME=%1").arg(newProfile); |
529 | file.close(); | 521 | file.close(); |
530 | } | 522 | } |
531 | // restart all up devices? | 523 | // restart all up devices? |
532 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ | 524 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ |
533 | // Go through them one by one | 525 | // Go through them one by one |
534 | QMap<Interface*, QListViewItem*>::Iterator it; | 526 | QMap<Interface*, QListViewItem*>::Iterator it; |
535 | for( it = items.begin(); it != items.end(); ++it ){ | 527 | for( it = items.begin(); it != items.end(); ++it ){ |
536 | if(it.key()->getStatus() == true) | 528 | if(it.key()->getStatus() == true) |
537 | it.key()->restart(); | 529 | it.key()->restart(); |
538 | } | 530 | } |
539 | } | 531 | } |
540 | } | 532 | } |
533 | // TODO change the profile in the modules | ||
541 | } | 534 | } |
542 | 535 | ||
543 | // mainwindowimp.cpp | 536 | // mainwindowimp.cpp |
544 | 537 | ||
diff --git a/noncore/net/networksetup/networksetup.pro b/noncore/net/networksetup/networksetup.pro index 1719a35..5666a42 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 defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp kprocctrl.cpp kprocess.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp kprocctrl.cpp kprocess.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ | 7 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ |
8 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan | 8 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan |
9 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -linterfaces | 9 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -Linterfaces/ -linterfaces |
10 | INTERFACES = mainwindow.ui addconnection.ui | 10 | INTERFACES = mainwindow.ui addconnection.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |
diff --git a/noncore/net/networksetup/opie-networksetup.control b/noncore/net/networksetup/opie-networksetup.control index 35bac52..d14e2d1 100644 --- a/noncore/net/networksetup/opie-networksetup.control +++ b/noncore/net/networksetup/opie-networksetup.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 $OPIEDIR/bin/changedns.sh $OPIEDIR/bin/getprofile.sh |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Opie network setup tool |
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index a466020..74bf390 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -12,48 +12,52 @@ | |||
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 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
20 | #include "interfacesetupimp.h" | 20 | #include "interfacesetupimp.h" |
21 | 21 | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ | 22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ |
23 | config = new Config("wireless"); | 23 | config = new Config("wireless"); |
24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); | 24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); |
25 | //configure->setProfile(currentProfile); | 25 | //configure->setProfile(currentProfile); |
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
27 | 27 | ||
28 | readConfig(); | 28 | readConfig(); |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | WLANImp::~WLANImp( ){ | 32 | WLANImp::~WLANImp( ){ |
33 | delete config; | 33 | delete config; |
34 | } | 34 | } |
35 | 35 | ||
36 | void WLANImp::setProfile(QString &profile){ | ||
37 | interfaceSetup->setProfile(profile); | ||
38 | } | ||
39 | |||
36 | void WLANImp::readConfig() | 40 | void WLANImp::readConfig() |
37 | { | 41 | { |
38 | qWarning( "WLANImp::readConfig() called." ); | 42 | qWarning( "WLANImp::readConfig() called." ); |
39 | config->setGroup( "Properties" ); | 43 | config->setGroup( "Properties" ); |
40 | QString ssid = config->readEntry( "SSID", "any" ); | 44 | QString ssid = config->readEntry( "SSID", "any" ); |
41 | if( ssid == "any" || ssid == "ANY" ){ | 45 | if( ssid == "any" || ssid == "ANY" ){ |
42 | essNon->setChecked( true ); | 46 | essNon->setChecked( true ); |
43 | } else { | 47 | } else { |
44 | essSpecific->setChecked( true ); | 48 | essSpecific->setChecked( true ); |
45 | essSpecificLineEdit->setText( ssid ); | 49 | essSpecificLineEdit->setText( ssid ); |
46 | } | 50 | } |
47 | QString mode = config->readEntry( "Mode", "Managed" ); | 51 | QString mode = config->readEntry( "Mode", "Managed" ); |
48 | if( mode == "adhoc" ) { | 52 | if( mode == "adhoc" ) { |
49 | network802->setChecked( true ); | 53 | network802->setChecked( true ); |
50 | } else { | 54 | } else { |
51 | networkInfrastructure->setChecked( true ); | 55 | networkInfrastructure->setChecked( true ); |
52 | } | 56 | } |
53 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 57 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
54 | // config->readEntry( "RATE", "auto" ); | 58 | // config->readEntry( "RATE", "auto" ); |
55 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 59 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
56 | config->readEntry( "AuthType", "opensystem" ); | 60 | config->readEntry( "AuthType", "opensystem" ); |
57 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 61 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
58 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 62 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
59 | switch( defaultkey ){ | 63 | switch( defaultkey ){ |
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index 608d681..faa1674 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -1,31 +1,32 @@ | |||
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 | class InterfaceSetupImp; | 6 | class InterfaceSetupImp; |
7 | class Interface; | 7 | class Interface; |
8 | class Config; | 8 | class Config; |
9 | 9 | ||
10 | class WLANImp : public WLAN { | 10 | class WLANImp : public WLAN { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); | 14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); |
15 | ~WLANImp( ); | 15 | ~WLANImp( ); |
16 | void setProfile(QString &profile); | ||
16 | 17 | ||
17 | protected: | 18 | protected: |
18 | void accept(); | 19 | void accept(); |
19 | 20 | ||
20 | private: | 21 | private: |
21 | void readConfig(); | 22 | void readConfig(); |
22 | bool writeConfig(); | 23 | bool writeConfig(); |
23 | bool writeWirelessOpts( QString scheme = "*" ); | 24 | bool writeWirelessOpts( QString scheme = "*" ); |
24 | bool writeWlanngOpts( QString scheme = "*" ); | 25 | bool writeWlanngOpts( QString scheme = "*" ); |
25 | Config* config; | 26 | Config* config; |
26 | InterfaceSetupImp *interfaceSetup; | 27 | InterfaceSetupImp *interfaceSetup; |
27 | 28 | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
31 | 32 | ||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index c8becb0..b14fc0a 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -39,48 +39,49 @@ QString WLANModule::getPixmapName(Interface* ){ | |||
39 | return "wlan"; | 39 | return "wlan"; |
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Check to see if the interface i is owned by this module. | 43 | * Check to see if the interface i is owned by this module. |
44 | * @param Interface* interface to check against | 44 | * @param Interface* interface to check against |
45 | * @return bool true if i is owned by this module, false otherwise. | 45 | * @return bool true if i is owned by this module, false otherwise. |
46 | */ | 46 | */ |
47 | bool WLANModule::isOwner(Interface *i){ | 47 | bool WLANModule::isOwner(Interface *i){ |
48 | WExtensions we(i->getInterfaceName()); | 48 | WExtensions we(i->getInterfaceName()); |
49 | if(!we.doesHaveWirelessExtensions()) | 49 | if(!we.doesHaveWirelessExtensions()) |
50 | return false; | 50 | return false; |
51 | 51 | ||
52 | i->setHardwareName("802.11b"); | 52 | i->setHardwareName("802.11b"); |
53 | list.append(i); | 53 | list.append(i); |
54 | return true; | 54 | return true; |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Create, and return the WLANConfigure Module | 58 | * Create, and return the WLANConfigure Module |
59 | * @return QWidget* pointer to this modules configure. | 59 | * @return QWidget* pointer to this modules configure. |
60 | */ | 60 | */ |
61 | QWidget *WLANModule::configure(Interface *i){ | 61 | QWidget *WLANModule::configure(Interface *i){ |
62 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); | 62 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); |
63 | wlanconfig->setProfile(profile); | ||
63 | return wlanconfig; | 64 | return wlanconfig; |
64 | } | 65 | } |
65 | 66 | ||
66 | /** | 67 | /** |
67 | * Create, and return the Information Module | 68 | * Create, and return the Information Module |
68 | * @return QWidget* pointer to this modules info. | 69 | * @return QWidget* pointer to this modules info. |
69 | */ | 70 | */ |
70 | QWidget *WLANModule::information(Interface *i){ | 71 | QWidget *WLANModule::information(Interface *i){ |
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 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | 76 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); |
76 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | 77 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); |
77 | info->tabWidget->insertTab(information, "TCP/IP"); | 78 | info->tabWidget->insertTab(information, "TCP/IP"); |
78 | return info; | 79 | return info; |
79 | } | 80 | } |
80 | 81 | ||
81 | /** | 82 | /** |
82 | * Get all active (up or down) interfaces | 83 | * Get all active (up or down) interfaces |
83 | * @return QList<Interface> A list of interfaces that exsist that havn't | 84 | * @return QList<Interface> A list of interfaces that exsist that havn't |
84 | * been called by isOwner() | 85 | * been called by isOwner() |
85 | */ | 86 | */ |
86 | QList<Interface> WLANModule::getInterfaces(){ | 87 | QList<Interface> WLANModule::getInterfaces(){ |
diff --git a/noncore/settings/networksettings/TODO b/noncore/settings/networksettings/TODO index 0584f81..ec6d2c6 100644 --- a/noncore/settings/networksettings/TODO +++ b/noncore/settings/networksettings/TODO | |||
@@ -1,16 +1,16 @@ | |||
1 | CLEAN UP | 1 | CLEAN UP |
2 | 2 | ||
3 | Fix Profiles | 3 | Fix Profiles |
4 | 4 | ||
5 | Write dns script | 5 | Write dns script |
6 | 6 | ||
7 | |||
8 | WLAN needs to be re-written to not use Config | 7 | WLAN needs to be re-written to not use Config |
9 | WHERE Is DHCP info stored??? | ||
10 | |||
11 | PPP module needs to be written | ||
12 | 8 | ||
13 | Write a class that parses /proc and not ifconfig | 9 | Write a class that parses /proc and not ifconfig |
10 | udchcp needs to output the dhcp information | ||
11 | |||
12 | Possible other modules to write: ppp, ipsec, bluetooth, ipchains | ||
13 | |||
14 | PPP module needs to scan pppd.tdb to see what is currently active | ||
14 | 15 | ||
15 | Possible other modules: ipsec, bluetooth, ipchains | ||
16 | 16 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 97c05cc..d42b45d 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -72,48 +72,49 @@ bool InterfaceSetupImp::saveSettings(){ | |||
72 | } | 72 | } |
73 | else{ | 73 | else{ |
74 | interfaces->setInterfaceMethod("static"); | 74 | interfaces->setInterfaceMethod("static"); |
75 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); | 75 | interfaces->setInterfaceOption("address", ipAddressEdit->text()); |
76 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); | 76 | interfaces->setInterfaceOption("netmask", subnetMaskEdit->text()); |
77 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); | 77 | interfaces->setInterfaceOption("gateway", gatewayEdit->text()); |
78 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); | 78 | QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); |
79 | interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); | 79 | interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); |
80 | interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); | 80 | interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); |
81 | } | 81 | } |
82 | 82 | ||
83 | // IP Information | 83 | // IP Information |
84 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 84 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
85 | return true; | 85 | return true; |
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * The Profile has changed. | 89 | * The Profile has changed. |
90 | * @profile the new profile. | 90 | * @profile the new profile. |
91 | */ | 91 | */ |
92 | void InterfaceSetupImp::setProfile(const QString &profile){ | 92 | void InterfaceSetupImp::setProfile(const QString &profile){ |
93 | QString newInterfaceName = interface->getInterfaceName(); | 93 | QString newInterfaceName = interface->getInterfaceName(); |
94 | if(profile.length() > 0) | 94 | if(profile.length() > 0) |
95 | newInterfaceName += "_" + profile; | 95 | newInterfaceName += "_" + profile; |
96 | qDebug("InterfaceSetupImp::setProfile"); | ||
96 | // See if we have to make a interface. | 97 | // See if we have to make a interface. |
97 | if(!interfaces->setInterface(newInterfaceName)){ | 98 | if(!interfaces->setInterface(newInterfaceName)){ |
98 | // Add making for this new interface if need too | 99 | // Add making for this new interface if need too |
99 | if(profile != ""){ | 100 | if(profile != ""){ |
100 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 101 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
101 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 102 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
102 | interfaces->addMapping(interface->getInterfaceName()); | 103 | interfaces->addMapping(interface->getInterfaceName()); |
103 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 104 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
104 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); | 105 | qDebug("InterfaceSetupImp: Added Mapping, but still can't set."); |
105 | return; | 106 | return; |
106 | } | 107 | } |
107 | } | 108 | } |
108 | interfaces->setMap("map", newInterfaceName); | 109 | interfaces->setMap("map", newInterfaceName); |
109 | interfaces->setScript("getprofile.sh"); | 110 | interfaces->setScript("getprofile.sh"); |
110 | } | 111 | } |
111 | else{ | 112 | else{ |
112 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 113 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
113 | if(!interfaces->setInterface(newInterfaceName)){ | 114 | if(!interfaces->setInterface(newInterfaceName)){ |
114 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); | 115 | qDebug("InterfaceSetupImp: Added interface, but still can't set."); |
115 | return; | 116 | return; |
116 | } | 117 | } |
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.h b/noncore/settings/networksettings/interfaces/interfacesetupimp.h index 936f2be..3bbf34e 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.h +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.h | |||
@@ -8,42 +8,48 @@ class Interface; | |||
8 | class Interfaces; | 8 | class Interfaces; |
9 | 9 | ||
10 | class InterfaceSetupImp : public InterfaceSetup { | 10 | class InterfaceSetupImp : public InterfaceSetup { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); | 14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); |
15 | void saveChanges(); | 15 | void saveChanges(); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void setProfile(const QString &profile); | 18 | void setProfile(const QString &profile); |
19 | bool saveSettings(); | 19 | bool saveSettings(); |
20 | private: | 20 | private: |
21 | Interfaces *interfaces; | 21 | Interfaces *interfaces; |
22 | Interface *interface; | 22 | Interface *interface; |
23 | 23 | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | 26 | ||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | class InterfaceSetupImpDialog : public QDialog { | 29 | class InterfaceSetupImpDialog : public QDialog { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ | 33 | InterfaceSetupImpDialog(QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = false, WFlags fl = 0) : QDialog(parent, name, modal, fl){ |
34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); | 34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); |
35 | setCaption("Interface Setup"); | 35 | setCaption("Interface Setup"); |
36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); | 36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); |
37 | InterfaceSetupLayout->addWidget( interfaceSetup ); | 37 | InterfaceSetupLayout->addWidget( interfaceSetup ); |
38 | }; | 38 | }; |
39 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; | ||
39 | 40 | ||
41 | private: | ||
40 | InterfaceSetupImp *interfaceSetup; | 42 | InterfaceSetupImp *interfaceSetup; |
41 | 43 | ||
42 | protected slots: | 44 | protected slots: |
43 | void accept(){ interfaceSetup->saveChanges(); }; | 45 | void accept(){ |
46 | interfaceSetup->saveChanges(); | ||
47 | QDialog::accept(); | ||
48 | }; | ||
49 | |||
44 | }; | 50 | }; |
45 | 51 | ||
46 | #endif | 52 | #endif |
47 | 53 | ||
48 | // interfacesetupimp.h | 54 | // interfacesetupimp.h |
49 | 55 | ||
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index b9fff56..6440bd4 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -209,93 +209,85 @@ void MainWindowImp::removeClicked(){ | |||
209 | } | 209 | } |
210 | else{ | 210 | else{ |
211 | if(!i->getModuleOwner()->remove(i)) | 211 | if(!i->getModuleOwner()->remove(i)) |
212 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); | 212 | QMessageBox::information(this, "Error", "Unable to remove.", "Ok"); |
213 | else{ | 213 | else{ |
214 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); | 214 | QMessageBox::information(this, "Success", "Interface was removed.", "Ok"); |
215 | // TODO memory managment.... | 215 | // TODO memory managment.... |
216 | // who deletes the interface? | 216 | // who deletes the interface? |
217 | } | 217 | } |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Pull up the configure about the currently selected interface. | 222 | * Pull up the configure about the currently selected interface. |
223 | * Report an error if no interface is selected. | 223 | * Report an error if no interface is selected. |
224 | * If the interface has a module owner then request its configure. | 224 | * If the interface has a module owner then request its configure. |
225 | */ | 225 | */ |
226 | void MainWindowImp::configureClicked(){ | 226 | void MainWindowImp::configureClicked(){ |
227 | QListViewItem *item = connectionList->currentItem(); | 227 | QListViewItem *item = connectionList->currentItem(); |
228 | if(!item){ | 228 | if(!item){ |
229 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); | 229 | QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | 232 | ||
233 | QString currentProfile = currentProfileLabel->text(); | ||
234 | if(profilesList->count() <= 1 || currentProfile == "All"){ | ||
235 | currentProfile = ""; | ||
236 | } | ||
237 | |||
238 | Interface *i = interfaceItems[item]; | 233 | Interface *i = interfaceItems[item]; |
239 | if(i->getModuleOwner()){ | 234 | if(i->getModuleOwner()){ |
240 | i->getModuleOwner()->setProfile(currentProfile); | ||
241 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); | 235 | QWidget *moduleConfigure = i->getModuleOwner()->configure(i); |
242 | if(moduleConfigure != NULL){ | 236 | if(moduleConfigure != NULL){ |
243 | moduleConfigure->showMaximized(); | 237 | moduleConfigure->showMaximized(); |
244 | moduleConfigure->show(); | 238 | moduleConfigure->show(); |
245 | return; | 239 | return; |
246 | } | 240 | } |
247 | } | 241 | } |
248 | 242 | ||
249 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); | 243 | InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); |
250 | //configure->setProfile(currentProfile); | 244 | QString currentProfileText = currentProfileLabel->text(); |
245 | if(currentProfileText.upper() == "ALL"); | ||
246 | currentProfileText = ""; | ||
247 | configure->setProfile(currentProfileText); | ||
251 | configure->showMaximized(); | 248 | configure->showMaximized(); |
252 | configure->show(); | 249 | configure->show(); |
253 | } | 250 | } |
254 | 251 | ||
255 | /** | 252 | /** |
256 | * Pull up the information about the currently selected interface. | 253 | * Pull up the information about the currently selected interface. |
257 | * Report an error if no interface is selected. | 254 | * Report an error if no interface is selected. |
258 | * If the interface has a module owner then request its configure. | 255 | * If the interface has a module owner then request its configure. |
259 | */ | 256 | */ |
260 | void MainWindowImp::informationClicked(){ | 257 | void MainWindowImp::informationClicked(){ |
261 | QListViewItem *item = connectionList->currentItem(); | 258 | QListViewItem *item = connectionList->currentItem(); |
262 | if(!item){ | 259 | if(!item){ |
263 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); | 260 | QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); |
264 | return; | 261 | return; |
265 | } | 262 | } |
266 | 263 | ||
267 | Interface *i = interfaceItems[item]; | 264 | Interface *i = interfaceItems[item]; |
268 | if(!i->isAttached()){ | 265 | if(!i->isAttached()){ |
269 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); | 266 | QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); |
270 | return; | 267 | return; |
271 | } | 268 | } |
272 | 269 | ||
273 | QStringList list; | ||
274 | for(uint i = 0; i < profilesList->count(); i++){ | ||
275 | list.append(profilesList->text(i)); | ||
276 | } | ||
277 | |||
278 | if(i->getModuleOwner()){ | 270 | if(i->getModuleOwner()){ |
279 | QWidget *moduleInformation = i->getModuleOwner()->information(i); | 271 | QWidget *moduleInformation = i->getModuleOwner()->information(i); |
280 | if(moduleInformation != NULL){ | 272 | if(moduleInformation != NULL){ |
281 | moduleInformation->showMaximized(); | 273 | moduleInformation->showMaximized(); |
282 | moduleInformation->show(); | 274 | moduleInformation->show(); |
283 | return; | 275 | return; |
284 | } | 276 | } |
285 | } | 277 | } |
286 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); | 278 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); |
287 | information->showMaximized(); | 279 | information->showMaximized(); |
288 | information->show(); | 280 | information->show(); |
289 | } | 281 | } |
290 | 282 | ||
291 | /** | 283 | /** |
292 | * Aquire the list of active interfaces from ifconfig | 284 | * Aquire the list of active interfaces from ifconfig |
293 | * Call ifconfig and ifconfig -a | 285 | * Call ifconfig and ifconfig -a |
294 | */ | 286 | */ |
295 | void MainWindowImp::getInterfaceList(){ | 287 | void MainWindowImp::getInterfaceList(){ |
296 | KShellProcess *processAll = new KShellProcess(); | 288 | KShellProcess *processAll = new KShellProcess(); |
297 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; | 289 | *processAll << "/sbin/ifconfig" << "-a" << " > " TEMP_ALL; |
298 | connect(processAll, SIGNAL(processExited(KProcess *)), | 290 | connect(processAll, SIGNAL(processExited(KProcess *)), |
299 | this, SLOT(jobDone(KProcess *))); | 291 | this, SLOT(jobDone(KProcess *))); |
300 | threads.insert(processAll, TEMP_ALL); | 292 | threads.insert(processAll, TEMP_ALL); |
301 | 293 | ||
@@ -517,28 +509,29 @@ void MainWindowImp::changeProfile(){ | |||
517 | if(profilesList->currentItem() == -1){ | 509 | if(profilesList->currentItem() == -1){ |
518 | QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok"); | 510 | QMessageBox::information(this, "Can't Change.","Please select a profile.", "Ok"); |
519 | return; | 511 | return; |
520 | } | 512 | } |
521 | QString newProfile = profilesList->text(profilesList->currentItem()); | 513 | QString newProfile = profilesList->text(profilesList->currentItem()); |
522 | if(newProfile != currentProfileLabel->text()){ | 514 | if(newProfile != currentProfileLabel->text()){ |
523 | currentProfileLabel->setText(newProfile); | 515 | currentProfileLabel->setText(newProfile); |
524 | QFile::remove(scheme); | 516 | QFile::remove(scheme); |
525 | QFile file(scheme); | 517 | QFile file(scheme); |
526 | if ( file.open(IO_ReadWrite) ) { | 518 | if ( file.open(IO_ReadWrite) ) { |
527 | QTextStream stream( &file ); | 519 | QTextStream stream( &file ); |
528 | stream << QString("SCHEME=%1").arg(newProfile); | 520 | stream << QString("SCHEME=%1").arg(newProfile); |
529 | file.close(); | 521 | file.close(); |
530 | } | 522 | } |
531 | // restart all up devices? | 523 | // restart all up devices? |
532 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ | 524 | if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ |
533 | // Go through them one by one | 525 | // Go through them one by one |
534 | QMap<Interface*, QListViewItem*>::Iterator it; | 526 | QMap<Interface*, QListViewItem*>::Iterator it; |
535 | for( it = items.begin(); it != items.end(); ++it ){ | 527 | for( it = items.begin(); it != items.end(); ++it ){ |
536 | if(it.key()->getStatus() == true) | 528 | if(it.key()->getStatus() == true) |
537 | it.key()->restart(); | 529 | it.key()->restart(); |
538 | } | 530 | } |
539 | } | 531 | } |
540 | } | 532 | } |
533 | // TODO change the profile in the modules | ||
541 | } | 534 | } |
542 | 535 | ||
543 | // mainwindowimp.cpp | 536 | // mainwindowimp.cpp |
544 | 537 | ||
diff --git a/noncore/settings/networksettings/networksetup.pro b/noncore/settings/networksettings/networksetup.pro index 1719a35..5666a42 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 defaultmodule.h kprocctrl.h module.h kprocess.h | 5 | HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h kprocctrl.h module.h kprocess.h |
6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp kprocctrl.cpp kprocess.cpp | 6 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp kprocctrl.cpp kprocess.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ | 7 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ |
8 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan | 8 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan |
9 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -linterfaces | 9 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksetup -Linterfaces/ -linterfaces |
10 | INTERFACES = mainwindow.ui addconnection.ui | 10 | INTERFACES = mainwindow.ui addconnection.ui |
11 | TARGET = networksetup | 11 | TARGET = networksetup |
diff --git a/noncore/settings/networksettings/opie-networksettings.control b/noncore/settings/networksettings/opie-networksettings.control index 35bac52..d14e2d1 100644 --- a/noncore/settings/networksettings/opie-networksettings.control +++ b/noncore/settings/networksettings/opie-networksettings.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 $OPIEDIR/bin/changedns.sh $OPIEDIR/bin/getprofile.sh |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Opie network setup tool |
diff --git a/noncore/settings/networksettings/opie-networksetup.control b/noncore/settings/networksettings/opie-networksetup.control index 35bac52..d14e2d1 100644 --- a/noncore/settings/networksettings/opie-networksetup.control +++ b/noncore/settings/networksettings/opie-networksetup.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 | 1 | Files: bin/networksetup apps/Settings/networksetup.desktop pics/Network plugins/networksetup/* pics/networksetup $QTDIR/lib/libinterfaces.so.1.0.0 $QTDIR/lib/libinterfaces.so.1.0 $QTDIR/lib/libinterfaces.so.1 $OPIEDIR/bin/changedns.sh $OPIEDIR/bin/getprofile.sh |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/settings | 3 | Section: opie/settings |
4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> | 4 | Maintainer: Ben Meyer <meyerb@sharpsec.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Opie network setup tool | 8 | Description: Opie network setup tool |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index a466020..74bf390 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -12,48 +12,52 @@ | |||
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 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
20 | #include "interfacesetupimp.h" | 20 | #include "interfacesetupimp.h" |
21 | 21 | ||
22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ | 22 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl):WLAN(parent, name, modal, fl){ |
23 | config = new Config("wireless"); | 23 | config = new Config("wireless"); |
24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); | 24 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i);//, Qt::WDestructiveClose); |
25 | //configure->setProfile(currentProfile); | 25 | //configure->setProfile(currentProfile); |
26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 26 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
27 | 27 | ||
28 | readConfig(); | 28 | readConfig(); |
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | WLANImp::~WLANImp( ){ | 32 | WLANImp::~WLANImp( ){ |
33 | delete config; | 33 | delete config; |
34 | } | 34 | } |
35 | 35 | ||
36 | void WLANImp::setProfile(QString &profile){ | ||
37 | interfaceSetup->setProfile(profile); | ||
38 | } | ||
39 | |||
36 | void WLANImp::readConfig() | 40 | void WLANImp::readConfig() |
37 | { | 41 | { |
38 | qWarning( "WLANImp::readConfig() called." ); | 42 | qWarning( "WLANImp::readConfig() called." ); |
39 | config->setGroup( "Properties" ); | 43 | config->setGroup( "Properties" ); |
40 | QString ssid = config->readEntry( "SSID", "any" ); | 44 | QString ssid = config->readEntry( "SSID", "any" ); |
41 | if( ssid == "any" || ssid == "ANY" ){ | 45 | if( ssid == "any" || ssid == "ANY" ){ |
42 | essNon->setChecked( true ); | 46 | essNon->setChecked( true ); |
43 | } else { | 47 | } else { |
44 | essSpecific->setChecked( true ); | 48 | essSpecific->setChecked( true ); |
45 | essSpecificLineEdit->setText( ssid ); | 49 | essSpecificLineEdit->setText( ssid ); |
46 | } | 50 | } |
47 | QString mode = config->readEntry( "Mode", "Managed" ); | 51 | QString mode = config->readEntry( "Mode", "Managed" ); |
48 | if( mode == "adhoc" ) { | 52 | if( mode == "adhoc" ) { |
49 | network802->setChecked( true ); | 53 | network802->setChecked( true ); |
50 | } else { | 54 | } else { |
51 | networkInfrastructure->setChecked( true ); | 55 | networkInfrastructure->setChecked( true ); |
52 | } | 56 | } |
53 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); | 57 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
54 | // config->readEntry( "RATE", "auto" ); | 58 | // config->readEntry( "RATE", "auto" ); |
55 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 59 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
56 | config->readEntry( "AuthType", "opensystem" ); | 60 | config->readEntry( "AuthType", "opensystem" ); |
57 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 61 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
58 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 62 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
59 | switch( defaultkey ){ | 63 | switch( defaultkey ){ |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index 608d681..faa1674 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h | |||
@@ -1,31 +1,32 @@ | |||
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 | class InterfaceSetupImp; | 6 | class InterfaceSetupImp; |
7 | class Interface; | 7 | class Interface; |
8 | class Config; | 8 | class Config; |
9 | 9 | ||
10 | class WLANImp : public WLAN { | 10 | class WLANImp : public WLAN { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); | 14 | WLANImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, bool modal = FALSE, WFlags fl = 0 ); |
15 | ~WLANImp( ); | 15 | ~WLANImp( ); |
16 | void setProfile(QString &profile); | ||
16 | 17 | ||
17 | protected: | 18 | protected: |
18 | void accept(); | 19 | void accept(); |
19 | 20 | ||
20 | private: | 21 | private: |
21 | void readConfig(); | 22 | void readConfig(); |
22 | bool writeConfig(); | 23 | bool writeConfig(); |
23 | bool writeWirelessOpts( QString scheme = "*" ); | 24 | bool writeWirelessOpts( QString scheme = "*" ); |
24 | bool writeWlanngOpts( QString scheme = "*" ); | 25 | bool writeWlanngOpts( QString scheme = "*" ); |
25 | Config* config; | 26 | Config* config; |
26 | InterfaceSetupImp *interfaceSetup; | 27 | InterfaceSetupImp *interfaceSetup; |
27 | 28 | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |
31 | 32 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index c8becb0..b14fc0a 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -39,48 +39,49 @@ QString WLANModule::getPixmapName(Interface* ){ | |||
39 | return "wlan"; | 39 | return "wlan"; |
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Check to see if the interface i is owned by this module. | 43 | * Check to see if the interface i is owned by this module. |
44 | * @param Interface* interface to check against | 44 | * @param Interface* interface to check against |
45 | * @return bool true if i is owned by this module, false otherwise. | 45 | * @return bool true if i is owned by this module, false otherwise. |
46 | */ | 46 | */ |
47 | bool WLANModule::isOwner(Interface *i){ | 47 | bool WLANModule::isOwner(Interface *i){ |
48 | WExtensions we(i->getInterfaceName()); | 48 | WExtensions we(i->getInterfaceName()); |
49 | if(!we.doesHaveWirelessExtensions()) | 49 | if(!we.doesHaveWirelessExtensions()) |
50 | return false; | 50 | return false; |
51 | 51 | ||
52 | i->setHardwareName("802.11b"); | 52 | i->setHardwareName("802.11b"); |
53 | list.append(i); | 53 | list.append(i); |
54 | return true; | 54 | return true; |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Create, and return the WLANConfigure Module | 58 | * Create, and return the WLANConfigure Module |
59 | * @return QWidget* pointer to this modules configure. | 59 | * @return QWidget* pointer to this modules configure. |
60 | */ | 60 | */ |
61 | QWidget *WLANModule::configure(Interface *i){ | 61 | QWidget *WLANModule::configure(Interface *i){ |
62 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); | 62 | WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); |
63 | wlanconfig->setProfile(profile); | ||
63 | return wlanconfig; | 64 | return wlanconfig; |
64 | } | 65 | } |
65 | 66 | ||
66 | /** | 67 | /** |
67 | * Create, and return the Information Module | 68 | * Create, and return the Information Module |
68 | * @return QWidget* pointer to this modules info. | 69 | * @return QWidget* pointer to this modules info. |
69 | */ | 70 | */ |
70 | QWidget *WLANModule::information(Interface *i){ | 71 | QWidget *WLANModule::information(Interface *i){ |
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 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); | 76 | WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); |
76 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); | 77 | InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); |
77 | info->tabWidget->insertTab(information, "TCP/IP"); | 78 | info->tabWidget->insertTab(information, "TCP/IP"); |
78 | return info; | 79 | return info; |
79 | } | 80 | } |
80 | 81 | ||
81 | /** | 82 | /** |
82 | * Get all active (up or down) interfaces | 83 | * Get all active (up or down) interfaces |
83 | * @return QList<Interface> A list of interfaces that exsist that havn't | 84 | * @return QList<Interface> A list of interfaces that exsist that havn't |
84 | * been called by isOwner() | 85 | * been called by isOwner() |
85 | */ | 86 | */ |
86 | QList<Interface> WLANModule::getInterfaces(){ | 87 | QList<Interface> WLANModule::getInterfaces(){ |