author | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-11 21:42:31 (UTC) |
commit | 96678694f8952f60d0a895cede2b621404b4bfb8 (patch) (unidiff) | |
tree | 7138e554e5ba200b8f9ca8b51c89b47531dc34f2 /noncore/settings/networksettings2/wlan/wlanrun.cpp | |
parent | f89120a7a1a3d0bf9c0805456490906ca914e560 (diff) | |
download | opie-96678694f8952f60d0a895cede2b621404b4bfb8.zip opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.gz opie-96678694f8952f60d0a895cede2b621404b4bfb8.tar.bz2 |
Major rename of NodeCollection to NetworkSetup
this commit is broken (missing symbols)
Diffstat (limited to 'noncore/settings/networksettings2/wlan/wlanrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/wlan/wlanrun.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp index b15a560..a0c5884 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.cpp +++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp | |||
@@ -1,38 +1,38 @@ | |||
1 | 1 | ||
2 | #include <qfile.h> | 2 | #include <qfile.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <qstringlist.h> | 4 | #include <qstringlist.h> |
5 | #include <resources.h> | 5 | #include <resources.h> |
6 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
7 | 7 | ||
8 | State_t WLanRun::detectState( void ) { | 8 | State_t WLanRun::detectState( void ) { |
9 | 9 | ||
10 | // unavailable : no card found | 10 | // unavailable : no card found |
11 | // available : card found and assigned to us or free | 11 | // available : card found and assigned to us or free |
12 | // up : card found and assigned to us and up | 12 | // up : card found and assigned to us and up |
13 | 13 | ||
14 | NodeCollection * NC = nodeCollection(); | 14 | NetworkSetup * NC = networkSetup(); |
15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 15 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
16 | System & Sys = NSResources->system(); | 16 | System & Sys = NSResources->system(); |
17 | InterfaceInfo * Run; | 17 | InterfaceInfo * Run; |
18 | 18 | ||
19 | QFile F( S ); | 19 | QFile F( S ); |
20 | 20 | ||
21 | if( F.open( IO_ReadOnly ) ) { | 21 | if( F.open( IO_ReadOnly ) ) { |
22 | // could open file -> read interface and assign | 22 | // could open file -> read interface and assign |
23 | QString X; | 23 | QString X; |
24 | QTextStream TS(&F); | 24 | QTextStream TS(&F); |
25 | X = TS.readLine(); | 25 | X = TS.readLine(); |
26 | // find interface | 26 | // find interface |
27 | if( handlesInterface( X ) ) { | 27 | if( handlesInterface( X ) ) { |
28 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 28 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
29 | It.current(); | 29 | It.current(); |
30 | ++It ) { | 30 | ++It ) { |
31 | Run = It.current(); | 31 | Run = It.current(); |
32 | if( X == Run->Name ) { | 32 | if( X == Run->Name ) { |
33 | NC->assignInterface( Run ); | 33 | NC->assignInterface( Run ); |
34 | return (Run->IsUp) ? IsUp : Available; | 34 | return (Run->IsUp) ? IsUp : Available; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
@@ -49,72 +49,72 @@ State_t WLanRun::detectState( void ) { | |||
49 | NC->assignInterface( 0 ); | 49 | NC->assignInterface( 0 ); |
50 | 50 | ||
51 | // find possible interface | 51 | // find possible interface |
52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 52 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
53 | It.current(); | 53 | It.current(); |
54 | ++It ) { | 54 | ++It ) { |
55 | Run = It.current(); | 55 | Run = It.current(); |
56 | if( handlesInterface( *Run ) && | 56 | if( handlesInterface( *Run ) && |
57 | ( Run->CardType == ARPHRD_ETHER | 57 | ( Run->CardType == ARPHRD_ETHER |
58 | #ifdef ARPHRD_IEEE1394 | 58 | #ifdef ARPHRD_IEEE1394 |
59 | || Run->CardType == ARPHRD_IEEE1394 | 59 | || Run->CardType == ARPHRD_IEEE1394 |
60 | #endif | 60 | #endif |
61 | ) && | 61 | ) && |
62 | ! Run->IsUp | 62 | ! Run->IsUp |
63 | ) { | 63 | ) { |
64 | // proper type, and Not UP -> free | 64 | // proper type, and Not UP -> free |
65 | return Off; | 65 | return Off; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | return Unavailable; | 69 | return Unavailable; |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | QString WLanRun::setMyState( NodeCollection * , Action_t , bool ) { | 73 | QString WLanRun::setMyState( NetworkSetup * , Action_t , bool ) { |
74 | 74 | ||
75 | // we only handle activate and deactivate | 75 | // we only handle activate and deactivate |
76 | return QString(); | 76 | return QString(); |
77 | } | 77 | } |
78 | 78 | ||
79 | // get interface that is free or assigned to us | 79 | // get interface that is free or assigned to us |
80 | InterfaceInfo * WLanRun::getInterface( void ) { | 80 | InterfaceInfo * WLanRun::getInterface( void ) { |
81 | 81 | ||
82 | System & S = NSResources->system(); | 82 | System & S = NSResources->system(); |
83 | InterfaceInfo * best = 0, * Run; | 83 | InterfaceInfo * best = 0, * Run; |
84 | 84 | ||
85 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 85 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
86 | It.current(); | 86 | It.current(); |
87 | ++It ) { | 87 | ++It ) { |
88 | Run = It.current(); | 88 | Run = It.current(); |
89 | if( handlesInterface( *Run ) && | 89 | if( handlesInterface( *Run ) && |
90 | ( Run->CardType == ARPHRD_ETHER | 90 | ( Run->CardType == ARPHRD_ETHER |
91 | #ifdef ARPHRD_IEEE1394 | 91 | #ifdef ARPHRD_IEEE1394 |
92 | || Run->CardType == ARPHRD_IEEE1394 | 92 | || Run->CardType == ARPHRD_IEEE1394 |
93 | #endif | 93 | #endif |
94 | ) | 94 | ) |
95 | ) { | 95 | ) { |
96 | // this is a LAN card | 96 | // this is a LAN card |
97 | if( Run->assignedConnection() == netNode()->connection() ) { | 97 | if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) { |
98 | // assigned to us | 98 | // assigned to us |
99 | return Run; | 99 | return Run; |
100 | } else if( Run->assignedConnection() == 0 ) { | 100 | } else if( Run->assignedToNetworkSetup() == 0 ) { |
101 | // free | 101 | // free |
102 | best = Run; | 102 | best = Run; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | return best; // can be 0 | 106 | return best; // can be 0 |
107 | } | 107 | } |
108 | 108 | ||
109 | bool WLanRun::handlesInterface( const QString & S ) { | 109 | bool WLanRun::handlesInterface( const QString & S ) { |
110 | InterfaceInfo * II; | 110 | InterfaceInfo * II; |
111 | II = NSResources->system().interface( S ); | 111 | II = NSResources->system().interface( S ); |
112 | if( ( II = NSResources->system().interface( S ) ) ) { | 112 | if( ( II = NSResources->system().interface( S ) ) ) { |
113 | return handlesInterface( *II ); | 113 | return handlesInterface( *II ); |
114 | } | 114 | } |
115 | return Pat.match( S ) >= 0; | 115 | return Pat.match( S ) >= 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | bool WLanRun::handlesInterface( const InterfaceInfo & II ) { | 118 | bool WLanRun::handlesInterface( const InterfaceInfo & II ) { |
119 | return ( Pat.match( II.Name ) < 0 ); | 119 | return ( Pat.match( II.Name ) < 0 ); |
120 | } | 120 | } |