author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfacesetupimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 7c2f85c..ec3bad3 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -37,25 +37,25 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac | |||
37 | InterfaceSetupImp::~InterfaceSetupImp(){ | 37 | InterfaceSetupImp::~InterfaceSetupImp(){ |
38 | if(delInterfaces) { | 38 | if(delInterfaces) { |
39 | delete interfaces; | 39 | delete interfaces; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Save the current settings, then write out the interfaces file and close. | 44 | * Save the current settings, then write out the interfaces file and close. |
45 | */ | 45 | */ |
46 | bool InterfaceSetupImp::saveChanges(){ | 46 | bool InterfaceSetupImp::saveChanges(){ |
47 | bool error; | 47 | bool error; |
48 | QString iface = interfaces->getInterfaceName(error); | 48 | QString iface = interfaces->getInterfaceName(error); |
49 | qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() ); | 49 | odebug << "InterfaceSetupImp::saveChanges saves interface " << iface.latin1() << "" << oendl; |
50 | if(!saveSettings()) | 50 | if(!saveSettings()) |
51 | return false; | 51 | return false; |
52 | 52 | ||
53 | interfaces->write(); | 53 | interfaces->write(); |
54 | 54 | ||
55 | if (interface->getStatus()) { | 55 | if (interface->getStatus()) { |
56 | QString ifup; | 56 | QString ifup; |
57 | ifup += "ifdown "; | 57 | ifup += "ifdown "; |
58 | ifup += iface; | 58 | ifup += iface; |
59 | ifup += "; ifup "; | 59 | ifup += "; ifup "; |
60 | ifup += iface; | 60 | ifup += iface; |
61 | ifup += ";"; | 61 | ifup += ";"; |
@@ -63,25 +63,25 @@ bool InterfaceSetupImp::saveChanges(){ | |||
63 | OProcess restart; | 63 | OProcess restart; |
64 | restart << "sh"; | 64 | restart << "sh"; |
65 | restart << "-c"; | 65 | restart << "-c"; |
66 | restart << ifup; | 66 | restart << ifup; |
67 | 67 | ||
68 | OWait *owait = new OWait(); | 68 | OWait *owait = new OWait(); |
69 | Global::statusMessage( tr( "Restarting interface" ) ); | 69 | Global::statusMessage( tr( "Restarting interface" ) ); |
70 | 70 | ||
71 | owait->show(); | 71 | owait->show(); |
72 | qApp->processEvents(); | 72 | qApp->processEvents(); |
73 | 73 | ||
74 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { | 74 | if (!restart.start(OProcess::Block, OProcess::NoCommunication) ) { |
75 | qWarning("unstable to spawn ifdown/ifup"); | 75 | owarn << "unstable to spawn ifdown/ifup" << oendl; |
76 | } | 76 | } |
77 | 77 | ||
78 | owait->hide(); | 78 | owait->hide(); |
79 | delete owait; | 79 | delete owait; |
80 | 80 | ||
81 | interface->refresh(); | 81 | interface->refresh(); |
82 | } | 82 | } |
83 | return true; | 83 | return true; |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Save the settings for the current Interface. | 87 | * Save the settings for the current Interface. |
@@ -148,61 +148,61 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
148 | 148 | ||
149 | QString newInterfaceName = interface->getInterfaceName(); | 149 | QString newInterfaceName = interface->getInterfaceName(); |
150 | if(profile.length() > 0) | 150 | if(profile.length() > 0) |
151 | newInterfaceName += "_" + profile; | 151 | newInterfaceName += "_" + profile; |
152 | // See if we have to make a interface. | 152 | // See if we have to make a interface. |
153 | if(!interfaces->setInterface(newInterfaceName)){ | 153 | if(!interfaces->setInterface(newInterfaceName)){ |
154 | // Add making for this new interface if need too | 154 | // Add making for this new interface if need too |
155 | if(profile != ""){ | 155 | if(profile != ""){ |
156 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); | 156 | interfaces->copyInterface(interface->getInterfaceName(), newInterfaceName); |
157 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 157 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
158 | interfaces->addMapping(interface->getInterfaceName()); | 158 | interfaces->addMapping(interface->getInterfaceName()); |
159 | if(!interfaces->setMapping(interface->getInterfaceName())){ | 159 | if(!interfaces->setMapping(interface->getInterfaceName())){ |
160 | qDebug("InterfaceSetupImp: Added Mapping, but still can't setInterface."); | 160 | odebug << "InterfaceSetupImp: Added Mapping, but still can't setInterface." << oendl; |
161 | return; | 161 | return; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | interfaces->setMap("map", newInterfaceName); | 164 | interfaces->setMap("map", newInterfaceName); |
165 | interfaces->setScript("getprofile.sh"); | 165 | interfaces->setScript("getprofile.sh"); |
166 | } | 166 | } |
167 | else{ | 167 | else{ |
168 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); | 168 | interfaces->addInterface(newInterfaceName, INTERFACES_FAMILY_INET, INTERFACES_METHOD_DHCP); |
169 | if(!interfaces->setInterface(newInterfaceName)){ | 169 | if(!interfaces->setInterface(newInterfaceName)){ |
170 | qDebug("InterfaceSetupImp: Added interface, but still can't setInterface."); | 170 | odebug << "InterfaceSetupImp: Added interface, but still can't setInterface." << oendl; |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | // We must have a valid interface to get this far so read some settings. | 176 | // We must have a valid interface to get this far so read some settings. |
177 | 177 | ||
178 | // DHCP | 178 | // DHCP |
179 | bool error = false; | 179 | bool error = false; |
180 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) | 180 | if(interfaces->getInterfaceMethod(error) == INTERFACES_METHOD_DHCP) |
181 | dhcpCheckBox->setChecked(true); | 181 | dhcpCheckBox->setChecked(true); |
182 | else | 182 | else |
183 | dhcpCheckBox->setChecked(false); | 183 | dhcpCheckBox->setChecked(false); |
184 | 184 | ||
185 | // IP Information | 185 | // IP Information |
186 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); | 186 | autoStart->setChecked(interfaces->isAuto(interface->getInterfaceName())); |
187 | QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); | 187 | QString dns = interfaces->getInterfaceOption("up "DNSSCRIPT" -a", error); |
188 | qDebug("dns >%s<",dns.latin1()); | 188 | odebug << "dns >" << dns.latin1() << "<" << oendl; |
189 | if(dns.contains(" ")){ | 189 | if(dns.contains(" ")){ |
190 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); | 190 | firstDNSLineEdit->setText(dns.mid(0, dns.find(" "))); |
191 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); | 191 | secondDNSLineEdit->setText(dns.mid(dns.find(" ")+1, dns.length())); |
192 | }else firstDNSLineEdit->setText(dns); | 192 | }else firstDNSLineEdit->setText(dns); |
193 | 193 | ||
194 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); | 194 | ipAddressEdit->setText(interfaces->getInterfaceOption("address", error)); |
195 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); | 195 | subnetMaskEdit->setText(interfaces->getInterfaceOption("netmask", error)); |
196 | if (subnetMaskEdit->text().isEmpty()) | 196 | if (subnetMaskEdit->text().isEmpty()) |
197 | subnetMaskEdit->setText( "255.255.255.0" ); | 197 | subnetMaskEdit->setText( "255.255.255.0" ); |
198 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); | 198 | gatewayEdit->setText(interfaces->getInterfaceOption("gateway", error)); |
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | qWarning("InterfaceSetupImp::setProfile(%s)\n", profile.latin1()); | 202 | owarn << "InterfaceSetupImp::setProfile(" << profile.latin1() << ")\n" << oendl; |
203 | qWarning("InterfaceSetupImp::setProfile: iface is %s\n", interfaces->getInterfaceName(error).latin1()); | 203 | owarn << "InterfaceSetupImp::setProfile: iface is " << interfaces->getInterfaceName(error).latin1() << "\n" << oendl; |
204 | 204 | ||
205 | } | 205 | } |
206 | 206 | ||
207 | // interfacesetup.cpp | 207 | // interfacesetup.cpp |
208 | 208 | ||