summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/network/networkrun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/network/networkrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/network/networkrun.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp
index e732bfa..8deca14 100644
--- a/noncore/settings/networksettings2/network/networkrun.cpp
+++ b/noncore/settings/networksettings2/network/networkrun.cpp
@@ -5,49 +5,49 @@
5void NetworkRun::detectState( NodeCollection * NC ) { 5void NetworkRun::detectState( NodeCollection * NC ) {
6 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 6 RuntimeInfo * RI = netNode()->nextNode()->runtime();
7 AsDevice * Next = RI->asDevice(); 7 AsDevice * Next = RI->asDevice();
8 InterfaceInfo * II = Next->assignedInterface(); 8 InterfaceInfo * II = Next->assignedInterface();
9 9
10 if( II ) { 10 if( II ) {
11 // device has assigned interface 11 // device has assigned interface
12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) ); 12 NC->setCurrentState( (( II->IsUp ) ? IsUp : Available) );
13 } 13 }
14 14
15 // has no interface -> delegate 15 // has no interface -> delegate
16 RI->detectState( NC ); 16 RI->detectState( NC );
17} 17}
18 18
19bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { 19bool NetworkRun::setState( NodeCollection * NC, Action_t A ) {
20 // we handle UP and DOWN 20 // we handle UP and DOWN
21 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 21 RuntimeInfo * RI = netNode()->nextNode()->runtime();
22 AsDevice * Next = RI->asDevice(); 22 AsDevice * Next = RI->asDevice();
23 InterfaceInfo * II = Next->assignedInterface(); 23 InterfaceInfo * II = Next->assignedInterface();
24 24
25 if( A == Up ) { 25 if( A == Up ) {
26 // we can bring UP if lower level is available 26 // we can bring UP if lower level is available
27 if( NC->currentState() == Available ) { 27 if( NC->currentState() == Available ) {
28 QString S; 28 QString S;
29 S.sprintf( "ifup %s=manual", II->Name.latin1() ); 29 S.sprintf( "ifup %s", II->Name.latin1() );
30 NSResources->system().execute( S ); 30 NSResources->system().execute( S );
31 NC->setCurrentState( IsUp ); 31 NC->setCurrentState( IsUp );
32 } 32 }
33 return 1; 33 return 1;
34 } else if( A == Down ) { 34 } else if( A == Down ) {
35 if( NC->currentState() == IsUp ) { 35 if( NC->currentState() == IsUp ) {
36 QString S; 36 QString S;
37 S.sprintf( "ifdown %s", II->Name.latin1() ); 37 S.sprintf( "ifdown %s", II->Name.latin1() );
38 NSResources->system().execute( S ); 38 NSResources->system().execute( S );
39 NC->setCurrentState( Available ); 39 NC->setCurrentState( Available );
40 } 40 }
41 return 1; 41 return 1;
42 } 42 }
43 // delegate 43 // delegate
44 return RI->setState( NC, A ); 44 return RI->setState( NC, A );
45} 45}
46 46
47bool NetworkRun::canSetState( State_t Curr, Action_t A ) { 47bool NetworkRun::canSetState( State_t Curr, Action_t A ) {
48 // we handle UP and DOWN 48 // we handle UP and DOWN
49 RuntimeInfo * RI = netNode()->nextNode()->runtime(); 49 RuntimeInfo * RI = netNode()->nextNode()->runtime();
50 50
51 if( A == Up ) { 51 if( A == Up ) {
52 return ( Curr == Available ); 52 return ( Curr == Available );
53 } else if( A == Down ) { 53 } else if( A == Down ) {