summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/nsdata.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp22
1 files changed, 13 insertions, 9 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
@@ -15,7 +15,9 @@ 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;
@@ -353,10 +355,12 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
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 }
@@ -370,13 +374,15 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
370 if allowed, echo Interface-allowed else Interface-disallowed 374 if allowed, echo Interface-allowed else Interface-disallowed
371*/ 375*/
372 376
373void NetworkSettingsData::canStart( const char * Interface ) { 377bool 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;
@@ -384,10 +390,7 @@ void NetworkSettingsData::canStart( const char * Interface ) {
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 ) {
@@ -410,12 +413,13 @@ void NetworkSettingsData::canStart( const char * Interface ) {
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 }
419
416 // if we come here no alternatives are possible 420 // if we come here no alternatives are possible
417 printf( "%s-cnn-disallowed\n", Interface ); 421 printf( "%s-cnn-disallowed\n", Interface );
418 } 422 return 0;
419} 423}
420 424
421/* 425/*