summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp47
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp5
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp17
3 files changed, 42 insertions, 27 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index 49a47ae..8de30de 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -18,31 +18,31 @@
18#endif 18#endif
19 19
20#define DNSSCRIPT "changedns" 20#define DNSSCRIPT "changedns"
21 21
22/** 22/**
23 * Constuctor. Set up the connection. A profile must be set. 23 * Constuctor. Set up the connection. A profile must be set.
24 */ 24 */
25InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ 25InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){
26 if (j == 0) { 26 if (j == 0) {
27 delInterfaces = true; 27 delInterfaces = true;
28 interfaces = new Interfaces; 28 interfaces = new Interfaces;
29 } 29 }
30} 30}
31 31
32/** 32/**
33 * Destructor 33 * Destructor
34 */ 34 */
35InterfaceSetupImp::~InterfaceSetupImp(){ 35InterfaceSetupImp::~InterfaceSetupImp(){
36 if(delInterfaces) { 36 if(delInterfaces) {
37 delete interfaces; 37 delete interfaces;
38 } 38 }
39} 39}
40 40
41/** 41/**
42 * Save the current settings, then write out the interfaces file and close. 42 * Save the current settings, then write out the interfaces file and close.
43 */ 43 */
44bool InterfaceSetupImp::saveChanges(){ 44bool InterfaceSetupImp::saveChanges(){
45 bool error; 45 bool error;
46 QString iface = interfaces->getInterfaceName(error); 46 QString iface = interfaces->getInterfaceName(error);
47 if(!saveSettings()) 47 if(!saveSettings())
48 return false; 48 return false;
@@ -53,56 +53,56 @@ bool InterfaceSetupImp::saveChanges(){
53 QString ifup; 53 QString ifup;
54 ifup += "ifdown "; 54 ifup += "ifdown ";
55 ifup += iface; 55 ifup += iface;
56 ifup += "; ifup "; 56 ifup += "; ifup ";
57 ifup += iface; 57 ifup += iface;
58 ifup += ";"; 58 ifup += ";";
59 59
60 OProcess restart; 60 OProcess restart;
61 restart << "sh"; 61 restart << "sh";
62 restart << "-c"; 62 restart << "-c";
63 restart << ifup; 63 restart << ifup;
64 64
65 OWait *owait = new OWait(); 65 OWait *owait = new OWait();
66 Global::statusMessage( tr( "Restarting interface" ) ); 66 Global::statusMessage( tr( "Restarting interface" ) );
67 67
68 owait->show(); 68 owait->show();
69 qApp->processEvents(); 69 qApp->processEvents();
70 70
71 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { 71 if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) {
72 qWarning("unstable to spawn ifdown/ifup"); 72 qWarning("unstable to spawn ifdown/ifup");
73 } 73 }
74 74
75 owait->hide(); 75 owait->hide();
76 delete owait; 76 delete owait;
77 77
78 interface->refresh(); 78 interface->refresh();
79 } 79 }
80 return true; 80 return true;
81} 81}
82 82
83/** 83/**
84 * Save the settings for the current Interface. 84 * Save the settings for the current Interface.
85 * @return bool true if successfull, false otherwise 85 * @return bool true if successfull, false otherwise
86 */ 86 */
87bool InterfaceSetupImp::saveSettings(){ 87bool InterfaceSetupImp::saveSettings(){
88 // eh can't really do anything about it other then return. :-D 88 // eh can't really do anything about it other then return. :-D
89 if(!interfaces->isInterfaceSet()) 89 if(!interfaces->isInterfaceSet())
90 return true; 90 return true;
91 91
92 bool error = false; 92 bool error = false;
93 // Loopback case 93 // Loopback case
94 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 94 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
95 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 95 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
96 return true; 96 return true;
97 } 97 }
98 98
99 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ 99 if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){
100 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok); 100 QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", QMessageBox::Ok);
101 return false; 101 return false;
102 } 102 }
103 // DHCP 103 // DHCP
104 if(dhcpCheckBox->isChecked()) { 104 if(dhcpCheckBox->isChecked()) {
105 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); 105 interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP);
106 interfaces->removeInterfaceOption("address"); 106 interfaces->removeInterfaceOption("address");
107 interfaces->removeInterfaceOption("netmask"); 107 interfaces->removeInterfaceOption("netmask");
108 interfaces->removeInterfaceOption("gateway"); 108 interfaces->removeInterfaceOption("gateway");
@@ -116,22 +116,22 @@ bool InterfaceSetupImp::saveSettings(){
116 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){ 116 if(!firstDNSLineEdit->text().isEmpty() || !secondDNSLineEdit->text().isEmpty()){
117 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text(); 117 QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
118 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns); 118 interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
119 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns); 119 interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
120 } 120 }
121 } 121 }
122 122
123 // IP Information 123 // IP Information
124 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); 124 interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked());
125 return true; 125 return true;
126} 126}
127 127
128/** 128/**
129 * The Profile has changed. 129 * The Profile has changed.
130 * @param QString profile the new profile. 130 * @param QString profile the new profile.
131 */ 131 */
132void InterfaceSetupImp::setProfile(const QString &profile){ 132void InterfaceSetupImp::setProfile(const QString &profile){
133 /* 133 /*
134 bool error = false; 134 bool error = false;
135 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ 135 if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){
136 staticGroupBox->hide(); 136 staticGroupBox->hide();
137 dhcpCheckBox->hide(); 137 dhcpCheckBox->hide();
@@ -159,38 +159,41 @@ void InterfaceSetupImp::setProfile(const QString &profile){
159 interfaces->setScript("getprofile.sh"); 159 interfaces->setScript("getprofile.sh");
160 } 160 }
161 else{ 161 else{
162 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); 162 interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP);
163 if(!interfaces->setInterface(newInterfaceName)){ 163 if(!interfaces->setInterface(newInterfaceName)){
164 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); 164 qDebug("InterfaceSetupImp: Added interface, but still can't setInterface.");
165 return; 165 return;
166 } 166 }
167 } 167 }
168 } 168 }
169 169
170 // We must have a valid interface to get this far so read some settings. 170 // We must have a valid interface to get this far so read some settings.
171 171
172 // DHCP 172 // DHCP
173 bool error = false; 173 bool error = false;
174 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) 174 if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP)
175 dhcpCheckBox->setChecked(true); 175 dhcpCheckBox->setChecked(true);
176 else 176 else
177 dhcpCheckBox->setChecked(false); 177 dhcpCheckBox->setChecked(false);
178 178
179 // IP Information 179 // IP Information
180 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); 180 autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName()));
181 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); 181 QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error);
182 qDebug("dns >%s<",dns.latin1());
182 if(dns.contains(" ")){ 183 if(dns.contains(" ")){
183 firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); 184 firstDNSLineEdit->setText(dns.mid(0, dns.find(" ")));
184 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); 185 secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length()));
185 } 186 }
186 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); 187 ipAddressEdit->setText(interfaces->getInterfaceOption("address", error));
187 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); 188 subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error));
188 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); 189 gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error));
190
191
189 192
190 qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1()); 193 qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1());
191 qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1()); 194 qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1());
192 195
193} 196}
194 197
195// interfacesetup.cpp 198// interfacesetup.cpp
196 199
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 8ea241d..2d714ca 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -637,12 +637,17 @@ void MainWindowImp::makeChannel()
637 637
638void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) 638void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
639{ 639{
640 bool found = false; 640 bool found = false;
641 qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); 641 qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
642 642
643 if (msg == "raise") {
644 raise();
645 return;
646 }
647
643 QString dest = msg.left(msg.find("(")); 648 QString dest = msg.left(msg.find("("));
644 QCString param = msg.right(msg.length() - msg.find("(") - 1); 649 QCString param = msg.right(msg.length() - msg.find("(") - 1);
645 param = param.left( param.length() - 1 ); 650 param = param.left( param.length() - 1 );
646 qDebug("dest >%s< param >"+param+"<",dest.latin1()); 651 qDebug("dest >%s< param >"+param+"<",dest.latin1());
647 652
648 QMap<Module*, QLibrary*>::Iterator it; 653 QMap<Module*, QLibrary*>::Iterator it;
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 371b689..7bded85 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -67,13 +67,13 @@ bool WLANModule::isOwner(Interface *i){
67 67
68/** 68/**
69 * Create, and return the WLANConfigure Module 69 * Create, and return the WLANConfigure Module
70 * @return QWidget* pointer to this modules configure. 70 * @return QWidget* pointer to this modules configure.
71 */ 71 */
72QWidget *WLANModule::configure(Interface *i){ 72QWidget *WLANModule::configure(Interface *i){
73 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, false, Qt::WDestructiveClose); 73 WLANImp *wlanconfig = new WLANImp(0, "WlanConfig", i, true, Qt::WDestructiveClose);
74 wlanconfig->setProfile(profile); 74 wlanconfig->setProfile(profile);
75 return wlanconfig; 75 return wlanconfig;
76} 76}
77 77
78/** 78/**
79 * Create, and return the Information Module 79 * Create, and return the Information Module
@@ -129,12 +129,13 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
129 return; 129 return;
130 } 130 }
131 131
132 QDataStream stream(arg,IO_ReadOnly); 132 QDataStream stream(arg,IO_ReadOnly);
133 QString interface; 133 QString interface;
134 QString action; 134 QString action;
135 QDialog *toShow;
135 while (! stream.atEnd() ){ 136 while (! stream.atEnd() ){
136 stream >> interface; 137 stream >> interface;
137 stream >> action; 138 stream >> action;
138 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1()); 139 qDebug("WLANModule got interface %s and acion %s", interface.latin1(), action.latin1());
139 // find interfaces 140 // find interfaces
140 Interface *ifa=0; 141 Interface *ifa=0;
@@ -144,14 +145,14 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
144 ifa = i; 145 ifa = i;
145 } 146 }
146 } 147 }
147 148
148 if (ifa == 0){ 149 if (ifa == 0){
149 qDebug("WLANModule Did not find %s",interface.latin1()); 150 qDebug("WLANModule Did not find %s",interface.latin1());
150 qDebug("returning"); 151 qDebug("skipping");
151 return; 152 count = 0;
152 } 153 }
153 154
154 if (count == 2){ 155 if (count == 2){
155 // those should call the interface directly 156 // those should call the interface directly
156 QWidget *info = getInfo( ifa ); 157 QWidget *info = getInfo( ifa );
157 info->showMaximized(); 158 info->showMaximized();
@@ -167,12 +168,13 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
167 } 168 }
168 }else if (count == 3){ 169 }else if (count == 3){
169 QString value; 170 QString value;
170 if (!wlanconfigWiget){ 171 if (!wlanconfigWiget){
171 //FIXME: what if it got closed meanwhile? 172 //FIXME: what if it got closed meanwhile?
172 wlanconfigWiget = (WLANImp*) configure(ifa); 173 wlanconfigWiget = (WLANImp*) configure(ifa);
174 toShow = (QDialog*) wlanconfigWiget;
173 } 175 }
174 wlanconfigWiget->showMaximized(); 176 wlanconfigWiget->showMaximized();
175 stream >> value; 177 stream >> value;
176 qDebug("WLANModule is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() ); 178 qDebug("WLANModule is setting %s of %s to %s", action.latin1(), interface.latin1(), value.latin1() );
177 if ( action.contains("ESSID") ){ 179 if ( action.contains("ESSID") ){
178 QComboBox *combo = wlanconfigWiget->essid; 180 QComboBox *combo = wlanconfigWiget->essid;
@@ -188,21 +190,26 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
188 for ( int i = 0; i < combo->count(); i++) 190 for ( int i = 0; i < combo->count(); i++)
189 if ( combo->text( i ) == value ){ 191 if ( combo->text( i ) == value ){
190 combo->setCurrentItem( i ); 192 combo->setCurrentItem( i );
191 } 193 }
192 194
193 }else if (action.contains("Channel")){ 195 }else if (action.contains("Channel")){
194 wlanconfigWiget->specifyChan->setChecked( true ); 196 bool ok;
195 wlanconfigWiget->networkChannel->setValue( value.toInt() ); 197 int chan = value.toInt( &ok );
198 if (ok){
199 wlanconfigWiget->specifyChan->setChecked( true );
200 wlanconfigWiget->networkChannel->setValue( chan );
201 }
196 }else if (action.contains("MacAddr")){ 202 }else if (action.contains("MacAddr")){
197 wlanconfigWiget->specifyAp->setChecked( true ); 203 wlanconfigWiget->specifyAp->setChecked( true );
198 wlanconfigWiget->macEdit->setText( value ); 204 wlanconfigWiget->macEdit->setText( value );
199 }else 205 }else
200 qDebug("wlan plugin has no clue"); 206 qDebug("wlan plugin has no clue");
201 } 207 }
202 }// while stream 208 }// while stream
209 if (toShow) toShow->exec();
203} 210}
204 211
205QWidget *WLANModule::getInfo( Interface *i) 212QWidget *WLANModule::getInfo( Interface *i)
206{ 213{
207 qDebug("WLANModule::getInfo start"); 214 qDebug("WLANModule::getInfo start");
208 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose); 215 WlanInfoImp *info = new WlanInfoImp(0, i->getInterfaceName(), Qt::WDestructiveClose);