author | wimpie <wimpie> | 2004-08-09 02:31:25 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-08-09 02:31:25 (UTC) |
commit | 0784cfdbd261c43856b45be6ab7439841e69b858 (patch) (unidiff) | |
tree | f6a27d6b2e1e6d8dcc908b2ef5836cd320ddfab1 /noncore/settings/networksettings2/nsdata.cpp | |
parent | 5e10278e748608766245ff9f59a54d1ae8ff6f7e (diff) | |
download | opie-0784cfdbd261c43856b45be6ab7439841e69b858.zip opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.gz opie-0784cfdbd261c43856b45be6ab7439841e69b858.tar.bz2 |
Many changes :
bluetooth and usb seems to work
added preliminary support for VPN on top of any network
This version is still very much crippled yet is does DO some
things
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index bb37f10..3b17548 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -16,9 +16,9 @@ NetworkSettingsData::NetworkSettingsData( void ) { | |||
16 | new TheNSResources(); | 16 | new TheNSResources(); |
17 | 17 | ||
18 | CfgFile.sprintf( "%s/Settings/NS2.conf", | 18 | CfgFile.sprintf( "%s/Settings/NS2.conf", |
19 | NSResources->currentUser().HomeDir.latin1() ); | 19 | NSResources->currentUser().HomeDir.latin1() ); |
20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); | 20 | Log(( "Cfg from %s\n", CfgFile.latin1() )); |
21 | 21 | ||
22 | // load settings | 22 | // load settings |
23 | Force = 0; | 23 | Force = 0; |
24 | IsModified = 0; | 24 | IsModified = 0; |
@@ -78,13 +78,13 @@ void NetworkSettingsData::loadSettings( void ) { | |||
78 | S = S.mid( 9, S.length()-9 ); | 78 | S = S.mid( 9, S.length()-9 ); |
79 | S = deQuote(S); | 79 | S = deQuote(S); |
80 | // try to find netnode | 80 | // try to find netnode |
81 | NN = NSResources->findNetNode( S ); | 81 | NN = NSResources->findNetNode( S ); |
82 | fprintf( stderr, "Node %s : %p\n", S.latin1(), NN ); | 82 | Log( ( "Node %s : %p\n", S.latin1(), NN ) ); |
83 | } else { | 83 | } else { |
84 | // try to find instance | 84 | // try to find instance |
85 | NNI = NSResources->createNodeInstance( S ); | 85 | NNI = NSResources->createNodeInstance( S ); |
86 | fprintf( stderr, "NodeInstance %s : %p\n", S.latin1(), NNI ); | 86 | Log( ( "NodeInstance %s : %p\n", S.latin1(), NNI )); |
87 | } | 87 | } |
88 | 88 | ||
89 | if( NN == 0 && NNI == 0 ) { | 89 | if( NN == 0 && NNI == 0 ) { |
90 | LeftOvers.append( Line ); | 90 | LeftOvers.append( Line ); |
@@ -150,9 +150,9 @@ QString NetworkSettingsData::saveSettings( void ) { | |||
150 | 150 | ||
151 | QString S; | 151 | QString S; |
152 | QFile F( CfgFile + ".bup" ); | 152 | QFile F( CfgFile + ".bup" ); |
153 | 153 | ||
154 | printf( "Saving settings to %s\n", CfgFile.latin1() ); | 154 | Log( ( "Saving settings to %s\n", CfgFile.latin1() )); |
155 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { | 155 | if( ! F.open( IO_WriteOnly | IO_Truncate ) ) { |
156 | ErrS = qApp->translate( "NetworkSettings", | 156 | ErrS = qApp->translate( "NetworkSettings", |
157 | "<p>Could not save setup to \"%1\" !</p>" ). | 157 | "<p>Could not save setup to \"%1\" !</p>" ). |
158 | arg(CfgFile); | 158 | arg(CfgFile); |
@@ -228,9 +228,9 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
228 | if( ! ForceIt && ! isModified() ) | 228 | if( ! ForceIt && ! isModified() ) |
229 | return S; | 229 | return S; |
230 | 230 | ||
231 | // regenerate system files | 231 | // regenerate system files |
232 | fprintf( stderr, "Generating settings from %s\n", CfgFile.latin1() ); | 232 | Log( ( "Generating settings from %s\n", CfgFile.latin1() )); |
233 | 233 | ||
234 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); | 234 | { Name2SystemFile_t & SFM = NSResources->systemFiles(); |
235 | Name2Connection_t & M = NSResources->connections(); | 235 | Name2Connection_t & M = NSResources->connections(); |
236 | NodeCollection * NC; | 236 | NodeCollection * NC; |
@@ -280,16 +280,8 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | // we cannot renumber with a FORCE request since | ||
285 | // we probably are NOT going to save the config | ||
286 | // e.g. when using --regen option | ||
287 | if( ! ForceReq && needToRegenerate ) { | ||
288 | NSResources->renumberConnections(); | ||
289 | setModified(1); | ||
290 | } | ||
291 | |||
292 | // | 284 | // |
293 | // generate files proper to each netnodeinstance | 285 | // generate files proper to each netnodeinstance |
294 | // | 286 | // |
295 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); | 287 | { Name2Instance_t & NNIs = NSResources->netNodeInstances(); |
@@ -320,9 +312,9 @@ QString NetworkSettingsData::generateSettings( bool ForceReq ) { | |||
320 | sfit.current(); | 312 | sfit.current(); |
321 | ++sfit ) { | 313 | ++sfit ) { |
322 | SF = sfit.current(); | 314 | SF = sfit.current(); |
323 | 315 | ||
324 | fprintf( stderr, "Generating %s\n", SF->name().latin1() ); | 316 | Log( ( "Generating %s\n", SF->name().latin1() )); |
325 | SF->open(); | 317 | SF->open(); |
326 | 318 | ||
327 | do { // so we can break; | 319 | do { // so we can break; |
328 | 320 | ||
@@ -404,9 +396,9 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa | |||
404 | if( NC->handlesInterface( Interface ) && // if different Intf. | 396 | if( NC->handlesInterface( Interface ) && // if different Intf. |
405 | NC->state() != Disabled && // if not enabled | 397 | NC->state() != Disabled && // if not enabled |
406 | NC->state() != IsUp // if already used | 398 | NC->state() != IsUp // if already used |
407 | ) { | 399 | ) { |
408 | fprintf( stderr, "Append %s for %s\n", NC->name().latin1(), Interface); | 400 | Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); |
409 | PossibleConnections.append( NC ); | 401 | PossibleConnections.append( NC ); |
410 | } | 402 | } |
411 | } | 403 | } |
412 | return PossibleConnections; | 404 | return PossibleConnections; |
@@ -425,10 +417,9 @@ bool NetworkSettingsData::canStart( const char * Interface ) { | |||
425 | QList<NodeCollection> PossibleConnections; | 417 | QList<NodeCollection> PossibleConnections; |
426 | 418 | ||
427 | PossibleConnections = collectPossible( Interface ); | 419 | PossibleConnections = collectPossible( Interface ); |
428 | 420 | ||
429 | fprintf( stderr, "Possiblilies %d\n", | 421 | Log( ( "Possiblilies %d\n", PossibleConnections.count() )); |
430 | PossibleConnections.count() ); | ||
431 | switch( PossibleConnections.count() ) { | 422 | switch( PossibleConnections.count() ) { |
432 | case 0 : // no connections | 423 | case 0 : // no connections |
433 | break; | 424 | break; |
434 | case 1 : // one connection | 425 | case 1 : // one connection |