Diffstat (limited to 'noncore/settings/networksettings2/profile/profilerun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/profile/profilerun.cpp | 72 |
1 files changed, 16 insertions, 56 deletions
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index 1a5b15b..ab57a00 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp | |||
@@ -4,64 +4,24 @@ | |||
4 | 4 | ||
5 | void ProfileRun::detectState( NodeCollection * NC ) { | 5 | State_t ProfileRun::detectState( void ) { |
6 | if( Data->Disabled ) { | 6 | if( Data->Disabled ) { |
7 | Log(( "%s disabled\n", NC->name().latin1() )); | 7 | return Disabled; |
8 | NC->setCurrentState( Disabled ); | 8 | } |
9 | } else { | 9 | return Unknown; |
10 | Log(( "%s not disabled\n", NC->name().latin1() )); | ||
11 | // find next item in connection | ||
12 | // convert to runtime and ask to detect the state | ||
13 | netNode()->nextNode()->runtime()->detectState( NC ); | ||
14 | } | ||
15 | } | 10 | } |
16 | 11 | ||
17 | bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool F ) { | 12 | QString ProfileRun::setMyState( NodeCollection * NC, Action_t A, bool ) { |
18 | ANetNodeInstance * NNNI; | 13 | owarn << "Profile " << Data->Disabled << oendl; |
19 | 14 | if( A == Disable ) { | |
20 | NNNI = netNode()->nextNode(); | 15 | if( ! Data->Disabled ) { |
21 | switch ( A ) { | ||
22 | case Enable : | ||
23 | if( NC->currentState() == Disabled ) { | ||
24 | Data->Disabled = 0; | ||
25 | NC->setCurrentState( Off ); // at least | ||
26 | // ... but request deeper | ||
27 | NNNI->runtime()->detectState(NC); | ||
28 | } | ||
29 | return 1; | ||
30 | case Disable : | ||
31 | switch( NC->currentState() ) { | ||
32 | case IsUp : | ||
33 | case Available : | ||
34 | // bring Deactivate (will bring down) | ||
35 | if( ! NNNI->runtime()->setState(NC, Deactivate) ) | ||
36 | return 0; | ||
37 | default : | ||
38 | break; | ||
39 | } | ||
40 | Data->Disabled = 1; | 16 | Data->Disabled = 1; |
41 | NC->setCurrentState( Disabled ); | 17 | NC->setModified( 1 ); |
42 | return 1; | 18 | } |
43 | default : | 19 | } else if( A == Enable ) { |
44 | break; | 20 | if( Data->Disabled ) { |
45 | } | 21 | Data->Disabled = 0; |
46 | return NNNI->runtime()->setState(NC, A, F ); | 22 | NC->setModified( 1 ); |
47 | } | 23 | } |
48 | |||
49 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { | ||
50 | RuntimeInfo * RI; | ||
51 | switch ( A ) { | ||
52 | case Enable : | ||
53 | case Disable : | ||
54 | // always possible | ||
55 | return 1; | ||
56 | default : | ||
57 | break; | ||
58 | } | 24 | } |
59 | RI = netNode()->nextNode()->runtime(); | ||
60 | return ( Curr != Disabled ) ? | ||
61 | RI->canSetState(Curr, A) : 0; | ||
62 | } | ||
63 | 25 | ||
64 | bool ProfileRun::handlesInterface( const QString & S ) { | 26 | return QString(); |
65 | // donno -> pass deeper | ||
66 | return netNode()->nextNode()->runtime()->handlesInterface(S); | ||
67 | } | 27 | } |