summaryrefslogtreecommitdiff
authortille <tille>2003-06-13 14:54:32 (UTC)
committer tille <tille>2003-06-13 14:54:32 (UTC)
commit006f7b028f03232e51dd6ceab35a7d492288fd22 (patch) (unidiff)
tree27fe264b7628f7ac4f17b925803b3f562f165fb7
parente5d826221bab71c39dc8fc89d91509dd16bc2a8a (diff)
downloadopie-006f7b028f03232e51dd6ceab35a7d492288fd22.zip
opie-006f7b028f03232e51dd6ceab35a7d492288fd22.tar.gz
opie-006f7b028f03232e51dd6ceab35a7d492288fd22.tar.bz2
qcop channels for ESSID, Channel and Mode
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp3
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp2
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp50
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.h7
4 files changed, 42 insertions, 20 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 0ef1e68..5029525 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -649,18 +649,19 @@ void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
649// QDataStream stream(arg,IO_ReadOnly); 649// QDataStream stream(arg,IO_ReadOnly);
650// QString arg1, arg2, arg3; 650// QString arg1, arg2, arg3;
651// stream >> arg1 >> arg2 >> arg3 ; 651// stream >> arg1 >> arg2 >> arg3 ;
652// qDebug("args: >%s< >%s< >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1()); 652// qDebug("args: >%s< >%s< >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1());
653// } 653// }
654 654
655 QMap<Module*, QLibrary*>::Iterator it; 655 QMap<Module*, QLibrary*>::Iterator it;
656 for( it = libraries.begin(); it != libraries.end(); ++it ){ 656 for( it = libraries.begin(); it != libraries.end(); ++it ){
657 qDebug("plugin >%s<", it.key()->type().latin1() ); 657 qDebug("plugin >%s<", it.key()->type().latin1() );
658 if(it.key()->type() == dest){ 658 if(it.key()->type() == dest){
659 it.key()->receive( param, arg ); 659 it.key()->receive( param, arg );
660 found = true; 660 found = true;
661 } 661 }
662 } 662 }
663 663
664 664
665 if (!found) qDebug("Huh what do ya want"); 665 if (found) QPEApplication::setKeepRunning();
666 else qDebug("Huh what do ya want");
666} 667}
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index b988822..cdafb4d 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -15,33 +15,33 @@
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 */
30WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) { 30WLANImp::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
42WLANImp::~WLANImp() { 42WLANImp::~WLANImp() {
43//FIXME: 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.
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index e6f082c..bc467bb 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1,33 +1,39 @@
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 <qcheckbox.h>
8#include <qcombobox.h>
7#include <qlabel.h> 9#include <qlabel.h>
8#include <qprogressbar.h> 10#include <qprogressbar.h>
11#include <qspinbox.h>
9#include <qtabwidget.h> 12#include <qtabwidget.h>
10 13
11 14
12 15
13 16
14/** 17/**
15 * Constructor, find all of the possible interfaces 18 * Constructor, find all of the possible interfaces
16 */ 19 */
17WLANModule::WLANModule() : Module() { 20WLANModule::WLANModule()
21 : Module(),
22 wlanconfigWiget(0)
23{
18} 24}
19 25
20/** 26/**
21 * Delete any interfaces that we own. 27 * Delete any interfaces that we own.
22 */ 28 */
23WLANModule::~WLANModule(){ 29WLANModule::~WLANModule(){
24 Interface *i; 30 Interface *i;
25 for ( i=list.first(); i != 0; i=list.next() ) 31 for ( i=list.first(); i != 0; i=list.next() )
26 delete i; 32 delete i;
27 33
28} 34}
29 35
30/** 36/**
31 * Change the current profile 37 * Change the current profile
32 */ 38 */
33void WLANModule::setProfile(const QString &newProfile){ 39void WLANModule::setProfile(const QString &newProfile){
@@ -102,86 +108,102 @@ Interface *WLANModule::addNewInterface(const QString &){
102} 108}
103 109
104/** 110/**
105 * Attempts to remove the interface, doesn't delete i 111 * Attempts to remove the interface, doesn't delete i
106 * @return bool true if successfull, false otherwise. 112 * @return bool true if successfull, false otherwise.
107 */ 113 */
108bool WLANModule::remove(Interface*){ 114bool WLANModule::remove(Interface*){
109 // Can't remove a hardware device, you can stop it though. 115 // Can't remove a hardware device, you can stop it though.
110 return false; 116 return false;
111} 117}
112 118
113void WLANModule::receive(const QCString &param, const QByteArray &arg) 119void WLANModule::receive(const QCString &param, const QByteArray &arg)
114{ 120{
115 qDebug("WLANModule::receive "+param); 121 qDebug("WLANModule::receive "+param);
116 QStringList params = QStringList::split(",",param); 122 QStringList params = QStringList::split(",",param);
117 int count = params.count(); 123 int count = params.count();
118 qDebug("got %i params", count ); 124 qDebug("WLANModule got %i params", count );
119 if (count < 2){ 125 if (count < 2){
120 qDebug("Erorr less than 2 parameter"); 126 qDebug("Erorr less than 2 parameter");
121 qDebug("RETURNING"); 127 qDebug("RETURNING");
122 return; 128 return;
123 } 129 }
124 130
125 QDataStream stream(arg,IO_ReadOnly); 131 QDataStream stream(arg,IO_ReadOnly);
126 QString interface; 132 QString interface;
127 QString action; 133 QString action;
128 134
129 stream >> interface; 135 stream >> interface;
130 stream >> action; 136 stream >> action;
131 qDebug("got interface %s and acion %s", interface.latin1(), action.latin1()); 137 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
132 // find interfaces 138 // find interfaces
133 Interface *ifa=0; 139 Interface *ifa=0;
134 for ( Interface *i=list.first(); i != 0; i=list.next() ){ 140 for ( Interface *i=list.first(); i != 0; i=list.next() ){
135 if (i->getInterfaceName() == interface){ 141 if (i->getInterfaceName() == interface){
136 qDebug("found interface %s",interface.latin1()); 142 qDebug("WLANModule found interface %s",interface.latin1());
137 ifa = i; 143 ifa = i;
138 } 144 }
139 } 145 }
140 146
141 if (ifa == 0){ 147 if (ifa == 0){
142 qFatal("Did not find %s",interface.latin1()); 148 qFatal("WLANModule Did not find %s",interface.latin1());
143 } 149 }
144 150
145 if (count == 2){ 151 if (count == 2){
146 // those should call the interface directly 152 // those should call the interface directly
147 QWidget *info = getInfo( ifa ); 153 QWidget *info = getInfo( ifa );
148 info->showMaximized(); 154 info->showMaximized();
149 155
150 if ( action.contains("start" ) ){ 156 if ( action.contains("start" ) ){
151 ifa->start(); 157 ifa->start();
152 } else if ( action.contains("restart" ) ){ 158 } else if ( action.contains("restart" ) ){
153 ifa->restart(); 159 ifa->restart();
154 } else if ( action.contains("stop" ) ){ 160 } else if ( action.contains("stop" ) ){
155 ifa->stop(); 161 ifa->stop();
156 }else if ( action.contains("refresh" ) ){ 162 }else if ( action.contains("refresh" ) ){
157 ifa->refresh(); 163 ifa->refresh();
158 } 164 }
159 }else if (count == 3){ 165 }else if (count == 3){
160 QString value; 166 QString value;
167 if (!wlanconfigWiget){
168 //FIXME: what if it got closed meanwhile?
169 wlanconfigWiget = (WLANImp*) configure(ifa);
170 }
171 wlanconfigWiget->showMaximized();
161 stream >> value; 172 stream >> value;
162 qDebug("setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); 173 qDebug("WLANModule is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
163 if ( action.contains("ESSID") ){ 174 if ( action.contains("ESSID") ){
164 qDebug("Setting ESSID not yet impl"); 175 QComboBox *combo = wlanconfigWiget->essid;
176 bool found = false;
177 for ( int i = 0; i < combo->count(); i++)
178 if ( combo->text( i ) == value ){
179 combo->setCurrentItem( i );
180 found = true;
181 }
182 if (!found) combo->insertItem( value, 0 );
183 }else if ( action.contains("Mode") ){
184 QComboBox *combo = wlanconfigWiget->mode;
185 for ( int i = 0; i < combo->count(); i++)
186 if ( combo->text( i ) == value ){
187 combo->setCurrentItem( i );
188 }
189
165 }else if (action.contains("Channel")){ 190 }else if (action.contains("Channel")){
166 qDebug("Setting Channel not yet impl"); 191 wlanconfigWiget->specifyChan->setChecked( true );
192 wlanconfigWiget->networkChannel->setValue( value.toInt() );
167 }else 193 }else
168 qDebug("wlan plugin has no clue"); 194 qDebug("wlan plugin has no clue");
169 } 195 }
170 // if (param.contains("QString,QString,QString")) { 196
171// QDataStream stream(arg,IO_ReadOnly);
172// QString arg1, arg2, arg3;
173// stream >> arg1 >> arg2 >> arg3 ;
174// qDebug("interface >%s< setting >%s< value >%s<",arg1.latin1(),arg2.latin1(),arg3.latin1());
175// }
176} 197}
177 198
178QWidget *WLANModule::getInfo( Interface *i) 199QWidget *WLANModule::getInfo( Interface *i)
179{ 200{
180 qDebug("WLANModule::getInfo start"); 201 qDebug("WLANModule::getInfo start");
181 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 202 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);
182 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i); 203 InterfaceInformationImp *information = new InterfaceInformationImp(info->tabWidget, "InterfaceSetupImp", i);
183 info->tabWidget->insertTab(information, "TCP/IP", 0); 204 info->tabWidget->insertTab(information, "TCP/IP", 0);
184 205
185 qDebug("WLANModule::getInfo return"); 206 qDebug("WLANModule::getInfo return");
186 return info; 207 return info;
187} 208}
209
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.h b/noncore/settings/networksettings/wlan/wlanmodule.h
index 0963137..027ecec 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.h
+++ b/noncore/settings/networksettings/wlan/wlanmodule.h
@@ -1,49 +1,48 @@
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; 6class WLANImp;
7 7
8class WLANModule : Module{ 8class WLANModule : Module{
9 9
10signals: 10signals:
11 void updateInterface(Interface *i); 11 void updateInterface(Interface *i);
12 12
13public: 13public:
14 WLANModule(); 14 WLANModule();
15 ~WLANModule(); 15 ~WLANModule();
16 16
17 17
18 virtual const QString type() {return "wlan";}; 18 virtual const QString type() {return "wlan";};
19 void setProfile(const QString &newProfile); 19 void setProfile(const QString &newProfile);
20 bool isOwner(Interface *); 20 bool isOwner(Interface *);
21 QWidget *configure(Interface *i); 21 QWidget *configure(Interface *i);
22 QWidget *information(Interface *i); 22 QWidget *information(Interface *i);
23 QList<Interface> getInterfaces(); 23 QList<Interface> getInterfaces();
24 void possibleNewInterfaces(QMap<QString, QString> &){}; 24 void possibleNewInterfaces(QMap<QString, QString> &){};
25 Interface *addNewInterface(const QString &name); 25 Interface *addNewInterface(const QString &name);
26 bool remove(Interface* i); 26 bool remove(Interface* i);
27 QString getPixmapName(Interface* i); 27 QString getPixmapName(Interface* i);
28 virtual void receive(const QCString&, const QByteArray&); 28 virtual void receive(const QCString&, const QByteArray&);
29 29
30private: 30private:
31 QWidget *getInfo(Interface*); 31 QWidget *getInfo(Interface*);
32 32 WLANImp *wlanconfigWiget;
33 QList<Interface> list; 33 QList<Interface> list;
34 QString profile; 34 QString profile;
35 // WlanInfoImp *info; 35
36 // Interface *iface;
37}; 36};
38 37
39extern "C" 38extern "C"
40{ 39{
41 void* create_plugin() { 40 void* create_plugin() {
42 return new WLANModule(); 41 return new WLANModule();
43 } 42 }
44}; 43};
45 44
46#endif 45#endif
47 46
48// wlanmodule.h 47// wlanmodule.h
49 48