Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index eb63e02..b4d9aaa 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp | |||
@@ -12,13 +12,15 @@ | |||
12 | static QString CfgFile; | 12 | static QString CfgFile; |
13 | 13 | ||
14 | NetworkSettingsData::NetworkSettingsData( void ) { | 14 | NetworkSettingsData::NetworkSettingsData( void ) { |
15 | // init global resources structure | 15 | // init global resources structure |
16 | new TheNSResources(); | 16 | new TheNSResources(); |
17 | 17 | ||
18 | CfgFile.sprintf( "%s/NETCONFIG", getenv("HOME") ); | 18 | CfgFile.sprintf( "%s/NETCONFIG", |
19 | NSResources->currentUser().HomeDir.latin1() ); | ||
20 | fprintf( stderr, "Cfg from %s\n", CfgFile.latin1() ); | ||
19 | 21 | ||
20 | // load settings | 22 | // load settings |
21 | Force = 0; | 23 | Force = 0; |
22 | IsModified = 0; | 24 | IsModified = 0; |
23 | loadSettings(); | 25 | loadSettings(); |
24 | } | 26 | } |
@@ -350,16 +352,18 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa | |||
350 | // for all connections | 352 | // for all connections |
351 | for( QDictIterator<NodeCollection> it(M); | 353 | for( QDictIterator<NodeCollection> it(M); |
352 | it.current(); | 354 | it.current(); |
353 | ++it ) { | 355 | ++it ) { |
354 | NC = it.current(); | 356 | NC = it.current(); |
355 | // check if this profile handles the requested interface | 357 | // check if this profile handles the requested interface |
358 | fprintf( stderr, "check %s\n", NC->name().latin1() ); | ||
356 | if( NC->handlesInterface( Interface ) && // if different Intf. | 359 | if( NC->handlesInterface( Interface ) && // if different Intf. |
357 | NC->state() != Disabled && // if not enabled | 360 | NC->state() != Disabled && // if not enabled |
358 | NC->state() != IsUp // if already used | 361 | NC->state() != IsUp // if already used |
359 | ) { | 362 | ) { |
363 | fprintf( stderr, "Append %s\n", NC->name().latin1() ); | ||
360 | PossibleConnections.append( NC ); | 364 | PossibleConnections.append( NC ); |
361 | } | 365 | } |
362 | } | 366 | } |
363 | return PossibleConnections; | 367 | return PossibleConnections; |
364 | } | 368 | } |
365 | 369 | ||
@@ -367,30 +371,29 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa | |||
367 | /* | 371 | /* |
368 | Called by the system to see if interface can be brought UP | 372 | Called by the system to see if interface can be brought UP |
369 | 373 | ||
370 | if allowed, echo Interface-allowed else Interface-disallowed | 374 | if allowed, echo Interface-allowed else Interface-disallowed |
371 | */ | 375 | */ |
372 | 376 | ||
373 | void NetworkSettingsData::canStart( const char * Interface ) { | 377 | bool NetworkSettingsData::canStart( const char * Interface ) { |
374 | // load situation | 378 | // load situation |
375 | NodeCollection * NC = 0; | 379 | NodeCollection * NC = 0; |
376 | QList<NodeCollection> PossibleConnections; | 380 | QList<NodeCollection> PossibleConnections; |
377 | 381 | ||
378 | PossibleConnections = collectPossible( Interface ); | 382 | PossibleConnections = collectPossible( Interface ); |
379 | 383 | ||
384 | fprintf( stderr, "Possiblilies %d\n", | ||
385 | PossibleConnections.count() ); | ||
380 | switch( PossibleConnections.count() ) { | 386 | switch( PossibleConnections.count() ) { |
381 | case 0 : // no connections | 387 | case 0 : // no connections |
382 | break; | 388 | break; |
383 | case 1 : // one connection | 389 | case 1 : // one connection |
384 | NC = PossibleConnections.first(); | 390 | NC = PossibleConnections.first(); |
385 | break; | 391 | break; |
386 | default : // need to ask user ? | 392 | default : // need to ask user ? |
387 | // are we connected to a server | 393 | return 1; |
388 | // system( "su %d networksettings2 --prompt %s\n", | ||
389 | // "", Interface ); | ||
390 | break; | ||
391 | } | 394 | } |
392 | 395 | ||
393 | if( NC ) { | 396 | if( NC ) { |
394 | switch( NC->state() ) { | 397 | switch( NC->state() ) { |
395 | case Unchecked : | 398 | case Unchecked : |
396 | case Unknown : | 399 | case Unknown : |
@@ -407,18 +410,19 @@ void NetworkSettingsData::canStart( const char * Interface ) { | |||
407 | } | 410 | } |
408 | // FT | 411 | // FT |
409 | case Available : | 412 | case Available : |
410 | case IsUp : // also called for 'ifdown' | 413 | case IsUp : // also called for 'ifdown' |
411 | // device is ready -> done | 414 | // device is ready -> done |
412 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); | 415 | printf( "%s-c%d-allowed\n", Interface, NC->number() ); |
413 | return; | 416 | return 0; |
414 | } | 417 | } |
415 | } else { | 418 | } |
416 | // if we come here no alternatives are possible | 419 | |
417 | printf( "%s-cnn-disallowed\n", Interface ); | 420 | // if we come here no alternatives are possible |
418 | } | 421 | printf( "%s-cnn-disallowed\n", Interface ); |
422 | return 0; | ||
419 | } | 423 | } |
420 | 424 | ||
421 | /* | 425 | /* |
422 | Called by the system to regenerate config files | 426 | Called by the system to regenerate config files |
423 | */ | 427 | */ |
424 | 428 | ||