summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/network_NNI.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/network/network_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/network_NNI.cpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/noncore/settings/networksettings2/network/network_NNI.cpp b/noncore/settings/networksettings2/network/network_NNI.cpp
index 324c6e2..78e6545 100644
--- a/noncore/settings/networksettings2/network/network_NNI.cpp
+++ b/noncore/settings/networksettings2/network/network_NNI.cpp
@@ -1,4 +1,4 @@
1#include <system.h> 1#include <system.h>
2#include <asdevice.h> 2#include <netnode.h>
3#include "networkedit.h" 3#include "networkedit.h"
4#include "network_NNI.h" 4#include "network_NNI.h"
@@ -100,13 +100,11 @@ void ANetwork::commit( void ) {
100} 100}
101 101
102bool ANetwork::hasDataForFile( const QString & S ) { 102bool ANetwork::hasDataForFile( SystemFile & S ) {
103 return S == "interfaces"; 103 return S.name() == "interfaces";
104} 104}
105 105
106short ANetwork::generateFile( const QString & ID, 106short ANetwork::generateFile( SystemFile &SF,
107 const QString & Path, 107 long DevNr
108 QTextStream &TS, 108 ) {
109 long DevNr
110 ) {
111 109
112 short rvl, rvd ; 110 short rvl, rvd ;
@@ -114,9 +112,9 @@ short ANetwork::generateFile( const QString & ID,
114 112
115 rvl = 1; 113 rvl = 1;
116 if( ID == "interfaces" ) { 114 if( SF.name() == "interfaces" ) {
117 Log(("Generate Network for %s\n", ID.latin1() )); 115 Log(("Generate Network for %s\n", SF.name().latin1() ));
118 // we can safely call from here since device item is deeper 116 // we can safely call from here since device item is deeper
119 if( Data.UseDHCP ) { 117 if( Data.UseDHCP ) {
120 TS << "iface " 118 SF << "iface "
121 << NIC 119 << NIC
122 << "-c" 120 << "-c"
@@ -124,5 +122,5 @@ short ANetwork::generateFile( const QString & ID,
124 << "-allowed inet dhcp" 122 << "-allowed inet dhcp"
125 << endl; 123 << endl;
126 TS << " up echo \"" 124 SF << " up echo \""
127 << NIC 125 << NIC
128 << "\" > /tmp/profile-" 126 << "\" > /tmp/profile-"
@@ -131,20 +129,20 @@ short ANetwork::generateFile( const QString & ID,
131 << endl; 129 << endl;
132 if( Data.SendHostname ) { 130 if( Data.SendHostname ) {
133 TS << " hostname " 131 SF << " hostname "
134 << Data.Hostname 132 << Data.Hostname
135 << endl; 133 << endl;
136 } 134 }
137 135
138 TS << " down rm -f /tmp/profile-" 136 SF << " down rm -f /tmp/profile-"
139 << connection()->number() 137 << connection()->number()
140 << ".up" 138 << ".up"
141 << endl; 139 << endl;
142 } else { 140 } else {
143 TS << "iface " 141 SF << "iface "
144 << NIC << "-c" 142 << NIC << "-c"
145 << connection()->number() 143 << connection()->number()
146 << "-allowed inet static" 144 << "-allowed inet static"
147 << endl; 145 << endl;
148 TS << " up echo \"" 146 SF << " up echo \""
149 << NIC 147 << NIC
150 << "\" > /tmp/profile-" 148 << "\" > /tmp/profile-"
@@ -152,15 +150,15 @@ short ANetwork::generateFile( const QString & ID,
152 << ".up" 150 << ".up"
153 << endl; 151 << endl;
154 TS << " down rm -f /tmp/profile-" 152 SF << " down rm -f /tmp/profile-"
155 << connection()->number() 153 << connection()->number()
156 << ".up" 154 << ".up"
157 << endl; 155 << endl;
158 TS << " address " 156 SF << " address "
159 << Data.IPAddress 157 << Data.IPAddress
160 << endl; 158 << endl;
161 TS << " broadcast " 159 SF << " broadcast "
162 << Data.Broadcast 160 << Data.Broadcast
163 << endl; 161 << endl;
164 TS << " netmask " 162 SF << " netmask "
165 << Data.NetMask 163 << Data.NetMask
166 << endl; 164 << endl;
@@ -176,5 +174,5 @@ short ANetwork::generateFile( const QString & ID,
176 arg( ipal[2].toShort() & nmal[2].toShort() ). 174 arg( ipal[2].toShort() & nmal[2].toShort() ).
177 arg( ipal[3].toShort() & nmal[3].toShort() ); 175 arg( ipal[3].toShort() & nmal[3].toShort() );
178 TS << " network " 176 SF << " network "
179 << NW 177 << NW
180 << endl; 178 << endl;
@@ -184,5 +182,5 @@ short ANetwork::generateFile( const QString & ID,
184 it != Data.PreUp_SL.end(); 182 it != Data.PreUp_SL.end();
185 ++it ) { 183 ++it ) {
186 TS << " pre-up " 184 SF << " pre-up "
187 << (*it) 185 << (*it)
188 << endl; 186 << endl;
@@ -191,5 +189,5 @@ short ANetwork::generateFile( const QString & ID,
191 it != Data.PostUp_SL.end(); 189 it != Data.PostUp_SL.end();
192 ++it ) { 190 ++it ) {
193 TS << " up " 191 SF << " up "
194 << (*it) 192 << (*it)
195 << endl; 193 << endl;
@@ -198,5 +196,5 @@ short ANetwork::generateFile( const QString & ID,
198 it != Data.PreDown_SL.end(); 196 it != Data.PreDown_SL.end();
199 ++it ) { 197 ++it ) {
200 TS << " down " 198 SF << " down "
201 << (*it) 199 << (*it)
202 << endl; 200 << endl;
@@ -205,5 +203,5 @@ short ANetwork::generateFile( const QString & ID,
205 it != Data.PostDown_SL.end(); 203 it != Data.PostDown_SL.end();
206 ++it ) { 204 ++it ) {
207 TS << " post-down " 205 SF << " post-down "
208 << (*it) 206 << (*it)
209 << endl; 207 << endl;
@@ -213,5 +211,5 @@ short ANetwork::generateFile( const QString & ID,
213 211
214 // embed other info in it 212 // embed other info in it
215 rvd = connection()->getToplevel()->generateFileEmbedded( ID, Path, TS, DevNr ); 213 rvd = connection()->getToplevel()->generateFileEmbedded( SF, DevNr );
216 214
217 return (rvd == 2 || rvl == 2 ) ? 2 : 215 return (rvd == 2 || rvl == 2 ) ? 2 :