Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/nsdata.cpp | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/noncore/settings/networksettings2/nsdata.cpp b/noncore/settings/networksettings2/nsdata.cpp index d76353a..39031ed 100644 --- a/noncore/settings/networksettings2/nsdata.cpp +++ b/noncore/settings/networksettings2/nsdata.cpp @@ -62,4 +62,6 @@ NetworkSettingsData::NetworkSettingsData( void ) { NC->assignInterface( NSResources->system().findInterface( interfacename ) ); + Log(( "Assign interface %p\n", + NC->assignedInterface() )); } else { Log(( "Profile nr %d no longer defined\n", @@ -644,5 +646,6 @@ QString NetworkSettingsData::generateSettings( void ) { } -QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { +QList<NodeCollection> NetworkSettingsData::collectPossible( + const QString & Interface ) { // collect connections that can work on top of this interface NodeCollection * NC; @@ -657,8 +660,9 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa // check if this profile handles the requested interface if( NC->handlesInterface( Interface ) && // if different Intf. - NC->state() != Disabled && // if not enabled + NC->state() != Disabled && // if enabled NC->state() != IsUp // if already used ) { - Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); + Log( ( "Append %s for %s\n", + NC->name().latin1(), Interface.latin1() )); PossibleConnections.append( NC ); } @@ -674,5 +678,5 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa */ -bool NetworkSettingsData::canStart( const char * Interface ) { +bool NetworkSettingsData::canStart( const QString & Interface ) { // load situation NodeCollection * NC = 0; @@ -682,5 +686,5 @@ bool NetworkSettingsData::canStart( const char * Interface ) { Log( ( "for %s : Possiblilies %d\n", - Interface, PossibleConnections.count() )); + Interface.latin1(), PossibleConnections.count() )); switch( PossibleConnections.count() ) { case 0 : // no connections @@ -707,6 +711,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) { if( ! S.isEmpty() ) { // could not bring device Online -> try other alters - Log(( "%s-c%d-disallowed : %s\n", - Interface, NC->number(), S.latin1() )); + Log(( "disallow %ld for %s : %s\n", + NC->number(), Interface.latin1(), S.latin1() )); break; } @@ -717,6 +721,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) { case IsUp : // also called for 'ifdown' // device is ready -> done - Log(( "%s-c%d-allowed\n", Interface, NC->number() )); - printf( "%s-c%d-allowed\n", Interface, NC->number() ); + Log(( "allow %ld for %s\n", NC->number(), Interface.latin1())); + printf( "A%ld%s\n", NC->number(), Interface.latin1() ); return 0; } @@ -724,6 +728,6 @@ bool NetworkSettingsData::canStart( const char * Interface ) { // if we come here no alternatives are possible - Log(( "%s-cnn-disallowed\n", Interface )); - printf( "%s-cnn-disallowed\n", Interface ); + Log(( "disallow %s\n", Interface.latin1())); + printf( "D-%s\n", Interface.latin1() ); return 0; } @@ -742,2 +746,42 @@ bool NetworkSettingsData::isModified( void ) { return 0; } + +bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) { + // load situation + QList<NodeCollection> PossibleTriggered; + + PossibleTriggered = collectTriggered( Interface ); + + Log( ( "for %s : Possiblilies %d\n", + Interface.latin1(), PossibleTriggered.count() )); + + return ( PossibleTriggered.count() ) ? 1 : 0; +} + +QList<NodeCollection> NetworkSettingsData::collectTriggered( + const QString & Interface ) { + + // collect connections that could be triggered by this interface + NodeCollection * NC; + QList<NodeCollection> PossibleTriggered; + + // for all connections + Name2Connection_t & M = NSResources->connections(); + + for( QDictIterator<NodeCollection> it(M); + it.current(); + ++it ) { + NC = it.current(); + // check if this profile handles the requested interface + if( NC->triggeredBy( Interface ) && // if different Intf. + NC->state() != Disabled && // if enabled + NC->state() != IsUp // if already used + ) { + Log( ( "Append %s for %s\n", + NC->name().latin1(), Interface.latin1() )); + PossibleTriggered.append( NC ); + } + } + return PossibleTriggered; +} + |