summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/nsdata.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/nsdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/nsdata.cpp66
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
@@ -63,2 +63,4 @@ NetworkSettingsData::NetworkSettingsData( void ) {
NSResources->system().findInterface( interfacename ) );
+ Log(( "Assign interface %p\n",
+ NC->assignedInterface() ));
} else {
@@ -645,3 +647,4 @@ 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
@@ -658,6 +661,7 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
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 );
@@ -675,3 +679,3 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
-bool NetworkSettingsData::canStart( const char * Interface ) {
+bool NetworkSettingsData::canStart( const QString & Interface ) {
// load situation
@@ -683,3 +687,3 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
Log( ( "for %s : Possiblilies %d\n",
- Interface, PossibleConnections.count() ));
+ Interface.latin1(), PossibleConnections.count() ));
switch( PossibleConnections.count() ) {
@@ -708,4 +712,4 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
// 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;
@@ -718,4 +722,4 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
// 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;
@@ -725,4 +729,4 @@ 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;
@@ -743 +747,41 @@ bool NetworkSettingsData::isModified( void ) {
}
+
+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;
+}
+