Diffstat (limited to 'noncore/settings/networksettings/wlan/wlanmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 50 |
1 files changed, 42 insertions, 8 deletions
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 | |||
@@ -3,29 +3,33 @@ | |||
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 | } |
@@ -68,20 +72,17 @@ QWidget *WLANModule::configure(Interface *i){ | |||
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(){ |
@@ -123,31 +124,64 @@ void WLANModule::receive(const QCString ¶m, const QByteArray &arg) | |||
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 | } | ||