Diffstat (limited to 'noncore/settings/networksettings/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/mainwindowimp.cpp | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp index 0f48a4b..89dac6f 100644 --- a/noncore/settings/networksettings/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindowimp.cpp | |||
@@ -148,13 +148,13 @@ void MainWindowImp::removeClicked(){ | |||
148 | QListViewItem *item = serviceList->currentItem(); | 148 | QListViewItem *item = serviceList->currentItem(); |
149 | if(item == NULL) { | 149 | if(item == NULL) { |
150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 150 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
151 | return; | 151 | return; |
152 | } | 152 | } |
153 | 153 | ||
154 | if(modules.find(interfaceItems[item]) == modules.end()){ | 154 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); | 155 | QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", "Ok"); |
156 | } | 156 | } |
157 | else{ | 157 | else{ |
158 | // Try to remove. | 158 | // Try to remove. |
159 | } | 159 | } |
160 | 160 | ||
@@ -168,20 +168,35 @@ void MainWindowImp::configureClicked(){ | |||
168 | QListViewItem *item = serviceList->currentItem(); | 168 | QListViewItem *item = serviceList->currentItem(); |
169 | if(item == NULL){ | 169 | if(item == NULL){ |
170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 170 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | 173 | ||
174 | if(modules.find(interfaceItems[item]) == modules.end()){ | 174 | if((interfaceItems[item])->getModuleOwner() == NULL){ |
175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); | 175 | InterfaceSetupImp *conf = new InterfaceSetupImp(0, "InterfaceConfiguration", interfaceItems[item]); |
176 | conf->showMaximized(); | 176 | conf->showMaximized(); |
177 | conf->show(); | 177 | conf->show(); |
178 | } | 178 | } |
179 | else{ | 179 | else{ |
180 | InterfaceSetupImp *conf = new InterfaceSetupImp(this, "InterfaceConfiguration"); | 180 | QTabWidget *t = NULL; |
181 | conf->show(); | 181 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->configure(&t); |
182 | if(conf != NULL){ | ||
183 | qDebug("Conf found"); | ||
184 | if(t != NULL){ | ||
185 | qDebug("Adding Interface"); | ||
186 | InterfaceSetupImp *i = new InterfaceSetupImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
187 | t->insertTab(i, "TCP/IP"); | ||
188 | } | ||
189 | conf->showMaximized(); | ||
190 | conf->show(); | ||
191 | } | ||
192 | else{ | ||
193 | InterfaceSetupImp *i = new InterfaceSetupImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
194 | i->showMaximized(); | ||
195 | i->show(); | ||
196 | } | ||
182 | } | 197 | } |
183 | } | 198 | } |
184 | 199 | ||
185 | /** | 200 | /** |
186 | * Pull up the information about the selected interface | 201 | * Pull up the information about the selected interface |
187 | * Report an error | 202 | * Report an error |
@@ -190,22 +205,34 @@ void MainWindowImp::informationClicked(){ | |||
190 | QListViewItem *item = serviceList->currentItem(); | 205 | QListViewItem *item = serviceList->currentItem(); |
191 | if(item == NULL){ | 206 | if(item == NULL){ |
192 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); | 207 | QMessageBox::information(this, "Error","Please select an interface.", "Ok"); |
193 | return; | 208 | return; |
194 | } | 209 | } |
195 | 210 | ||
196 | if(modules.find(interfaceItems[item]) == modules.end()){ | 211 | if( (interfaceItems[item])->getModuleOwner() == NULL){ |
197 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); | 212 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "InterfaceInformationImp", interfaceItems[item]); |
198 | i->showMaximized(); | 213 | i->showMaximized(); |
199 | i->show(); | 214 | i->show(); |
200 | } | 215 | } |
201 | else{ | 216 | else{ |
202 | QTabWidget *t = new QTabWidget(this, "InterfaceInformationTAB"); | 217 | QTabWidget *t = NULL; |
203 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | 218 | QWidget *conf = (interfaceItems[item])->getModuleOwner()->information(&t); |
204 | t->insertTab(i, "TCP/IP"); | 219 | if(conf != NULL){ |
205 | t->show(); | 220 | if(t){ |
221 | qDebug("Adding Interface"); | ||
222 | InterfaceInformationImp *i = new InterfaceInformationImp(t, "TCPIPInformation", interfaceItems[item], true); | ||
223 | t->insertTab(i, "TCP/IP"); | ||
224 | } | ||
225 | conf->showMaximized(); | ||
226 | conf->show(); | ||
227 | } | ||
228 | else{ | ||
229 | InterfaceInformationImp *i = new InterfaceInformationImp(0, "TCPIPInformation", interfaceItems[item], true); | ||
230 | i->showMaximized(); | ||
231 | i->show(); | ||
232 | } | ||
206 | } | 233 | } |
207 | } | 234 | } |
208 | 235 | ||
209 | /** | 236 | /** |
210 | * Aquire the list of active interfaces from ifconfig | 237 | * Aquire the list of active interfaces from ifconfig |
211 | * Call ifconfig and ifconfig -a | 238 | * Call ifconfig and ifconfig -a |
@@ -283,16 +310,18 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
283 | QListViewItem *item = NULL; | 310 | QListViewItem *item = NULL; |
284 | 311 | ||
285 | // See if we already have it | 312 | // See if we already have it |
286 | if(items.find(i) == items.end()){ | 313 | if(items.find(i) == items.end()){ |
287 | item = new QListViewItem(serviceList, "", "", ""); | 314 | item = new QListViewItem(serviceList, "", "", ""); |
288 | // See if you can't find a module owner for this interface | 315 | // See if you can't find a module owner for this interface |
289 | //EmployeeMap::Iterator it; | 316 | QMap<Module*, QLibrary*>::Iterator it; |
290 | //for( it = map.begin(); it != map.end(); ++it ) | 317 | for( it = libraries.begin(); it != libraries.end(); ++it ){ |
291 | // printf( "%s, %s earns %d\n", it.key().latin1(), it.data().name().latin1(), it.data().salary() ); | 318 | if(it.key()->isOwner(i)) |
292 | 319 | i->setModuleOwner(it.key()); | |
320 | } | ||
321 | |||
293 | items.insert(i, item); | 322 | items.insert(i, item); |
294 | interfaceItems.insert(item, i); | 323 | interfaceItems.insert(item, i); |
295 | } | 324 | } |
296 | else | 325 | else |
297 | item = items[i]; | 326 | item = items[i]; |
298 | 327 | ||
@@ -306,12 +335,16 @@ void MainWindowImp::updateInterface(Interface *i){ | |||
306 | if(i->getHardwareName().contains("Local Loopback")) | 335 | if(i->getHardwareName().contains("Local Loopback")) |
307 | typeName = "lo"; | 336 | typeName = "lo"; |
308 | if(i->getInterfaceName().contains("irda")) | 337 | if(i->getInterfaceName().contains("irda")) |
309 | typeName = "irda"; | 338 | typeName = "irda"; |
310 | if(i->getInterfaceName().contains("wlan")) | 339 | if(i->getInterfaceName().contains("wlan")) |
311 | typeName = "wlan"; | 340 | typeName = "wlan"; |
341 | // Actually try to use the Module | ||
342 | if(i->getModuleOwner() != NULL){ | ||
343 | typeName = i->getModuleOwner()->getPixmapName(i); | ||
344 | } | ||
312 | QPixmap type = (Resource::loadPixmap(typeName)); | 345 | QPixmap type = (Resource::loadPixmap(typeName)); |
313 | item->setPixmap(1, type); | 346 | item->setPixmap(1, type); |
314 | 347 | ||
315 | item->setText(2, i->getHardwareName()); | 348 | item->setText(2, i->getHardwareName()); |
316 | 349 | ||
317 | } | 350 | } |