author | tille <tille> | 2003-06-17 13:05:55 (UTC) |
---|---|---|
committer | tille <tille> | 2003-06-17 13:05:55 (UTC) |
commit | 154d6deef15b9f7f83ea7a25f2079d9fca034910 (patch) (unidiff) | |
tree | 2cb0428922d8d2a4a2adc49b2c62e44cbbdd3b82 /noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |
parent | e3aff4e49db15c44faf874ee96d666ad56c1d37a (diff) | |
download | opie-154d6deef15b9f7f83ea7a25f2079d9fca034910.zip opie-154d6deef15b9f7f83ea7a25f2079d9fca034910.tar.gz opie-154d6deef15b9f7f83ea7a25f2079d9fca034910.tar.bz2 |
wellenreiter qcop call works now
dns are saved and read in again
Diffstat (limited to 'noncore/settings/networksettings/interfaces/interfacesetupimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | 47 |
1 files changed, 25 insertions, 22 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 | |||
@@ -21,7 +21,7 @@ | |||
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 | */ |
25 | InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interface *i, Interfaces *j, WFlags fl) : InterfaceSetup(parent, name, fl), interface(i), interfaces(j), delInterfaces(false){ | 25 | InterfaceSetupImp::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; |
@@ -31,7 +31,7 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac | |||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Destructor | 33 | * Destructor |
34 | */ | 34 | */ |
35 | InterfaceSetupImp::~InterfaceSetupImp(){ | 35 | InterfaceSetupImp::~InterfaceSetupImp(){ |
36 | if(delInterfaces) { | 36 | if(delInterfaces) { |
37 | delete interfaces; | 37 | delete interfaces; |
@@ -39,7 +39,7 @@ InterfaceSetupImp::~InterfaceSetupImp(){ | |||
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 | */ |
44 | bool InterfaceSetupImp::saveChanges(){ | 44 | bool InterfaceSetupImp::saveChanges(){ |
45 | bool error; | 45 | bool error; |
@@ -56,25 +56,25 @@ bool InterfaceSetupImp::saveChanges(){ | |||
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; |
@@ -83,23 +83,23 @@ bool InterfaceSetupImp::saveChanges(){ | |||
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 | */ |
87 | bool InterfaceSetupImp::saveSettings(){ | 87 | bool 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); |
@@ -119,7 +119,7 @@ bool InterfaceSetupImp::saveSettings(){ | |||
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; |
@@ -128,7 +128,7 @@ bool InterfaceSetupImp::saveSettings(){ | |||
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 | */ |
132 | void InterfaceSetupImp::setProfile(const QString &profile){ | 132 | void InterfaceSetupImp::setProfile(const QString &profile){ |
133 | /* | 133 | /* |
134 | bool error = false; | 134 | bool error = false; |
@@ -162,13 +162,13 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
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) |
@@ -179,18 +179,21 @@ void InterfaceSetupImp::setProfile(const QString &profile){ | |||
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 | ||