summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/networksetup/interfaces/interface.cpp4
-rw-r--r--noncore/net/networksetup/mainwindowimp.cpp10
-rw-r--r--noncore/net/networksetup/wlan/wlanimp.cpp8
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp10
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp.cpp8
6 files changed, 18 insertions, 26 deletions
diff --git a/noncore/net/networksetup/interfaces/interface.cpp b/noncore/net/networksetup/interfaces/interface.cpp
index 7ffa76f..d964961 100644
--- a/noncore/net/networksetup/interfaces/interface.cpp
+++ b/noncore/net/networksetup/interfaces/interface.cpp
@@ -42,86 +42,86 @@ void Interface::setAttached(bool isAttached){
42 * @param name - the new name 42 * @param name - the new name
43 * emit updateInterface 43 * emit updateInterface
44 */ 44 */
45void Interface::setHardwareName(const QString &name){ 45void Interface::setHardwareName(const QString &name){
46 hardwareName = name; 46 hardwareName = name;
47 emit(updateInterface(this)); 47 emit(updateInterface(this));
48}; 48};
49 49
50/** 50/**
51 * Set Module owner 51 * Set Module owner
52 * @param owner - the new owner 52 * @param owner - the new owner
53 * emit updateInterface 53 * emit updateInterface
54 */ 54 */
55void Interface::setModuleOwner(Module *owner){ 55void Interface::setModuleOwner(Module *owner){
56 moduleOwner = owner; 56 moduleOwner = owner;
57 emit(updateInterface(this)); 57 emit(updateInterface(this));
58}; 58};
59 59
60 60
61/** 61/**
62 * Try to start the interface. 62 * Try to start the interface.
63 */ 63 */
64void Interface::start(){ 64void Interface::start(){
65 // check to see if we are already running. 65 // check to see if we are already running.
66 if(true == status){ 66 if(true == status){
67 emit (updateMessage("Unable to start interface,\n already started")); 67 emit (updateMessage("Unable to start interface,\n already started"));
68 return; 68 return;
69 } 69 }
70 70
71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); 71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
72 // See if it was successfull... 72 // See if it was successfull...
73 if(ret != 0){ 73 if(ret != 0){
74 emit (updateMessage("Starting interface failed.")); 74 emit (updateMessage("Starting interface failed"));
75 return; 75 return;
76 } 76 }
77 77
78 status = true; 78 status = true;
79 refresh(); 79 refresh();
80 emit (updateMessage("Start successfull")); 80 emit (updateMessage("Start successfull"));
81} 81}
82 82
83/** 83/**
84 * Try to stop the interface. 84 * Try to stop the interface.
85 */ 85 */
86void Interface::stop(){ 86void Interface::stop(){
87 // check to see if we are already stopped. 87 // check to see if we are already stopped.
88 if(false == status){ 88 if(false == status){
89 emit (updateMessage("Unable to stop interface,\n already stopped")); 89 emit (updateMessage("Unable to stop interface,\n already stopped"));
90 return; 90 return;
91 } 91 }
92 92
93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); 93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
94 if(ret != 0){ 94 if(ret != 0){
95 emit (updateMessage("Stopping interface failed.")); 95 emit (updateMessage("Stopping interface failed"));
96 return; 96 return;
97 } 97 }
98 98
99 status = false; 99 status = false;
100 refresh(); 100 refresh();
101 emit (updateMessage("Stop successfull")); 101 emit (updateMessage("Stop successfull"));
102} 102}
103 103
104/** 104/**
105 * Try to restart the interface. 105 * Try to restart the interface.
106 */ 106 */
107void Interface::restart(){ 107void Interface::restart(){
108 stop(); 108 stop();
109 start(); 109 start();
110} 110}
111 111
112/** 112/**
113 * Try to refresh the information about the interface. 113 * Try to refresh the information about the interface.
114 * First call ifconfig, then check the dhcp-info file 114 * First call ifconfig, then check the dhcp-info file
115 * @return bool true if successfull. 115 * @return bool true if successfull.
116 */ 116 */
117bool Interface::refresh(){ 117bool Interface::refresh(){
118 // See if we are up. 118 // See if we are up.
119 if(status == false){ 119 if(status == false){
120 macAddress = ""; 120 macAddress = "";
121 ip = "0.0.0.0"; 121 ip = "0.0.0.0";
122 subnetMask = "0.0.0.0"; 122 subnetMask = "0.0.0.0";
123 broadcast = ""; 123 broadcast = "";
124 dhcp = false; 124 dhcp = false;
125 dhcpServerIp = ""; 125 dhcpServerIp = "";
126 leaseObtained = ""; 126 leaseObtained = "";
127 leaseExpires = ""; 127 leaseExpires = "";
diff --git a/noncore/net/networksetup/mainwindowimp.cpp b/noncore/net/networksetup/mainwindowimp.cpp
index 7b93554..9a17743 100644
--- a/noncore/net/networksetup/mainwindowimp.cpp
+++ b/noncore/net/networksetup/mainwindowimp.cpp
@@ -291,156 +291,152 @@ void MainWindowImp::removeClicked(){
291 Interface *i = interfaceItems[item]; 291 Interface *i = interfaceItems[item];
292 if(i->getModuleOwner() == NULL){ 292 if(i->getModuleOwner() == NULL){
293 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 293 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
294 } 294 }
295 else{ 295 else{
296 if(!i->getModuleOwner()->remove(i)) 296 if(!i->getModuleOwner()->remove(i))
297 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); 297 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
298 else{ 298 else{
299 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 299 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
300 // TODO memory managment.... 300 // TODO memory managment....
301 // who deletes the interface? 301 // who deletes the interface?
302 } 302 }
303 } 303 }
304} 304}
305 305
306/** 306/**
307 * Pull up the configure about the currently selected interface. 307 * Pull up the configure about the currently selected interface.
308 * Report an error if no interface is selected. 308 * Report an error if no interface is selected.
309 * If the interface has a module owner then request its configure. 309 * If the interface has a module owner then request its configure.
310 */ 310 */
311void MainWindowImp::configureClicked(){ 311void MainWindowImp::configureClicked(){
312 QListViewItem *item = connectionList->currentItem(); 312 QListViewItem *item = connectionList->currentItem();
313 if(!item){ 313 if(!item){
314 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 314 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
315 return; 315 return;
316 } 316 }
317 317
318 Interface *i = interfaceItems[item]; 318 Interface *i = interfaceItems[item];
319 if(i->getModuleOwner()){ 319 if(i->getModuleOwner()){
320 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 320 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
321 if(moduleConfigure != NULL){ 321 if(moduleConfigure != NULL){
322 moduleConfigure->showMaximized(); 322 moduleConfigure->showMaximized();
323 moduleConfigure->show();
324 return; 323 return;
325 } 324 }
326 } 325 }
327 326
328 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); 327 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose);
329 QString currentProfileText = currentProfileLabel->text(); 328 QString currentProfileText = currentProfileLabel->text();
330 if(currentProfileText.upper() == "ALL"); 329 if(currentProfileText.upper() == "ALL");
331 currentProfileText = ""; 330 currentProfileText = "";
332 configure->setProfile(currentProfileText); 331 configure->setProfile(currentProfileText);
333 configure->showMaximized(); 332 configure->showMaximized();
334 configure->show();
335} 333}
336 334
337/** 335/**
338 * Pull up the information about the currently selected interface. 336 * Pull up the information about the currently selected interface.
339 * Report an error if no interface is selected. 337 * Report an error if no interface is selected.
340 * If the interface has a module owner then request its configure. 338 * If the interface has a module owner then request its configure.
341 */ 339 */
342void MainWindowImp::informationClicked(){ 340void MainWindowImp::informationClicked(){
343 QListViewItem *item = connectionList->currentItem(); 341 QListViewItem *item = connectionList->currentItem();
344 if(!item){ 342 if(!item){
345 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 343 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
346 return; 344 return;
347 } 345 }
348 346
349 Interface *i = interfaceItems[item]; 347 Interface *i = interfaceItems[item];
350 if(!i->isAttached()){ 348 if(!i->isAttached()){
351 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 349 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
352 return; 350 return;
353 } 351 }
354 352
355 if(i->getModuleOwner()){ 353 if(i->getModuleOwner()){
356 QWidget *moduleInformation = i->getModuleOwner()->information(i); 354 QWidget *moduleInformation = i->getModuleOwner()->information(i);
357 if(moduleInformation != NULL){ 355 if(moduleInformation != NULL){
358 moduleInformation->showMaximized(); 356 moduleInformation->showMaximized();
359 moduleInformation->show();
360 return; 357 return;
361 } 358 }
362 } 359 }
363 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); 360 InterfaceInformationImp information(0, "InterfaceSetupImp", i);
364 information->showMaximized(); 361 information.showMaximized();
365 information->show();
366} 362}
367 363
368/** 364/**
369 * Update this interface. If no QListViewItem exists create one. 365 * Update this interface. If no QListViewItem exists create one.
370 * @param Interface* pointer to the interface that needs to be updated. 366 * @param Interface* pointer to the interface that needs to be updated.
371 */ 367 */
372void MainWindowImp::updateInterface(Interface *i){ 368void MainWindowImp::updateInterface(Interface *i){
373 if(!advancedUserMode){ 369 if(!advancedUserMode){
374 if(i->getInterfaceName() == "lo") 370 if(i->getInterfaceName() == "lo")
375 return; 371 return;
376 } 372 }
377 373
378 QListViewItem *item = NULL; 374 QListViewItem *item = NULL;
379 375
380 // Find the interface, making it if needed. 376 // Find the interface, making it if needed.
381 if(items.find(i) == items.end()){ 377 if(items.find(i) == items.end()){
382 item = new QListViewItem(connectionList, "", "", ""); 378 item = new QListViewItem(connectionList, "", "", "");
383 // See if you can't find a module owner for this interface 379 // See if you can't find a module owner for this interface
384 QMap<Module*, QLibrary*>::Iterator it; 380 QMap<Module*, QLibrary*>::Iterator it;
385 for( it = libraries.begin(); it != libraries.end(); ++it ){ 381 for( it = libraries.begin(); it != libraries.end(); ++it ){
386 if(it.key()->isOwner(i)) 382 if(it.key()->isOwner(i))
387 i->setModuleOwner(it.key()); 383 i->setModuleOwner(it.key());
388 } 384 }
389 items.insert(i, item); 385 items.insert(i, item);
390 interfaceItems.insert(item, i); 386 interfaceItems.insert(item, i);
391 } 387 }
392 else 388 else
393 item = items[i]; 389 item = items[i];
394 390
395 // Update the icons and information 391 // Update the icons and information
396 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 392 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
397 393
398 QString typeName = "lan"; 394 QString typeName = "lan";
399 if(i->getHardwareName().contains("Local Loopback")) 395 if(i->getHardwareName().contains("Local Loopback"))
400 typeName = "lo"; 396 typeName = "lo";
401 if(i->getInterfaceName().contains("irda")) 397 if(i->getInterfaceName().contains("irda"))
402 typeName = "irda"; 398 typeName = "irda";
403 if(i->getInterfaceName().contains("wlan")) 399 if(i->getInterfaceName().contains("wlan"))
404 typeName = "wlan"; 400 typeName = "wlan";
405 if(i->getInterfaceName().contains("usb")) 401 if(i->getInterfaceName().contains("usb"))
406 typeName = "usb"; 402 typeName = "usb";
407 403
408 if(!i->isAttached()) 404 if(!i->isAttached())
409 typeName = "connect_no"; 405 typeName = "connect_no";
410 // Actually try to use the Module 406 // Actually try to use the Module
411 if(i->getModuleOwner() != NULL) 407 if(i->getModuleOwner() != NULL)
412 typeName = i->getModuleOwner()->getPixmapName(i); 408 typeName = i->getModuleOwner()->getPixmapName(i);
413 409
414 item->setPixmap(1, (Resource::loadPixmap(typeName))); 410 item->setPixmap(1, (Resource::loadPixmap(QString("networksetup/") + typeName)));
415 item->setText(2, i->getHardwareName()); 411 item->setText(2, i->getHardwareName());
416 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 412 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
417 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 413 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
418} 414}
419 415
420void MainWindowImp::newProfileChanged(const QString& newText){ 416void MainWindowImp::newProfileChanged(const QString& newText){
421 if(newText.length() > 0) 417 if(newText.length() > 0)
422 newProfileButton->setEnabled(true); 418 newProfileButton->setEnabled(true);
423 else 419 else
424 newProfileButton->setEnabled(false); 420 newProfileButton->setEnabled(false);
425} 421}
426 422
427/** 423/**
428 * Adds a new profile to the list of profiles. 424 * Adds a new profile to the list of profiles.
429 * Don't add profiles that already exists. 425 * Don't add profiles that already exists.
430 * Appends to the list and QStringList 426 * Appends to the list and QStringList
431 */ 427 */
432void MainWindowImp::addProfile(){ 428void MainWindowImp::addProfile(){
433 QString newProfileName = newProfile->text(); 429 QString newProfileName = newProfile->text();
434 if(profiles.grep(newProfileName).count() > 0){ 430 if(profiles.grep(newProfileName).count() > 0){
435 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 431 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
436 return; 432 return;
437 } 433 }
438 profiles.append(newProfileName); 434 profiles.append(newProfileName);
439 profilesList->insertItem(newProfileName); 435 profilesList->insertItem(newProfileName);
440} 436}
441 437
442/** 438/**
443 * Removes the currently selected profile in the combo. 439 * Removes the currently selected profile in the combo.
444 * Doesn't delete if there are less then 2 profiles. 440 * Doesn't delete if there are less then 2 profiles.
445 */ 441 */
446void MainWindowImp::removeProfile(){ 442void MainWindowImp::removeProfile(){
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp
index cc18fba..648932f 100644
--- a/noncore/net/networksetup/wlan/wlanimp.cpp
+++ b/noncore/net/networksetup/wlan/wlanimp.cpp
@@ -70,71 +70,71 @@ void WLANImp::parseSettingFile(){
70 // See if we found our scheme to write or the sceme couldn't be found 70 // See if we found our scheme to write or the sceme couldn't be found
71 if((foundCase && line.contains("esac")) || 71 if((foundCase && line.contains("esac")) ||
72 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) 72 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#'))
73 found = true; 73 found = true;
74 74
75 if(line.contains(";;")) 75 if(line.contains(";;"))
76 found = false; 76 found = false;
77 if(found){ 77 if(found){
78 // write out scheme 78 // write out scheme
79 if(line.contains("ESSID=")){ 79 if(line.contains("ESSID=")){
80 QString id = line.mid(line.find("ESSID=")+6, line.length()); 80 QString id = line.mid(line.find("ESSID=")+6, line.length());
81 if(id == "any"){ 81 if(id == "any"){
82 essAny->setChecked(false); 82 essAny->setChecked(false);
83 }else{ 83 }else{
84 essAny->setChecked(true); 84 essAny->setChecked(true);
85 essSpecificLineEdit->setText(id); 85 essSpecificLineEdit->setText(id);
86 } 86 }
87 } 87 }
88 if(line.contains("MODE=")){ 88 if(line.contains("MODE=")){
89 QString mode = line.mid(line.find("MODE=")+5, line.length()); 89 QString mode = line.mid(line.find("MODE=")+5, line.length());
90 if(mode == "Managed"){ 90 if(mode == "Managed"){
91 networkType->setCurrentItem(0); 91 networkType->setCurrentItem(0);
92 channelLabel->setEnabled(false); 92 channelLabel->setEnabled(false);
93 networkChannel->setEnabled(false); 93 networkChannel->setEnabled(false);
94 } 94 }
95 else{ 95 else{
96 networkType->setCurrentItem(1); 96 networkType->setCurrentItem(1);
97 networkChannel->setEnabled(true); 97 networkChannel->setEnabled(true);
98 channelLabel->setEnabled(true); 98 channelLabel->setEnabled(true);
99 } 99 }
100 } 100 }
101 if(line.contains("#KEY0=")) 101 if(line.contains("#KEY0="))
102 keyLineEdit0->setText(line.mid(5, line.length())); 102 keyLineEdit0->setText(line.mid(6, line.length()));
103 if(line.contains("#KEY1=")) 103 if(line.contains("#KEY1="))
104 keyLineEdit1->setText(line.mid(5, line.length())); 104 keyLineEdit1->setText(line.mid(6, line.length()));
105 if(line.contains("#KEY2=")) 105 if(line.contains("#KEY2="))
106 keyLineEdit2->setText(line.mid(5, line.length())); 106 keyLineEdit2->setText(line.mid(6, line.length()));
107 if(line.contains("#KEY3=")) 107 if(line.contains("#KEY3="))
108 keyLineEdit3->setText(line.mid(5, line.length())); 108 keyLineEdit3->setText(line.mid(6, line.length()));
109 109
110 if(line.contains("KEY=")){ 110 if(line.contains("KEY=")){
111 wepEnabled->setChecked(true); 111 wepEnabled->setChecked(true);
112 QString key; 112 QString key;
113 if(line.right(5) == (" open")){ 113 if(line.right(5) == (" open")){
114 key = line.mid(4, line.length()-5); 114 key = line.mid(4, line.length()-5);
115 authOpen->setChecked(true); 115 authOpen->setChecked(true);
116 authShared->setChecked(false); 116 authShared->setChecked(false);
117 } 117 }
118 else{ 118 else{
119 authOpen->setChecked(false); 119 authOpen->setChecked(false);
120 authShared->setChecked(true); 120 authShared->setChecked(true);
121 key = line.mid(4, line.length()); 121 key = line.mid(4, line.length());
122 } 122 }
123 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); 123 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true);
124 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); 124 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true);
125 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); 125 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true);
126 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); 126 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true);
127 } 127 }
128 if(line.contains("CHANNEL=")){ 128 if(line.contains("CHANNEL=")){
129 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); 129 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt());
130 } 130 }
131 } 131 }
132 } 132 }
133} 133}
134 134
135/** 135/**
136 * Saves settings to the wireless.opts file using the current profile 136 * Saves settings to the wireless.opts file using the current profile
137 */ 137 */
138void WLANImp::changeAndSaveSettingFile(){ 138void WLANImp::changeAndSaveSettingFile(){
139 QString wlanFile = WIRELESS_OPTS; 139 QString wlanFile = WIRELESS_OPTS;
140 QFile::remove(wlanFile); 140 QFile::remove(wlanFile);
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index 7ffa76f..d964961 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -42,86 +42,86 @@ void Interface::setAttached(bool isAttached){
42 * @param name - the new name 42 * @param name - the new name
43 * emit updateInterface 43 * emit updateInterface
44 */ 44 */
45void Interface::setHardwareName(const QString &name){ 45void Interface::setHardwareName(const QString &name){
46 hardwareName = name; 46 hardwareName = name;
47 emit(updateInterface(this)); 47 emit(updateInterface(this));
48}; 48};
49 49
50/** 50/**
51 * Set Module owner 51 * Set Module owner
52 * @param owner - the new owner 52 * @param owner - the new owner
53 * emit updateInterface 53 * emit updateInterface
54 */ 54 */
55void Interface::setModuleOwner(Module *owner){ 55void Interface::setModuleOwner(Module *owner){
56 moduleOwner = owner; 56 moduleOwner = owner;
57 emit(updateInterface(this)); 57 emit(updateInterface(this));
58}; 58};
59 59
60 60
61/** 61/**
62 * Try to start the interface. 62 * Try to start the interface.
63 */ 63 */
64void Interface::start(){ 64void Interface::start(){
65 // check to see if we are already running. 65 // check to see if we are already running.
66 if(true == status){ 66 if(true == status){
67 emit (updateMessage("Unable to start interface,\n already started")); 67 emit (updateMessage("Unable to start interface,\n already started"));
68 return; 68 return;
69 } 69 }
70 70
71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1()); 71 int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
72 // See if it was successfull... 72 // See if it was successfull...
73 if(ret != 0){ 73 if(ret != 0){
74 emit (updateMessage("Starting interface failed.")); 74 emit (updateMessage("Starting interface failed"));
75 return; 75 return;
76 } 76 }
77 77
78 status = true; 78 status = true;
79 refresh(); 79 refresh();
80 emit (updateMessage("Start successfull")); 80 emit (updateMessage("Start successfull"));
81} 81}
82 82
83/** 83/**
84 * Try to stop the interface. 84 * Try to stop the interface.
85 */ 85 */
86void Interface::stop(){ 86void Interface::stop(){
87 // check to see if we are already stopped. 87 // check to see if we are already stopped.
88 if(false == status){ 88 if(false == status){
89 emit (updateMessage("Unable to stop interface,\n already stopped")); 89 emit (updateMessage("Unable to stop interface,\n already stopped"));
90 return; 90 return;
91 } 91 }
92 92
93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1()); 93 int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
94 if(ret != 0){ 94 if(ret != 0){
95 emit (updateMessage("Stopping interface failed.")); 95 emit (updateMessage("Stopping interface failed"));
96 return; 96 return;
97 } 97 }
98 98
99 status = false; 99 status = false;
100 refresh(); 100 refresh();
101 emit (updateMessage("Stop successfull")); 101 emit (updateMessage("Stop successfull"));
102} 102}
103 103
104/** 104/**
105 * Try to restart the interface. 105 * Try to restart the interface.
106 */ 106 */
107void Interface::restart(){ 107void Interface::restart(){
108 stop(); 108 stop();
109 start(); 109 start();
110} 110}
111 111
112/** 112/**
113 * Try to refresh the information about the interface. 113 * Try to refresh the information about the interface.
114 * First call ifconfig, then check the dhcp-info file 114 * First call ifconfig, then check the dhcp-info file
115 * @return bool true if successfull. 115 * @return bool true if successfull.
116 */ 116 */
117bool Interface::refresh(){ 117bool Interface::refresh(){
118 // See if we are up. 118 // See if we are up.
119 if(status == false){ 119 if(status == false){
120 macAddress = ""; 120 macAddress = "";
121 ip = "0.0.0.0"; 121 ip = "0.0.0.0";
122 subnetMask = "0.0.0.0"; 122 subnetMask = "0.0.0.0";
123 broadcast = ""; 123 broadcast = "";
124 dhcp = false; 124 dhcp = false;
125 dhcpServerIp = ""; 125 dhcpServerIp = "";
126 leaseObtained = ""; 126 leaseObtained = "";
127 leaseExpires = ""; 127 leaseExpires = "";
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 7b93554..9a17743 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -291,156 +291,152 @@ void MainWindowImp::removeClicked(){
291 Interface *i = interfaceItems[item]; 291 Interface *i = interfaceItems[item];
292 if(i->getModuleOwner() == NULL){ 292 if(i->getModuleOwner() == NULL){
293 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 293 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
294 } 294 }
295 else{ 295 else{
296 if(!i->getModuleOwner()->remove(i)) 296 if(!i->getModuleOwner()->remove(i))
297 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok); 297 QMessageBox::information(this, "Error", "Unable to remove.", QMessageBox::Ok);
298 else{ 298 else{
299 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 299 QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
300 // TODO memory managment.... 300 // TODO memory managment....
301 // who deletes the interface? 301 // who deletes the interface?
302 } 302 }
303 } 303 }
304} 304}
305 305
306/** 306/**
307 * Pull up the configure about the currently selected interface. 307 * Pull up the configure about the currently selected interface.
308 * Report an error if no interface is selected. 308 * Report an error if no interface is selected.
309 * If the interface has a module owner then request its configure. 309 * If the interface has a module owner then request its configure.
310 */ 310 */
311void MainWindowImp::configureClicked(){ 311void MainWindowImp::configureClicked(){
312 QListViewItem *item = connectionList->currentItem(); 312 QListViewItem *item = connectionList->currentItem();
313 if(!item){ 313 if(!item){
314 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok); 314 QMessageBox::information(this, "Sorry","Please select an interface first.", QMessageBox::Ok);
315 return; 315 return;
316 } 316 }
317 317
318 Interface *i = interfaceItems[item]; 318 Interface *i = interfaceItems[item];
319 if(i->getModuleOwner()){ 319 if(i->getModuleOwner()){
320 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 320 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
321 if(moduleConfigure != NULL){ 321 if(moduleConfigure != NULL){
322 moduleConfigure->showMaximized(); 322 moduleConfigure->showMaximized();
323 moduleConfigure->show();
324 return; 323 return;
325 } 324 }
326 } 325 }
327 326
328 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose); 327 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(0, "InterfaceSetupImp", i, true, Qt::WDestructiveClose);
329 QString currentProfileText = currentProfileLabel->text(); 328 QString currentProfileText = currentProfileLabel->text();
330 if(currentProfileText.upper() == "ALL"); 329 if(currentProfileText.upper() == "ALL");
331 currentProfileText = ""; 330 currentProfileText = "";
332 configure->setProfile(currentProfileText); 331 configure->setProfile(currentProfileText);
333 configure->showMaximized(); 332 configure->showMaximized();
334 configure->show();
335} 333}
336 334
337/** 335/**
338 * Pull up the information about the currently selected interface. 336 * Pull up the information about the currently selected interface.
339 * Report an error if no interface is selected. 337 * Report an error if no interface is selected.
340 * If the interface has a module owner then request its configure. 338 * If the interface has a module owner then request its configure.
341 */ 339 */
342void MainWindowImp::informationClicked(){ 340void MainWindowImp::informationClicked(){
343 QListViewItem *item = connectionList->currentItem(); 341 QListViewItem *item = connectionList->currentItem();
344 if(!item){ 342 if(!item){
345 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 343 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
346 return; 344 return;
347 } 345 }
348 346
349 Interface *i = interfaceItems[item]; 347 Interface *i = interfaceItems[item];
350 if(!i->isAttached()){ 348 if(!i->isAttached()){
351 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 349 QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
352 return; 350 return;
353 } 351 }
354 352
355 if(i->getModuleOwner()){ 353 if(i->getModuleOwner()){
356 QWidget *moduleInformation = i->getModuleOwner()->information(i); 354 QWidget *moduleInformation = i->getModuleOwner()->information(i);
357 if(moduleInformation != NULL){ 355 if(moduleInformation != NULL){
358 moduleInformation->showMaximized(); 356 moduleInformation->showMaximized();
359 moduleInformation->show();
360 return; 357 return;
361 } 358 }
362 } 359 }
363 InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i, true); 360 InterfaceInformationImp information(0, "InterfaceSetupImp", i);
364 information->showMaximized(); 361 information.showMaximized();
365 information->show();
366} 362}
367 363
368/** 364/**
369 * Update this interface. If no QListViewItem exists create one. 365 * Update this interface. If no QListViewItem exists create one.
370 * @param Interface* pointer to the interface that needs to be updated. 366 * @param Interface* pointer to the interface that needs to be updated.
371 */ 367 */
372void MainWindowImp::updateInterface(Interface *i){ 368void MainWindowImp::updateInterface(Interface *i){
373 if(!advancedUserMode){ 369 if(!advancedUserMode){
374 if(i->getInterfaceName() == "lo") 370 if(i->getInterfaceName() == "lo")
375 return; 371 return;
376 } 372 }
377 373
378 QListViewItem *item = NULL; 374 QListViewItem *item = NULL;
379 375
380 // Find the interface, making it if needed. 376 // Find the interface, making it if needed.
381 if(items.find(i) == items.end()){ 377 if(items.find(i) == items.end()){
382 item = new QListViewItem(connectionList, "", "", ""); 378 item = new QListViewItem(connectionList, "", "", "");
383 // See if you can't find a module owner for this interface 379 // See if you can't find a module owner for this interface
384 QMap<Module*, QLibrary*>::Iterator it; 380 QMap<Module*, QLibrary*>::Iterator it;
385 for( it = libraries.begin(); it != libraries.end(); ++it ){ 381 for( it = libraries.begin(); it != libraries.end(); ++it ){
386 if(it.key()->isOwner(i)) 382 if(it.key()->isOwner(i))
387 i->setModuleOwner(it.key()); 383 i->setModuleOwner(it.key());
388 } 384 }
389 items.insert(i, item); 385 items.insert(i, item);
390 interfaceItems.insert(item, i); 386 interfaceItems.insert(item, i);
391 } 387 }
392 else 388 else
393 item = items[i]; 389 item = items[i];
394 390
395 // Update the icons and information 391 // Update the icons and information
396 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 392 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
397 393
398 QString typeName = "lan"; 394 QString typeName = "lan";
399 if(i->getHardwareName().contains("Local Loopback")) 395 if(i->getHardwareName().contains("Local Loopback"))
400 typeName = "lo"; 396 typeName = "lo";
401 if(i->getInterfaceName().contains("irda")) 397 if(i->getInterfaceName().contains("irda"))
402 typeName = "irda"; 398 typeName = "irda";
403 if(i->getInterfaceName().contains("wlan")) 399 if(i->getInterfaceName().contains("wlan"))
404 typeName = "wlan"; 400 typeName = "wlan";
405 if(i->getInterfaceName().contains("usb")) 401 if(i->getInterfaceName().contains("usb"))
406 typeName = "usb"; 402 typeName = "usb";
407 403
408 if(!i->isAttached()) 404 if(!i->isAttached())
409 typeName = "connect_no"; 405 typeName = "connect_no";
410 // Actually try to use the Module 406 // Actually try to use the Module
411 if(i->getModuleOwner() != NULL) 407 if(i->getModuleOwner() != NULL)
412 typeName = i->getModuleOwner()->getPixmapName(i); 408 typeName = i->getModuleOwner()->getPixmapName(i);
413 409
414 item->setPixmap(1, (Resource::loadPixmap(typeName))); 410 item->setPixmap(1, (Resource::loadPixmap(QString("networksetup/") + typeName)));
415 item->setText(2, i->getHardwareName()); 411 item->setText(2, i->getHardwareName());
416 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 412 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
417 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 413 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
418} 414}
419 415
420void MainWindowImp::newProfileChanged(const QString& newText){ 416void MainWindowImp::newProfileChanged(const QString& newText){
421 if(newText.length() > 0) 417 if(newText.length() > 0)
422 newProfileButton->setEnabled(true); 418 newProfileButton->setEnabled(true);
423 else 419 else
424 newProfileButton->setEnabled(false); 420 newProfileButton->setEnabled(false);
425} 421}
426 422
427/** 423/**
428 * Adds a new profile to the list of profiles. 424 * Adds a new profile to the list of profiles.
429 * Don't add profiles that already exists. 425 * Don't add profiles that already exists.
430 * Appends to the list and QStringList 426 * Appends to the list and QStringList
431 */ 427 */
432void MainWindowImp::addProfile(){ 428void MainWindowImp::addProfile(){
433 QString newProfileName = newProfile->text(); 429 QString newProfileName = newProfile->text();
434 if(profiles.grep(newProfileName).count() > 0){ 430 if(profiles.grep(newProfileName).count() > 0){
435 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 431 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
436 return; 432 return;
437 } 433 }
438 profiles.append(newProfileName); 434 profiles.append(newProfileName);
439 profilesList->insertItem(newProfileName); 435 profilesList->insertItem(newProfileName);
440} 436}
441 437
442/** 438/**
443 * Removes the currently selected profile in the combo. 439 * Removes the currently selected profile in the combo.
444 * Doesn't delete if there are less then 2 profiles. 440 * Doesn't delete if there are less then 2 profiles.
445 */ 441 */
446void MainWindowImp::removeProfile(){ 442void MainWindowImp::removeProfile(){
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp
index cc18fba..648932f 100644
--- a/noncore/settings/networksettings/wlan/wlanimp.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp.cpp
@@ -70,71 +70,71 @@ void WLANImp::parseSettingFile(){
70 // See if we found our scheme to write or the sceme couldn't be found 70 // See if we found our scheme to write or the sceme couldn't be found
71 if((foundCase && line.contains("esac")) || 71 if((foundCase && line.contains("esac")) ||
72 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#')) 72 (foundCase && line.left(currentProfile.length()+7) == currentProfile + ",*,*,*)" && line.at(0) != '#'))
73 found = true; 73 found = true;
74 74
75 if(line.contains(";;")) 75 if(line.contains(";;"))
76 found = false; 76 found = false;
77 if(found){ 77 if(found){
78 // write out scheme 78 // write out scheme
79 if(line.contains("ESSID=")){ 79 if(line.contains("ESSID=")){
80 QString id = line.mid(line.find("ESSID=")+6, line.length()); 80 QString id = line.mid(line.find("ESSID=")+6, line.length());
81 if(id == "any"){ 81 if(id == "any"){
82 essAny->setChecked(false); 82 essAny->setChecked(false);
83 }else{ 83 }else{
84 essAny->setChecked(true); 84 essAny->setChecked(true);
85 essSpecificLineEdit->setText(id); 85 essSpecificLineEdit->setText(id);
86 } 86 }
87 } 87 }
88 if(line.contains("MODE=")){ 88 if(line.contains("MODE=")){
89 QString mode = line.mid(line.find("MODE=")+5, line.length()); 89 QString mode = line.mid(line.find("MODE=")+5, line.length());
90 if(mode == "Managed"){ 90 if(mode == "Managed"){
91 networkType->setCurrentItem(0); 91 networkType->setCurrentItem(0);
92 channelLabel->setEnabled(false); 92 channelLabel->setEnabled(false);
93 networkChannel->setEnabled(false); 93 networkChannel->setEnabled(false);
94 } 94 }
95 else{ 95 else{
96 networkType->setCurrentItem(1); 96 networkType->setCurrentItem(1);
97 networkChannel->setEnabled(true); 97 networkChannel->setEnabled(true);
98 channelLabel->setEnabled(true); 98 channelLabel->setEnabled(true);
99 } 99 }
100 } 100 }
101 if(line.contains("#KEY0=")) 101 if(line.contains("#KEY0="))
102 keyLineEdit0->setText(line.mid(5, line.length())); 102 keyLineEdit0->setText(line.mid(6, line.length()));
103 if(line.contains("#KEY1=")) 103 if(line.contains("#KEY1="))
104 keyLineEdit1->setText(line.mid(5, line.length())); 104 keyLineEdit1->setText(line.mid(6, line.length()));
105 if(line.contains("#KEY2=")) 105 if(line.contains("#KEY2="))
106 keyLineEdit2->setText(line.mid(5, line.length())); 106 keyLineEdit2->setText(line.mid(6, line.length()));
107 if(line.contains("#KEY3=")) 107 if(line.contains("#KEY3="))
108 keyLineEdit3->setText(line.mid(5, line.length())); 108 keyLineEdit3->setText(line.mid(6, line.length()));
109 109
110 if(line.contains("KEY=")){ 110 if(line.contains("KEY=")){
111 wepEnabled->setChecked(true); 111 wepEnabled->setChecked(true);
112 QString key; 112 QString key;
113 if(line.right(5) == (" open")){ 113 if(line.right(5) == (" open")){
114 key = line.mid(4, line.length()-5); 114 key = line.mid(4, line.length()-5);
115 authOpen->setChecked(true); 115 authOpen->setChecked(true);
116 authShared->setChecked(false); 116 authShared->setChecked(false);
117 } 117 }
118 else{ 118 else{
119 authOpen->setChecked(false); 119 authOpen->setChecked(false);
120 authShared->setChecked(true); 120 authShared->setChecked(true);
121 key = line.mid(4, line.length()); 121 key = line.mid(4, line.length());
122 } 122 }
123 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true); 123 if(key == keyLineEdit0->text()) keyRadio0->setChecked(true);
124 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true); 124 if(key == keyLineEdit1->text()) keyRadio1->setChecked(true);
125 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true); 125 if(key == keyLineEdit2->text()) keyRadio2->setChecked(true);
126 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true); 126 if(key == keyLineEdit3->text()) keyRadio3->setChecked(true);
127 } 127 }
128 if(line.contains("CHANNEL=")){ 128 if(line.contains("CHANNEL=")){
129 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt()); 129 networkChannel->setValue(line.mid(line.find("CHANNEL=")+8, line.length()).toInt());
130 } 130 }
131 } 131 }
132 } 132 }
133} 133}
134 134
135/** 135/**
136 * Saves settings to the wireless.opts file using the current profile 136 * Saves settings to the wireless.opts file using the current profile
137 */ 137 */
138void WLANImp::changeAndSaveSettingFile(){ 138void WLANImp::changeAndSaveSettingFile(){
139 QString wlanFile = WIRELESS_OPTS; 139 QString wlanFile = WIRELESS_OPTS;
140 QFile::remove(wlanFile); 140 QFile::remove(wlanFile);