summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/nsdata.cpp
Unidiff
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 ) {
63 NSResources->system().findInterface( interfacename ) ); 63 NSResources->system().findInterface( interfacename ) );
64 Log(( "Assign interface %p\n",
65 NC->assignedInterface() ));
64 } else { 66 } else {
@@ -645,3 +647,4 @@ QString NetworkSettingsData::generateSettings( void ) {
645 647
646QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interface ) { 648QList<NodeCollection> NetworkSettingsData::collectPossible(
649 const QString & Interface ) {
647 // collect connections that can work on top of this interface 650 // collect connections that can work on top of this interface
@@ -658,6 +661,7 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
658 if( NC->handlesInterface( Interface ) && // if different Intf. 661 if( NC->handlesInterface( Interface ) && // if different Intf.
659 NC->state() != Disabled && // if not enabled 662 NC->state() != Disabled && // if enabled
660 NC->state() != IsUp // if already used 663 NC->state() != IsUp // if already used
661 ) { 664 ) {
662 Log( ( "Append %s for %s\n", NC->name().latin1(), Interface)); 665 Log( ( "Append %s for %s\n",
666 NC->name().latin1(), Interface.latin1() ));
663 PossibleConnections.append( NC ); 667 PossibleConnections.append( NC );
@@ -675,3 +679,3 @@ QList<NodeCollection> NetworkSettingsData::collectPossible( const char * Interfa
675 679
676bool NetworkSettingsData::canStart( const char * Interface ) { 680bool NetworkSettingsData::canStart( const QString & Interface ) {
677 // load situation 681 // load situation
@@ -683,3 +687,3 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
683 Log( ( "for %s : Possiblilies %d\n", 687 Log( ( "for %s : Possiblilies %d\n",
684 Interface, PossibleConnections.count() )); 688 Interface.latin1(), PossibleConnections.count() ));
685 switch( PossibleConnections.count() ) { 689 switch( PossibleConnections.count() ) {
@@ -708,4 +712,4 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
708 // could not bring device Online -> try other alters 712 // could not bring device Online -> try other alters
709 Log(( "%s-c%d-disallowed : %s\n", 713 Log(( "disallow %ld for %s : %s\n",
710 Interface, NC->number(), S.latin1() )); 714 NC->number(), Interface.latin1(), S.latin1() ));
711 break; 715 break;
@@ -718,4 +722,4 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
718 // device is ready -> done 722 // device is ready -> done
719 Log(( "%s-c%d-allowed\n", Interface, NC->number() )); 723 Log(( "allow %ld for %s\n", NC->number(), Interface.latin1()));
720 printf( "%s-c%d-allowed\n", Interface, NC->number() ); 724 printf( "A%ld%s\n", NC->number(), Interface.latin1() );
721 return 0; 725 return 0;
@@ -725,4 +729,4 @@ bool NetworkSettingsData::canStart( const char * Interface ) {
725 // if we come here no alternatives are possible 729 // if we come here no alternatives are possible
726 Log(( "%s-cnn-disallowed\n", Interface )); 730 Log(( "disallow %s\n", Interface.latin1()));
727 printf( "%s-cnn-disallowed\n", Interface ); 731 printf( "D-%s\n", Interface.latin1() );
728 return 0; 732 return 0;
@@ -743 +747,41 @@ bool NetworkSettingsData::isModified( void ) {
743} 747}
748
749bool NetworkSettingsData::couldBeTriggered( const QString & Interface ) {
750 // load situation
751 QList<NodeCollection> PossibleTriggered;
752
753 PossibleTriggered = collectTriggered( Interface );
754
755 Log( ( "for %s : Possiblilies %d\n",
756 Interface.latin1(), PossibleTriggered.count() ));
757
758 return ( PossibleTriggered.count() ) ? 1 : 0;
759}
760
761QList<NodeCollection> NetworkSettingsData::collectTriggered(
762 const QString & Interface ) {
763
764 // collect connections that could be triggered by this interface
765 NodeCollection * NC;
766 QList<NodeCollection> PossibleTriggered;
767
768 // for all connections
769 Name2Connection_t & M = NSResources->connections();
770
771 for( QDictIterator<NodeCollection> it(M);
772 it.current();
773 ++it ) {
774 NC = it.current();
775 // check if this profile handles the requested interface
776 if( NC->triggeredBy( Interface ) && // if different Intf.
777 NC->state() != Disabled && // if enabled
778 NC->state() != IsUp // if already used
779 ) {
780 Log( ( "Append %s for %s\n",
781 NC->name().latin1(), Interface.latin1() ));
782 PossibleTriggered.append( NC );
783 }
784 }
785 return PossibleTriggered;
786}
787