author | wimpie <wimpie> | 2004-04-10 13:06:13 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-10 13:06:13 (UTC) |
commit | db9f0e2a7fd93157d95f421534fcc3015abe53e0 (patch) (unidiff) | |
tree | 001918ca18d0d74f3e49597f766c070bea71e25c | |
parent | 6bcdc8cd41199dce849b800b4296011faf6281df (diff) | |
download | opie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.zip opie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.tar.gz opie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.tar.bz2 |
*** empty log message ***
34 files changed, 957 insertions, 293 deletions
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h index 4a773cd..c168429 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothBNEPrun.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #include <asdevice.h> | 1 | #include <asdevice.h> |
2 | #include "bluetoothBNEPdata.h" | 2 | #include "bluetoothBNEPdata.h" |
3 | 3 | ||
4 | class BluetoothBNEPRun : public AsDevice { | 4 | class BluetoothBNEPRun : public AsDevice { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | BluetoothBNEPRun( ANetNodeInstance * NNI, | 8 | BluetoothBNEPRun( ANetNodeInstance * NNI, |
9 | BluetoothBNEPData & Data ) : AsDevice( NNI ) | 9 | BluetoothBNEPData & Data ) : AsDevice( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsDevice * asDevice( void ) | 12 | virtual AsDevice * asDevice( void ) |
13 | { return (AsDevice *)this; } | 13 | { return (AsDevice *)this; } |
14 | 14 | ||
15 | virtual AsDevice * device( void ) | 15 | virtual AsDevice * device( void ) |
16 | { return asDevice(); } | 16 | { return asDevice(); } |
17 | 17 | ||
18 | protected : | 18 | protected : |
19 | 19 | ||
20 | void detectState( NodeCollection * ) | 20 | void detectState( NodeCollection * ) |
21 | { } | 21 | { } |
22 | 22 | ||
23 | bool setState( NodeCollection * , Action_t ) | 23 | bool setState( NodeCollection * , Action_t, bool ) |
24 | { return 0; } | 24 | { return 0; } |
25 | 25 | ||
26 | bool canSetState( State_t , Action_t ) | 26 | bool canSetState( State_t , Action_t ) |
27 | { return 0; } | 27 | { return 0; } |
28 | 28 | ||
29 | bool handlesInterface( const QString & ) | 29 | bool handlesInterface( const QString & ) |
30 | { return 0; } | 30 | { return 0; } |
31 | }; | 31 | }; |
diff --git a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h index 6a7902a..aff1f59 100644 --- a/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h +++ b/noncore/settings/networksettings2/bluetooth/bluetoothRFCOMMrun.h | |||
@@ -1,25 +1,25 @@ | |||
1 | #include <asline.h> | 1 | #include <asline.h> |
2 | #include "bluetoothRFCOMMdata.h" | 2 | #include "bluetoothRFCOMMdata.h" |
3 | 3 | ||
4 | class BluetoothRFCOMMRun : public AsLine { | 4 | class BluetoothRFCOMMRun : public AsLine { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, | 8 | BluetoothRFCOMMRun( ANetNodeInstance * NNI, |
9 | BluetoothRFCOMMData & Data ) : AsLine( NNI ) | 9 | BluetoothRFCOMMData & Data ) : AsLine( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual AsLine * asLine( void ) |
13 | { return (AsLine *)this; } | 13 | { return (AsLine *)this; } |
14 | 14 | ||
15 | protected : | 15 | protected : |
16 | 16 | ||
17 | void detectState( NodeCollection * ) | 17 | void detectState( NodeCollection * ) |
18 | { } | 18 | { } |
19 | 19 | ||
20 | bool setState( NodeCollection * , Action_t ) | 20 | bool setState( NodeCollection * , Action_t, bool ) |
21 | { return 0; } | 21 | { return 0; } |
22 | 22 | ||
23 | bool canSetState( State_t , Action_t ) | 23 | bool canSetState( State_t , Action_t ) |
24 | { return 0; } | 24 | { return 0; } |
25 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/cable/cablerun.cpp b/noncore/settings/networksettings2/cable/cablerun.cpp index edb4b01..5e99237 100644 --- a/noncore/settings/networksettings2/cable/cablerun.cpp +++ b/noncore/settings/networksettings2/cable/cablerun.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | #include <fcntl.h> | 1 | #include <fcntl.h> |
2 | #include <unistd.h> | 2 | #include <unistd.h> |
3 | #include "cablerun.h" | 3 | #include "cablerun.h" |
4 | 4 | ||
5 | void CableRun::detectState( NodeCollection * NC ) { | 5 | void CableRun::detectState( NodeCollection * NC ) { |
6 | 6 | ||
7 | int fd = open( D->Device.latin1(), O_RDWR ); | 7 | int fd = open( D->Device.latin1(), O_RDWR ); |
8 | 8 | ||
9 | if( fd < 0 ) { | 9 | if( fd < 0 ) { |
10 | NC->setCurrentState( Unavailable ); | 10 | NC->setCurrentState( Unavailable ); |
11 | } | 11 | } |
12 | close( fd ); | 12 | close( fd ); |
13 | NC->setCurrentState( Available ); | 13 | NC->setCurrentState( Available ); |
14 | } | 14 | } |
15 | 15 | ||
16 | bool CableRun::setState( NodeCollection * NC, Action_t A ) { | 16 | bool CableRun::setState( NodeCollection * NC, Action_t A, bool ) { |
17 | if( A == Activate ) { | 17 | if( A == Activate ) { |
18 | detectState(NC); | 18 | detectState(NC); |
19 | return (NC->currentState() == Available); | 19 | return (NC->currentState() == Available); |
20 | } | 20 | } |
21 | return 1; | 21 | return 1; |
22 | } | 22 | } |
23 | 23 | ||
24 | bool CableRun::canSetState( State_t , Action_t ) { | 24 | bool CableRun::canSetState( State_t , Action_t ) { |
25 | return 1; | 25 | return 1; |
26 | } | 26 | } |
diff --git a/noncore/settings/networksettings2/cable/cablerun.h b/noncore/settings/networksettings2/cable/cablerun.h index 7b341c4..c5b59d5 100644 --- a/noncore/settings/networksettings2/cable/cablerun.h +++ b/noncore/settings/networksettings2/cable/cablerun.h | |||
@@ -1,24 +1,24 @@ | |||
1 | #include <asline.h> | 1 | #include <asline.h> |
2 | #include "cabledata.h" | 2 | #include "cabledata.h" |
3 | 3 | ||
4 | class CableRun : public AsLine { | 4 | class CableRun : public AsLine { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | CableRun( ANetNodeInstance * NNI, | 8 | CableRun( ANetNodeInstance * NNI, |
9 | CableData & Data ) : AsLine( NNI ) | 9 | CableData & Data ) : AsLine( NNI ) |
10 | { D = &Data; } | 10 | { D = &Data; } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual AsLine * asLine( void ) |
13 | { return (AsLine *)this; } | 13 | { return (AsLine *)this; } |
14 | 14 | ||
15 | protected : | 15 | protected : |
16 | 16 | ||
17 | void detectState( NodeCollection * NC ); | 17 | void detectState( NodeCollection * NC ); |
18 | bool setState( NodeCollection * NC, Action_t A ); | 18 | bool setState( NodeCollection * NC, Action_t A, bool Force ); |
19 | bool canSetState( State_t Curr, Action_t A ); | 19 | bool canSetState( State_t Curr, Action_t A ); |
20 | 20 | ||
21 | private : | 21 | private : |
22 | 22 | ||
23 | CableData_t * D; | 23 | CableData_t * D; |
24 | }; | 24 | }; |
diff --git a/noncore/settings/networksettings2/irda/irdarun.h b/noncore/settings/networksettings2/irda/irdarun.h index d9fe5e8..4c903cc 100644 --- a/noncore/settings/networksettings2/irda/irdarun.h +++ b/noncore/settings/networksettings2/irda/irdarun.h | |||
@@ -1,25 +1,25 @@ | |||
1 | #include <asline.h> | 1 | #include <asline.h> |
2 | #include "irdadata.h" | 2 | #include "irdadata.h" |
3 | 3 | ||
4 | class IRDARun : public AsLine { | 4 | class IRDARun : public AsLine { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | IRDARun( ANetNodeInstance * NNI, | 8 | IRDARun( ANetNodeInstance * NNI, |
9 | IRDAData & Data ) : AsLine( NNI ) | 9 | IRDAData & Data ) : AsLine( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual AsLine * asLine( void ) |
13 | { return (AsLine *)this; } | 13 | { return (AsLine *)this; } |
14 | 14 | ||
15 | protected : | 15 | protected : |
16 | 16 | ||
17 | void detectState( NodeCollection * ) | 17 | void detectState( NodeCollection * ) |
18 | { } | 18 | { } |
19 | 19 | ||
20 | bool setState( NodeCollection * , Action_t ) | 20 | bool setState( NodeCollection * , Action_t, bool ) |
21 | { return 0; } | 21 | { return 0; } |
22 | 22 | ||
23 | bool canSetState( State_t , Action_t ) | 23 | bool canSetState( State_t , Action_t ) |
24 | { return 0; } | 24 | { return 0; } |
25 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp index 2e4fc43..1544ddc 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.cpp +++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp | |||
@@ -1,192 +1,192 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include <qstringlist.h> | 3 | #include <qstringlist.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "lancardrun.h" | 5 | #include "lancardrun.h" |
6 | 6 | ||
7 | void LanCardRun::detectState( NodeCollection * NC ) { | 7 | void LanCardRun::detectState( NodeCollection * NC ) { |
8 | 8 | ||
9 | // unavailable : no card found | 9 | // unavailable : no card found |
10 | // available : card found and assigned to us or free | 10 | // available : card found and assigned to us or free |
11 | // up : card found and assigned to us and up | 11 | // up : card found and assigned to us and up |
12 | 12 | ||
13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 13 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
14 | System & Sys = NSResources->system(); | 14 | System & Sys = NSResources->system(); |
15 | InterfaceInfo * Run; | 15 | InterfaceInfo * Run; |
16 | 16 | ||
17 | QFile F( S ); | 17 | QFile F( S ); |
18 | 18 | ||
19 | if( F.open( IO_ReadOnly ) ) { | 19 | if( F.open( IO_ReadOnly ) ) { |
20 | // could open file -> read interface and assign | 20 | // could open file -> read interface and assign |
21 | QString X; | 21 | QString X; |
22 | QTextStream TS(&F); | 22 | QTextStream TS(&F); |
23 | X = TS.readLine(); | 23 | X = TS.readLine(); |
24 | // find interface | 24 | // find interface |
25 | if( handlesInterface( X ) ) { | 25 | if( handlesInterface( X ) ) { |
26 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 26 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
27 | It.current(); | 27 | It.current(); |
28 | ++It ) { | 28 | ++It ) { |
29 | Run = It.current(); | 29 | Run = It.current(); |
30 | if( X == Run->Name ) { | 30 | if( X == Run->Name ) { |
31 | Run->assignNode( netNode() ); | 31 | Run->assignNode( netNode() ); |
32 | assignInterface( Run ); | 32 | assignInterface( Run ); |
33 | NC->setCurrentState( IsUp ); | 33 | NC->setCurrentState( IsUp ); |
34 | return; | 34 | return; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | if( ( Run = assignedInterface() ) ) { | 40 | if( ( Run = assignedInterface() ) ) { |
41 | // we already have an interface assigned -> still present ? | 41 | // we already have an interface assigned -> still present ? |
42 | if( ! Run->IsUp ) { | 42 | if( ! Run->IsUp ) { |
43 | // usb is still free -> keep assignment | 43 | // usb is still free -> keep assignment |
44 | NC->setCurrentState( Available ); | 44 | NC->setCurrentState( Available ); |
45 | return; | 45 | return; |
46 | } // else interface is up but NOT us -> some other profile | 46 | } // else interface is up but NOT us -> some other profile |
47 | } | 47 | } |
48 | 48 | ||
49 | // nothing (valid) assigned to us | 49 | // nothing (valid) assigned to us |
50 | assignInterface( 0 ); | 50 | assignInterface( 0 ); |
51 | 51 | ||
52 | // find possible interface | 52 | // find possible interface |
53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 53 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
54 | It.current(); | 54 | It.current(); |
55 | ++It ) { | 55 | ++It ) { |
56 | Run = It.current(); | 56 | Run = It.current(); |
57 | if( handlesInterface( *Run ) && | 57 | if( handlesInterface( *Run ) && |
58 | ( Run->CardType == ARPHRD_ETHER | 58 | ( Run->CardType == ARPHRD_ETHER |
59 | #ifdef ARPHRD_IEEE1394 | 59 | #ifdef ARPHRD_IEEE1394 |
60 | || Run->CardType == ARPHRD_IEEE1394 | 60 | || Run->CardType == ARPHRD_IEEE1394 |
61 | #endif | 61 | #endif |
62 | ) && | 62 | ) && |
63 | ! Run->IsUp | 63 | ! Run->IsUp |
64 | ) { | 64 | ) { |
65 | // proper type, and Not UP -> free | 65 | // proper type, and Not UP -> free |
66 | NC->setCurrentState( Off ); | 66 | NC->setCurrentState( Off ); |
67 | return; | 67 | return; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | // no free found | 70 | // no free found |
71 | 71 | ||
72 | NC->setCurrentState( Unavailable ); | 72 | NC->setCurrentState( Unavailable ); |
73 | 73 | ||
74 | } | 74 | } |
75 | 75 | ||
76 | bool LanCardRun::setState( NodeCollection * NC, Action_t A ) { | 76 | bool LanCardRun::setState( NodeCollection * NC, Action_t A, bool ) { |
77 | 77 | ||
78 | // we only handle activate and deactivate | 78 | // we only handle activate and deactivate |
79 | switch( A ) { | 79 | switch( A ) { |
80 | case Activate : | 80 | case Activate : |
81 | { | 81 | { |
82 | if( NC->currentState() != Off ) { | 82 | if( NC->currentState() != Off ) { |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | InterfaceInfo * N = getInterface(); | 85 | InterfaceInfo * N = getInterface(); |
86 | if( ! N ) { | 86 | if( ! N ) { |
87 | // no interface available | 87 | // no interface available |
88 | NC->setCurrentState( Unavailable ); | 88 | NC->setCurrentState( Unavailable ); |
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | // because we were OFF the interface | 91 | // because we were OFF the interface |
92 | // we get back is NOT assigned | 92 | // we get back is NOT assigned |
93 | N->assignNode( netNode() ); | 93 | N->assignNode( netNode() ); |
94 | assignInterface( N ); | 94 | assignInterface( N ); |
95 | NC->setCurrentState( Available ); | 95 | NC->setCurrentState( Available ); |
96 | return 1; | 96 | return 1; |
97 | } | 97 | } |
98 | case Deactivate : | 98 | case Deactivate : |
99 | if( NC->currentState() == IsUp ) { | 99 | if( NC->currentState() == IsUp ) { |
100 | // bring down first | 100 | // bring down first |
101 | if( ! connection()->setState( Down ) ) | 101 | if( ! connection()->setState( Down ) ) |
102 | // could not ... | 102 | // could not ... |
103 | return 0; | 103 | return 0; |
104 | } else if( NC->currentState() != Available ) { | 104 | } else if( NC->currentState() != Available ) { |
105 | return 1; | 105 | return 1; |
106 | } | 106 | } |
107 | assignedInterface()->assignNode( 0 ); // release | 107 | assignedInterface()->assignNode( 0 ); // release |
108 | assignInterface( 0 ); | 108 | assignInterface( 0 ); |
109 | NC->setCurrentState( Off ); | 109 | NC->setCurrentState( Off ); |
110 | return 1; | 110 | return 1; |
111 | default : | 111 | default : |
112 | // FT | 112 | // FT |
113 | break; | 113 | break; |
114 | } | 114 | } |
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { | 118 | bool LanCardRun::canSetState( State_t Curr, Action_t A ) { |
119 | // we only handle up down activate and deactivate | 119 | // we only handle up down activate and deactivate |
120 | switch( A ) { | 120 | switch( A ) { |
121 | case Activate : | 121 | case Activate : |
122 | { // at least available | 122 | { // at least available |
123 | if( Curr == Available ) { | 123 | if( Curr == Available ) { |
124 | return 1; | 124 | return 1; |
125 | } | 125 | } |
126 | // or we can make one available | 126 | // or we can make one available |
127 | InterfaceInfo * N = getInterface(); | 127 | InterfaceInfo * N = getInterface(); |
128 | if( ! N || N->assignedNode() != 0 ) { | 128 | if( ! N || N->assignedNode() != 0 ) { |
129 | // non available or assigned | 129 | // non available or assigned |
130 | return 0; | 130 | return 0; |
131 | } | 131 | } |
132 | return 1; | 132 | return 1; |
133 | } | 133 | } |
134 | case Deactivate : | 134 | case Deactivate : |
135 | return ( Curr >= Available ); | 135 | return ( Curr >= Available ); |
136 | default : | 136 | default : |
137 | // FT | 137 | // FT |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | // get interface that is free or assigned to us | 143 | // get interface that is free or assigned to us |
144 | InterfaceInfo * LanCardRun::getInterface( void ) { | 144 | InterfaceInfo * LanCardRun::getInterface( void ) { |
145 | 145 | ||
146 | System & S = NSResources->system(); | 146 | System & S = NSResources->system(); |
147 | InterfaceInfo * best = 0, * Run; | 147 | InterfaceInfo * best = 0, * Run; |
148 | 148 | ||
149 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 149 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
150 | It.current(); | 150 | It.current(); |
151 | ++It ) { | 151 | ++It ) { |
152 | Run = It.current(); | 152 | Run = It.current(); |
153 | if( handlesInterface( *Run ) && | 153 | if( handlesInterface( *Run ) && |
154 | ( Run->CardType == ARPHRD_ETHER | 154 | ( Run->CardType == ARPHRD_ETHER |
155 | #ifdef ARPHRD_IEEE1394 | 155 | #ifdef ARPHRD_IEEE1394 |
156 | || Run->CardType == ARPHRD_IEEE1394 | 156 | || Run->CardType == ARPHRD_IEEE1394 |
157 | #endif | 157 | #endif |
158 | ) | 158 | ) |
159 | ) { | 159 | ) { |
160 | // this is a LAN card | 160 | // this is a LAN card |
161 | if( Run->assignedNode() == netNode() ) { | 161 | if( Run->assignedNode() == netNode() ) { |
162 | // assigned to us | 162 | // assigned to us |
163 | return Run; | 163 | return Run; |
164 | } else if( Run->assignedNode() == 0 ) { | 164 | } else if( Run->assignedNode() == 0 ) { |
165 | // free | 165 | // free |
166 | best = Run; | 166 | best = Run; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } | 169 | } |
170 | return best; // can be 0 | 170 | return best; // can be 0 |
171 | } | 171 | } |
172 | 172 | ||
173 | bool LanCardRun::handlesInterface( const QString & S ) { | 173 | bool LanCardRun::handlesInterface( const QString & S ) { |
174 | InterfaceInfo * II; | 174 | InterfaceInfo * II; |
175 | II = NSResources->system().interface( S ); | 175 | II = NSResources->system().interface( S ); |
176 | if( ( II = NSResources->system().interface( S ) ) ) { | 176 | if( ( II = NSResources->system().interface( S ) ) ) { |
177 | return handlesInterface( *II ); | 177 | return handlesInterface( *II ); |
178 | } | 178 | } |
179 | return Pat.match( S ) >= 0; | 179 | return Pat.match( S ) >= 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { | 182 | bool LanCardRun::handlesInterface( const InterfaceInfo & II ) { |
183 | if( Pat.match( II.Name ) < 0 ) | 183 | if( Pat.match( II.Name ) < 0 ) |
184 | return 0; | 184 | return 0; |
185 | 185 | ||
186 | if( Data->AnyLanCard ) { | 186 | if( Data->AnyLanCard ) { |
187 | return 1; | 187 | return 1; |
188 | } | 188 | } |
189 | 189 | ||
190 | // must also match hardware address | 190 | // must also match hardware address |
191 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); | 191 | return ( Data->HWAddresses.findIndex( II.MACAddress ) >= 0 ); |
192 | } | 192 | } |
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.h b/noncore/settings/networksettings2/lancard/lancardrun.h index e8a535a..b28dda7 100644 --- a/noncore/settings/networksettings2/lancard/lancardrun.h +++ b/noncore/settings/networksettings2/lancard/lancardrun.h | |||
@@ -1,39 +1,39 @@ | |||
1 | #ifndef LANCARDRUN_H | 1 | #ifndef LANCARDRUN_H |
2 | #define LANCARDRUN_H | 2 | #define LANCARDRUN_H |
3 | 3 | ||
4 | #include <asdevice.h> | 4 | #include <asdevice.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "lancarddata.h" | 6 | #include "lancarddata.h" |
7 | 7 | ||
8 | class LanCardRun : public AsDevice { | 8 | class LanCardRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | LanCardRun( ANetNodeInstance * NNI, | 12 | LanCardRun( ANetNodeInstance * NNI, |
13 | LanCardData & D ) : AsDevice( NNI ), | 13 | LanCardData & D ) : AsDevice( NNI ), |
14 | Pat( "eth[0-9]" ) | 14 | Pat( "eth[0-9]" ) |
15 | { Data = &D; } | 15 | { Data = &D; } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
19 | 19 | ||
20 | virtual AsDevice * asDevice( void ) | 20 | virtual AsDevice * asDevice( void ) |
21 | { return (AsDevice *)this; } | 21 | { return (AsDevice *)this; } |
22 | 22 | ||
23 | protected : | 23 | protected : |
24 | 24 | ||
25 | void detectState( NodeCollection * NC ); | 25 | void detectState( NodeCollection * NC ); |
26 | bool setState( NodeCollection * NC, Action_t A ); | 26 | bool setState( NodeCollection * NC, Action_t A, bool Force ); |
27 | bool canSetState( State_t Curr, Action_t A ); | 27 | bool canSetState( State_t Curr, Action_t A ); |
28 | 28 | ||
29 | bool handlesInterface( const QString & I ); | 29 | bool handlesInterface( const QString & I ); |
30 | bool handlesInterface( const InterfaceInfo & II ); | 30 | bool handlesInterface( const InterfaceInfo & II ); |
31 | 31 | ||
32 | private : | 32 | private : |
33 | 33 | ||
34 | InterfaceInfo * getInterface( void ); | 34 | InterfaceInfo * getInterface( void ); |
35 | QRegExp Pat; | 35 | QRegExp Pat; |
36 | LanCardData * Data; | 36 | LanCardData * Data; |
37 | 37 | ||
38 | }; | 38 | }; |
39 | #endif | 39 | #endif |
diff --git a/noncore/settings/networksettings2/modem/modemrun.h b/noncore/settings/networksettings2/modem/modemrun.h index 6d1662b..336462e 100644 --- a/noncore/settings/networksettings2/modem/modemrun.h +++ b/noncore/settings/networksettings2/modem/modemrun.h | |||
@@ -1,25 +1,25 @@ | |||
1 | #include <asline.h> | 1 | #include <asline.h> |
2 | #include "modemdata.h" | 2 | #include "modemdata.h" |
3 | 3 | ||
4 | class ModemRun : public AsLine { | 4 | class ModemRun : public AsLine { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | ModemRun( ANetNodeInstance * NNI, | 8 | ModemRun( ANetNodeInstance * NNI, |
9 | ModemData & Data ) : AsLine ( NNI ) | 9 | ModemData & Data ) : AsLine ( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsLine * asLine( void ) | 12 | virtual AsLine * asLine( void ) |
13 | { return (AsLine *)this; } | 13 | { return (AsLine *)this; } |
14 | 14 | ||
15 | protected : | 15 | protected : |
16 | 16 | ||
17 | void detectState( NodeCollection * ) | 17 | void detectState( NodeCollection * ) |
18 | { } | 18 | { } |
19 | 19 | ||
20 | bool setState( NodeCollection *, Action_t ) | 20 | bool setState( NodeCollection *, Action_t, bool ) |
21 | { return 0; } | 21 | { return 0; } |
22 | 22 | ||
23 | bool canSetState( State_t, Action_t ) | 23 | bool canSetState( State_t, Action_t ) |
24 | { return 0; } | 24 | { return 0; } |
25 | }; | 25 | }; |
diff --git a/noncore/settings/networksettings2/network/networkrun.cpp b/noncore/settings/networksettings2/network/networkrun.cpp index c19235a..41e1c53 100644 --- a/noncore/settings/networksettings2/network/networkrun.cpp +++ b/noncore/settings/networksettings2/network/networkrun.cpp | |||
@@ -1,66 +1,66 @@ | |||
1 | #include <system.h> | 1 | #include <system.h> |
2 | #include <asdevice.h> | 2 | #include <asdevice.h> |
3 | #include "networkrun.h" | 3 | #include "networkrun.h" |
4 | 4 | ||
5 | void NetworkRun::detectState( NodeCollection * NC ) { | 5 | void 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 | return; | 13 | return; |
14 | } | 14 | } |
15 | 15 | ||
16 | // has no interface -> delegate | 16 | // has no interface -> delegate |
17 | RI->detectState( NC ); | 17 | RI->detectState( NC ); |
18 | } | 18 | } |
19 | 19 | ||
20 | bool NetworkRun::setState( NodeCollection * NC, Action_t A ) { | 20 | bool NetworkRun::setState( NodeCollection * NC, Action_t A, bool Force ) { |
21 | // we handle UP and DOWN | 21 | // we handle UP and DOWN |
22 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 22 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
23 | AsDevice * Next = RI->asDevice(); | 23 | AsDevice * Next = RI->asDevice(); |
24 | InterfaceInfo * II = Next->assignedInterface(); | 24 | InterfaceInfo * II = Next->assignedInterface(); |
25 | 25 | ||
26 | if( A == Up ) { | 26 | if( A == Up ) { |
27 | // we can bring UP if lower level is available | 27 | // we can bring UP if lower level is available |
28 | if( NC->currentState() == Available ) { | 28 | if( NC->currentState() == Available || Force ) { |
29 | QString S; | 29 | QString S; |
30 | S.sprintf( "ifup %s=%s-c%d-allowed", | 30 | S.sprintf( "ifup %s=%s-c%d-allowed", |
31 | II->Name.latin1(), II->Name.latin1(), | 31 | II->Name.latin1(), II->Name.latin1(), |
32 | connection()->number() ); | 32 | connection()->number() ); |
33 | NSResources->system().runAsRoot( S ); | 33 | NSResources->system().runAsRoot( S ); |
34 | } | 34 | } |
35 | return 1; | 35 | return 1; |
36 | } else if( A == Down ) { | 36 | } else if( A == Down ) { |
37 | if( NC->currentState() == IsUp ) { | 37 | if( NC->currentState() == IsUp || Force ) { |
38 | QString S; | 38 | QString S; |
39 | S.sprintf( "ifdown %s=%s-c%d-allowed", | 39 | S.sprintf( "ifdown %s=%s-c%d-allowed", |
40 | II->Name.latin1(), II->Name.latin1(), | 40 | II->Name.latin1(), II->Name.latin1(), |
41 | connection()->number() ); | 41 | connection()->number() ); |
42 | NSResources->system().runAsRoot( S ); | 42 | NSResources->system().runAsRoot( S ); |
43 | } | 43 | } |
44 | return 1; | 44 | return 1; |
45 | } | 45 | } |
46 | // delegate | 46 | // delegate |
47 | return RI->setState( NC, A ); | 47 | return RI->setState( NC, A ); |
48 | } | 48 | } |
49 | 49 | ||
50 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { | 50 | bool NetworkRun::canSetState( State_t Curr, Action_t A ) { |
51 | // we handle UP and DOWN | 51 | // we handle UP and DOWN |
52 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); | 52 | RuntimeInfo * RI = netNode()->nextNode()->runtime(); |
53 | 53 | ||
54 | if( A == Up ) { | 54 | if( A == Up ) { |
55 | return ( Curr == Available ); | 55 | return ( Curr == Available ); |
56 | } else if( A == Down ) { | 56 | } else if( A == Down ) { |
57 | return ( Curr == IsUp ); | 57 | return ( Curr == IsUp ); |
58 | } | 58 | } |
59 | // delegate | 59 | // delegate |
60 | return RI->canSetState( Curr, A ); | 60 | return RI->canSetState( Curr, A ); |
61 | } | 61 | } |
62 | 62 | ||
63 | bool NetworkRun::handlesInterface( const QString & S ) { | 63 | bool NetworkRun::handlesInterface( const QString & S ) { |
64 | // donno -> pass deeper | 64 | // donno -> pass deeper |
65 | return netNode()->nextNode()->runtime()->handlesInterface(S); | 65 | return netNode()->nextNode()->runtime()->handlesInterface(S); |
66 | } | 66 | } |
diff --git a/noncore/settings/networksettings2/network/networkrun.h b/noncore/settings/networksettings2/network/networkrun.h index fa16365..522a912 100644 --- a/noncore/settings/networksettings2/network/networkrun.h +++ b/noncore/settings/networksettings2/network/networkrun.h | |||
@@ -1,23 +1,23 @@ | |||
1 | #include <asconnection.h> | 1 | #include <asconnection.h> |
2 | #include "networkdata.h" | 2 | #include "networkdata.h" |
3 | 3 | ||
4 | class NetworkRun : public AsConnection { | 4 | class NetworkRun : public AsConnection { |
5 | 5 | ||
6 | public : | 6 | public : |
7 | 7 | ||
8 | NetworkRun( ANetNodeInstance * NNI, | 8 | NetworkRun( ANetNodeInstance * NNI, |
9 | NetworkData & Data ) : AsConnection( NNI ) | 9 | NetworkData & Data ) : AsConnection( NNI ) |
10 | { } | 10 | { } |
11 | 11 | ||
12 | virtual AsConnection * asConnection( void ) | 12 | virtual AsConnection * asConnection( void ) |
13 | { return (AsConnection *)this; } | 13 | { return (AsConnection *)this; } |
14 | 14 | ||
15 | protected : | 15 | protected : |
16 | 16 | ||
17 | void detectState( NodeCollection * ); | 17 | void detectState( NodeCollection * ); |
18 | bool setState( NodeCollection * ,Action_t A ); | 18 | bool setState( NodeCollection * ,Action_t A, bool ); |
19 | bool canSetState( State_t , Action_t A ); | 19 | bool canSetState( State_t , Action_t A ); |
20 | 20 | ||
21 | bool handlesInterface( const QString & I ); | 21 | bool handlesInterface( const QString & I ); |
22 | 22 | ||
23 | }; | 23 | }; |
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp index 3ddcbde..b36c7a0 100644 --- a/noncore/settings/networksettings2/networksettings.cpp +++ b/noncore/settings/networksettings2/networksettings.cpp | |||
@@ -1,423 +1,449 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlistbox.h> | 7 | #include <qlistbox.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qiconview.h> | 10 | #include <qiconview.h> |
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | #include <qtoolbutton.h> | 13 | #include <qtoolbutton.h> |
14 | 14 | ||
15 | #include <asdevice.h> | 15 | #include <asdevice.h> |
16 | #include "networksettings.h" | 16 | #include "networksettings.h" |
17 | #include "netnode.h" | 17 | #include "netnode.h" |
18 | #include "editconnection.h" | 18 | #include "editconnection.h" |
19 | 19 | ||
20 | NetworkSettings::NetworkSettings( QWidget *parent, | 20 | NetworkSettings::NetworkSettings( QWidget *parent, |
21 | const char *name, | 21 | const char *name, |
22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), | 22 | WFlags fl ) : NetworkSettingsGUI(parent,name,fl), |
23 | NSD() { | 23 | NSD() { |
24 | 24 | ||
25 | UpdateTimer = new QTimer( this ); | 25 | UpdateTimer = new QTimer( this ); |
26 | |||
26 | // set pixmaps | 27 | // set pixmaps |
27 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); | 28 | Add_TB->setPixmap( NSResources->getPixmap( "add" ) ); |
28 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); | 29 | Delete_TB->setPixmap( NSResources->getPixmap( "remove" ) ); |
29 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); | 30 | CheckState_TB->setPixmap( NSResources->getPixmap( "check" ) ); |
30 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); | 31 | Enable_TB->setPixmap( NSResources->getPixmap( "disabled" ) ); |
31 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); | 32 | GenConfig_TB->setPixmap( NSResources->getPixmap( "configure" ) ); |
32 | 33 | ||
33 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); | 34 | Connect_TB->setPixmap( NSResources->getPixmap( "connected" ) ); |
35 | Disconnect_TB->setPixmap( NSResources->getPixmap( "disconnected" ) ); | ||
34 | 36 | ||
35 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); | 37 | On_TB->setPixmap( NSResources->getPixmap( "off" ) ); |
36 | 38 | ||
39 | SLOT_ToProfile(); | ||
40 | |||
37 | // populate main Listbox | 41 | // populate main Listbox |
38 | Profiles_LB->clear(); | 42 | Profiles_LB->clear(); |
39 | { Name2Connection_t & M = NSResources->connections(); | 43 | { Name2Connection_t & M = NSResources->connections(); |
40 | NodeCollection * NC; | 44 | NodeCollection * NC; |
41 | // for all connections | 45 | // for all connections |
42 | for( QDictIterator<NodeCollection> it(M); | 46 | for( QDictIterator<NodeCollection> it(M); |
43 | it.current(); | 47 | it.current(); |
44 | ++it ) { | 48 | ++it ) { |
45 | NC = it.current(); | 49 | NC = it.current(); |
46 | Profiles_LB->insertItem( NC->devicePixmap(), | 50 | Profiles_LB->insertItem( NC->devicePixmap(), |
47 | NC->name() ); | 51 | NC->name() ); |
48 | } | 52 | } |
49 | } | 53 | } |
50 | 54 | ||
51 | if( Profiles_LB->count() ) { | 55 | if( Profiles_LB->count() ) { |
52 | Profiles_LB->setSelected( 0, TRUE ); | 56 | Profiles_LB->setSelected( 0, TRUE ); |
53 | } | 57 | } |
54 | 58 | ||
55 | // if no profiles -> auto popup editing | 59 | // if no profiles -> auto popup editing |
56 | if( NSResources->connections().count() == 0 ) { | 60 | if( NSResources->connections().count() == 0 ) { |
57 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); | 61 | QTimer::singleShot( 100, this, SLOT(SLOT_AddNode() ) ); |
58 | } | 62 | } |
59 | 63 | ||
60 | UpdateTimer->start( 5000 ); | 64 | UpdateTimer->start( 5000 ); |
61 | connect( UpdateTimer, SIGNAL( timeout() ), | 65 | connect( UpdateTimer, SIGNAL( timeout() ), |
62 | this, SLOT( SLOT_RefreshStates() ) ); | 66 | this, SLOT( SLOT_RefreshStates() ) ); |
63 | 67 | ||
64 | /* Add QCopChannel */ | 68 | /* Add QCopChannel */ |
65 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 69 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
66 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); | 70 | this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); |
67 | } | 71 | } |
68 | 72 | ||
69 | NetworkSettings::~NetworkSettings() { | 73 | NetworkSettings::~NetworkSettings() { |
70 | QString S; | 74 | QString S; |
71 | 75 | ||
72 | S = NSD.generateSettings(); | 76 | S = NSD.generateSettings(); |
73 | if( ! S.isEmpty() ) { | 77 | if( ! S.isEmpty() ) { |
74 | QMessageBox::warning( | 78 | QMessageBox::warning( |
75 | 0, | 79 | 0, |
76 | tr( "In System Config" ), | 80 | tr( "In System Config" ), |
77 | S | 81 | S |
78 | ); | 82 | ); |
79 | } | 83 | } |
80 | 84 | ||
81 | S = NSD.saveSettings(); | 85 | S = NSD.saveSettings(); |
82 | if( ! S.isEmpty() ) { | 86 | if( ! S.isEmpty() ) { |
83 | // problem saving | 87 | // problem saving |
84 | QMessageBox::warning( | 88 | QMessageBox::warning( |
85 | 0, | 89 | 0, |
86 | tr( "Saving setup" ), S ); | 90 | tr( "Saving setup" ), S ); |
87 | } | 91 | } |
88 | } | 92 | } |
89 | 93 | ||
90 | void NetworkSettings::SLOT_RefreshStates( void ) { | 94 | void NetworkSettings::SLOT_RefreshStates( void ) { |
91 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember | 95 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember |
92 | 96 | ||
93 | if( LBI ) { | 97 | if( LBI ) { |
94 | NodeCollection * NC; | 98 | NodeCollection * NC; |
95 | NSResources->system().probeInterfaces(); | 99 | NSResources->system().probeInterfaces(); |
96 | // update current selection only | 100 | // update current selection only |
97 | NC = NSResources->findConnection( LBI->text() ); | 101 | NC = NSResources->findConnection( LBI->text() ); |
98 | if( NC ) { | 102 | if( NC ) { |
99 | State_t OldS = NC->state(); | 103 | State_t OldS = NC->state(); |
100 | State_t NewS = NC->state(1); | 104 | State_t NewS = NC->state(1); |
101 | if( OldS != NewS ) { | 105 | if( OldS != NewS ) { |
102 | updateProfileState( LBI ); | 106 | updateProfileState( LBI ); |
103 | } | 107 | } |
104 | } | 108 | } |
105 | } | 109 | } |
106 | 110 | ||
107 | 111 | ||
108 | /* -> LATER !! | 112 | /* -> LATER !! |
109 | bool is; | 113 | bool is; |
110 | NodeCollection * NC; | 114 | NodeCollection * NC; |
111 | 115 | ||
112 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { | 116 | for( unsigned int i = 0; i < Profiles_LB->count() ; i ++ ) { |
113 | NC = NSResources->findConnection( Profiles_LB->text(i) ); | 117 | NC = NSResources->findConnection( Profiles_LB->text(i) ); |
114 | if( NC ) { | 118 | if( NC ) { |
115 | State_t OldS = NC->state(); | 119 | State_t OldS = NC->state(); |
116 | State_t NewS = NC->state(1); | 120 | State_t NewS = NC->state(1); |
117 | if( OldS != NewS ) { | 121 | if( OldS != NewS ) { |
118 | is = Profiles_LB->isSelected(i); | 122 | is = Profiles_LB->isSelected(i); |
119 | Profiles_LB->changeItem( NC->statePixmap(NewS), | 123 | Profiles_LB->changeItem( NC->statePixmap(NewS), |
120 | NC->name(), | 124 | NC->name(), |
121 | i ); | 125 | i ); |
122 | if( is ) { | 126 | if( is ) { |
123 | Profiles_LB->setSelected( i, TRUE ); | 127 | Profiles_LB->setSelected( i, TRUE ); |
124 | } | 128 | } |
125 | } | 129 | } |
126 | } | 130 | } |
127 | } | 131 | } |
128 | if( ci >= 0 ) | 132 | if( ci >= 0 ) |
129 | Profiles_LB->setCurrentItem( ci ); | 133 | Profiles_LB->setCurrentItem( ci ); |
130 | */ | 134 | */ |
131 | } | 135 | } |
132 | 136 | ||
133 | void NetworkSettings::SLOT_AddNode( void ) { | 137 | void NetworkSettings::SLOT_AddNode( void ) { |
134 | SLOT_EditNode( 0 ); | 138 | SLOT_EditNode( 0 ); |
135 | } | 139 | } |
136 | 140 | ||
137 | void NetworkSettings::SLOT_DeleteNode( void ) { | 141 | void NetworkSettings::SLOT_DeleteNode( void ) { |
138 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 142 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
139 | 143 | ||
140 | if ( ! LBI ) | 144 | if ( ! LBI ) |
141 | return; | 145 | return; |
142 | 146 | ||
143 | if( QMessageBox::warning( | 147 | if( QMessageBox::warning( |
144 | 0, | 148 | 0, |
145 | tr( "Removing profile" ), | 149 | tr( "Removing profile" ), |
146 | tr( "Remove selected profile ?" ), | 150 | tr( "Remove selected profile ?" ), |
147 | 1, 0 ) == 1 ) { | 151 | 1, 0 ) == 1 ) { |
148 | NSResources->removeConnection( LBI->text() ); | 152 | NSResources->removeConnection( LBI->text() ); |
149 | delete LBI; | 153 | delete LBI; |
150 | setModified( 1 ); | 154 | setModified( 1 ); |
151 | NSD.forceGeneration(1); | 155 | NSD.forceGeneration(1); |
152 | } | 156 | } |
153 | } | 157 | } |
154 | 158 | ||
155 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { | 159 | void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { |
156 | QString OldName = ""; | 160 | QString OldName = ""; |
157 | EditConnection EC( this ); | 161 | EditConnection EC( this ); |
158 | 162 | ||
159 | if( LBI ) { | 163 | if( LBI ) { |
160 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 164 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
161 | if( ! NC ) { | 165 | if( ! NC ) { |
162 | return; | 166 | return; |
163 | } | 167 | } |
164 | OldName = NC->name(); | 168 | OldName = NC->name(); |
165 | EC.setConnection( NC ); | 169 | EC.setConnection( NC ); |
166 | } | 170 | } |
167 | 171 | ||
168 | EC.showMaximized(); | 172 | EC.showMaximized(); |
169 | // disable refresh timer | 173 | // disable refresh timer |
170 | UpdateTimer->stop(); | 174 | UpdateTimer->stop(); |
171 | // we need to retry | 175 | // we need to retry |
172 | while( 1 ) { | 176 | while( 1 ) { |
173 | if( EC.exec() == QDialog::Accepted ) { | 177 | if( EC.exec() == QDialog::Accepted ) { |
174 | // toplevel item -> store | 178 | // toplevel item -> store |
175 | NodeCollection * NC = EC.connection(); | 179 | NodeCollection * NC = EC.connection(); |
176 | if( NC->isModified() ) { | 180 | if( NC->isModified() ) { |
177 | setModified( 1 ); | 181 | setModified( 1 ); |
178 | if( LBI ) { | 182 | if( LBI ) { |
179 | if( NC->name() != OldName ) { | 183 | if( NC->name() != OldName ) { |
180 | // find if new name is free | 184 | // find if new name is free |
181 | NodeCollection * LCN = NSResources->findConnection( | 185 | NodeCollection * LCN = NSResources->findConnection( |
182 | NC->name() ); | 186 | NC->name() ); |
183 | if( LCN ) { | 187 | if( LCN ) { |
184 | QMessageBox::warning( | 188 | QMessageBox::warning( |
185 | 0, | 189 | 0, |
186 | tr( "In System Config" ), | 190 | tr( "In System Config" ), |
187 | tr( "Name %1 already exists" ).arg(NC->name()) | 191 | tr( "Name %1 already exists" ).arg(NC->name()) |
188 | ); | 192 | ); |
189 | continue; // restart exec | 193 | continue; // restart exec |
190 | } // else new name | 194 | } // else new name |
191 | // new name -> remove item | 195 | // new name -> remove item |
192 | NSResources->removeConnection( OldName ); | 196 | NSResources->removeConnection( OldName ); |
193 | NSResources->addConnection( NC ); | 197 | NSResources->addConnection( NC ); |
194 | } // else not changed | 198 | } // else not changed |
195 | 199 | ||
196 | // must add it here since change will trigger event | 200 | // must add it here since change will trigger event |
197 | Profiles_LB->changeItem( NC->devicePixmap(), | 201 | Profiles_LB->changeItem( NC->devicePixmap(), |
198 | NC->name(), | 202 | NC->name(), |
199 | Profiles_LB->index( LBI ) | 203 | Profiles_LB->index( LBI ) |
200 | ); | 204 | ); |
201 | } else { | 205 | } else { |
202 | // new item | 206 | // new item |
203 | int ci = Profiles_LB->count(); | 207 | int ci = Profiles_LB->count(); |
204 | NSResources->addConnection( NC ); | 208 | NSResources->addConnection( NC ); |
205 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 209 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
206 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); | 210 | Profiles_LB->insertItem( NC->devicePixmap(), NC->name() ); |
207 | Profiles_LB->setSelected( ci, TRUE ); | 211 | Profiles_LB->setSelected( ci, TRUE ); |
208 | } | 212 | } |
209 | updateProfileState( LBI ); | 213 | updateProfileState( LBI ); |
210 | } | 214 | } |
211 | } else { | 215 | } else { |
212 | // cancelled : reset connection | 216 | // cancelled : reset connection |
213 | if( LBI ) { | 217 | if( LBI ) { |
214 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 218 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
215 | NC->reassign(); | 219 | NC->reassign(); |
216 | } | 220 | } |
217 | } | 221 | } |
218 | break; | 222 | break; |
219 | } | 223 | } |
220 | // reenable | 224 | // reenable |
221 | UpdateTimer->start( 5000 ); | 225 | UpdateTimer->start( 5000 ); |
222 | } | 226 | } |
223 | 227 | ||
224 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { | 228 | void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { |
225 | if( LBI == 0 ) | 229 | if( LBI == 0 ) |
226 | return; | 230 | return; |
227 | 231 | ||
228 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); | 232 | NodeCollection * NC = NSResources->findConnection( LBI->text() ); |
229 | 233 | ||
230 | // is button possible | 234 | // is button possible |
231 | bool EnabledPossible, OnPossible, ConnectPossible; | 235 | bool EnabledPossible, OnPossible, ConnectPossible; |
232 | // is button On or Off | 236 | // is button On or Off |
233 | bool DisabledOn, OnOn, ConnectOn; | 237 | bool DisabledOn, OnOn, ConnectOn; |
234 | 238 | ||
235 | EnabledPossible = OnPossible = ConnectPossible = 1; | 239 | EnabledPossible = OnPossible = ConnectPossible = 1; |
236 | DisabledOn = 1; | 240 | DisabledOn = 1; |
237 | OnOn = ConnectOn = 0; | 241 | OnOn = ConnectOn = 0; |
238 | 242 | ||
239 | switch( NC->state() ) { | 243 | switch( NC->state() ) { |
240 | case Unknown : | 244 | case Unknown : |
241 | // cannot occur here | 245 | // cannot occur here |
242 | break; | 246 | break; |
243 | case Unchecked : | 247 | case Unchecked : |
244 | case Unavailable : | 248 | case Unavailable : |
245 | // cannot do anything but recheck | 249 | // cannot do anything but recheck |
246 | EnabledPossible = OnPossible = ConnectPossible = 0; | 250 | EnabledPossible = OnPossible = ConnectPossible = 0; |
247 | break; | 251 | break; |
248 | case Disabled : | 252 | case Disabled : |
249 | OnPossible = ConnectPossible = 0; | 253 | OnPossible = ConnectPossible = 0; |
250 | break; | 254 | break; |
251 | case Off : | 255 | case Off : |
252 | DisabledOn = 0; | 256 | DisabledOn = 0; |
253 | break; | 257 | break; |
254 | case Available : | 258 | case Available : |
255 | OnOn = 1; | 259 | OnOn = 1; |
256 | DisabledOn = 0; | 260 | DisabledOn = 0; |
257 | break; | 261 | break; |
258 | case IsUp : | 262 | case IsUp : |
259 | OnOn = ConnectOn = 1; | 263 | OnOn = ConnectOn = 1; |
260 | DisabledOn = 0; | 264 | DisabledOn = 0; |
261 | break; | 265 | break; |
262 | } | 266 | } |
263 | 267 | ||
264 | // set button state | 268 | // set button state |
265 | Enable_TB->setEnabled( EnabledPossible ); | 269 | Enable_TB->setEnabled( EnabledPossible ); |
266 | On_TB->setEnabled( OnPossible ); | 270 | On_TB->setEnabled( OnPossible ); |
267 | Connect_TB->setEnabled( ConnectPossible ); | 271 | Connect_TB->setEnabled( ConnectPossible ); |
268 | 272 | ||
269 | Enable_TB->setOn( DisabledOn ); | 273 | Enable_TB->setOn( DisabledOn ); |
270 | On_TB->setOn( OnOn ); | 274 | On_TB->setOn( OnOn ); |
271 | Connect_TB->setOn( ConnectOn ); | 275 | Connect_TB->setOn( ConnectOn ); |
272 | 276 | ||
273 | if( NC->description().isEmpty() ) { | 277 | if( NC->description().isEmpty() ) { |
274 | Description_LBL->setText( tr( "No description" ) ); | 278 | Description_LBL->setText( tr( "No description" ) ); |
275 | } else { | 279 | } else { |
276 | Description_LBL->setText( NC->description() ); | 280 | Description_LBL->setText( NC->description() ); |
277 | } | 281 | } |
278 | 282 | ||
279 | CurProfile_GB->setTitle( LBI->text() ); | 283 | Profile_GB->setTitle( LBI->text() ); |
280 | State_LBL->setText( NC->stateName() ); | 284 | State_LBL->setText( NC->stateName() ); |
281 | } | 285 | } |
282 | 286 | ||
283 | void NetworkSettings::SLOT_CheckState( void ) { | 287 | void NetworkSettings::SLOT_CheckState( void ) { |
284 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 288 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
285 | if ( ! LBI ) | 289 | if ( ! LBI ) |
286 | return; | 290 | return; |
287 | updateProfileState( LBI ); | 291 | updateProfileState( LBI ); |
288 | } | 292 | } |
289 | 293 | ||
290 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { | 294 | void NetworkSettings::updateProfileState( QListBoxItem * LBI ) { |
291 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { | 295 | if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) { |
292 | SLOT_ShowNode( LBI ); | 296 | SLOT_ShowNode( LBI ); |
293 | } | 297 | } |
294 | } | 298 | } |
295 | 299 | ||
296 | void NetworkSettings::SLOT_GenerateConfig( void ) { | 300 | void NetworkSettings::SLOT_GenerateConfig( void ) { |
297 | QString S = NSD.generateSettings( TRUE ); | 301 | QString S = NSD.generateSettings( TRUE ); |
298 | 302 | ||
299 | if( ! S.isEmpty() ) { | 303 | if( ! S.isEmpty() ) { |
300 | QMessageBox::warning( | 304 | QMessageBox::warning( |
301 | 0, | 305 | 0, |
302 | tr( "Generating system configuration" ), | 306 | tr( "Generating system configuration" ), |
303 | S | 307 | S |
304 | ); | 308 | ); |
305 | } | 309 | } |
306 | } | 310 | } |
307 | 311 | ||
308 | void NetworkSettings::SLOT_Enable( void ) { | 312 | void NetworkSettings::SLOT_Enable( void ) { |
309 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 313 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
310 | QString Msg; | 314 | QString Msg; |
311 | if ( ! LBI ) | 315 | if ( ! LBI ) |
312 | return; | 316 | return; |
313 | 317 | ||
314 | NodeCollection * NC = | 318 | NodeCollection * NC = |
315 | NSResources->findConnection( LBI->text() ); | 319 | NSResources->findConnection( LBI->text() ); |
316 | 320 | ||
317 | bool rv; | 321 | bool rv; |
318 | switch( NC->state() ) { | 322 | switch( NC->state() ) { |
319 | case Disabled : | 323 | case Disabled : |
320 | Msg = tr( "Cannot enable profile" ); | 324 | Msg = tr( "Cannot enable profile" ); |
321 | rv = NC->setState( Enable ); | 325 | rv = NC->setState( Enable ); |
322 | break; | 326 | break; |
323 | default : | 327 | default : |
324 | Msg = tr( "Cannot disable profile" ); | 328 | Msg = tr( "Cannot disable profile" ); |
325 | rv = NC->setState( Disable ); | 329 | rv = NC->setState( Disable ); |
326 | break; | 330 | break; |
327 | } | 331 | } |
328 | 332 | ||
329 | if( ! rv ) { | 333 | if( ! rv ) { |
330 | QMessageBox::warning( | 334 | QMessageBox::warning( |
331 | 0, | 335 | 0, |
332 | tr( "Activating profile" ), | 336 | tr( "Activating profile" ), |
333 | Msg ); | 337 | Msg ); |
334 | return; | 338 | return; |
335 | } | 339 | } |
336 | updateProfileState( LBI ); | 340 | updateProfileState( LBI ); |
337 | } | 341 | } |
338 | 342 | ||
339 | void NetworkSettings::SLOT_On( void ) { | 343 | void NetworkSettings::SLOT_On( void ) { |
340 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 344 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
341 | 345 | ||
342 | if ( ! LBI ) | 346 | if ( ! LBI ) |
343 | return; | 347 | return; |
344 | 348 | ||
345 | NodeCollection * NC = | 349 | NodeCollection * NC = |
346 | NSResources->findConnection( LBI->text() ); | 350 | NSResources->findConnection( LBI->text() ); |
347 | 351 | ||
348 | bool rv; | 352 | bool rv; |
349 | switch( NC->state() ) { | 353 | switch( NC->state() ) { |
350 | case Off : | 354 | case Off : |
351 | // activate interface | 355 | // activate interface |
352 | rv = NC->setState( Activate ); | 356 | rv = NC->setState( Activate ); |
353 | break; | 357 | break; |
354 | case Available : // deactivate | 358 | case Available : // deactivate |
355 | case IsUp : // deactivate (will also bring down if needed) | 359 | case IsUp : // deactivate (will also bring down if needed) |
356 | rv = NC->setState( Deactivate ); | 360 | rv = NC->setState( Deactivate ); |
357 | break; | 361 | break; |
358 | default : | 362 | default : |
359 | // others no change | 363 | // others no change |
360 | return; | 364 | return; |
361 | } | 365 | } |
362 | 366 | ||
363 | if( ! rv ) { | 367 | if( ! rv ) { |
364 | QMessageBox::warning( | 368 | QMessageBox::warning( |
365 | 0, | 369 | 0, |
366 | tr( "Activating profile" ), | 370 | tr( "Activating profile" ), |
367 | tr( "Cannot enable profile" ) ); | 371 | tr( "Cannot enable profile" ) ); |
368 | return; | 372 | return; |
369 | } | 373 | } |
370 | updateProfileState( LBI ); | 374 | updateProfileState( LBI ); |
371 | } | 375 | } |
372 | 376 | ||
373 | void NetworkSettings::SLOT_Connect( void ) { | 377 | void NetworkSettings::SLOT_Connect( void ) { |
374 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | 378 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); |
375 | 379 | ||
376 | if ( ! LBI ) | 380 | if ( ! LBI ) |
377 | return; | 381 | return; |
378 | 382 | ||
379 | NodeCollection * NC = | 383 | NodeCollection * NC = |
380 | NSResources->findConnection( LBI->text() ); | 384 | NSResources->findConnection( LBI->text() ); |
381 | 385 | ||
382 | bool rv = 1 ; | 386 | bool rv = 1 ; |
383 | switch( NC->state() ) { | 387 | switch( NC->state() ) { |
384 | case IsUp : | 388 | case IsUp : |
385 | // down interface | 389 | // down interface |
386 | rv = NC->setState( Down ); | 390 | rv = NC->setState( Down ); |
387 | break; | 391 | break; |
388 | case Available : | 392 | case Available : |
389 | // up interface | 393 | // up interface |
390 | rv = NC->setState( Up ); | 394 | rv = NC->setState( Up ); |
391 | break; | 395 | break; |
392 | case Off : | 396 | case Off : |
393 | // activate and bring up | 397 | // activate and bring up |
394 | rv = ( NC->setState( Activate ) && | 398 | rv = ( NC->setState( Activate ) && |
395 | NC->setState( Up ) ); | 399 | NC->setState( Up ) ); |
396 | break; | 400 | break; |
397 | default : | 401 | default : |
398 | // others no change | 402 | // others no change |
399 | break; | 403 | break; |
400 | } | 404 | } |
401 | 405 | ||
402 | if( ! rv ) { | 406 | if( ! rv ) { |
403 | QMessageBox::warning( | 407 | QMessageBox::warning( |
404 | 0, | 408 | 0, |
405 | tr( "Activating profile" ), | 409 | tr( "Activating profile" ), |
406 | tr( "Cannot enable profile" ) ); | 410 | tr( "Cannot enable profile" ) ); |
407 | } | 411 | } |
408 | 412 | ||
409 | // we do not update the GUI but wait for the REAL upping of the device | 413 | // we do not update the GUI but wait for the REAL upping of the device |
410 | } | 414 | } |
411 | 415 | ||
416 | void NetworkSettings::SLOT_Disconnect( void ) { | ||
417 | QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); | ||
418 | |||
419 | if ( ! LBI ) | ||
420 | return; | ||
421 | |||
422 | NodeCollection * NC = | ||
423 | NSResources->findConnection( LBI->text() ); | ||
424 | |||
425 | NC->setState( Down, 1 ); | ||
426 | } | ||
427 | |||
428 | void NetworkSettings::SLOT_ToMessages( void ) { | ||
429 | Profile_GB->hide(); | ||
430 | Messages_GB->show(); | ||
431 | } | ||
432 | |||
433 | void NetworkSettings::SLOT_ToProfile( void ) { | ||
434 | Profile_GB->show(); | ||
435 | Messages_GB->hide(); | ||
436 | } | ||
437 | |||
412 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { | 438 | void NetworkSettings::SLOT_QCopMessage(const QCString &msg, const QByteArray &data) { |
413 | QDataStream stream( data, IO_ReadOnly ); | 439 | QDataStream stream( data, IO_ReadOnly ); |
414 | 440 | ||
415 | if( msg == "raise" ) { | 441 | if( msg == "raise" ) { |
416 | raise(); | 442 | raise(); |
417 | return; | 443 | return; |
418 | } /* if ( msg == "someMessage(int,int,int)" ) { | 444 | } /* if ( msg == "someMessage(int,int,int)" ) { |
419 | int a,b,c; | 445 | int a,b,c; |
420 | stream >> a >> b >> c; | 446 | stream >> a >> b >> c; |
421 | ... | 447 | ... |
422 | } */ | 448 | } */ |
423 | } | 449 | } |
diff --git a/noncore/settings/networksettings2/networksettings.h b/noncore/settings/networksettings2/networksettings.h index d9ea5d4..97852af 100644 --- a/noncore/settings/networksettings2/networksettings.h +++ b/noncore/settings/networksettings2/networksettings.h | |||
@@ -1,49 +1,52 @@ | |||
1 | #include "nsdata.h" | 1 | #include "nsdata.h" |
2 | #include "networksettingsGUI.h" | 2 | #include "networksettingsGUI.h" |
3 | #include "resources.h" | 3 | #include "resources.h" |
4 | 4 | ||
5 | class ANetNode; | 5 | class ANetNode; |
6 | class ANetNodeInstance; | 6 | class ANetNodeInstance; |
7 | class QTimer; | 7 | class QTimer; |
8 | class QListBoxItem; | 8 | class QListBoxItem; |
9 | 9 | ||
10 | class NetworkSettings : public NetworkSettingsGUI { | 10 | class NetworkSettings : public NetworkSettingsGUI { |
11 | 11 | ||
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public : | 14 | public : |
15 | 15 | ||
16 | NetworkSettings( QWidget *parent=0, | 16 | NetworkSettings( QWidget *parent=0, |
17 | const char *name=0, | 17 | const char *name=0, |
18 | WFlags fl = 0 ); | 18 | WFlags fl = 0 ); |
19 | ~NetworkSettings( void ); | 19 | ~NetworkSettings( void ); |
20 | 20 | ||
21 | static QString appName( void ) | 21 | static QString appName( void ) |
22 | { return QString::fromLatin1("networksettings"); } | 22 | { return QString::fromLatin1("networksettings"); } |
23 | 23 | ||
24 | bool isModified( void ) | 24 | bool isModified( void ) |
25 | { return NSD.isModified(); } | 25 | { return NSD.isModified(); } |
26 | void setModified( bool m ) | 26 | void setModified( bool m ) |
27 | { NSD.setModified( m ); } | 27 | { NSD.setModified( m ); } |
28 | 28 | ||
29 | public slots : | 29 | public slots : |
30 | 30 | ||
31 | void SLOT_AddNode( void ); | 31 | void SLOT_AddNode( void ); |
32 | void SLOT_DeleteNode( void ); | 32 | void SLOT_DeleteNode( void ); |
33 | void SLOT_ShowNode( QListBoxItem * ); | 33 | void SLOT_ShowNode( QListBoxItem * ); |
34 | void SLOT_EditNode( QListBoxItem * ); | 34 | void SLOT_EditNode( QListBoxItem * ); |
35 | void SLOT_CheckState( void ); | 35 | void SLOT_CheckState( void ); |
36 | void SLOT_Enable( void ); | 36 | void SLOT_Enable( void ); |
37 | void SLOT_On( void ); | 37 | void SLOT_On( void ); |
38 | void SLOT_Connect( void ); | 38 | void SLOT_Connect( void ); |
39 | void SLOT_Disconnect( void ); | ||
39 | void SLOT_GenerateConfig( void ); | 40 | void SLOT_GenerateConfig( void ); |
40 | void SLOT_RefreshStates( void ); | 41 | void SLOT_RefreshStates( void ); |
41 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); | 42 | void SLOT_QCopMessage( const QCString&,const QByteArray& ); |
43 | void SLOT_ToProfile( void ); | ||
44 | void SLOT_ToMessages( void ); | ||
42 | 45 | ||
43 | private : | 46 | private : |
44 | 47 | ||
45 | void updateProfileState( QListBoxItem * it ); | 48 | void updateProfileState( QListBoxItem * it ); |
46 | QTimer * UpdateTimer; | 49 | QTimer * UpdateTimer; |
47 | NetworkSettingsData NSD; | 50 | NetworkSettingsData NSD; |
48 | 51 | ||
49 | }; | 52 | }; |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.cpp b/noncore/settings/networksettings2/networksettings2/netnode.cpp index dc66aff..1182543 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.cpp +++ b/noncore/settings/networksettings2/networksettings2/netnode.cpp | |||
@@ -1,299 +1,310 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | #include <time.h> | 1 | #include <time.h> |
2 | #include <qpe/qpeapplication.h> | ||
3 | #include <qpainter.h> | ||
4 | #include <qbitmap.h> | ||
3 | #include <qtextstream.h> | 5 | #include <qtextstream.h> |
4 | #include <qpixmap.h> | 6 | #include <qpixmap.h> |
5 | 7 | ||
6 | #include "resources.h" | 8 | #include "resources.h" |
7 | #include "netnode.h" | 9 | #include "netnode.h" |
8 | 10 | ||
9 | #include "asdevice.h" | 11 | #include "asdevice.h" |
10 | #include "asline.h" | 12 | #include "asline.h" |
11 | #include "asconnection.h" | 13 | #include "asconnection.h" |
12 | #include "asfullsetup.h" | 14 | #include "asfullsetup.h" |
13 | 15 | ||
14 | QString & deQuote( QString & X ) { | 16 | QString & deQuote( QString & X ) { |
15 | if( X[0] == '"' ) { | 17 | if( X[0] == '"' ) { |
16 | // remove end and trailing "" and \x -> x | 18 | // remove end and trailing "" and \x -> x |
17 | QChar R; | 19 | QChar R; |
18 | long idx; | 20 | long idx; |
19 | idx = X.length()-1; | 21 | idx = X.length()-1; |
20 | X = X.mid( 1, idx ); | 22 | X = X.mid( 1, idx ); |
21 | 23 | ||
22 | idx = 0; | 24 | idx = 0; |
23 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { | 25 | while( ( idx = X.find( '\\', idx ) ) >= 0 ) { |
24 | R = X.at( idx + 1 ); | 26 | R = X.at( idx + 1 ); |
25 | X.replace( idx, 2, &R, 1 ); | 27 | X.replace( idx, 2, &R, 1 ); |
26 | } | 28 | } |
27 | X = X.left( X.length()-1 ); | 29 | X = X.left( X.length()-1 ); |
28 | } | 30 | } |
29 | return X; | 31 | return X; |
30 | } | 32 | } |
31 | 33 | ||
32 | QString quote( QString X ) { | 34 | QString quote( QString X ) { |
33 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { | 35 | if( X.find( QRegExp( "[ \n\"\\\t]" ) ) >= 0 ) { |
34 | // need to quote this | 36 | // need to quote this |
35 | QString OutString = "\""; | 37 | QString OutString = "\""; |
36 | 38 | ||
37 | X.replace( QRegExp("\""), "\\\"" ); | 39 | X.replace( QRegExp("\""), "\\\"" ); |
38 | X.replace( QRegExp("\\"), "\\\\" ); | 40 | X.replace( QRegExp("\\"), "\\\\" ); |
39 | X.replace( QRegExp(" "), "\\ " ); | 41 | X.replace( QRegExp(" "), "\\ " ); |
40 | 42 | ||
41 | OutString += X; | 43 | OutString += X; |
42 | OutString += "\""; | 44 | OutString += "\""; |
43 | X = OutString; | 45 | X = OutString; |
44 | } | 46 | } |
45 | return X; | 47 | return X; |
46 | } | 48 | } |
47 | 49 | ||
48 | 50 | ||
49 | // | 51 | // |
50 | // | 52 | // |
51 | // ANETNODE | 53 | // ANETNODE |
52 | // | 54 | // |
53 | // | 55 | // |
54 | 56 | ||
55 | void ANetNode::saveAttributes( QTextStream & TS ) { | 57 | void ANetNode::saveAttributes( QTextStream & TS ) { |
56 | saveSpecificAttribute( TS ); | 58 | saveSpecificAttribute( TS ); |
57 | } | 59 | } |
58 | 60 | ||
59 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ | 61 | void ANetNode::setAttribute( QString & Attr, QString & Value ){ |
60 | setSpecificAttribute( Attr, Value ); | 62 | setSpecificAttribute( Attr, Value ); |
61 | } | 63 | } |
62 | 64 | ||
63 | // | 65 | // |
64 | // | 66 | // |
65 | // ANETNODEINSTANCE | 67 | // ANETNODEINSTANCE |
66 | // | 68 | // |
67 | // | 69 | // |
68 | 70 | ||
69 | long ANetNodeInstance::InstanceCounter = -1; | 71 | long ANetNodeInstance::InstanceCounter = -1; |
70 | 72 | ||
71 | void ANetNodeInstance::initialize( void ) { | 73 | void ANetNodeInstance::initialize( void ) { |
72 | if( InstanceCounter == -1 ) | 74 | if( InstanceCounter == -1 ) |
73 | InstanceCounter = time(0); | 75 | InstanceCounter = time(0); |
74 | // set name | 76 | // set name |
75 | QString N; | 77 | QString N; |
76 | N.sprintf( "-%ld", InstanceCounter++ ); | 78 | N.sprintf( "-%ld", InstanceCounter++ ); |
77 | N.prepend( NodeType->name() ); | 79 | N.prepend( NodeType->name() ); |
78 | setName( N.latin1() ); | 80 | setName( N.latin1() ); |
79 | } | 81 | } |
80 | 82 | ||
81 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ | 83 | void ANetNodeInstance::setAttribute( QString & Attr, QString & Value ){ |
82 | if( Attr == "name" ) { | 84 | if( Attr == "name" ) { |
83 | setName( Value.latin1() ); | 85 | setName( Value.latin1() ); |
84 | } else { | 86 | } else { |
85 | setSpecificAttribute( Attr, Value ); | 87 | setSpecificAttribute( Attr, Value ); |
86 | } | 88 | } |
87 | } | 89 | } |
88 | 90 | ||
89 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { | 91 | void ANetNodeInstance::saveAttributes( QTextStream & TS ) { |
90 | TS << "name=" << name() << endl; | 92 | TS << "name=" << name() << endl; |
91 | saveSpecificAttribute( TS ); | 93 | saveSpecificAttribute( TS ); |
92 | } | 94 | } |
93 | 95 | ||
94 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { | 96 | ANetNodeInstance * ANetNodeInstance::nextNode( void ) { |
95 | return connection()->findNext( this ); | 97 | return connection()->findNext( this ); |
96 | } | 98 | } |
97 | 99 | ||
98 | // | 100 | // |
99 | // | 101 | // |
100 | // NODECOLLECTION | 102 | // NODECOLLECTION |
101 | // | 103 | // |
102 | // | 104 | // |
103 | 105 | ||
104 | long NodeCollection::MaxNr = -1; | 106 | long NodeCollection::MaxNr = -1; |
105 | 107 | ||
106 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { | 108 | NodeCollection::NodeCollection( void ) : QList<ANetNodeInstance>() { |
107 | IsModified = 0; | 109 | IsModified = 0; |
108 | Index = -1; | 110 | Index = -1; |
109 | Name=""; | 111 | Name=""; |
110 | IsNew = 1; | 112 | IsNew = 1; |
111 | CurrentState = Unchecked; | 113 | CurrentState = Unchecked; |
112 | } | 114 | } |
113 | 115 | ||
114 | NodeCollection::NodeCollection( QTextStream & TS ) : | 116 | NodeCollection::NodeCollection( QTextStream & TS ) : |
115 | QList<ANetNodeInstance>() { | 117 | QList<ANetNodeInstance>() { |
116 | long idx; | 118 | long idx; |
117 | bool InError = 0; | 119 | bool InError = 0; |
118 | QString S, A, N; | 120 | QString S, A, N; |
119 | IsModified = 0; | 121 | IsModified = 0; |
120 | Index = -1; | 122 | Index = -1; |
121 | Name=""; | 123 | Name=""; |
122 | IsNew = 0; | 124 | IsNew = 0; |
123 | CurrentState = Unchecked; | 125 | CurrentState = Unchecked; |
124 | 126 | ||
125 | do { | 127 | do { |
126 | S = TS.readLine(); | 128 | S = TS.readLine(); |
127 | if( S.isEmpty() ) { | 129 | if( S.isEmpty() ) { |
128 | if( InError ) { | 130 | if( InError ) { |
129 | // remove all nodes | 131 | // remove all nodes |
130 | clear(); | 132 | clear(); |
131 | } | 133 | } |
132 | // empty line | 134 | // empty line |
133 | break; | 135 | break; |
134 | } | 136 | } |
135 | 137 | ||
136 | idx = S.find('='); | 138 | idx = S.find('='); |
137 | S.stripWhiteSpace(); | 139 | S.stripWhiteSpace(); |
138 | A = S.left( idx ); | 140 | A = S.left( idx ); |
139 | A.lower(); | 141 | A.lower(); |
140 | N = S.mid( idx+1, S.length() ); | 142 | N = S.mid( idx+1, S.length() ); |
141 | N.stripWhiteSpace(); | 143 | N.stripWhiteSpace(); |
142 | N = deQuote( N ); | 144 | N = deQuote( N ); |
143 | 145 | ||
144 | if( A == "name" ) { | 146 | if( A == "name" ) { |
145 | Name = N; | 147 | Name = N; |
146 | } else if( A == "number" ) { | 148 | } else if( A == "number" ) { |
147 | setNumber( N.toLong() ); | 149 | setNumber( N.toLong() ); |
148 | } else if( A == "node" ) { | 150 | } else if( A == "node" ) { |
149 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); | 151 | ANetNodeInstance * NNI = NSResources->findNodeInstance( N ); |
150 | if( NNI && ! InError ) { | 152 | if( NNI && ! InError ) { |
151 | append( NSResources->findNodeInstance( N ) ); | 153 | append( NSResources->findNodeInstance( N ) ); |
152 | } else { | 154 | } else { |
153 | // could not find a node type -> collection invalid | 155 | // could not find a node type -> collection invalid |
154 | InError = 1; | 156 | InError = 1; |
155 | } | 157 | } |
156 | } | 158 | } |
157 | } while( 1 ); | 159 | } while( 1 ); |
158 | } | 160 | } |
159 | 161 | ||
160 | 162 | ||
161 | NodeCollection::~NodeCollection( void ) { | 163 | NodeCollection::~NodeCollection( void ) { |
162 | } | 164 | } |
163 | 165 | ||
164 | const QString & NodeCollection::description( void ) { | 166 | const QString & NodeCollection::description( void ) { |
165 | ANetNodeInstance * NNI = getToplevel(); | 167 | ANetNodeInstance * NNI = getToplevel(); |
166 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; | 168 | return (NNI) ? NNI->runtime()->asFullSetup()->description() : Name; |
167 | } | 169 | } |
168 | 170 | ||
169 | void NodeCollection::append( ANetNodeInstance * NNI ) { | 171 | void NodeCollection::append( ANetNodeInstance * NNI ) { |
170 | NNI->setConnection( this ); | 172 | NNI->setConnection( this ); |
171 | QList<ANetNodeInstance>::append( NNI ); | 173 | QList<ANetNodeInstance>::append( NNI ); |
172 | } | 174 | } |
173 | 175 | ||
174 | void NodeCollection::save( QTextStream & TS ) { | 176 | void NodeCollection::save( QTextStream & TS ) { |
175 | 177 | ||
176 | TS << "name=" << quote( Name ) << endl; | 178 | TS << "name=" << quote( Name ) << endl; |
177 | TS << "number=" << number() << endl; | 179 | TS << "number=" << number() << endl; |
178 | ANetNodeInstance * NNI; | 180 | ANetNodeInstance * NNI; |
179 | for( QListIterator<ANetNodeInstance> it(*this); | 181 | for( QListIterator<ANetNodeInstance> it(*this); |
180 | it.current(); | 182 | it.current(); |
181 | ++it ) { | 183 | ++it ) { |
182 | NNI = it.current(); | 184 | NNI = it.current(); |
183 | TS << "node=" << NNI->name() << endl; | 185 | TS << "node=" << NNI->name() << endl; |
184 | } | 186 | } |
185 | TS << endl; | 187 | TS << endl; |
186 | IsNew = 0; | 188 | IsNew = 0; |
187 | } | 189 | } |
188 | 190 | ||
189 | ANetNodeInstance * NodeCollection::getToplevel( void ) { | 191 | ANetNodeInstance * NodeCollection::getToplevel( void ) { |
190 | ANetNodeInstance * NNI = 0; | 192 | ANetNodeInstance * NNI = 0; |
191 | for( QListIterator<ANetNodeInstance> it(*this); | 193 | for( QListIterator<ANetNodeInstance> it(*this); |
192 | it.current(); | 194 | it.current(); |
193 | ++it ) { | 195 | ++it ) { |
194 | NNI = it.current(); | 196 | NNI = it.current(); |
195 | if( NNI->nodeClass()->isToplevel() ) | 197 | if( NNI->nodeClass()->isToplevel() ) |
196 | break; | 198 | break; |
197 | } | 199 | } |
198 | return NNI; | 200 | return NNI; |
199 | } | 201 | } |
200 | 202 | ||
201 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { | 203 | ANetNodeInstance * NodeCollection::findByName( const QString & S ) { |
202 | ANetNodeInstance * NNI = 0; | 204 | ANetNodeInstance * NNI = 0; |
203 | for( QListIterator<ANetNodeInstance> it(*this); | 205 | for( QListIterator<ANetNodeInstance> it(*this); |
204 | it.current(); | 206 | it.current(); |
205 | ++it ) { | 207 | ++it ) { |
206 | NNI = it.current(); | 208 | NNI = it.current(); |
207 | if( NNI->name() == S ) | 209 | if( NNI->name() == S ) |
208 | break; | 210 | break; |
209 | } | 211 | } |
210 | return NNI; | 212 | return NNI; |
211 | } | 213 | } |
212 | 214 | ||
213 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { | 215 | ANetNodeInstance * NodeCollection::findNext( ANetNodeInstance * NNI ) { |
214 | ANetNodeInstance * NNNI; | 216 | ANetNodeInstance * NNNI; |
215 | 217 | ||
216 | if( ! NNI ) | 218 | if( ! NNI ) |
217 | getToplevel(); | 219 | getToplevel(); |
218 | 220 | ||
219 | for( QListIterator<ANetNodeInstance> it(*this); | 221 | for( QListIterator<ANetNodeInstance> it(*this); |
220 | it.current(); | 222 | it.current(); |
221 | ++it ) { | 223 | ++it ) { |
222 | NNNI = it.current(); | 224 | NNNI = it.current(); |
223 | if( NNNI == NNI ) { | 225 | if( NNNI == NNI ) { |
224 | ++it; | 226 | ++it; |
225 | return it.current(); | 227 | return it.current(); |
226 | } | 228 | } |
227 | } | 229 | } |
228 | return 0; // no more next | 230 | return 0; // no more next |
229 | } | 231 | } |
230 | 232 | ||
231 | int NodeCollection::compareItems( QCollection::Item I1, | 233 | int NodeCollection::compareItems( QCollection::Item I1, |
232 | QCollection::Item I2 ) { | 234 | QCollection::Item I2 ) { |
233 | ANetNodeInstance * NNI1, * NNI2; | 235 | ANetNodeInstance * NNI1, * NNI2; |
234 | NNI1 = (ANetNodeInstance *)I1; | 236 | NNI1 = (ANetNodeInstance *)I1; |
235 | NNI2 = (ANetNodeInstance *)I2; | 237 | NNI2 = (ANetNodeInstance *)I2; |
236 | return strcmp( NNI1->name(), NNI2->name() ); | 238 | return strcmp( NNI1->name(), NNI2->name() ); |
237 | } | 239 | } |
238 | 240 | ||
239 | static char * State2PixmapTbl[] = { | 241 | static char * State2PixmapTbl[] = { |
240 | "NULL", // Unchecked : no pixmap | 242 | "NULL", // Unchecked : no pixmap |
241 | "check", // Unknown | 243 | "check", // Unknown |
242 | "delete", // unavailable | 244 | "delete", // unavailable |
243 | "disabled", // disabled | 245 | "disabled", // disabled |
244 | "off", // off | 246 | "off", // off |
245 | "disconnected", // available | 247 | "disconnected", // available |
246 | "connected" // up | 248 | "connected" // up |
247 | }; | 249 | }; |
248 | 250 | ||
249 | QPixmap NodeCollection::devicePixmap( void ) { | 251 | QPixmap NodeCollection::devicePixmap( void ) { |
250 | return NSResources->getPixmap( | 252 | QPixmap pm = NSResources->getPixmap( |
251 | device()->netNode()->pixmapName()+"-large" ); | 253 | getToplevel()->nextNode()->pixmapName()+"-large"); |
254 | |||
255 | QPixmap Mini = NSResources->getPixmap( device()->netNode()->pixmapName() ); | ||
256 | |||
257 | QPainter painter( &pm ); | ||
258 | painter.drawPixmap( pm.width()-Mini.width(), | ||
259 | pm.height()-Mini.height(), | ||
260 | Mini ); | ||
261 | pm.setMask( pm.createHeuristicMask( TRUE ) ); | ||
262 | return pm; | ||
252 | } | 263 | } |
253 | 264 | ||
254 | QPixmap NodeCollection::statePixmap( State_t S) { | 265 | QPixmap NodeCollection::statePixmap( State_t S) { |
255 | return NSResources->getPixmap( State2PixmapTbl[S] ); | 266 | return NSResources->getPixmap( State2PixmapTbl[S] ); |
256 | } | 267 | } |
257 | 268 | ||
258 | QString NodeCollection::stateName( State_t S) { | 269 | QString NodeCollection::stateName( State_t S) { |
259 | switch( S ) { | 270 | switch( S ) { |
260 | case Unknown : | 271 | case Unknown : |
261 | return qApp->translate( "networksettings2", "Unknown"); | 272 | return qApp->translate( "networksettings2", "Unknown"); |
262 | case Unavailable : | 273 | case Unavailable : |
263 | return qApp->translate( "networksettings2", "Unavailable"); | 274 | return qApp->translate( "networksettings2", "Unavailable"); |
264 | case Disabled : | 275 | case Disabled : |
265 | return qApp->translate( "networksettings2", "Disabled"); | 276 | return qApp->translate( "networksettings2", "Disabled"); |
266 | case Off : | 277 | case Off : |
267 | return qApp->translate( "networksettings2", "Off"); | 278 | return qApp->translate( "networksettings2", "Off"); |
268 | case Available : | 279 | case Available : |
269 | return qApp->translate( "networksettings2", "Available"); | 280 | return qApp->translate( "networksettings2", "Available"); |
270 | case IsUp : | 281 | case IsUp : |
271 | return qApp->translate( "networksettings2", "IsUp"); | 282 | return qApp->translate( "networksettings2", "IsUp"); |
272 | case Unchecked : /* FT */ | 283 | case Unchecked : /* FT */ |
273 | default : | 284 | default : |
274 | break; | 285 | break; |
275 | } | 286 | } |
276 | return QString(""); | 287 | return QString(""); |
277 | } | 288 | } |
278 | 289 | ||
279 | void NodeCollection::reassign( void ) { | 290 | void NodeCollection::reassign( void ) { |
280 | for( QListIterator<ANetNodeInstance> it(*this); | 291 | for( QListIterator<ANetNodeInstance> it(*this); |
281 | it.current(); | 292 | it.current(); |
282 | ++it ) { | 293 | ++it ) { |
283 | it.current()->setConnection( this ); | 294 | it.current()->setConnection( this ); |
284 | } | 295 | } |
285 | } | 296 | } |
286 | 297 | ||
287 | // | 298 | // |
288 | // | 299 | // |
289 | // RUNTIMEINFO | 300 | // RUNTIMEINFO |
290 | // | 301 | // |
291 | // | 302 | // |
292 | 303 | ||
293 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { | 304 | InterfaceInfo * RuntimeInfo::assignedInterface( void ) { |
294 | return netNode()->nextNode()->runtime()->assignedInterface(); | 305 | return netNode()->nextNode()->runtime()->assignedInterface(); |
295 | } | 306 | } |
296 | 307 | ||
297 | AsDevice * RuntimeInfo::device( void ) { | 308 | AsDevice * RuntimeInfo::device( void ) { |
298 | return netNode()->nextNode()->runtime()->device(); | 309 | return netNode()->nextNode()->runtime()->device(); |
299 | } | 310 | } |
diff --git a/noncore/settings/networksettings2/networksettings2/netnode.h b/noncore/settings/networksettings2/networksettings2/netnode.h index 27d54f8..5e36062 100644 --- a/noncore/settings/networksettings2/networksettings2/netnode.h +++ b/noncore/settings/networksettings2/networksettings2/netnode.h | |||
@@ -1,382 +1,382 @@ | |||
1 | #ifndef NETNODE_H | 1 | #ifndef NETNODE_H |
2 | #define NETNODE_H | 2 | #define NETNODE_H |
3 | 3 | ||
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qobject.h> | 8 | #include <qobject.h> |
9 | #include <time.h> | 9 | #include <time.h> |
10 | 10 | ||
11 | // difference feature interfaces | 11 | // difference feature interfaces |
12 | class AsDevice; | 12 | class AsDevice; |
13 | class AsLine; | 13 | class AsLine; |
14 | class AsConnection; | 14 | class AsConnection; |
15 | class AsFullSetup; | 15 | class AsFullSetup; |
16 | 16 | ||
17 | // needed for plugin creation function | 17 | // needed for plugin creation function |
18 | #include <qlist.h> | 18 | #include <qlist.h> |
19 | 19 | ||
20 | class ANetNode; | 20 | class ANetNode; |
21 | class ANetNodeInstance; | 21 | class ANetNodeInstance; |
22 | class NodeCollection; | 22 | class NodeCollection; |
23 | class QTextStream; | 23 | class QTextStream; |
24 | class RuntimeInfo; | 24 | class RuntimeInfo; |
25 | class InterfaceInfo; | 25 | class InterfaceInfo; |
26 | 26 | ||
27 | extern QString & deQuote( QString & X ); | 27 | extern QString & deQuote( QString & X ); |
28 | extern QString quote( QString X ); | 28 | extern QString quote( QString X ); |
29 | 29 | ||
30 | #include "systemfile.h" | 30 | #include "systemfile.h" |
31 | 31 | ||
32 | typedef enum State { | 32 | typedef enum State { |
33 | // if we have not yet detected the state of the device | 33 | // if we have not yet detected the state of the device |
34 | Unchecked = 0, | 34 | Unchecked = 0, |
35 | // if we cannot determine the state | 35 | // if we cannot determine the state |
36 | Unknown = 1, | 36 | Unknown = 1, |
37 | // if connection cannot be established e.g. because | 37 | // if connection cannot be established e.g. because |
38 | // the hardware is not available | 38 | // the hardware is not available |
39 | Unavailable = 2, | 39 | Unavailable = 2, |
40 | // if the connection cannot be establishec but NOT | 40 | // if the connection cannot be establishec but NOT |
41 | // because it is physically impossible but because | 41 | // because it is physically impossible but because |
42 | // it has been disabled for FUNCTIONAL reasons | 42 | // it has been disabled for FUNCTIONAL reasons |
43 | Disabled = 3, | 43 | Disabled = 3, |
44 | // if connection is available to is currently down | 44 | // if connection is available to is currently down |
45 | // i.e. the corresponding hardware is not activated | 45 | // i.e. the corresponding hardware is not activated |
46 | Off = 4, | 46 | Off = 4, |
47 | // if connection is available to be used (i.e. the | 47 | // if connection is available to be used (i.e. the |
48 | // devices if fully ready to be used | 48 | // devices if fully ready to be used |
49 | Available = 5, | 49 | Available = 5, |
50 | // if connection is being used | 50 | // if connection is being used |
51 | IsUp = 6 | 51 | IsUp = 6 |
52 | } State_t; | 52 | } State_t; |
53 | 53 | ||
54 | typedef enum Action { | 54 | typedef enum Action { |
55 | // to make the device unavailable functionally | 55 | // to make the device unavailable functionally |
56 | Disable = 0, | 56 | Disable = 0, |
57 | // to make the device available functionally | 57 | // to make the device available functionally |
58 | Enable = 1, | 58 | Enable = 1, |
59 | // bring the hardware up | 59 | // bring the hardware up |
60 | Activate = 2, | 60 | Activate = 2, |
61 | // bring the hardware down | 61 | // bring the hardware down |
62 | Deactivate = 3, | 62 | Deactivate = 3, |
63 | // bring the connection up | 63 | // bring the connection up |
64 | Up = 4, | 64 | Up = 4, |
65 | // bring the connection down | 65 | // bring the connection down |
66 | Down = 5 | 66 | Down = 5 |
67 | } Action_t; | 67 | } Action_t; |
68 | 68 | ||
69 | class ANetNode : public QObject{ | 69 | class ANetNode : public QObject{ |
70 | 70 | ||
71 | public: | 71 | public: |
72 | 72 | ||
73 | typedef QArray<ANetNode *> NetNodeList; | 73 | typedef QArray<ANetNode *> NetNodeList; |
74 | 74 | ||
75 | ANetNode( const char * Name ) : QObject( 0, Name ) {} | 75 | ANetNode( const char * Name ) : QObject( 0, Name ) {} |
76 | virtual ~ANetNode(){}; | 76 | virtual ~ANetNode(){}; |
77 | 77 | ||
78 | // pixmap needed for this NetNode | 78 | // pixmap needed for this NetNode |
79 | virtual const QString pixmapName() = 0; | 79 | virtual const QString pixmapName() = 0; |
80 | 80 | ||
81 | // description for this NetNode | 81 | // description for this NetNode |
82 | virtual const QString nodeDescription() = 0; | 82 | virtual const QString nodeDescription() = 0; |
83 | 83 | ||
84 | // create a blank instance of a net node | 84 | // create a blank instance of a net node |
85 | virtual ANetNodeInstance * createInstance( void ) = 0; | 85 | virtual ANetNodeInstance * createInstance( void ) = 0; |
86 | 86 | ||
87 | // return feature this NetNode provides | 87 | // return feature this NetNode provides |
88 | virtual const char * provides( void ) = 0; | 88 | virtual const char * provides( void ) = 0; |
89 | virtual const char ** needs( void ) = 0; | 89 | virtual const char ** needs( void ) = 0; |
90 | 90 | ||
91 | // generate files specific for this node (if any) | 91 | // generate files specific for this node (if any) |
92 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; | 92 | virtual bool generateProperFilesFor( ANetNodeInstance * NNI ) = 0; |
93 | // return TRUE if this node has data to be inserted in systemfile | 93 | // return TRUE if this node has data to be inserted in systemfile |
94 | // with name S | 94 | // with name S |
95 | virtual bool hasDataFor( const QString & S ) = 0; | 95 | virtual bool hasDataFor( const QString & S ) = 0; |
96 | // generate data specific for the device for the system file S | 96 | // generate data specific for the device for the system file S |
97 | // called only IF data was needed | 97 | // called only IF data was needed |
98 | virtual bool generateDeviceDataForCommonFile( | 98 | virtual bool generateDeviceDataForCommonFile( |
99 | SystemFile & SF, long DevNr ) = 0; | 99 | SystemFile & SF, long DevNr ) = 0; |
100 | 100 | ||
101 | // does this Node provide a Connection | 101 | // does this Node provide a Connection |
102 | bool isToplevel( void ) | 102 | bool isToplevel( void ) |
103 | { return strcmp( provides(), "fullsetup") == 0 ; } | 103 | { return strcmp( provides(), "fullsetup") == 0 ; } |
104 | 104 | ||
105 | // generate NIC name based on instance nr | 105 | // generate NIC name based on instance nr |
106 | // only relevant if node instances are devices | 106 | // only relevant if node instances are devices |
107 | virtual QString genNic( long ) | 107 | virtual QString genNic( long ) |
108 | { return QString(""); } | 108 | { return QString(""); } |
109 | 109 | ||
110 | // max number of instances for this node type | 110 | // max number of instances for this node type |
111 | // only relevant if node instances are devices | 111 | // only relevant if node instances are devices |
112 | virtual long instanceCount( void ) | 112 | virtual long instanceCount( void ) |
113 | { return 1; } | 113 | { return 1; } |
114 | 114 | ||
115 | // set the value of an attribute | 115 | // set the value of an attribute |
116 | void setAttribute( QString & Attr, QString & Value ) ; | 116 | void setAttribute( QString & Attr, QString & Value ) ; |
117 | void saveAttributes( QTextStream & TS ) ; | 117 | void saveAttributes( QTextStream & TS ) ; |
118 | 118 | ||
119 | // compiled references to 'needed' NetNodes -> needs list | 119 | // compiled references to 'needed' NetNodes -> needs list |
120 | void setAlternatives( NetNodeList * Alt ) | 120 | void setAlternatives( NetNodeList * Alt ) |
121 | { Alternatives = Alt; } | 121 | { Alternatives = Alt; } |
122 | NetNodeList & alternatives( void ) | 122 | NetNodeList & alternatives( void ) |
123 | { return *Alternatives; } | 123 | { return *Alternatives; } |
124 | 124 | ||
125 | protected : | 125 | protected : |
126 | 126 | ||
127 | NetNodeList * Alternatives; | 127 | NetNodeList * Alternatives; |
128 | 128 | ||
129 | private : | 129 | private : |
130 | 130 | ||
131 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 131 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
132 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 132 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
133 | 133 | ||
134 | }; | 134 | }; |
135 | 135 | ||
136 | class ANetNodeInstance : public QObject { | 136 | class ANetNodeInstance : public QObject { |
137 | 137 | ||
138 | public: | 138 | public: |
139 | 139 | ||
140 | ANetNodeInstance( ANetNode * NN ) : QObject() | 140 | ANetNodeInstance( ANetNode * NN ) : QObject() |
141 | { IsModified=0; NodeType = NN; IsNew = TRUE; } | 141 | { IsModified=0; NodeType = NN; IsNew = TRUE; } |
142 | virtual ~ANetNodeInstance( void ) { } | 142 | virtual ~ANetNodeInstance( void ) { } |
143 | 143 | ||
144 | virtual RuntimeInfo * runtime( void ) = 0; | 144 | virtual RuntimeInfo * runtime( void ) = 0; |
145 | 145 | ||
146 | void setConnection( NodeCollection * NC ) | 146 | void setConnection( NodeCollection * NC ) |
147 | { Connection = NC; } | 147 | { Connection = NC; } |
148 | NodeCollection * connection( void ) | 148 | NodeCollection * connection( void ) |
149 | { return Connection; } | 149 | { return Connection; } |
150 | 150 | ||
151 | // create edit widget under parent | 151 | // create edit widget under parent |
152 | virtual QWidget * edit( QWidget * parent ) = 0; | 152 | virtual QWidget * edit( QWidget * parent ) = 0; |
153 | // is given data acceptable | 153 | // is given data acceptable |
154 | virtual QString acceptable( void ) = 0; | 154 | virtual QString acceptable( void ) = 0; |
155 | 155 | ||
156 | // return data was modified | 156 | // return data was modified |
157 | void setModified( bool M ) | 157 | void setModified( bool M ) |
158 | { IsModified = M; } | 158 | { IsModified = M; } |
159 | bool isModified( void ) | 159 | bool isModified( void ) |
160 | { return IsModified; } | 160 | { return IsModified; } |
161 | 161 | ||
162 | // get data from GUI and store in node | 162 | // get data from GUI and store in node |
163 | virtual void commit( void ) = 0; | 163 | virtual void commit( void ) = 0; |
164 | 164 | ||
165 | // get next node | 165 | // get next node |
166 | ANetNodeInstance * nextNode(); | 166 | ANetNodeInstance * nextNode(); |
167 | // return NetNode this is an instance of | 167 | // return NetNode this is an instance of |
168 | ANetNode * nodeClass( void ) | 168 | ANetNode * nodeClass( void ) |
169 | { return NodeType; } | 169 | { return NodeType; } |
170 | 170 | ||
171 | // intialize am instance of a net node | 171 | // intialize am instance of a net node |
172 | void initialize( void ); | 172 | void initialize( void ); |
173 | 173 | ||
174 | // set the value of an attribute | 174 | // set the value of an attribute |
175 | void setAttribute( QString & Attr, QString & Value ) ; | 175 | void setAttribute( QString & Attr, QString & Value ) ; |
176 | void saveAttributes( QTextStream & TS ) ; | 176 | void saveAttributes( QTextStream & TS ) ; |
177 | 177 | ||
178 | // return true if node isntance is NEW and not loaded | 178 | // return true if node isntance is NEW and not loaded |
179 | void setNew( bool IsN ) | 179 | void setNew( bool IsN ) |
180 | { IsNew = IsN; } | 180 | { IsNew = IsN; } |
181 | bool isNew( void ) | 181 | bool isNew( void ) |
182 | { return IsNew; } | 182 | { return IsNew; } |
183 | 183 | ||
184 | // return description for this instance | 184 | // return description for this instance |
185 | QString & description( void ) | 185 | QString & description( void ) |
186 | { return Description; } | 186 | { return Description; } |
187 | void setDescription( const QString & S ) | 187 | void setDescription( const QString & S ) |
188 | { Description = S; } | 188 | { Description = S; } |
189 | 189 | ||
190 | // pixmap for this instance -> from NetNode | 190 | // pixmap for this instance -> from NetNode |
191 | const QString pixmapName( void ) | 191 | const QString pixmapName( void ) |
192 | { return NodeType->pixmapName(); } | 192 | { return NodeType->pixmapName(); } |
193 | 193 | ||
194 | const char * provides( void ) | 194 | const char * provides( void ) |
195 | { return NodeType->provides(); } | 195 | { return NodeType->provides(); } |
196 | 196 | ||
197 | const char ** needs( void ) | 197 | const char ** needs( void ) |
198 | { return NodeType->needs(); } | 198 | { return NodeType->needs(); } |
199 | 199 | ||
200 | // returns node specific data -> only useful for 'buddy' | 200 | // returns node specific data -> only useful for 'buddy' |
201 | virtual void * data( void ) = 0; | 201 | virtual void * data( void ) = 0; |
202 | 202 | ||
203 | // return TRUE if this node has data to be inserted in systemfile | 203 | // return TRUE if this node has data to be inserted in systemfile |
204 | // with name S | 204 | // with name S |
205 | virtual bool hasDataFor( const QString & S ) = 0; | 205 | virtual bool hasDataFor( const QString & S ) = 0; |
206 | 206 | ||
207 | // generate data specific for a profile and for the system file S | 207 | // generate data specific for a profile and for the system file S |
208 | // called only IF data was needed | 208 | // called only IF data was needed |
209 | virtual bool generateDataForCommonFile( | 209 | virtual bool generateDataForCommonFile( |
210 | SystemFile & SF, long DevNr ) = 0; | 210 | SystemFile & SF, long DevNr ) = 0; |
211 | 211 | ||
212 | protected : | 212 | protected : |
213 | 213 | ||
214 | virtual void setSpecificAttribute( QString & , QString & ) = 0; | 214 | virtual void setSpecificAttribute( QString & , QString & ) = 0; |
215 | virtual void saveSpecificAttribute( QTextStream & ) = 0; | 215 | virtual void saveSpecificAttribute( QTextStream & ) = 0; |
216 | 216 | ||
217 | ANetNode * NodeType; | 217 | ANetNode * NodeType; |
218 | // connection to which this node belongs to | 218 | // connection to which this node belongs to |
219 | NodeCollection * Connection; | 219 | NodeCollection * Connection; |
220 | QString Description; | 220 | QString Description; |
221 | bool IsModified; | 221 | bool IsModified; |
222 | bool IsNew; | 222 | bool IsNew; |
223 | 223 | ||
224 | static long InstanceCounter; | 224 | static long InstanceCounter; |
225 | }; | 225 | }; |
226 | 226 | ||
227 | class RuntimeInfo : public QObject { | 227 | class RuntimeInfo : public QObject { |
228 | 228 | ||
229 | Q_OBJECT | 229 | Q_OBJECT |
230 | 230 | ||
231 | public : | 231 | public : |
232 | 232 | ||
233 | RuntimeInfo( ANetNodeInstance * TheNNI ) | 233 | RuntimeInfo( ANetNodeInstance * TheNNI ) |
234 | { NNI = TheNNI; } | 234 | { NNI = TheNNI; } |
235 | 235 | ||
236 | // downcast implemented by specify runtime classes | 236 | // downcast implemented by specify runtime classes |
237 | virtual AsDevice * asDevice( void ) | 237 | virtual AsDevice * asDevice( void ) |
238 | { return 0; } | 238 | { return 0; } |
239 | virtual AsConnection * asConnection( void ) | 239 | virtual AsConnection * asConnection( void ) |
240 | { return 0; } | 240 | { return 0; } |
241 | virtual AsLine * asLine( void ) | 241 | virtual AsLine * asLine( void ) |
242 | { return 0; } | 242 | { return 0; } |
243 | virtual AsFullSetup * asFullSetup( void ) | 243 | virtual AsFullSetup * asFullSetup( void ) |
244 | { return 0; } | 244 | { return 0; } |
245 | 245 | ||
246 | // does this node handles this interface e.g.eth0 | 246 | // does this node handles this interface e.g.eth0 |
247 | // recurse deeper if this node cannot answer that question | 247 | // recurse deeper if this node cannot answer that question |
248 | virtual bool handlesInterface( const QString & ) | 248 | virtual bool handlesInterface( const QString & ) |
249 | { return 0; } | 249 | { return 0; } |
250 | virtual bool handlesInterface( const InterfaceInfo & ) | 250 | virtual bool handlesInterface( const InterfaceInfo & ) |
251 | { return 0; } | 251 | { return 0; } |
252 | virtual InterfaceInfo * assignedInterface( void ); | 252 | virtual InterfaceInfo * assignedInterface( void ); |
253 | virtual AsDevice * device( void ); | 253 | virtual AsDevice * device( void ); |
254 | 254 | ||
255 | ANetNodeInstance * netNode() | 255 | ANetNodeInstance * netNode() |
256 | { return NNI; } | 256 | { return NNI; } |
257 | NodeCollection * connection() | 257 | NodeCollection * connection() |
258 | { return NNI->connection(); } | 258 | { return NNI->connection(); } |
259 | 259 | ||
260 | virtual void detectState( NodeCollection * NC ) = 0; | 260 | virtual void detectState( NodeCollection * NC ) = 0; |
261 | virtual bool setState( NodeCollection * NC, Action_t A ) = 0; | 261 | virtual bool setState( NodeCollection * NC, Action_t A, bool Force = 0 ) = 0; |
262 | virtual bool canSetState( State_t Curr, Action_t A ) = 0; | 262 | virtual bool canSetState( State_t Curr, Action_t A ) = 0; |
263 | 263 | ||
264 | signals : | 264 | signals : |
265 | 265 | ||
266 | // sent by device if state changes | 266 | // sent by device if state changes |
267 | void stateChanged( State_t S, ANetNodeInstance * NNI ); | 267 | void stateChanged( State_t S, ANetNodeInstance * NNI ); |
268 | 268 | ||
269 | protected : | 269 | protected : |
270 | 270 | ||
271 | // connection this runtime info belongs to | 271 | // connection this runtime info belongs to |
272 | ANetNodeInstance * NNI; | 272 | ANetNodeInstance * NNI; |
273 | }; | 273 | }; |
274 | 274 | ||
275 | class NodeCollection : public QList<ANetNodeInstance> { | 275 | class NodeCollection : public QList<ANetNodeInstance> { |
276 | 276 | ||
277 | public : | 277 | public : |
278 | 278 | ||
279 | NodeCollection( void ); | 279 | NodeCollection( void ); |
280 | NodeCollection( QTextStream & TS ); | 280 | NodeCollection( QTextStream & TS ); |
281 | ~NodeCollection( void ); | 281 | ~NodeCollection( void ); |
282 | 282 | ||
283 | int number( void ) | 283 | int number( void ) |
284 | { return Number; } | 284 | { return Number; } |
285 | void setNumber( int i ) | 285 | void setNumber( int i ) |
286 | { Number = i; if( MaxNr < i ) MaxNr = i; } | 286 | { Number = i; if( MaxNr < i ) MaxNr = i; } |
287 | bool isNew( void ) | 287 | bool isNew( void ) |
288 | { return IsNew; } | 288 | { return IsNew; } |
289 | void setNew( bool N ) | 289 | void setNew( bool N ) |
290 | { IsNew = N ; } | 290 | { IsNew = N ; } |
291 | bool isModified( void ) | 291 | bool isModified( void ) |
292 | { return IsModified; } | 292 | { return IsModified; } |
293 | void setModified( bool N ) | 293 | void setModified( bool N ) |
294 | { IsModified = N ; } | 294 | { IsModified = N ; } |
295 | 295 | ||
296 | bool handlesInterface( const QString & S ) { | 296 | bool handlesInterface( const QString & S ) { |
297 | return getToplevel()->runtime()->handlesInterface( S ); | 297 | return getToplevel()->runtime()->handlesInterface( S ); |
298 | } | 298 | } |
299 | 299 | ||
300 | InterfaceInfo * assignedInterface( void ) { | 300 | InterfaceInfo * assignedInterface( void ) { |
301 | return getToplevel()->runtime()->assignedInterface(); | 301 | return getToplevel()->runtime()->assignedInterface(); |
302 | } | 302 | } |
303 | 303 | ||
304 | AsDevice * device() { | 304 | AsDevice * device() { |
305 | return getToplevel()->runtime()->device(); | 305 | return getToplevel()->runtime()->device(); |
306 | } | 306 | } |
307 | 307 | ||
308 | State_t state( bool Update = 0 ) | 308 | State_t state( bool Update = 0 ) |
309 | { if( CurrentState == Unchecked || Update ) { | 309 | { if( CurrentState == Unchecked || Update ) { |
310 | // need to get current state | 310 | // need to get current state |
311 | getToplevel()->runtime()->detectState( this ); | 311 | getToplevel()->runtime()->detectState( this ); |
312 | } | 312 | } |
313 | return CurrentState; | 313 | return CurrentState; |
314 | } | 314 | } |
315 | 315 | ||
316 | // get the ixmap for this device | 316 | // get the ixmap for this device |
317 | QPixmap devicePixmap( void ); | 317 | QPixmap devicePixmap( void ); |
318 | QPixmap statePixmap( State_t S ); | 318 | QPixmap statePixmap( State_t S ); |
319 | QPixmap statePixmap( bool Update = 0 ) | 319 | QPixmap statePixmap( bool Update = 0 ) |
320 | { return statePixmap( state(Update) ); } | 320 | { return statePixmap( state(Update) ); } |
321 | QString stateName( State_t ); | 321 | QString stateName( State_t ); |
322 | QString stateName( bool Update = 0 ) | 322 | QString stateName( bool Update = 0 ) |
323 | { return stateName( state(Update) ); } | 323 | { return stateName( state(Update) ); } |
324 | 324 | ||
325 | bool setState( Action_t A ) | 325 | bool setState( Action_t A, bool Force =0 ) |
326 | { return getToplevel()->runtime()->setState( this, A ); } | 326 | { return getToplevel()->runtime()->setState( this, A, Force ); } |
327 | bool canSetState( Action_t A ) | 327 | bool canSetState( Action_t A ) |
328 | { return getToplevel()->runtime()->canSetState( CurrentState, A ); } | 328 | { return getToplevel()->runtime()->canSetState( CurrentState, A ); } |
329 | 329 | ||
330 | void save( QTextStream & TS ); | 330 | void save( QTextStream & TS ); |
331 | 331 | ||
332 | void append( ANetNodeInstance * NNI ); | 332 | void append( ANetNodeInstance * NNI ); |
333 | 333 | ||
334 | // makes sure that all items in the connection point to | 334 | // makes sure that all items in the connection point to |
335 | // that connectoin | 335 | // that connectoin |
336 | void reassign( void ); | 336 | void reassign( void ); |
337 | 337 | ||
338 | ANetNodeInstance * getToplevel( void ); | 338 | ANetNodeInstance * getToplevel( void ); |
339 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); | 339 | ANetNodeInstance * findNext( ANetNodeInstance * NNI ); |
340 | ANetNodeInstance * findByName( const QString & S ); | 340 | ANetNodeInstance * findByName( const QString & S ); |
341 | 341 | ||
342 | const QString & name() | 342 | const QString & name() |
343 | { return Name; } | 343 | { return Name; } |
344 | 344 | ||
345 | const QString & description( void ); | 345 | const QString & description( void ); |
346 | 346 | ||
347 | void setName( const QString & N) | 347 | void setName( const QString & N) |
348 | { Name = N; } | 348 | { Name = N; } |
349 | 349 | ||
350 | State_t currentState( void ) | 350 | State_t currentState( void ) |
351 | { return CurrentState; } | 351 | { return CurrentState; } |
352 | void setCurrentState( State_t S ) | 352 | void setCurrentState( State_t S ) |
353 | { CurrentState = S; } | 353 | { CurrentState = S; } |
354 | 354 | ||
355 | long maxConnectionNumber( void ) | 355 | long maxConnectionNumber( void ) |
356 | { return MaxNr; } | 356 | { return MaxNr; } |
357 | 357 | ||
358 | static void resetMaxNr( void ) | 358 | static void resetMaxNr( void ) |
359 | { MaxNr = -1; } | 359 | { MaxNr = -1; } |
360 | 360 | ||
361 | private : | 361 | private : |
362 | 362 | ||
363 | int compareItems ( QCollection::Item item1, | 363 | int compareItems ( QCollection::Item item1, |
364 | QCollection::Item item2 ); | 364 | QCollection::Item item2 ); |
365 | 365 | ||
366 | static long MaxNr; | 366 | static long MaxNr; |
367 | long Number; | 367 | long Number; |
368 | 368 | ||
369 | // state of this connection | 369 | // state of this connection |
370 | State_t CurrentState; | 370 | State_t CurrentState; |
371 | 371 | ||
372 | QString Name; | 372 | QString Name; |
373 | // true if this collection was just created (and not | 373 | // true if this collection was just created (and not |
374 | // loaded from file | 374 | // loaded from file |
375 | bool IsNew; | 375 | bool IsNew; |
376 | // index in listbox | 376 | // index in listbox |
377 | int Index; | 377 | int Index; |
378 | bool IsModified; | 378 | bool IsModified; |
379 | 379 | ||
380 | }; | 380 | }; |
381 | 381 | ||
382 | #endif | 382 | #endif |
diff --git a/noncore/settings/networksettings2/networksettings2/networksettings2.pro b/noncore/settings/networksettings2/networksettings2/networksettings2.pro index 11b5f84..f97c93b 100644 --- a/noncore/settings/networksettings2/networksettings2/networksettings2.pro +++ b/noncore/settings/networksettings2/networksettings2/networksettings2.pro | |||
@@ -1,26 +1,28 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #CONFIG += qt warn_on debug | 3 | #CONFIG += qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 4 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
5 | HEADERS = netnode.h \ | 5 | HEADERS = netnode.h \ |
6 | resources.h \ | 6 | resources.h \ |
7 | system.h \ | 7 | system.h \ |
8 | asline.h \ | 8 | asline.h \ |
9 | GUIUtils.h \ | 9 | GUIUtils.h \ |
10 | asconnection.h \ | 10 | asconnection.h \ |
11 | asfullsetup.h \ | 11 | asfullsetup.h \ |
12 | systemfile.h \ | 12 | systemfile.h \ |
13 | wextensions.h \ | ||
13 | asdevice.h | 14 | asdevice.h |
14 | SOURCES = netnode.cpp \ | 15 | SOURCES = netnode.cpp \ |
15 | GUIUtils.cpp \ | 16 | GUIUtils.cpp \ |
16 | system.cpp \ | 17 | system.cpp \ |
17 | systemfile.cpp \ | 18 | systemfile.cpp \ |
19 | wextensions.cpp \ | ||
18 | resources.cpp | 20 | resources.cpp |
19 | INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2 | 21 | INCLUDEPATH+= $(OPIEDIR)/include ../networksettings2 |
20 | DEPENDPATH+= $(OPIEDIR)/include | 22 | DEPENDPATH+= $(OPIEDIR)/include |
21 | LIBS += -lqpe -lopiecore2 | 23 | LIBS += -lqpe -lopiecore2 |
22 | INTERFACES= | 24 | INTERFACES= |
23 | TARGET = networksettings2 | 25 | TARGET = networksettings2 |
24 | VERSION = 1.0.0 | 26 | VERSION = 1.0.0 |
25 | 27 | ||
26 | include ( $(OPIEDIR)/include.pro ) | 28 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/networksettings2/networksettings2/resources.cpp b/noncore/settings/networksettings2/networksettings2/resources.cpp index 4b7a62f..c95ac7f 100644 --- a/noncore/settings/networksettings2/networksettings2/resources.cpp +++ b/noncore/settings/networksettings2/networksettings2/resources.cpp | |||
@@ -1,369 +1,370 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <errno.h> | 2 | #include <errno.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <pwd.h> | 4 | #include <pwd.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | #include <qpe/qlibrary.h> | 7 | #include <qpe/qlibrary.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <qtopia/resource.h> | 10 | #include <qtopia/resource.h> |
11 | 11 | ||
12 | #include "netnode.h" | 12 | #include "netnode.h" |
13 | #include "resources.h" | 13 | #include "resources.h" |
14 | 14 | ||
15 | #define PLUGINDIR "plugins/networksettings2" | 15 | #define PLUGINDIR "plugins/networksettings2" |
16 | #define ICONDIR "/pics/networksettings2/" | 16 | #define ICONDIR "/pics/networksettings2/" |
17 | 17 | ||
18 | // single resources instance | 18 | // single resources instance |
19 | TheNSResources * _NSResources = 0; | 19 | TheNSResources * _NSResources = 0; |
20 | 20 | ||
21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), | 21 | TheNSResources::TheNSResources( void ) : NodeTypeNameMap(), |
22 | ConnectionsMap() { | 22 | ConnectionsMap() { |
23 | 23 | ||
24 | _NSResources = this; | 24 | _NSResources = this; |
25 | 25 | ||
26 | // load available netnodes | 26 | // load available netnodes |
27 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); | 27 | findAvailableNetNodes(QPEApplication::qpeDir() + PLUGINDIR ); |
28 | 28 | ||
29 | // compile provides and needs lists | 29 | // compile provides and needs lists |
30 | { const char ** NeedsRun; | 30 | { const char ** NeedsRun; |
31 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); | 31 | QDictIterator<NetNode_t> OuterIt( AllNodeTypes ); |
32 | bool Done; | 32 | bool Done; |
33 | 33 | ||
34 | for ( ; OuterIt.current(); ++OuterIt ) { | 34 | for ( ; OuterIt.current(); ++OuterIt ) { |
35 | // find needs list | 35 | // find needs list |
36 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; | 36 | ANetNode::NetNodeList * NNLP = new ANetNode::NetNodeList; |
37 | ANetNode::NetNodeList & NNL = *(NNLP); | 37 | ANetNode::NetNodeList & NNL = *(NNLP); |
38 | 38 | ||
39 | // must iterate this way to avoid duplication pointers | 39 | // must iterate this way to avoid duplication pointers |
40 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); | 40 | for ( QDictIterator<NetNode_t> InnerIt( AllNodeTypes ); |
41 | InnerIt.current(); ++InnerIt ) { | 41 | InnerIt.current(); ++InnerIt ) { |
42 | if( InnerIt.current() == OuterIt.current() ) | 42 | if( InnerIt.current() == OuterIt.current() ) |
43 | // avoid recursive | 43 | // avoid recursive |
44 | continue; | 44 | continue; |
45 | 45 | ||
46 | const char * Provides = InnerIt.current()->NetNode->provides(); | 46 | const char * Provides = InnerIt.current()->NetNode->provides(); |
47 | NeedsRun = OuterIt.current()->NetNode->needs(); | 47 | NeedsRun = OuterIt.current()->NetNode->needs(); |
48 | for( ; *NeedsRun; NeedsRun ++ ) { | 48 | for( ; *NeedsRun; NeedsRun ++ ) { |
49 | if( strcmp( Provides, *NeedsRun ) == 0 ) { | 49 | if( strcmp( Provides, *NeedsRun ) == 0 ) { |
50 | // inner provides what outer needs | 50 | // inner provides what outer needs |
51 | NNL.resize( NNL.size() + 1 ); | 51 | NNL.resize( NNL.size() + 1 ); |
52 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; | 52 | NNL[NNL.size()-1] = InnerIt.current()->NetNode; |
53 | Done = 1; // break from 2 loops | 53 | Done = 1; // break from 2 loops |
54 | break; | 54 | break; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | } | 57 | } |
58 | OuterIt.current()->NetNode->setAlternatives( NNLP ); | 58 | OuterIt.current()->NetNode->setAlternatives( NNLP ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | // define Node types to Description map | 62 | // define Node types to Description map |
63 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); | 63 | NodeTypeNameMap.insert( "device", tr( "Network Device" ) ); |
64 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); | 64 | NodeTypeNameMap.insert( "line", tr( "Character device" ) ); |
65 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); | 65 | NodeTypeNameMap.insert( "connection", tr( "IP Connection" ) ); |
66 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); | 66 | NodeTypeNameMap.insert( "fullsetup", tr( "Connection Profile" ) ); |
67 | 67 | ||
68 | NodeTypeDescriptionMap.insert( "device", | 68 | NodeTypeDescriptionMap.insert( "device", |
69 | tr( "<p>Devices that can handle IP packets</p>" ) ); | 69 | tr( "<p>Devices that can handle IP packets</p>" ) ); |
70 | NodeTypeDescriptionMap.insert( "line", | 70 | NodeTypeDescriptionMap.insert( "line", |
71 | tr( "<p>Devices that can handle single bytes</p>" ) ); | 71 | tr( "<p>Devices that can handle single bytes</p>" ) ); |
72 | NodeTypeDescriptionMap.insert( "connection", | 72 | NodeTypeDescriptionMap.insert( "connection", |
73 | tr( "<p>Nodes that provide working IP connections</p>" ) ); | 73 | tr( "<p>Nodes that provide working IP connections</p>" ) ); |
74 | NodeTypeDescriptionMap.insert( "fullsetup", | 74 | NodeTypeDescriptionMap.insert( "fullsetup", |
75 | tr( "<p>Fully configured connection profile</p>" ) ); | 75 | tr( "<p>Fully configured connection profile</p>" ) ); |
76 | 76 | ||
77 | // define system files | 77 | // define system files |
78 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); | 78 | addSystemFile( new SystemFile( "interfaces", "./interfaces" ) ); |
79 | 79 | ||
80 | // get access to the system | 80 | // get access to the system |
81 | TheSystem = new System(); | 81 | TheSystem = new System(); |
82 | 82 | ||
83 | detectCurrentUser(); | 83 | detectCurrentUser(); |
84 | } | 84 | } |
85 | 85 | ||
86 | TheNSResources::~TheNSResources( void ) { | 86 | TheNSResources::~TheNSResources( void ) { |
87 | delete TheSystem; | 87 | delete TheSystem; |
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Load all modules that are found in the path | 91 | * Load all modules that are found in the path |
92 | * @param path a directory that is scaned for any plugins that can be loaded | 92 | * @param path a directory that is scaned for any plugins that can be loaded |
93 | * and attempts to load them | 93 | * and attempts to load them |
94 | */ | 94 | */ |
95 | void TheNSResources::findAvailableNetNodes(const QString &path){ | 95 | void TheNSResources::findAvailableNetNodes(const QString &path){ |
96 | 96 | ||
97 | QDir d(path); | 97 | QDir d(path); |
98 | if(!d.exists()) | 98 | if(!d.exists()) |
99 | return; | 99 | return; |
100 | 100 | ||
101 | QString lang = ::getenv("LANG"); | 101 | QString lang = ::getenv("LANG"); |
102 | 102 | ||
103 | // Don't want sym links | 103 | // Don't want sym links |
104 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 104 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
105 | const QFileInfoList *list = d.entryInfoList(); | 105 | const QFileInfoList *list = d.entryInfoList(); |
106 | QFileInfoListIterator it( *list ); | 106 | QFileInfoListIterator it( *list ); |
107 | QFileInfo *fi; | 107 | QFileInfo *fi; |
108 | 108 | ||
109 | while ( (fi=it.current()) ) { | 109 | while ( (fi=it.current()) ) { |
110 | 110 | ||
111 | if( fi->fileName().contains(".so")){ | 111 | if( fi->fileName().contains(".so")){ |
112 | /* if loaded install translation */ | 112 | /* if loaded install translation */ |
113 | if( loadNetNode(path + "/" + fi->fileName()) ) { | 113 | if( loadNetNode(path + "/" + fi->fileName()) ) { |
114 | QTranslator *trans = new QTranslator(qApp); | 114 | QTranslator *trans = new QTranslator(qApp); |
115 | QString fn = QPEApplication::qpeDir()+ | 115 | QString fn = QPEApplication::qpeDir()+ |
116 | "/i18n/"+lang+"/"+ | 116 | "/i18n/"+lang+"/"+ |
117 | fi->fileName().left( fi->fileName().find(".") )+ | 117 | fi->fileName().left( fi->fileName().find(".") )+ |
118 | ".qm"; | 118 | ".qm"; |
119 | 119 | ||
120 | if( trans->load( fn ) ) | 120 | if( trans->load( fn ) ) |
121 | qApp->installTranslator( trans ); | 121 | qApp->installTranslator( trans ); |
122 | else | 122 | else |
123 | delete trans; | 123 | delete trans; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | ++it; | 126 | ++it; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Attempt to load a function and resolve a function. | 131 | * Attempt to load a function and resolve a function. |
132 | * @param pluginFileName - the name of the file in which to attempt to load | 132 | * @param pluginFileName - the name of the file in which to attempt to load |
133 | * @param resolveString - function pointer to resolve | 133 | * @param resolveString - function pointer to resolve |
134 | * @return true of loading is successful | 134 | * @return true of loading is successful |
135 | */ | 135 | */ |
136 | bool TheNSResources::loadNetNode( | 136 | bool TheNSResources::loadNetNode( |
137 | const QString &pluginFileName, const QString &resolveString){ | 137 | const QString &pluginFileName, const QString &resolveString){ |
138 | 138 | ||
139 | QLibrary *lib = new QLibrary(pluginFileName); | 139 | QLibrary *lib = new QLibrary(pluginFileName); |
140 | void * res = lib->resolve(resolveString); | 140 | void * res = lib->resolve(resolveString); |
141 | if( ! res ){ | 141 | if( ! res ){ |
142 | delete lib; | 142 | delete lib; |
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; | 146 | GetNetNodeListFt_t getNetNodeList = (GetNetNodeListFt_t)res; |
147 | 147 | ||
148 | // Try to get an object. | 148 | // Try to get an object. |
149 | QList<ANetNode> PNN; | 149 | QList<ANetNode> PNN; |
150 | 150 | ||
151 | getNetNodeList( PNN ); | 151 | getNetNodeList( PNN ); |
152 | if( PNN.isEmpty() ) { | 152 | if( PNN.isEmpty() ) { |
153 | delete lib; | 153 | delete lib; |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | ANetNode * NNP; | 157 | ANetNode * NNP; |
158 | for( QListIterator<ANetNode> it(PNN); | 158 | for( QListIterator<ANetNode> it(PNN); |
159 | it.current(); | 159 | it.current(); |
160 | ++it ) { | 160 | ++it ) { |
161 | NetNode_t * NN; | 161 | NetNode_t * NN; |
162 | 162 | ||
163 | NNP = it.current(); | 163 | NNP = it.current(); |
164 | NN = new NetNode_t; | 164 | NN = new NetNode_t; |
165 | NN->NetNode = NNP; | 165 | NN->NetNode = NNP; |
166 | NN->TheLibrary = lib; | 166 | NN->TheLibrary = lib; |
167 | NN->NodeCountInLib = PNN.count(); | 167 | NN->NodeCountInLib = PNN.count(); |
168 | 168 | ||
169 | // store mapping | 169 | // store mapping |
170 | printf( "Store %s\n", NN->NetNode->name() ); | 170 | printf( "Store %s\n", NN->NetNode->name() ); |
171 | AllNodeTypes.insert( NN->NetNode->name(), NN ); | 171 | AllNodeTypes.insert( NN->NetNode->name(), NN ); |
172 | } | 172 | } |
173 | 173 | ||
174 | return 1; | 174 | return 1; |
175 | } | 175 | } |
176 | 176 | ||
177 | QPixmap TheNSResources::getPixmap( const QString & QS ) { | 177 | QPixmap TheNSResources::getPixmap( const QString & QS ) { |
178 | QString S("networksettings2/"); | 178 | QString S("networksettings2/"); |
179 | S += QS; | 179 | S += QS; |
180 | return Resource::loadPixmap( QString("networksettings2/")+QS ); | 180 | fprintf( stderr, "%s\n", S.latin1() ); |
181 | return Resource::loadPixmap( S ); | ||
181 | } | 182 | } |
182 | 183 | ||
183 | QString TheNSResources::tr( const char * s ) { | 184 | QString TheNSResources::tr( const char * s ) { |
184 | return qApp->translate( "resource", s ); | 185 | return qApp->translate( "resource", s ); |
185 | } | 186 | } |
186 | 187 | ||
187 | const QString & TheNSResources::netNode2Name( const char * s ) { | 188 | const QString & TheNSResources::netNode2Name( const char * s ) { |
188 | return NodeTypeNameMap[s]; | 189 | return NodeTypeNameMap[s]; |
189 | } | 190 | } |
190 | 191 | ||
191 | const QString & TheNSResources::netNode2Description( const char * s ) { | 192 | const QString & TheNSResources::netNode2Description( const char * s ) { |
192 | return NodeTypeDescriptionMap[s]; | 193 | return NodeTypeDescriptionMap[s]; |
193 | } | 194 | } |
194 | 195 | ||
195 | void TheNSResources::addConnection( NodeCollection * NC ) { | 196 | void TheNSResources::addConnection( NodeCollection * NC ) { |
196 | ANetNodeInstance * NNI; | 197 | ANetNodeInstance * NNI; |
197 | ConnectionsMap.insert( NC->name(), NC ); | 198 | ConnectionsMap.insert( NC->name(), NC ); |
198 | // add (new) nodes to NodeList | 199 | // add (new) nodes to NodeList |
199 | for( QListIterator<ANetNodeInstance> it(*NC); | 200 | for( QListIterator<ANetNodeInstance> it(*NC); |
200 | it.current(); | 201 | it.current(); |
201 | ++it ) { | 202 | ++it ) { |
202 | NNI = it.current(); | 203 | NNI = it.current(); |
203 | if( findNodeInstance( NNI->name() ) == 0 ) { | 204 | if( findNodeInstance( NNI->name() ) == 0 ) { |
204 | // new item | 205 | // new item |
205 | addNodeInstance( NNI ); | 206 | addNodeInstance( NNI ); |
206 | } | 207 | } |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
210 | void TheNSResources::removeConnection( const QString & N ) { | 211 | void TheNSResources::removeConnection( const QString & N ) { |
211 | NodeCollection * NC = findConnection( N ); | 212 | NodeCollection * NC = findConnection( N ); |
212 | if( ! NC ) | 213 | if( ! NC ) |
213 | return; | 214 | return; |
214 | 215 | ||
215 | // delete netnodes in this connection | 216 | // delete netnodes in this connection |
216 | ANetNodeInstance * NNI; | 217 | ANetNodeInstance * NNI; |
217 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { | 218 | for( NNI = NC->first(); NNI != 0; NNI = NC->next() ) { |
218 | removeNodeInstance( NNI->name() ); | 219 | removeNodeInstance( NNI->name() ); |
219 | } | 220 | } |
220 | ConnectionsMap.remove( N ); | 221 | ConnectionsMap.remove( N ); |
221 | } | 222 | } |
222 | 223 | ||
223 | NodeCollection * TheNSResources::findConnection( const QString & S ) { | 224 | NodeCollection * TheNSResources::findConnection( const QString & S ) { |
224 | return ConnectionsMap[ S ]; | 225 | return ConnectionsMap[ S ]; |
225 | } | 226 | } |
226 | 227 | ||
227 | void TheNSResources::renumberConnections( void ) { | 228 | void TheNSResources::renumberConnections( void ) { |
228 | Name2Connection_t & M = NSResources->connections(); | 229 | Name2Connection_t & M = NSResources->connections(); |
229 | NodeCollection * NC; | 230 | NodeCollection * NC; |
230 | 231 | ||
231 | // for all connections | 232 | // for all connections |
232 | NodeCollection::resetMaxNr(); | 233 | NodeCollection::resetMaxNr(); |
233 | for( QDictIterator<NodeCollection> it(M); | 234 | for( QDictIterator<NodeCollection> it(M); |
234 | it.current(); | 235 | it.current(); |
235 | ++it ) { | 236 | ++it ) { |
236 | NC = it.current(); | 237 | NC = it.current(); |
237 | NC->setNumber( NC->maxConnectionNumber()+1 ); | 238 | NC->setNumber( NC->maxConnectionNumber()+1 ); |
238 | NC->setModified( 1 ); | 239 | NC->setModified( 1 ); |
239 | } | 240 | } |
240 | } | 241 | } |
241 | 242 | ||
242 | typedef struct EnvVars { | 243 | typedef struct EnvVars { |
243 | char * Name; | 244 | char * Name; |
244 | int Len; | 245 | int Len; |
245 | } EnvVar_t; | 246 | } EnvVar_t; |
246 | 247 | ||
247 | #define AnEV(x) x, sizeof(x)-1 | 248 | #define AnEV(x) x, sizeof(x)-1 |
248 | 249 | ||
249 | static EnvVar_t EV[] = { | 250 | static EnvVar_t EV[] = { |
250 | // AnEV( "HOME=" ), -> SPECIAL | 251 | // AnEV( "HOME=" ), -> SPECIAL |
251 | // AnEV( "LOGNAME=" ), -> SPECIAL | 252 | // AnEV( "LOGNAME=" ), -> SPECIAL |
252 | AnEV( "USER=" ), | 253 | AnEV( "USER=" ), |
253 | AnEV( "LD_LIBRARY_PATH=" ), | 254 | AnEV( "LD_LIBRARY_PATH=" ), |
254 | AnEV( "PATH=" ), | 255 | AnEV( "PATH=" ), |
255 | AnEV( "QTDIR=" ), | 256 | AnEV( "QTDIR=" ), |
256 | AnEV( "OPIEDIR=" ), | 257 | AnEV( "OPIEDIR=" ), |
257 | AnEV( "SHELL=" ), | 258 | AnEV( "SHELL=" ), |
258 | { NULL, 0 } | 259 | { NULL, 0 } |
259 | }; | 260 | }; |
260 | 261 | ||
261 | void TheNSResources::detectCurrentUser( void ) { | 262 | void TheNSResources::detectCurrentUser( void ) { |
262 | // find current running qpe | 263 | // find current running qpe |
263 | QString QPEEnvFile = ""; | 264 | QString QPEEnvFile = ""; |
264 | 265 | ||
265 | // open proc dir and find all dirs in it | 266 | // open proc dir and find all dirs in it |
266 | { QRegExp R("[0-9]+"); | 267 | { QRegExp R("[0-9]+"); |
267 | QDir ProcDir( "/proc" ); | 268 | QDir ProcDir( "/proc" ); |
268 | QString QPELoc = QPEApplication::qpeDir() + "bin/qpe"; | 269 | QString QPELoc = QPEApplication::qpeDir() + "bin/qpe"; |
269 | QFileInfo FI; | 270 | QFileInfo FI; |
270 | QStringList EL = ProcDir.entryList( QDir::Dirs ); | 271 | QStringList EL = ProcDir.entryList( QDir::Dirs ); |
271 | 272 | ||
272 | // print it out | 273 | // print it out |
273 | for ( QStringList::Iterator it = EL.begin(); | 274 | for ( QStringList::Iterator it = EL.begin(); |
274 | it != EL.end(); | 275 | it != EL.end(); |
275 | ++it ) { | 276 | ++it ) { |
276 | if( R.match( (*it) ) >= 0 ) { | 277 | if( R.match( (*it) ) >= 0 ) { |
277 | QString S = ProcDir.path()+"/"+ (*it); | 278 | QString S = ProcDir.path()+"/"+ (*it); |
278 | S.append( "/exe" ); | 279 | S.append( "/exe" ); |
279 | FI.setFile( S ); | 280 | FI.setFile( S ); |
280 | // get the linke | 281 | // get the linke |
281 | S = FI.readLink(); | 282 | S = FI.readLink(); |
282 | if( S == QPELoc ) { | 283 | if( S == QPELoc ) { |
283 | // found running qpe | 284 | // found running qpe |
284 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); | 285 | QPEEnvFile.sprintf( ProcDir.path()+ "/" + (*it) + "/environ" ); |
285 | break; | 286 | break; |
286 | } | 287 | } |
287 | } | 288 | } |
288 | } | 289 | } |
289 | } | 290 | } |
290 | 291 | ||
291 | if( QPEEnvFile.isEmpty() ) { | 292 | if( QPEEnvFile.isEmpty() ) { |
292 | // could not find qpe | 293 | // could not find qpe |
293 | fprintf( stderr, "Could not find qpe\n" ); | 294 | fprintf( stderr, "Could not find qpe\n" ); |
294 | return; | 295 | return; |
295 | } | 296 | } |
296 | 297 | ||
297 | // FI now contains path ProcDir to the cmd dir | 298 | // FI now contains path ProcDir to the cmd dir |
298 | { char * Buf = 0; | 299 | { char * Buf = 0; |
299 | char TB[1024]; | 300 | char TB[1024]; |
300 | long BufSize = 0; | 301 | long BufSize = 0; |
301 | int fd; | 302 | int fd; |
302 | int rd; | 303 | int rd; |
303 | 304 | ||
304 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); | 305 | fd = open( QPEEnvFile.latin1(), O_RDONLY ); |
305 | if( fd < 0 ) { | 306 | if( fd < 0 ) { |
306 | fprintf( stderr, "Could not open %s : %d\n", | 307 | fprintf( stderr, "Could not open %s : %d\n", |
307 | QPEEnvFile.latin1(), errno ); | 308 | QPEEnvFile.latin1(), errno ); |
308 | return; | 309 | return; |
309 | } | 310 | } |
310 | 311 | ||
311 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { | 312 | while( (rd = read( fd, TB, sizeof(TB) ) ) > 0 ) { |
312 | Buf = (char *)realloc( Buf, BufSize+rd ); | 313 | Buf = (char *)realloc( Buf, BufSize+rd ); |
313 | memcpy( Buf+BufSize, TB, rd ); | 314 | memcpy( Buf+BufSize, TB, rd ); |
314 | BufSize += rd; | 315 | BufSize += rd; |
315 | } | 316 | } |
316 | 317 | ||
317 | char * Data = Buf; | 318 | char * Data = Buf; |
318 | char * DataEnd = Data+BufSize-1; | 319 | char * DataEnd = Data+BufSize-1; |
319 | 320 | ||
320 | // get env items out of list | 321 | // get env items out of list |
321 | while( Data < DataEnd ) { | 322 | while( Data < DataEnd ) { |
322 | if( strncmp( Data, "LOGNAME=", 8 ) == 0 ) { | 323 | if( strncmp( Data, "LOGNAME=", 8 ) == 0 ) { |
323 | CurrentUser.UserName = Data+8; | 324 | CurrentUser.UserName = Data+8; |
324 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 325 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
325 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 326 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
326 | strdup( Data ); | 327 | strdup( Data ); |
327 | } else if( strncmp( Data, "HOME=", 5 ) == 0 ) { | 328 | } else if( strncmp( Data, "HOME=", 5 ) == 0 ) { |
328 | CurrentUser.HomeDir = Data+5; | 329 | CurrentUser.HomeDir = Data+5; |
329 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 330 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
330 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 331 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
331 | strdup( Data ); | 332 | strdup( Data ); |
332 | } else { | 333 | } else { |
333 | EnvVar_t * Run = EV; | 334 | EnvVar_t * Run = EV; |
334 | while( Run->Name ) { | 335 | while( Run->Name ) { |
335 | if( strncmp( Data, Run->Name, Run->Len ) == 0 ) { | 336 | if( strncmp( Data, Run->Name, Run->Len ) == 0 ) { |
336 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); | 337 | CurrentUser.EnvList.resize( CurrentUser.EnvList.size()+1 ); |
337 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = | 338 | CurrentUser.EnvList[CurrentUser.EnvList.size()-1] = |
338 | strdup( Data ); | 339 | strdup( Data ); |
339 | break; | 340 | break; |
340 | } | 341 | } |
341 | Run ++; | 342 | Run ++; |
342 | } | 343 | } |
343 | } | 344 | } |
344 | 345 | ||
345 | Data += strlen( Data )+1; | 346 | Data += strlen( Data )+1; |
346 | } | 347 | } |
347 | 348 | ||
348 | free( Buf ); | 349 | free( Buf ); |
349 | 350 | ||
350 | if( ! CurrentUser.UserName.isEmpty() ) { | 351 | if( ! CurrentUser.UserName.isEmpty() ) { |
351 | // find user info | 352 | // find user info |
352 | struct passwd pwd; | 353 | struct passwd pwd; |
353 | struct passwd * pwdres; | 354 | struct passwd * pwdres; |
354 | 355 | ||
355 | if( getpwnam_r( CurrentUser.UserName.latin1(), | 356 | if( getpwnam_r( CurrentUser.UserName.latin1(), |
356 | &pwd, TB, sizeof(TB), &pwdres ) || | 357 | &pwd, TB, sizeof(TB), &pwdres ) || |
357 | pwdres == 0 ) { | 358 | pwdres == 0 ) { |
358 | fprintf( stderr, "Could not determine user %s : %d\n", | 359 | fprintf( stderr, "Could not determine user %s : %d\n", |
359 | CurrentUser.UserName.latin1(), errno ); | 360 | CurrentUser.UserName.latin1(), errno ); |
360 | return; | 361 | return; |
361 | } | 362 | } |
362 | CurrentUser.Uid = pwd.pw_uid; | 363 | CurrentUser.Uid = pwd.pw_uid; |
363 | CurrentUser.Gid = pwd.pw_gid; | 364 | CurrentUser.Gid = pwd.pw_gid; |
364 | } else{ | 365 | } else{ |
365 | CurrentUser.Uid = | 366 | CurrentUser.Uid = |
366 | CurrentUser.Gid = -1; | 367 | CurrentUser.Gid = -1; |
367 | } | 368 | } |
368 | } | 369 | } |
369 | } | 370 | } |
diff --git a/noncore/settings/networksettings2/networksettingsGUI.ui b/noncore/settings/networksettings2/networksettingsGUI.ui index 1d79123..7ef2f64 100644 --- a/noncore/settings/networksettings2/networksettingsGUI.ui +++ b/noncore/settings/networksettings2/networksettingsGUI.ui | |||
@@ -1,457 +1,630 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NetworkSettingsGUI</class> | 2 | <class>NetworkSettingsGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NetworkSettingsGUI</cstring> | 7 | <cstring>NetworkSettingsGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>399</width> | 14 | <width>160</width> |
15 | <height>502</height> | 15 | <height>260</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Settings</string> | 20 | <string>Network Settings</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QFrame</class> | 38 | <class>QFrame</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Frame4</cstring> | 41 | <cstring>Frame4</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>sizePolicy</name> | 44 | <name>sizePolicy</name> |
45 | <sizepolicy> | 45 | <sizepolicy> |
46 | <hsizetype>7</hsizetype> | 46 | <hsizetype>7</hsizetype> |
47 | <vsizetype>0</vsizetype> | 47 | <vsizetype>0</vsizetype> |
48 | </sizepolicy> | 48 | </sizepolicy> |
49 | </property> | 49 | </property> |
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>frameShape</name> | 51 | <name>frameShape</name> |
52 | <enum>NoFrame</enum> | 52 | <enum>NoFrame</enum> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>frameShadow</name> | 55 | <name>frameShadow</name> |
56 | <enum>Raised</enum> | 56 | <enum>Raised</enum> |
57 | </property> | 57 | </property> |
58 | <property> | 58 | <property> |
59 | <name>layoutMargin</name> | 59 | <name>layoutMargin</name> |
60 | </property> | 60 | </property> |
61 | <property> | 61 | <property> |
62 | <name>layoutSpacing</name> | 62 | <name>layoutSpacing</name> |
63 | </property> | 63 | </property> |
64 | <hbox> | 64 | <hbox> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>margin</name> | 66 | <name>margin</name> |
67 | <number>0</number> | 67 | <number>0</number> |
68 | </property> | 68 | </property> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>spacing</name> | 70 | <name>spacing</name> |
71 | <number>1</number> | 71 | <number>1</number> |
72 | </property> | 72 | </property> |
73 | <widget> | 73 | <widget> |
74 | <class>QToolButton</class> | 74 | <class>QToolButton</class> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>name</name> | 76 | <name>name</name> |
77 | <cstring>Add_TB</cstring> | 77 | <cstring>Add_TB</cstring> |
78 | </property> | 78 | </property> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>sizePolicy</name> | 80 | <name>sizePolicy</name> |
81 | <sizepolicy> | 81 | <sizepolicy> |
82 | <hsizetype>0</hsizetype> | 82 | <hsizetype>0</hsizetype> |
83 | <vsizetype>0</vsizetype> | 83 | <vsizetype>0</vsizetype> |
84 | </sizepolicy> | 84 | </sizepolicy> |
85 | </property> | 85 | </property> |
86 | <property stdset="1"> | 86 | <property stdset="1"> |
87 | <name>text</name> | 87 | <name>text</name> |
88 | <string>...</string> | 88 | <string>...</string> |
89 | </property> | 89 | </property> |
90 | </widget> | 90 | </widget> |
91 | <widget> | 91 | <widget> |
92 | <class>QToolButton</class> | 92 | <class>QToolButton</class> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>name</name> | 94 | <name>name</name> |
95 | <cstring>Delete_TB</cstring> | 95 | <cstring>Delete_TB</cstring> |
96 | </property> | 96 | </property> |
97 | <property stdset="1"> | 97 | <property stdset="1"> |
98 | <name>sizePolicy</name> | 98 | <name>sizePolicy</name> |
99 | <sizepolicy> | 99 | <sizepolicy> |
100 | <hsizetype>0</hsizetype> | 100 | <hsizetype>0</hsizetype> |
101 | <vsizetype>0</vsizetype> | 101 | <vsizetype>0</vsizetype> |
102 | </sizepolicy> | 102 | </sizepolicy> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>...</string> | 106 | <string>...</string> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | <widget> | 109 | <widget> |
110 | <class>QToolButton</class> | 110 | <class>QToolButton</class> |
111 | <property stdset="1"> | 111 | <property stdset="1"> |
112 | <name>name</name> | 112 | <name>name</name> |
113 | <cstring>CheckState_TB</cstring> | 113 | <cstring>CheckState_TB</cstring> |
114 | </property> | 114 | </property> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>sizePolicy</name> | 116 | <name>sizePolicy</name> |
117 | <sizepolicy> | 117 | <sizepolicy> |
118 | <hsizetype>0</hsizetype> | 118 | <hsizetype>0</hsizetype> |
119 | <vsizetype>0</vsizetype> | 119 | <vsizetype>0</vsizetype> |
120 | </sizepolicy> | 120 | </sizepolicy> |
121 | </property> | 121 | </property> |
122 | <property stdset="1"> | 122 | <property stdset="1"> |
123 | <name>text</name> | 123 | <name>text</name> |
124 | <string>...</string> | 124 | <string>...</string> |
125 | </property> | 125 | </property> |
126 | </widget> | 126 | </widget> |
127 | <widget> | 127 | <widget> |
128 | <class>QToolButton</class> | 128 | <class>QToolButton</class> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>name</name> | 130 | <name>name</name> |
131 | <cstring>GenConfig_TB</cstring> | 131 | <cstring>GenConfig_TB</cstring> |
132 | </property> | 132 | </property> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>sizePolicy</name> | 134 | <name>sizePolicy</name> |
135 | <sizepolicy> | 135 | <sizepolicy> |
136 | <hsizetype>0</hsizetype> | 136 | <hsizetype>0</hsizetype> |
137 | <vsizetype>0</vsizetype> | 137 | <vsizetype>0</vsizetype> |
138 | </sizepolicy> | 138 | </sizepolicy> |
139 | </property> | 139 | </property> |
140 | <property stdset="1"> | 140 | <property stdset="1"> |
141 | <name>text</name> | 141 | <name>text</name> |
142 | <string>...</string> | 142 | <string>...</string> |
143 | </property> | 143 | </property> |
144 | </widget> | 144 | </widget> |
145 | <spacer> | 145 | <spacer> |
146 | <property> | 146 | <property> |
147 | <name>name</name> | 147 | <name>name</name> |
148 | <cstring>Spacer1</cstring> | 148 | <cstring>Spacer1</cstring> |
149 | </property> | 149 | </property> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>orientation</name> | 151 | <name>orientation</name> |
152 | <enum>Horizontal</enum> | 152 | <enum>Horizontal</enum> |
153 | </property> | 153 | </property> |
154 | <property stdset="1"> | 154 | <property stdset="1"> |
155 | <name>sizeType</name> | 155 | <name>sizeType</name> |
156 | <enum>Expanding</enum> | 156 | <enum>Expanding</enum> |
157 | </property> | 157 | </property> |
158 | <property> | 158 | <property> |
159 | <name>sizeHint</name> | 159 | <name>sizeHint</name> |
160 | <size> | 160 | <size> |
161 | <width>20</width> | 161 | <width>20</width> |
162 | <height>20</height> | 162 | <height>20</height> |
163 | </size> | 163 | </size> |
164 | </property> | 164 | </property> |
165 | </spacer> | 165 | </spacer> |
166 | <widget> | 166 | <widget> |
167 | <class>QToolButton</class> | 167 | <class>QToolButton</class> |
168 | <property stdset="1"> | 168 | <property stdset="1"> |
169 | <name>name</name> | 169 | <name>name</name> |
170 | <cstring>On_TB</cstring> | 170 | <cstring>Enable_TB</cstring> |
171 | </property> | 171 | </property> |
172 | <property stdset="1"> | 172 | <property stdset="1"> |
173 | <name>sizePolicy</name> | 173 | <name>sizePolicy</name> |
174 | <sizepolicy> | 174 | <sizepolicy> |
175 | <hsizetype>0</hsizetype> | 175 | <hsizetype>0</hsizetype> |
176 | <vsizetype>0</vsizetype> | 176 | <vsizetype>0</vsizetype> |
177 | </sizepolicy> | 177 | </sizepolicy> |
178 | </property> | 178 | </property> |
179 | <property stdset="1"> | 179 | <property stdset="1"> |
180 | <name>text</name> | 180 | <name>text</name> |
181 | <string>...</string> | 181 | <string>...</string> |
182 | </property> | 182 | </property> |
183 | <property stdset="1"> | 183 | <property stdset="1"> |
184 | <name>toggleButton</name> | 184 | <name>toggleButton</name> |
185 | <bool>true</bool> | 185 | <bool>true</bool> |
186 | </property> | 186 | </property> |
187 | <property stdset="1"> | 187 | <property stdset="1"> |
188 | <name>toggleButton</name> | 188 | <name>toggleButton</name> |
189 | <bool>true</bool> | 189 | <bool>true</bool> |
190 | </property> | 190 | </property> |
191 | </widget> | 191 | </widget> |
192 | <widget> | 192 | <widget> |
193 | <class>QToolButton</class> | 193 | <class>QToolButton</class> |
194 | <property stdset="1"> | 194 | <property stdset="1"> |
195 | <name>name</name> | 195 | <name>name</name> |
196 | <cstring>Enable_TB</cstring> | 196 | <cstring>On_TB</cstring> |
197 | </property> | 197 | </property> |
198 | <property stdset="1"> | 198 | <property stdset="1"> |
199 | <name>sizePolicy</name> | 199 | <name>sizePolicy</name> |
200 | <sizepolicy> | 200 | <sizepolicy> |
201 | <hsizetype>0</hsizetype> | 201 | <hsizetype>0</hsizetype> |
202 | <vsizetype>0</vsizetype> | 202 | <vsizetype>0</vsizetype> |
203 | </sizepolicy> | 203 | </sizepolicy> |
204 | </property> | 204 | </property> |
205 | <property stdset="1"> | 205 | <property stdset="1"> |
206 | <name>text</name> | 206 | <name>text</name> |
207 | <string>...</string> | 207 | <string>...</string> |
208 | </property> | 208 | </property> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>toggleButton</name> | 210 | <name>toggleButton</name> |
211 | <bool>true</bool> | 211 | <bool>true</bool> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>toggleButton</name> | 214 | <name>toggleButton</name> |
215 | <bool>true</bool> | 215 | <bool>true</bool> |
216 | </property> | 216 | </property> |
217 | </widget> | 217 | </widget> |
218 | <widget> | 218 | <widget> |
219 | <class>QToolButton</class> | 219 | <class>QToolButton</class> |
220 | <property stdset="1"> | 220 | <property stdset="1"> |
221 | <name>name</name> | 221 | <name>name</name> |
222 | <cstring>Connect_TB</cstring> | 222 | <cstring>Connect_TB</cstring> |
223 | </property> | 223 | </property> |
224 | <property stdset="1"> | 224 | <property stdset="1"> |
225 | <name>sizePolicy</name> | 225 | <name>sizePolicy</name> |
226 | <sizepolicy> | 226 | <sizepolicy> |
227 | <hsizetype>0</hsizetype> | 227 | <hsizetype>0</hsizetype> |
228 | <vsizetype>0</vsizetype> | 228 | <vsizetype>0</vsizetype> |
229 | </sizepolicy> | 229 | </sizepolicy> |
230 | </property> | 230 | </property> |
231 | <property stdset="1"> | 231 | <property stdset="1"> |
232 | <name>text</name> | 232 | <name>text</name> |
233 | <string>...</string> | 233 | <string>...</string> |
234 | </property> | 234 | </property> |
235 | <property stdset="1"> | 235 | <property stdset="1"> |
236 | <name>toggleButton</name> | 236 | <name>toggleButton</name> |
237 | <bool>true</bool> | 237 | <bool>true</bool> |
238 | </property> | 238 | </property> |
239 | <property stdset="1"> | 239 | <property stdset="1"> |
240 | <name>toggleButton</name> | 240 | <name>toggleButton</name> |
241 | <bool>true</bool> | 241 | <bool>true</bool> |
242 | </property> | 242 | </property> |
243 | </widget> | 243 | </widget> |
244 | <widget> | ||
245 | <class>QToolButton</class> | ||
246 | <property stdset="1"> | ||
247 | <name>name</name> | ||
248 | <cstring>Disconnect_TB</cstring> | ||
249 | </property> | ||
250 | <property stdset="1"> | ||
251 | <name>sizePolicy</name> | ||
252 | <sizepolicy> | ||
253 | <hsizetype>0</hsizetype> | ||
254 | <vsizetype>0</vsizetype> | ||
255 | </sizepolicy> | ||
256 | </property> | ||
257 | <property stdset="1"> | ||
258 | <name>text</name> | ||
259 | <string>...</string> | ||
260 | </property> | ||
261 | <property stdset="1"> | ||
262 | <name>toggleButton</name> | ||
263 | <bool>true</bool> | ||
264 | </property> | ||
265 | <property stdset="1"> | ||
266 | <name>toggleButton</name> | ||
267 | <bool>true</bool> | ||
268 | </property> | ||
269 | </widget> | ||
244 | </hbox> | 270 | </hbox> |
245 | </widget> | 271 | </widget> |
246 | <widget> | 272 | <widget> |
247 | <class>QListBox</class> | 273 | <class>QListBox</class> |
248 | <property stdset="1"> | 274 | <property stdset="1"> |
249 | <name>name</name> | 275 | <name>name</name> |
250 | <cstring>Profiles_LB</cstring> | 276 | <cstring>Profiles_LB</cstring> |
251 | </property> | 277 | </property> |
252 | </widget> | 278 | </widget> |
253 | <widget> | 279 | <widget> |
254 | <class>QGroupBox</class> | 280 | <class>QGroupBox</class> |
255 | <property stdset="1"> | 281 | <property stdset="1"> |
256 | <name>name</name> | 282 | <name>name</name> |
257 | <cstring>CurProfile_GB</cstring> | 283 | <cstring>Profile_GB</cstring> |
258 | </property> | ||
259 | <property stdset="1"> | ||
260 | <name>sizePolicy</name> | ||
261 | <sizepolicy> | ||
262 | <hsizetype>5</hsizetype> | ||
263 | <vsizetype>1</vsizetype> | ||
264 | </sizepolicy> | ||
265 | </property> | 284 | </property> |
266 | <property stdset="1"> | 285 | <property stdset="1"> |
267 | <name>title</name> | 286 | <name>title</name> |
268 | <string></string> | 287 | <string>Profile</string> |
269 | </property> | 288 | </property> |
270 | <property> | 289 | <property> |
271 | <name>layoutMargin</name> | 290 | <name>layoutMargin</name> |
272 | </property> | 291 | </property> |
273 | <property> | 292 | <property> |
274 | <name>layoutSpacing</name> | 293 | <name>layoutSpacing</name> |
275 | </property> | 294 | </property> |
276 | <vbox> | 295 | <vbox> |
277 | <property stdset="1"> | 296 | <property stdset="1"> |
278 | <name>margin</name> | 297 | <name>margin</name> |
279 | <number>4</number> | 298 | <number>4</number> |
280 | </property> | 299 | </property> |
281 | <property stdset="1"> | 300 | <property stdset="1"> |
282 | <name>spacing</name> | 301 | <name>spacing</name> |
283 | <number>1</number> | 302 | <number>2</number> |
284 | </property> | 303 | </property> |
285 | <widget> | 304 | <widget> |
286 | <class>QLayoutWidget</class> | 305 | <class>QLayoutWidget</class> |
287 | <property stdset="1"> | 306 | <property stdset="1"> |
288 | <name>name</name> | 307 | <name>name</name> |
289 | <cstring>Layout3</cstring> | 308 | <cstring>Layout3</cstring> |
290 | </property> | 309 | </property> |
291 | <hbox> | 310 | <hbox> |
292 | <property stdset="1"> | 311 | <property stdset="1"> |
293 | <name>margin</name> | 312 | <name>margin</name> |
294 | <number>0</number> | 313 | <number>0</number> |
295 | </property> | 314 | </property> |
296 | <property stdset="1"> | 315 | <property stdset="1"> |
297 | <name>spacing</name> | 316 | <name>spacing</name> |
298 | <number>6</number> | 317 | <number>6</number> |
299 | </property> | 318 | </property> |
300 | <widget> | 319 | <widget> |
301 | <class>QLabel</class> | 320 | <class>QLabel</class> |
302 | <property stdset="1"> | 321 | <property stdset="1"> |
303 | <name>name</name> | 322 | <name>name</name> |
304 | <cstring>TextLabel2</cstring> | 323 | <cstring>TextLabel2_2</cstring> |
305 | </property> | 324 | </property> |
306 | <property stdset="1"> | 325 | <property stdset="1"> |
307 | <name>text</name> | 326 | <name>text</name> |
308 | <string>State</string> | 327 | <string>State</string> |
309 | </property> | 328 | </property> |
310 | </widget> | 329 | </widget> |
311 | <widget> | 330 | <widget> |
312 | <class>QLabel</class> | 331 | <class>QLabel</class> |
313 | <property stdset="1"> | 332 | <property stdset="1"> |
314 | <name>name</name> | 333 | <name>name</name> |
315 | <cstring>State_LBL</cstring> | 334 | <cstring>State_LBL</cstring> |
316 | </property> | 335 | </property> |
317 | <property stdset="1"> | 336 | <property stdset="1"> |
318 | <name>text</name> | 337 | <name>text</name> |
319 | <string>State</string> | 338 | <string>State</string> |
320 | </property> | 339 | </property> |
321 | <property stdset="1"> | 340 | <property stdset="1"> |
322 | <name>indent</name> | 341 | <name>indent</name> |
323 | <number>0</number> | 342 | <number>0</number> |
324 | </property> | 343 | </property> |
325 | </widget> | 344 | </widget> |
326 | <spacer> | 345 | <spacer> |
327 | <property> | 346 | <property> |
328 | <name>name</name> | 347 | <name>name</name> |
329 | <cstring>Spacer6</cstring> | 348 | <cstring>Spacer6_2</cstring> |
330 | </property> | 349 | </property> |
331 | <property stdset="1"> | 350 | <property stdset="1"> |
332 | <name>orientation</name> | 351 | <name>orientation</name> |
333 | <enum>Horizontal</enum> | 352 | <enum>Horizontal</enum> |
334 | </property> | 353 | </property> |
335 | <property stdset="1"> | 354 | <property stdset="1"> |
336 | <name>sizeType</name> | 355 | <name>sizeType</name> |
337 | <enum>Expanding</enum> | 356 | <enum>Expanding</enum> |
338 | </property> | 357 | </property> |
339 | <property> | 358 | <property> |
340 | <name>sizeHint</name> | 359 | <name>sizeHint</name> |
341 | <size> | 360 | <size> |
342 | <width>20</width> | 361 | <width>20</width> |
343 | <height>20</height> | 362 | <height>20</height> |
344 | </size> | 363 | </size> |
345 | </property> | 364 | </property> |
346 | </spacer> | 365 | </spacer> |
347 | </hbox> | 366 | </hbox> |
348 | </widget> | 367 | </widget> |
349 | <widget> | 368 | <widget> |
350 | <class>QLabel</class> | 369 | <class>QLabel</class> |
351 | <property stdset="1"> | 370 | <property stdset="1"> |
352 | <name>name</name> | 371 | <name>name</name> |
353 | <cstring>Description_LBL</cstring> | 372 | <cstring>Description_LBL</cstring> |
354 | </property> | 373 | </property> |
355 | <property stdset="1"> | 374 | <property stdset="1"> |
356 | <name>sizePolicy</name> | 375 | <name>sizePolicy</name> |
357 | <sizepolicy> | 376 | <sizepolicy> |
358 | <hsizetype>5</hsizetype> | 377 | <hsizetype>5</hsizetype> |
359 | <vsizetype>7</vsizetype> | 378 | <vsizetype>7</vsizetype> |
360 | </sizepolicy> | 379 | </sizepolicy> |
361 | </property> | 380 | </property> |
362 | <property stdset="1"> | 381 | <property stdset="1"> |
363 | <name>frameShape</name> | 382 | <name>frameShape</name> |
364 | <enum>NoFrame</enum> | 383 | <enum>NoFrame</enum> |
365 | </property> | 384 | </property> |
366 | <property stdset="1"> | 385 | <property stdset="1"> |
367 | <name>frameShadow</name> | 386 | <name>frameShadow</name> |
368 | <enum>Raised</enum> | 387 | <enum>Raised</enum> |
369 | </property> | 388 | </property> |
370 | <property stdset="1"> | 389 | <property stdset="1"> |
371 | <name>text</name> | 390 | <name>text</name> |
372 | <string></string> | 391 | <string></string> |
373 | </property> | 392 | </property> |
374 | <property stdset="1"> | 393 | <property stdset="1"> |
375 | <name>alignment</name> | 394 | <name>alignment</name> |
376 | <set>AlignTop|AlignLeft</set> | 395 | <set>AlignTop|AlignLeft</set> |
377 | </property> | 396 | </property> |
378 | <property> | 397 | <property> |
379 | <name>vAlign</name> | 398 | <name>vAlign</name> |
380 | </property> | 399 | </property> |
381 | </widget> | 400 | </widget> |
401 | <widget> | ||
402 | <class>QLayoutWidget</class> | ||
403 | <property stdset="1"> | ||
404 | <name>name</name> | ||
405 | <cstring>Layout4</cstring> | ||
406 | </property> | ||
407 | <hbox> | ||
408 | <property stdset="1"> | ||
409 | <name>margin</name> | ||
410 | <number>0</number> | ||
411 | </property> | ||
412 | <property stdset="1"> | ||
413 | <name>spacing</name> | ||
414 | <number>6</number> | ||
415 | </property> | ||
416 | <spacer> | ||
417 | <property> | ||
418 | <name>name</name> | ||
419 | <cstring>Spacer4</cstring> | ||
420 | </property> | ||
421 | <property stdset="1"> | ||
422 | <name>orientation</name> | ||
423 | <enum>Horizontal</enum> | ||
424 | </property> | ||
425 | <property stdset="1"> | ||
426 | <name>sizeType</name> | ||
427 | <enum>Expanding</enum> | ||
428 | </property> | ||
429 | <property> | ||
430 | <name>sizeHint</name> | ||
431 | <size> | ||
432 | <width>20</width> | ||
433 | <height>20</height> | ||
434 | </size> | ||
435 | </property> | ||
436 | </spacer> | ||
437 | <widget> | ||
438 | <class>QPushButton</class> | ||
439 | <property stdset="1"> | ||
440 | <name>name</name> | ||
441 | <cstring>ToMessages_BUT</cstring> | ||
442 | </property> | ||
443 | <property stdset="1"> | ||
444 | <name>sizePolicy</name> | ||
445 | <sizepolicy> | ||
446 | <hsizetype>1</hsizetype> | ||
447 | <vsizetype>0</vsizetype> | ||
448 | </sizepolicy> | ||
449 | </property> | ||
450 | <property stdset="1"> | ||
451 | <name>text</name> | ||
452 | <string>Messages ...</string> | ||
453 | </property> | ||
454 | </widget> | ||
455 | </hbox> | ||
456 | </widget> | ||
457 | </vbox> | ||
458 | </widget> | ||
459 | <widget> | ||
460 | <class>QGroupBox</class> | ||
461 | <property stdset="1"> | ||
462 | <name>name</name> | ||
463 | <cstring>Messages_GB</cstring> | ||
464 | </property> | ||
465 | <property stdset="1"> | ||
466 | <name>title</name> | ||
467 | <string>Messages</string> | ||
468 | </property> | ||
469 | <property> | ||
470 | <name>layoutMargin</name> | ||
471 | </property> | ||
472 | <property> | ||
473 | <name>layoutSpacing</name> | ||
474 | </property> | ||
475 | <vbox> | ||
476 | <property stdset="1"> | ||
477 | <name>margin</name> | ||
478 | <number>4</number> | ||
479 | </property> | ||
480 | <property stdset="1"> | ||
481 | <name>spacing</name> | ||
482 | <number>2</number> | ||
483 | </property> | ||
484 | <widget> | ||
485 | <class>QListBox</class> | ||
486 | <property stdset="1"> | ||
487 | <name>name</name> | ||
488 | <cstring>Mesages_LB</cstring> | ||
489 | </property> | ||
490 | </widget> | ||
491 | <widget> | ||
492 | <class>QLayoutWidget</class> | ||
493 | <property stdset="1"> | ||
494 | <name>name</name> | ||
495 | <cstring>Layout2</cstring> | ||
496 | </property> | ||
497 | <hbox> | ||
498 | <property stdset="1"> | ||
499 | <name>margin</name> | ||
500 | <number>0</number> | ||
501 | </property> | ||
502 | <property stdset="1"> | ||
503 | <name>spacing</name> | ||
504 | <number>6</number> | ||
505 | </property> | ||
506 | <spacer> | ||
507 | <property> | ||
508 | <name>name</name> | ||
509 | <cstring>Spacer3</cstring> | ||
510 | </property> | ||
511 | <property stdset="1"> | ||
512 | <name>orientation</name> | ||
513 | <enum>Horizontal</enum> | ||
514 | </property> | ||
515 | <property stdset="1"> | ||
516 | <name>sizeType</name> | ||
517 | <enum>Expanding</enum> | ||
518 | </property> | ||
519 | <property> | ||
520 | <name>sizeHint</name> | ||
521 | <size> | ||
522 | <width>20</width> | ||
523 | <height>20</height> | ||
524 | </size> | ||
525 | </property> | ||
526 | </spacer> | ||
527 | <widget> | ||
528 | <class>QPushButton</class> | ||
529 | <property stdset="1"> | ||
530 | <name>name</name> | ||
531 | <cstring>ToProfile_BUT</cstring> | ||
532 | </property> | ||
533 | <property stdset="1"> | ||
534 | <name>text</name> | ||
535 | <string>Profile ...</string> | ||
536 | </property> | ||
537 | </widget> | ||
538 | </hbox> | ||
539 | </widget> | ||
382 | </vbox> | 540 | </vbox> |
383 | </widget> | 541 | </widget> |
384 | </vbox> | 542 | </vbox> |
385 | </widget> | 543 | </widget> |
386 | <connections> | 544 | <connections> |
387 | <connection> | 545 | <connection> |
388 | <sender>Add_TB</sender> | 546 | <sender>Add_TB</sender> |
389 | <signal>clicked()</signal> | 547 | <signal>clicked()</signal> |
390 | <receiver>NetworkSettingsGUI</receiver> | 548 | <receiver>NetworkSettingsGUI</receiver> |
391 | <slot>SLOT_AddNode()</slot> | 549 | <slot>SLOT_AddNode()</slot> |
392 | </connection> | 550 | </connection> |
393 | <connection> | 551 | <connection> |
394 | <sender>Delete_TB</sender> | 552 | <sender>Delete_TB</sender> |
395 | <signal>clicked()</signal> | 553 | <signal>clicked()</signal> |
396 | <receiver>NetworkSettingsGUI</receiver> | 554 | <receiver>NetworkSettingsGUI</receiver> |
397 | <slot>SLOT_DeleteNode()</slot> | 555 | <slot>SLOT_DeleteNode()</slot> |
398 | </connection> | 556 | </connection> |
399 | <connection> | 557 | <connection> |
400 | <sender>CheckState_TB</sender> | 558 | <sender>CheckState_TB</sender> |
401 | <signal>clicked()</signal> | 559 | <signal>clicked()</signal> |
402 | <receiver>NetworkSettingsGUI</receiver> | 560 | <receiver>NetworkSettingsGUI</receiver> |
403 | <slot>SLOT_CheckState()</slot> | 561 | <slot>SLOT_CheckState()</slot> |
404 | </connection> | 562 | </connection> |
405 | <connection> | 563 | <connection> |
406 | <sender>Enable_TB</sender> | 564 | <sender>Enable_TB</sender> |
407 | <signal>clicked()</signal> | 565 | <signal>clicked()</signal> |
408 | <receiver>NetworkSettingsGUI</receiver> | 566 | <receiver>NetworkSettingsGUI</receiver> |
409 | <slot>SLOT_Enable()</slot> | 567 | <slot>SLOT_Enable()</slot> |
410 | </connection> | 568 | </connection> |
411 | <connection> | 569 | <connection> |
412 | <sender>Connect_TB</sender> | 570 | <sender>Connect_TB</sender> |
413 | <signal>clicked()</signal> | 571 | <signal>clicked()</signal> |
414 | <receiver>NetworkSettingsGUI</receiver> | 572 | <receiver>NetworkSettingsGUI</receiver> |
415 | <slot>SLOT_Connect()</slot> | 573 | <slot>SLOT_Connect()</slot> |
416 | </connection> | 574 | </connection> |
417 | <connection> | 575 | <connection> |
418 | <sender>On_TB</sender> | 576 | <sender>On_TB</sender> |
419 | <signal>clicked()</signal> | 577 | <signal>clicked()</signal> |
420 | <receiver>NetworkSettingsGUI</receiver> | 578 | <receiver>NetworkSettingsGUI</receiver> |
421 | <slot>SLOT_On()</slot> | 579 | <slot>SLOT_On()</slot> |
422 | </connection> | 580 | </connection> |
423 | <connection> | 581 | <connection> |
424 | <sender>GenConfig_TB</sender> | 582 | <sender>GenConfig_TB</sender> |
425 | <signal>clicked()</signal> | 583 | <signal>clicked()</signal> |
426 | <receiver>NetworkSettingsGUI</receiver> | 584 | <receiver>NetworkSettingsGUI</receiver> |
427 | <slot>SLOT_GenerateConfig()</slot> | 585 | <slot>SLOT_GenerateConfig()</slot> |
428 | </connection> | 586 | </connection> |
429 | <connection> | 587 | <connection> |
430 | <sender>Profiles_LB</sender> | 588 | <sender>Profiles_LB</sender> |
431 | <signal>clicked(QListBoxItem*)</signal> | 589 | <signal>clicked(QListBoxItem*)</signal> |
432 | <receiver>NetworkSettingsGUI</receiver> | 590 | <receiver>NetworkSettingsGUI</receiver> |
433 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> | 591 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
434 | </connection> | 592 | </connection> |
435 | <connection> | 593 | <connection> |
436 | <sender>Profiles_LB</sender> | 594 | <sender>Profiles_LB</sender> |
437 | <signal>currentChanged(QListBoxItem*)</signal> | 595 | <signal>currentChanged(QListBoxItem*)</signal> |
438 | <receiver>NetworkSettingsGUI</receiver> | 596 | <receiver>NetworkSettingsGUI</receiver> |
439 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> | 597 | <slot>SLOT_ShowNode( QListBoxItem*)</slot> |
440 | </connection> | 598 | </connection> |
441 | <connection> | 599 | <connection> |
442 | <sender>Profiles_LB</sender> | 600 | <sender>Profiles_LB</sender> |
443 | <signal>doubleClicked(QListBoxItem*)</signal> | 601 | <signal>doubleClicked(QListBoxItem*)</signal> |
444 | <receiver>NetworkSettingsGUI</receiver> | 602 | <receiver>NetworkSettingsGUI</receiver> |
445 | <slot>SLOT_EditNode( QListBoxItem *)</slot> | 603 | <slot>SLOT_EditNode( QListBoxItem *)</slot> |
446 | </connection> | 604 | </connection> |
605 | <connection> | ||
606 | <sender>ToProfile_BUT</sender> | ||
607 | <signal>clicked()</signal> | ||
608 | <receiver>NetworkSettingsGUI</receiver> | ||
609 | <slot>SLOT_ToProfile()</slot> | ||
610 | </connection> | ||
611 | <connection> | ||
612 | <sender>ToMessages_BUT</sender> | ||
613 | <signal>clicked()</signal> | ||
614 | <receiver>NetworkSettingsGUI</receiver> | ||
615 | <slot>SLOT_ToMessages()</slot> | ||
616 | </connection> | ||
447 | <slot access="public">SLOT_AddNode()</slot> | 617 | <slot access="public">SLOT_AddNode()</slot> |
448 | <slot access="public">SLOT_CheckState()</slot> | 618 | <slot access="public">SLOT_CheckState()</slot> |
449 | <slot access="public">SLOT_Connect()</slot> | 619 | <slot access="public">SLOT_Connect()</slot> |
450 | <slot access="public">SLOT_DeleteNode()</slot> | 620 | <slot access="public">SLOT_DeleteNode()</slot> |
451 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> | 621 | <slot access="public">SLOT_EditNode( QListBoxItem *)</slot> |
452 | <slot access="public">SLOT_Enable()</slot> | 622 | <slot access="public">SLOT_Enable()</slot> |
453 | <slot access="public">SLOT_GenerateConfig()</slot> | 623 | <slot access="public">SLOT_GenerateConfig()</slot> |
454 | <slot access="public">SLOT_On()</slot> | 624 | <slot access="public">SLOT_On()</slot> |
455 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> | 625 | <slot access="public">SLOT_ShowNode( QListBoxItem*)</slot> |
626 | <slot access="public">SLOT_ToMessages()</slot> | ||
627 | <slot access="public">SLOT_ToProfile()</slot> | ||
628 | <slot access="public">SLOT_Disconnect()</slot> | ||
456 | </connections> | 629 | </connections> |
457 | </UI> | 630 | </UI> |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.cpp b/noncore/settings/networksettings2/ppp/ppprun.cpp index 8c75df3..a8abc50 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.cpp +++ b/noncore/settings/networksettings2/ppp/ppprun.cpp | |||
@@ -1,82 +1,82 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | #include "ppprun.h" | 2 | #include "ppprun.h" |
3 | 3 | ||
4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : | 4 | PPPRun::PPPRun( ANetNodeInstance * NNI, PPPData & Data ) : |
5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { | 5 | AsConnection( NNI ), AsDevice( NNI ), Pat( "eth[0-9]" ) { |
6 | D = &Data; | 6 | D = &Data; |
7 | } | 7 | } |
8 | 8 | ||
9 | void PPPRun::detectState( NodeCollection * NC ) { | 9 | void PPPRun::detectState( NodeCollection * NC ) { |
10 | if( isMyPPPDRunning( ) ) { | 10 | if( isMyPPPDRunning( ) ) { |
11 | if( isMyPPPUp() ) { | 11 | if( isMyPPPUp() ) { |
12 | NC->setCurrentState( IsUp ); | 12 | NC->setCurrentState( IsUp ); |
13 | } else { | 13 | } else { |
14 | NC->setCurrentState( Available ); | 14 | NC->setCurrentState( Available ); |
15 | } | 15 | } |
16 | } else { | 16 | } else { |
17 | NC->setCurrentState( Off ); // at least this | 17 | NC->setCurrentState( Off ); // at least this |
18 | // but could also be unavailable | 18 | // but could also be unavailable |
19 | AsDevice::netNode()->nextNode()->runtime()->detectState( NC ); | 19 | AsDevice::netNode()->nextNode()->runtime()->detectState( NC ); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | 22 | ||
23 | bool PPPRun::setState( NodeCollection * NC, Action_t A ) { | 23 | bool PPPRun::setState( NodeCollection * NC, Action_t A, bool ) { |
24 | switch( A ) { | 24 | switch( A ) { |
25 | case Activate : | 25 | case Activate : |
26 | NC->setCurrentState( Available ); | 26 | NC->setCurrentState( Available ); |
27 | // no | 27 | // no |
28 | break; | 28 | break; |
29 | case Deactivate : | 29 | case Deactivate : |
30 | if( NC->currentState() == IsUp ) { | 30 | if( NC->currentState() == IsUp ) { |
31 | NC->state( Down ); | 31 | NC->state( Down ); |
32 | } | 32 | } |
33 | // cannot really disable | 33 | // cannot really disable |
34 | NC->setCurrentState( Available ); | 34 | NC->setCurrentState( Available ); |
35 | break; | 35 | break; |
36 | case Up : | 36 | case Up : |
37 | if( NC->currentState() != IsUp ) { | 37 | if( NC->currentState() != IsUp ) { |
38 | // start my PPPD | 38 | // start my PPPD |
39 | NC->setCurrentState( IsUp ); | 39 | NC->setCurrentState( IsUp ); |
40 | } | 40 | } |
41 | break; | 41 | break; |
42 | case Down : | 42 | case Down : |
43 | if( NC->currentState() == IsUp ) { | 43 | if( NC->currentState() == IsUp ) { |
44 | // stop my PPPD | 44 | // stop my PPPD |
45 | NC->setCurrentState( Available ); | 45 | NC->setCurrentState( Available ); |
46 | } | 46 | } |
47 | break; | 47 | break; |
48 | default : // FT | 48 | default : // FT |
49 | break; | 49 | break; |
50 | } | 50 | } |
51 | return 1; | 51 | return 1; |
52 | } | 52 | } |
53 | 53 | ||
54 | bool PPPRun::isMyPPPDRunning( void ) { | 54 | bool PPPRun::isMyPPPDRunning( void ) { |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | bool PPPRun::isMyPPPUp( void ) { | 58 | bool PPPRun::isMyPPPUp( void ) { |
59 | System & S = NSResources->system(); | 59 | System & S = NSResources->system(); |
60 | InterfaceInfo * Run; | 60 | InterfaceInfo * Run; |
61 | QRegExp R( "ppp[0-9]" ); | 61 | QRegExp R( "ppp[0-9]" ); |
62 | 62 | ||
63 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 63 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
64 | It.current(); | 64 | It.current(); |
65 | ++It ) { | 65 | ++It ) { |
66 | Run = It.current(); | 66 | Run = It.current(); |
67 | if( R.match( Run->Name ) >= 0 && | 67 | if( R.match( Run->Name ) >= 0 && |
68 | Run->IsPointToPoint | 68 | Run->IsPointToPoint |
69 | ) { | 69 | ) { |
70 | // this is a LAN card | 70 | // this is a LAN card |
71 | if( Run->assignedNode() == AsDevice::netNode() ) { | 71 | if( Run->assignedNode() == AsDevice::netNode() ) { |
72 | // assigned to us | 72 | // assigned to us |
73 | return 1; | 73 | return 1; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } | 76 | } |
77 | return 0; | 77 | return 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | bool PPPRun::handlesInterface( const QString & S ) { | 80 | bool PPPRun::handlesInterface( const QString & S ) { |
81 | return Pat.match( S ) >= 0; | 81 | return Pat.match( S ) >= 0; |
82 | } | 82 | } |
diff --git a/noncore/settings/networksettings2/ppp/ppprun.h b/noncore/settings/networksettings2/ppp/ppprun.h index af51fbe..90a3f25 100644 --- a/noncore/settings/networksettings2/ppp/ppprun.h +++ b/noncore/settings/networksettings2/ppp/ppprun.h | |||
@@ -1,47 +1,47 @@ | |||
1 | #ifndef PPPRUN_H | 1 | #ifndef PPPRUN_H |
2 | #define PPPRUN_H | 2 | #define PPPRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asconnection.h> | 5 | #include <asconnection.h> |
6 | #include <asdevice.h> | 6 | #include <asdevice.h> |
7 | #include "pppdata.h" | 7 | #include "pppdata.h" |
8 | 8 | ||
9 | class PPPRun : public AsConnection, public AsDevice { | 9 | class PPPRun : public AsConnection, public AsDevice { |
10 | 10 | ||
11 | public : | 11 | public : |
12 | 12 | ||
13 | PPPRun( ANetNodeInstance * NNI, | 13 | PPPRun( ANetNodeInstance * NNI, |
14 | PPPData & Data ); | 14 | PPPData & Data ); |
15 | 15 | ||
16 | virtual AsDevice * asDevice( void ) | 16 | virtual AsDevice * asDevice( void ) |
17 | { return (AsDevice *)this; } | 17 | { return (AsDevice *)this; } |
18 | virtual AsConnection * asConnection( void ) | 18 | virtual AsConnection * asConnection( void ) |
19 | { return (AsConnection *)this; } | 19 | { return (AsConnection *)this; } |
20 | 20 | ||
21 | virtual AsDevice * device( void ) | 21 | virtual AsDevice * device( void ) |
22 | { return (AsDevice *)this; } | 22 | { return (AsDevice *)this; } |
23 | 23 | ||
24 | virtual RuntimeInfo * runtimeInfo( void ) | 24 | virtual RuntimeInfo * runtimeInfo( void ) |
25 | { return ( AsConnection *)this; } | 25 | { return ( AsConnection *)this; } |
26 | 26 | ||
27 | protected : | 27 | protected : |
28 | 28 | ||
29 | void detectState( NodeCollection * NC ); | 29 | void detectState( NodeCollection * NC ); |
30 | bool setState( NodeCollection * NC, Action_t A ); | 30 | bool setState( NodeCollection * NC, Action_t A, bool ); |
31 | bool canSetState( State_t S, Action_t A ) | 31 | bool canSetState( State_t S, Action_t A ) |
32 | { return AsDevice::connection()->findNext( | 32 | { return AsDevice::connection()->findNext( |
33 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } | 33 | AsDevice::netNode() )->runtime()->canSetState( S,A ); } |
34 | 34 | ||
35 | bool handlesInterface( const QString & I ); | 35 | bool handlesInterface( const QString & I ); |
36 | 36 | ||
37 | private : | 37 | private : |
38 | 38 | ||
39 | bool isMyPPPDRunning( void ); | 39 | bool isMyPPPDRunning( void ); |
40 | bool isMyPPPUp( void ); | 40 | bool isMyPPPUp( void ); |
41 | 41 | ||
42 | PPPData_t * D; | 42 | PPPData_t * D; |
43 | QRegExp Pat; | 43 | QRegExp Pat; |
44 | 44 | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/profile/profileedit.cpp b/noncore/settings/networksettings2/profile/profileedit.cpp index 3f72c52..c9fb650 100644 --- a/noncore/settings/networksettings2/profile/profileedit.cpp +++ b/noncore/settings/networksettings2/profile/profileedit.cpp | |||
@@ -1,93 +1,96 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qframe.h> | 2 | #include <qframe.h> |
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qmultilineedit.h> | 4 | #include <qmultilineedit.h> |
5 | #include <qcheckbox.h> | 5 | #include <qcheckbox.h> |
6 | 6 | ||
7 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include <asdevice.h> | 8 | #include <asdevice.h> |
9 | #include <resources.h> | 9 | #include <resources.h> |
10 | 10 | ||
11 | #include "profileedit.h" | 11 | #include "profileedit.h" |
12 | 12 | ||
13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | 13 | ProfileEdit::ProfileEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : |
14 | ProfileGUI( Parent ), TrafficRefresh(this) { | 14 | ProfileGUI( Parent ), RefreshTimer(this) { |
15 | InterfaceInfo * II; | 15 | InterfaceInfo * II; |
16 | 16 | ||
17 | NNI = TNNI; | 17 | NNI = TNNI; |
18 | Dev = NNI->runtime()->device(); | 18 | Dev = NNI->runtime()->device(); |
19 | if( ( II = Dev->assignedInterface() ) ) { | 19 | if( ( II = Dev->assignedInterface() ) ) { |
20 | |||
20 | Refresh_CB->setEnabled( TRUE ); | 21 | Refresh_CB->setEnabled( TRUE ); |
21 | Snd_GB->setEnabled( TRUE ); | 22 | Snd_GB->setEnabled( TRUE ); |
22 | Rcv_GB->setEnabled( TRUE ); | 23 | Rcv_GB->setEnabled( TRUE ); |
23 | Collisions_FRM->setEnabled( TRUE ); | 24 | Collisions_FRM->setEnabled( TRUE ); |
25 | |||
24 | // show current content | 26 | // show current content |
25 | SLOT_Refresh(); | 27 | SLOT_Refresh(); |
26 | 28 | ||
27 | // fill in static data | 29 | // fill in static data |
28 | InterfaceName_LBL->setText( II->Name ); | 30 | InterfaceName_LBL->setText( II->Name ); |
29 | IPAddress_LBL->setText( II->Address ); | 31 | IPAddress_LBL->setText( II->Address ); |
30 | SubnetMask_LBL->setText( II->Netmask ); | 32 | SubnetMask_LBL->setText( II->Netmask ); |
31 | Broadcast_LBL->setText( II->BCastAddress ); | 33 | Broadcast_LBL->setText( II->BCastAddress ); |
32 | MACAddress_LBL->setText( II->MACAddress ); | 34 | MACAddress_LBL->setText( II->MACAddress ); |
33 | if( II->IsPointToPoint ) { | 35 | if( II->IsPointToPoint ) { |
34 | PointToPoint_LBL->setText( II->DstAddress ); | 36 | PointToPoint_LBL->setText( II->DstAddress ); |
35 | } | 37 | } |
36 | QString S; | 38 | QString S; |
37 | InterfaceName_LBL->setText( II->Name ); | 39 | InterfaceName_LBL->setText( II->Name ); |
38 | if( II->HasMulticast ) { | 40 | if( II->HasMulticast ) { |
39 | S += "Multicast"; | 41 | S += "Multicast"; |
40 | } | 42 | } |
41 | if( ! S.isEmpty() ) { | 43 | if( ! S.isEmpty() ) { |
42 | S.prepend( " : " ); | 44 | S.prepend( " : " ); |
43 | } | 45 | } |
44 | InterfaceOptions_LBL->setText( S ); | 46 | InterfaceOptions_LBL->setText( S ); |
47 | |||
48 | connect( &RefreshTimer, SIGNAL( timeout() ), | ||
49 | this, SLOT( SLOT_Refresh() ) ); | ||
45 | } | 50 | } |
46 | 51 | ||
47 | connect( &TrafficRefresh, SIGNAL( timeout() ), | ||
48 | this, SLOT( SLOT_Refresh() ) ); | ||
49 | } | 52 | } |
50 | 53 | ||
51 | QString ProfileEdit::acceptable( void ) { | 54 | QString ProfileEdit::acceptable( void ) { |
52 | return QString(); | 55 | return QString(); |
53 | } | 56 | } |
54 | 57 | ||
55 | void ProfileEdit::showData( ProfileData_t & Data ) { | 58 | void ProfileEdit::showData( ProfileData_t & Data ) { |
56 | Description_LE->setText( Data.Description ); | 59 | Description_LE->setText( Data.Description ); |
57 | Automatic_CB->setChecked( Data.Automatic ); | 60 | Automatic_CB->setChecked( Data.Automatic ); |
58 | Confirm_CB->setChecked( Data.Confirm ); | 61 | Confirm_CB->setChecked( Data.Confirm ); |
59 | Disabled_CB->setChecked( Data.Disabled ); | 62 | Disabled_CB->setChecked( Data.Disabled ); |
60 | } | 63 | } |
61 | 64 | ||
62 | 65 | ||
63 | bool ProfileEdit::commit( ProfileData_t & Data ) { | 66 | bool ProfileEdit::commit( ProfileData_t & Data ) { |
64 | bool SM = 0; | 67 | bool SM = 0; |
65 | TXTM( Data.Description, Description_LE, SM ); | 68 | TXTM( Data.Description, Description_LE, SM ); |
66 | 69 | ||
67 | CBM( Data.Automatic, Automatic_CB, SM ); | 70 | CBM( Data.Automatic, Automatic_CB, SM ); |
68 | CBM( Data.Disabled, Disabled_CB, SM ); | 71 | CBM( Data.Disabled, Disabled_CB, SM ); |
69 | CBM( Data.Confirm, Confirm_CB, SM ); | 72 | CBM( Data.Confirm, Confirm_CB, SM ); |
70 | 73 | ||
71 | return SM; | 74 | return SM; |
72 | } | 75 | } |
73 | 76 | ||
74 | void ProfileEdit::SLOT_Refresh( void ) { | 77 | void ProfileEdit::SLOT_Refresh( void ) { |
75 | InterfaceInfo * II = Dev->assignedInterface(); | 78 | InterfaceInfo * II = Dev->assignedInterface(); |
76 | NSResources->system().refreshStatistics( *II ); | 79 | NSResources->system().refreshStatistics( *II ); |
77 | RcvBytes_LBL->setText( II->RcvBytes ); | 80 | RcvBytes_LBL->setText( II->RcvBytes ); |
78 | SndBytes_LBL->setText( II->SndBytes ); | 81 | SndBytes_LBL->setText( II->SndBytes ); |
79 | RcvErrors_LBL->setText( II->RcvErrors ); | 82 | RcvErrors_LBL->setText( II->RcvErrors ); |
80 | SndErrors_LBL->setText( II->SndErrors ); | 83 | SndErrors_LBL->setText( II->SndErrors ); |
81 | RcvDropped_LBL->setText( II->RcvDropped ); | 84 | RcvDropped_LBL->setText( II->RcvDropped ); |
82 | SndDropped_LBL->setText( II->SndDropped ); | 85 | SndDropped_LBL->setText( II->SndDropped ); |
83 | Collisions_LBL->setText( II->Collisions ); | 86 | Collisions_LBL->setText( II->Collisions ); |
84 | } | 87 | } |
85 | 88 | ||
86 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { | 89 | void ProfileEdit::SLOT_AutoRefresh( bool ar ) { |
87 | if( ar ) { | 90 | if( ar ) { |
88 | TrafficRefresh.start( 1000 ); | 91 | RefreshTimer.start( 1000 ); |
89 | SLOT_Refresh(); | 92 | SLOT_Refresh(); |
90 | } else { | 93 | } else { |
91 | TrafficRefresh.stop(); | 94 | RefreshTimer.stop(); |
92 | } | 95 | } |
93 | } | 96 | } |
diff --git a/noncore/settings/networksettings2/profile/profileedit.h b/noncore/settings/networksettings2/profile/profileedit.h index 8ca34be..b186b58 100644 --- a/noncore/settings/networksettings2/profile/profileedit.h +++ b/noncore/settings/networksettings2/profile/profileedit.h | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "profiledata.h" | 1 | #include "profiledata.h" |
2 | #include "profileGUI.h" | 2 | #include "profileGUI.h" |
3 | 3 | ||
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | class ANetNodeInstance; | 5 | class ANetNodeInstance; |
6 | class AsDevice; | 6 | class AsDevice; |
7 | 7 | ||
8 | class ProfileEdit : public ProfileGUI { | 8 | class ProfileEdit : public ProfileGUI { |
9 | 9 | ||
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public : | 12 | public : |
13 | 13 | ||
14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); | 14 | ProfileEdit( QWidget * parent, ANetNodeInstance * NNI ); |
15 | QString acceptable( void ); | 15 | QString acceptable( void ); |
16 | bool commit( ProfileData_t & Data ); | 16 | bool commit( ProfileData_t & Data ); |
17 | void showData( ProfileData_t & Data ); | 17 | void showData( ProfileData_t & Data ); |
18 | 18 | ||
19 | public slots : | 19 | public slots : |
20 | 20 | ||
21 | void SLOT_AutoRefresh( bool ); | 21 | void SLOT_AutoRefresh( bool ); |
22 | void SLOT_Refresh( void ); | 22 | void SLOT_Refresh( void ); |
23 | 23 | ||
24 | private : | 24 | private : |
25 | 25 | ||
26 | QTimer TrafficRefresh; | 26 | QTimer RefreshTimer; |
27 | ANetNodeInstance * NNI; | 27 | ANetNodeInstance * NNI; |
28 | AsDevice * Dev; | 28 | AsDevice * Dev; |
29 | }; | 29 | }; |
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp index feebf86..79bb93e 100644 --- a/noncore/settings/networksettings2/profile/profilerun.cpp +++ b/noncore/settings/networksettings2/profile/profilerun.cpp | |||
@@ -1,65 +1,65 @@ | |||
1 | #include <resources.h> | 1 | #include <resources.h> |
2 | 2 | ||
3 | #include "profilerun.h" | 3 | #include "profilerun.h" |
4 | 4 | ||
5 | void ProfileRun::detectState( NodeCollection * NC ) { | 5 | void ProfileRun::detectState( NodeCollection * NC ) { |
6 | if( Data->Disabled ) { | 6 | if( Data->Disabled ) { |
7 | NC->setCurrentState( Disabled ); | 7 | NC->setCurrentState( Disabled ); |
8 | } else { | 8 | } else { |
9 | // find next item in connection | 9 | // find next item in connection |
10 | // convert to runtime and ask to detect the state | 10 | // convert to runtime and ask to detect the state |
11 | netNode()->nextNode()->runtime()->detectState( NC ); | 11 | netNode()->nextNode()->runtime()->detectState( NC ); |
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | bool ProfileRun::setState( NodeCollection * NC, Action_t A ) { | 15 | bool ProfileRun::setState( NodeCollection * NC, Action_t A, bool ) { |
16 | ANetNodeInstance * NNNI; | 16 | ANetNodeInstance * NNNI; |
17 | 17 | ||
18 | NNNI = netNode()->nextNode(); | 18 | NNNI = netNode()->nextNode(); |
19 | switch ( A ) { | 19 | switch ( A ) { |
20 | case Enable : | 20 | case Enable : |
21 | if( NC->currentState() == Disabled ) { | 21 | if( NC->currentState() == Disabled ) { |
22 | Data->Disabled = 0; | 22 | Data->Disabled = 0; |
23 | NC->setCurrentState( Off ); // at least | 23 | NC->setCurrentState( Off ); // at least |
24 | // ... but request deeper | 24 | // ... but request deeper |
25 | NNNI->runtime()->detectState(NC); | 25 | NNNI->runtime()->detectState(NC); |
26 | } | 26 | } |
27 | return 1; | 27 | return 1; |
28 | case Disable : | 28 | case Disable : |
29 | switch( NC->currentState() ) { | 29 | switch( NC->currentState() ) { |
30 | case IsUp : | 30 | case IsUp : |
31 | case Available : | 31 | case Available : |
32 | // bring Deactivate (will bring down) | 32 | // bring Deactivate (will bring down) |
33 | if( ! NNNI->runtime()->setState(NC, Deactivate) ) | 33 | if( ! NNNI->runtime()->setState(NC, Deactivate) ) |
34 | return 0; | 34 | return 0; |
35 | default : | 35 | default : |
36 | break; | 36 | break; |
37 | } | 37 | } |
38 | Data->Disabled = 1; | 38 | Data->Disabled = 1; |
39 | NC->setCurrentState( Disabled ); | 39 | NC->setCurrentState( Disabled ); |
40 | return 1; | 40 | return 1; |
41 | default : | 41 | default : |
42 | break; | 42 | break; |
43 | } | 43 | } |
44 | return NNNI->runtime()->setState(NC, A); | 44 | return NNNI->runtime()->setState(NC, A); |
45 | } | 45 | } |
46 | 46 | ||
47 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { | 47 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { |
48 | RuntimeInfo * RI; | 48 | RuntimeInfo * RI; |
49 | switch ( A ) { | 49 | switch ( A ) { |
50 | case Enable : | 50 | case Enable : |
51 | case Disable : | 51 | case Disable : |
52 | // always possible | 52 | // always possible |
53 | return 1; | 53 | return 1; |
54 | default : | 54 | default : |
55 | break; | 55 | break; |
56 | } | 56 | } |
57 | RI = netNode()->nextNode()->runtime(); | 57 | RI = netNode()->nextNode()->runtime(); |
58 | return ( Curr != Disabled ) ? | 58 | return ( Curr != Disabled ) ? |
59 | RI->canSetState(Curr, A) : 0; | 59 | RI->canSetState(Curr, A) : 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | bool ProfileRun::handlesInterface( const QString & S ) { | 62 | bool ProfileRun::handlesInterface( const QString & S ) { |
63 | // donno -> pass deeper | 63 | // donno -> pass deeper |
64 | return netNode()->nextNode()->runtime()->handlesInterface(S); | 64 | return netNode()->nextNode()->runtime()->handlesInterface(S); |
65 | } | 65 | } |
diff --git a/noncore/settings/networksettings2/profile/profilerun.h b/noncore/settings/networksettings2/profile/profilerun.h index 6e8385c..c8ea063 100644 --- a/noncore/settings/networksettings2/profile/profilerun.h +++ b/noncore/settings/networksettings2/profile/profilerun.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef PROFILERUN_H | 1 | #ifndef PROFILERUN_H |
2 | #define PROFILERUN_H | 2 | #define PROFILERUN_H |
3 | 3 | ||
4 | #include <asfullsetup.h> | 4 | #include <asfullsetup.h> |
5 | #include "profiledata.h" | 5 | #include "profiledata.h" |
6 | 6 | ||
7 | class ProfileRun : public AsFullSetup { | 7 | class ProfileRun : public AsFullSetup { |
8 | 8 | ||
9 | public : | 9 | public : |
10 | 10 | ||
11 | ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : | 11 | ProfileRun( ANetNodeInstance * NNI, ProfileData & D ) : |
12 | AsFullSetup( NNI ) | 12 | AsFullSetup( NNI ) |
13 | { Data = &D; } | 13 | { Data = &D; } |
14 | 14 | ||
15 | void detectState( NodeCollection * NC ); | 15 | void detectState( NodeCollection * NC ); |
16 | bool setState( NodeCollection * NC, Action_t A ); | 16 | bool setState( NodeCollection * NC, Action_t A, bool ); |
17 | bool canSetState( State_t Curr, Action_t A ); | 17 | bool canSetState( State_t Curr, Action_t A ); |
18 | 18 | ||
19 | bool handlesInterface( const QString & I ); | 19 | bool handlesInterface( const QString & I ); |
20 | 20 | ||
21 | virtual const QString & description( void ) | 21 | virtual const QString & description( void ) |
22 | { return Data->Description; } | 22 | { return Data->Description; } |
23 | 23 | ||
24 | virtual AsFullSetup * asFullSetup( void ) | 24 | virtual AsFullSetup * asFullSetup( void ) |
25 | { return (AsFullSetup *)this; } | 25 | { return (AsFullSetup *)this; } |
26 | private : | 26 | private : |
27 | 27 | ||
28 | ProfileData * Data; | 28 | ProfileData * Data; |
29 | 29 | ||
30 | }; | 30 | }; |
31 | #endif | 31 | #endif |
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp index 4ce6721..beacd7b 100644 --- a/noncore/settings/networksettings2/usb/usbrun.cpp +++ b/noncore/settings/networksettings2/usb/usbrun.cpp | |||
@@ -1,176 +1,176 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <resources.h> | 4 | #include <resources.h> |
5 | #include "usbrun.h" | 5 | #include "usbrun.h" |
6 | 6 | ||
7 | void USBRun::detectState( NodeCollection * NC ) { | 7 | void USBRun::detectState( NodeCollection * NC ) { |
8 | // unavailable : no card found | 8 | // unavailable : no card found |
9 | // available : card found and assigned to us or free | 9 | // available : card found and assigned to us or free |
10 | // up : card found and assigned to us and up | 10 | // up : card found and assigned to us and up |
11 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | 11 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); |
12 | System & Sys = NSResources->system(); | 12 | System & Sys = NSResources->system(); |
13 | InterfaceInfo * Run; | 13 | InterfaceInfo * Run; |
14 | QFile F( S ); | 14 | QFile F( S ); |
15 | 15 | ||
16 | if( F.open( IO_ReadOnly ) ) { | 16 | if( F.open( IO_ReadOnly ) ) { |
17 | // could open file -> read interface and assign | 17 | // could open file -> read interface and assign |
18 | QString X; | 18 | QString X; |
19 | QTextStream TS(&F); | 19 | QTextStream TS(&F); |
20 | X = TS.readLine(); | 20 | X = TS.readLine(); |
21 | // find interface | 21 | // find interface |
22 | if( handlesInterface( X ) ) { | 22 | if( handlesInterface( X ) ) { |
23 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 23 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
24 | It.current(); | 24 | It.current(); |
25 | ++It ) { | 25 | ++It ) { |
26 | Run = It.current(); | 26 | Run = It.current(); |
27 | if( X == Run->Name ) { | 27 | if( X == Run->Name ) { |
28 | Run->assignNode( netNode() ); | 28 | Run->assignNode( netNode() ); |
29 | assignInterface( Run ); | 29 | assignInterface( Run ); |
30 | NC->setCurrentState( IsUp ); | 30 | NC->setCurrentState( IsUp ); |
31 | return; | 31 | return; |
32 | } | 32 | } |
33 | } | 33 | } |
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
37 | fprintf( stderr, "Assigned %p\n", assignedInterface() ); | 37 | fprintf( stderr, "Assigned %p\n", assignedInterface() ); |
38 | if( ( Run = assignedInterface() ) ) { | 38 | if( ( Run = assignedInterface() ) ) { |
39 | // we already have an interface assigned -> still present ? | 39 | // we already have an interface assigned -> still present ? |
40 | if( ! Run->IsUp ) { | 40 | if( ! Run->IsUp ) { |
41 | // usb is still free -> keep assignment | 41 | // usb is still free -> keep assignment |
42 | NC->setCurrentState( Available ); | 42 | NC->setCurrentState( Available ); |
43 | return; | 43 | return; |
44 | } // else interface is up but NOT us -> some other profile | 44 | } // else interface is up but NOT us -> some other profile |
45 | } | 45 | } |
46 | 46 | ||
47 | // nothing (valid) assigned to us | 47 | // nothing (valid) assigned to us |
48 | assignInterface( 0 ); | 48 | assignInterface( 0 ); |
49 | 49 | ||
50 | // find possible interface | 50 | // find possible interface |
51 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | 51 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); |
52 | It.current(); | 52 | It.current(); |
53 | ++It ) { | 53 | ++It ) { |
54 | Run = It.current(); | 54 | Run = It.current(); |
55 | 55 | ||
56 | fprintf( stderr, "%s %d %d=%d %d\n", | 56 | fprintf( stderr, "%s %d %d=%d %d\n", |
57 | Run->Name.latin1(), | 57 | Run->Name.latin1(), |
58 | handlesInterface( Run->Name ), | 58 | handlesInterface( Run->Name ), |
59 | Run->CardType, ARPHRD_ETHER, | 59 | Run->CardType, ARPHRD_ETHER, |
60 | ! Run->IsUp ); | 60 | ! Run->IsUp ); |
61 | 61 | ||
62 | if( handlesInterface( Run->Name ) && | 62 | if( handlesInterface( Run->Name ) && |
63 | Run->CardType == ARPHRD_ETHER && | 63 | Run->CardType == ARPHRD_ETHER && |
64 | ! Run->IsUp | 64 | ! Run->IsUp |
65 | ) { | 65 | ) { |
66 | fprintf( stderr, "Released(OFF)\n" ); | 66 | fprintf( stderr, "Released(OFF)\n" ); |
67 | // proper type, and Not UP -> free | 67 | // proper type, and Not UP -> free |
68 | NC->setCurrentState( Off ); | 68 | NC->setCurrentState( Off ); |
69 | return; | 69 | return; |
70 | } | 70 | } |
71 | } | 71 | } |
72 | // no free found | 72 | // no free found |
73 | fprintf( stderr, "UNA\n" ); | 73 | fprintf( stderr, "UNA\n" ); |
74 | 74 | ||
75 | NC->setCurrentState( Unavailable ); | 75 | NC->setCurrentState( Unavailable ); |
76 | } | 76 | } |
77 | 77 | ||
78 | bool USBRun::setState( NodeCollection * NC, Action_t A ) { | 78 | bool USBRun::setState( NodeCollection * NC, Action_t A, bool ) { |
79 | 79 | ||
80 | // we only handle activate and deactivate | 80 | // we only handle activate and deactivate |
81 | switch( A ) { | 81 | switch( A ) { |
82 | case Activate : | 82 | case Activate : |
83 | { | 83 | { |
84 | if( NC->currentState() != Off ) { | 84 | if( NC->currentState() != Off ) { |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | InterfaceInfo * N = getInterface(); | 87 | InterfaceInfo * N = getInterface(); |
88 | if( ! N ) { | 88 | if( ! N ) { |
89 | // no interface available | 89 | // no interface available |
90 | NC->setCurrentState( Unavailable ); | 90 | NC->setCurrentState( Unavailable ); |
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | // because we were OFF the interface | 93 | // because we were OFF the interface |
94 | // we get back is NOT assigned | 94 | // we get back is NOT assigned |
95 | N->assignNode( netNode() ); | 95 | N->assignNode( netNode() ); |
96 | assignInterface( N ); | 96 | assignInterface( N ); |
97 | fprintf( stderr, "Assing %p\n", N ); | 97 | fprintf( stderr, "Assing %p\n", N ); |
98 | NC->setCurrentState( Available ); | 98 | NC->setCurrentState( Available ); |
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | case Deactivate : | 101 | case Deactivate : |
102 | if( NC->currentState() == IsUp ) { | 102 | if( NC->currentState() == IsUp ) { |
103 | // bring down first | 103 | // bring down first |
104 | if( ! connection()->setState( Down ) ) | 104 | if( ! connection()->setState( Down ) ) |
105 | // could not ... | 105 | // could not ... |
106 | return 0; | 106 | return 0; |
107 | } else if( NC->currentState() != Available ) { | 107 | } else if( NC->currentState() != Available ) { |
108 | return 1; | 108 | return 1; |
109 | } | 109 | } |
110 | assignedInterface()->assignNode( 0 ); // release | 110 | assignedInterface()->assignNode( 0 ); // release |
111 | assignInterface( 0 ); | 111 | assignInterface( 0 ); |
112 | NC->setCurrentState( Off ); | 112 | NC->setCurrentState( Off ); |
113 | return 1; | 113 | return 1; |
114 | default : | 114 | default : |
115 | // FT | 115 | // FT |
116 | break; | 116 | break; |
117 | } | 117 | } |
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | bool USBRun::canSetState( State_t Curr, Action_t A ) { | 121 | bool USBRun::canSetState( State_t Curr, Action_t A ) { |
122 | // we only handle up down activate and deactivate | 122 | // we only handle up down activate and deactivate |
123 | switch( A ) { | 123 | switch( A ) { |
124 | case Activate : | 124 | case Activate : |
125 | { // at least available | 125 | { // at least available |
126 | if( Curr == Available ) { | 126 | if( Curr == Available ) { |
127 | return 1; | 127 | return 1; |
128 | } | 128 | } |
129 | // or we can make one available | 129 | // or we can make one available |
130 | InterfaceInfo * N = getInterface(); | 130 | InterfaceInfo * N = getInterface(); |
131 | if( ! N || N->assignedNode() != 0 ) { | 131 | if( ! N || N->assignedNode() != 0 ) { |
132 | // non available or assigned | 132 | // non available or assigned |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | return 1; | 135 | return 1; |
136 | } | 136 | } |
137 | case Deactivate : | 137 | case Deactivate : |
138 | return ( Curr >= Available ); | 138 | return ( Curr >= Available ); |
139 | default : | 139 | default : |
140 | // FT | 140 | // FT |
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | return 0; | 143 | return 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | // get interface that is free or assigned to us | 146 | // get interface that is free or assigned to us |
147 | InterfaceInfo * USBRun::getInterface( void ) { | 147 | InterfaceInfo * USBRun::getInterface( void ) { |
148 | 148 | ||
149 | System & S = NSResources->system(); | 149 | System & S = NSResources->system(); |
150 | InterfaceInfo * best = 0, * Run; | 150 | InterfaceInfo * best = 0, * Run; |
151 | QRegExp R( "usb[0-9abcdef]" ); | 151 | QRegExp R( "usb[0-9abcdef]" ); |
152 | 152 | ||
153 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | 153 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); |
154 | It.current(); | 154 | It.current(); |
155 | ++It ) { | 155 | ++It ) { |
156 | Run = It.current(); | 156 | Run = It.current(); |
157 | if( handlesInterface( Run->Name ) && | 157 | if( handlesInterface( Run->Name ) && |
158 | Run->CardType == ARPHRD_ETHER | 158 | Run->CardType == ARPHRD_ETHER |
159 | ) { | 159 | ) { |
160 | // this is a USB card | 160 | // this is a USB card |
161 | if( Run->assignedNode() == netNode() ) { | 161 | if( Run->assignedNode() == netNode() ) { |
162 | // assigned to us | 162 | // assigned to us |
163 | return Run; | 163 | return Run; |
164 | } else if( Run->assignedNode() == 0 ) { | 164 | } else if( Run->assignedNode() == 0 ) { |
165 | // free | 165 | // free |
166 | best = Run; | 166 | best = Run; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } | 169 | } |
170 | return best; // can be 0 | 170 | return best; // can be 0 |
171 | } | 171 | } |
172 | 172 | ||
173 | bool USBRun::handlesInterface( const QString & S ) { | 173 | bool USBRun::handlesInterface( const QString & S ) { |
174 | return Pat.match( S ) >= 0; | 174 | return Pat.match( S ) >= 0; |
175 | } | 175 | } |
176 | 176 | ||
diff --git a/noncore/settings/networksettings2/usb/usbrun.h b/noncore/settings/networksettings2/usb/usbrun.h index 6c6e4e4..03e21ab 100644 --- a/noncore/settings/networksettings2/usb/usbrun.h +++ b/noncore/settings/networksettings2/usb/usbrun.h | |||
@@ -1,37 +1,37 @@ | |||
1 | #ifndef USBRUN_H | 1 | #ifndef USBRUN_H |
2 | #define USBRUN_H | 2 | #define USBRUN_H |
3 | 3 | ||
4 | #include <asdevice.h> | 4 | #include <asdevice.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | #include "usbdata.h" | 6 | #include "usbdata.h" |
7 | 7 | ||
8 | class USBRun : public AsDevice { | 8 | class USBRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | USBRun( ANetNodeInstance * NNI, | 12 | USBRun( ANetNodeInstance * NNI, |
13 | USBData & Data ) : | 13 | USBData & Data ) : |
14 | AsDevice( NNI ), | 14 | AsDevice( NNI ), |
15 | Pat( "usb[0-9abcdef]" ) | 15 | Pat( "usb[0-9abcdef]" ) |
16 | { } | 16 | { } |
17 | 17 | ||
18 | virtual AsDevice * device( void ) | 18 | virtual AsDevice * device( void ) |
19 | { return (AsDevice *)this; } | 19 | { return (AsDevice *)this; } |
20 | 20 | ||
21 | virtual AsDevice * asDevice( void ) | 21 | virtual AsDevice * asDevice( void ) |
22 | { return (AsDevice *)this; } | 22 | { return (AsDevice *)this; } |
23 | protected : | 23 | protected : |
24 | 24 | ||
25 | void detectState( NodeCollection * ); | 25 | void detectState( NodeCollection * ); |
26 | bool setState( NodeCollection * , Action_t A ); | 26 | bool setState( NodeCollection * , Action_t A, bool ); |
27 | bool canSetState( State_t , Action_t A ); | 27 | bool canSetState( State_t , Action_t A ); |
28 | 28 | ||
29 | bool handlesInterface( const QString & I ); | 29 | bool handlesInterface( const QString & I ); |
30 | 30 | ||
31 | private : | 31 | private : |
32 | 32 | ||
33 | InterfaceInfo * getInterface( void ); | 33 | InterfaceInfo * getInterface( void ); |
34 | QRegExp Pat; | 34 | QRegExp Pat; |
35 | 35 | ||
36 | }; | 36 | }; |
37 | #endif | 37 | #endif |
diff --git a/noncore/settings/networksettings2/vpn/vpnrun.h b/noncore/settings/networksettings2/vpn/vpnrun.h index 4d26298..c19b609 100644 --- a/noncore/settings/networksettings2/vpn/vpnrun.h +++ b/noncore/settings/networksettings2/vpn/vpnrun.h | |||
@@ -1,32 +1,32 @@ | |||
1 | #ifndef VPNRUN_H | 1 | #ifndef VPNRUN_H |
2 | #define VPNRUN_H | 2 | #define VPNRUN_H |
3 | 3 | ||
4 | #include <asconnection.h> | 4 | #include <asconnection.h> |
5 | #include "vpndata.h" | 5 | #include "vpndata.h" |
6 | 6 | ||
7 | class VPNRun : public AsConnection { | 7 | class VPNRun : public AsConnection { |
8 | 8 | ||
9 | public : | 9 | public : |
10 | 10 | ||
11 | VPNRun( ANetNodeInstance * NNI, VPNData & Data ) : | 11 | VPNRun( ANetNodeInstance * NNI, VPNData & Data ) : |
12 | AsConnection( NNI ) | 12 | AsConnection( NNI ) |
13 | { } | 13 | { } |
14 | 14 | ||
15 | virtual AsConnection * asConnection( void ) | 15 | virtual AsConnection * asConnection( void ) |
16 | { return (AsConnection *)this; } | 16 | { return (AsConnection *)this; } |
17 | protected : | 17 | protected : |
18 | 18 | ||
19 | void detectState( NodeCollection * ) | 19 | void detectState( NodeCollection * ) |
20 | { } | 20 | { } |
21 | 21 | ||
22 | bool setState( NodeCollection *, Action_t ) | 22 | bool setState( NodeCollection *, Action_t, bool ) |
23 | { return 0; } | 23 | { return 0; } |
24 | 24 | ||
25 | bool canSetState( State_t, Action_t ) | 25 | bool canSetState( State_t, Action_t ) |
26 | { return 0; } | 26 | { return 0; } |
27 | 27 | ||
28 | bool handlesInterface( const QString & I ); | 28 | bool handlesInterface( const QString & I ); |
29 | 29 | ||
30 | }; | 30 | }; |
31 | 31 | ||
32 | #endif | 32 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlanGUI.ui b/noncore/settings/networksettings2/wlan/wlanGUI.ui index 9614369..1aec138 100644 --- a/noncore/settings/networksettings2/wlan/wlanGUI.ui +++ b/noncore/settings/networksettings2/wlan/wlanGUI.ui | |||
@@ -1,975 +1,1021 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>WLanGUI</class> | 2 | <class>WLanGUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>WLanGUI</cstring> | 7 | <cstring>WLanGUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>192</width> | 14 | <width>209</width> |
15 | <height>329</height> | 15 | <height>307</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>0</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>0</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>WLan_TAB</cstring> | 41 | <cstring>WLan_TAB</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>enabled</name> | 44 | <name>enabled</name> |
45 | <bool>true</bool> | 45 | <bool>true</bool> |
46 | </property> | 46 | </property> |
47 | <property> | 47 | <property> |
48 | <name>layoutMargin</name> | 48 | <name>layoutMargin</name> |
49 | </property> | 49 | </property> |
50 | <property> | 50 | <property> |
51 | <name>layoutSpacing</name> | 51 | <name>layoutSpacing</name> |
52 | </property> | 52 | </property> |
53 | <widget> | 53 | <widget> |
54 | <class>QWidget</class> | 54 | <class>QWidget</class> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>name</name> | 56 | <name>name</name> |
57 | <cstring>ConfigPage</cstring> | 57 | <cstring>ConfigPage</cstring> |
58 | </property> | 58 | </property> |
59 | <attribute> | 59 | <attribute> |
60 | <name>title</name> | 60 | <name>title</name> |
61 | <string>General</string> | 61 | <string>General</string> |
62 | </attribute> | 62 | </attribute> |
63 | <vbox> | 63 | <vbox> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>margin</name> | 65 | <name>margin</name> |
66 | <number>0</number> | 66 | <number>0</number> |
67 | </property> | 67 | </property> |
68 | <property stdset="1"> | 68 | <property stdset="1"> |
69 | <name>spacing</name> | 69 | <name>spacing</name> |
70 | <number>2</number> | 70 | <number>2</number> |
71 | </property> | 71 | </property> |
72 | <widget> | 72 | <widget> |
73 | <class>QLayoutWidget</class> | 73 | <class>QLayoutWidget</class> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>name</name> | 75 | <name>name</name> |
76 | <cstring>Layout6</cstring> | 76 | <cstring>Layout11</cstring> |
77 | </property> | 77 | </property> |
78 | <property> | 78 | <property> |
79 | <name>layoutMargin</name> | 79 | <name>layoutSpacing</name> |
80 | </property> | 80 | </property> |
81 | <grid> | 81 | <grid> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>margin</name> | 83 | <name>margin</name> |
84 | <number>1</number> | 84 | <number>0</number> |
85 | </property> | 85 | </property> |
86 | <property stdset="1"> | 86 | <property stdset="1"> |
87 | <name>spacing</name> | 87 | <name>spacing</name> |
88 | <number>6</number> | 88 | <number>1</number> |
89 | </property> | 89 | </property> |
90 | <widget row="1" column="0" > | 90 | <widget row="0" column="1" > |
91 | <class>QLabel</class> | 91 | <class>QComboBox</class> |
92 | <item> | ||
93 | <property> | ||
94 | <name>text</name> | ||
95 | <string>Auto</string> | ||
96 | </property> | ||
97 | </item> | ||
98 | <item> | ||
99 | <property> | ||
100 | <name>text</name> | ||
101 | <string>Managed</string> | ||
102 | </property> | ||
103 | </item> | ||
104 | <item> | ||
105 | <property> | ||
106 | <name>text</name> | ||
107 | <string>Ad-Hoc</string> | ||
108 | </property> | ||
109 | </item> | ||
92 | <property stdset="1"> | 110 | <property stdset="1"> |
93 | <name>name</name> | 111 | <name>name</name> |
94 | <cstring>essidLabel</cstring> | 112 | <cstring>Mode_CB</cstring> |
95 | </property> | 113 | </property> |
96 | <property stdset="1"> | 114 | <property stdset="1"> |
97 | <name>enabled</name> | 115 | <name>enabled</name> |
98 | <bool>true</bool> | 116 | <bool>true</bool> |
99 | </property> | 117 | </property> |
100 | <property stdset="1"> | 118 | <property stdset="1"> |
101 | <name>sizePolicy</name> | 119 | <name>sizePolicy</name> |
102 | <sizepolicy> | 120 | <sizepolicy> |
103 | <hsizetype>1</hsizetype> | 121 | <hsizetype>1</hsizetype> |
104 | <vsizetype>1</vsizetype> | 122 | <vsizetype>0</vsizetype> |
105 | </sizepolicy> | 123 | </sizepolicy> |
106 | </property> | 124 | </property> |
107 | <property stdset="1"> | ||
108 | <name>text</name> | ||
109 | <string>ESS-ID</string> | ||
110 | </property> | ||
111 | </widget> | 125 | </widget> |
112 | <widget row="1" column="1" > | 126 | <widget row="2" column="0" > |
113 | <class>QComboBox</class> | 127 | <class>QLabel</class> |
114 | <item> | ||
115 | <property> | ||
116 | <name>text</name> | ||
117 | <string>any</string> | ||
118 | </property> | ||
119 | </item> | ||
120 | <property stdset="1"> | 128 | <property stdset="1"> |
121 | <name>name</name> | 129 | <name>name</name> |
122 | <cstring>ESSID_CB</cstring> | 130 | <cstring>essidLabel_2</cstring> |
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>sizePolicy</name> | ||
126 | <sizepolicy> | ||
127 | <hsizetype>7</hsizetype> | ||
128 | <vsizetype>0</vsizetype> | ||
129 | </sizepolicy> | ||
130 | </property> | 131 | </property> |
131 | <property stdset="1"> | 132 | <property stdset="1"> |
132 | <name>editable</name> | 133 | <name>enabled</name> |
133 | <bool>true</bool> | 134 | <bool>true</bool> |
134 | </property> | 135 | </property> |
135 | <property stdset="1"> | 136 | <property stdset="1"> |
136 | <name>currentItem</name> | 137 | <name>sizePolicy</name> |
137 | <number>0</number> | 138 | <sizepolicy> |
138 | </property> | 139 | <hsizetype>1</hsizetype> |
139 | <property stdset="1"> | 140 | <vsizetype>1</vsizetype> |
140 | <name>sizeLimit</name> | 141 | </sizepolicy> |
141 | <number>5</number> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>autoCompletion</name> | ||
145 | <bool>true</bool> | ||
146 | </property> | 142 | </property> |
147 | <property stdset="1"> | 143 | <property stdset="1"> |
148 | <name>duplicatesEnabled</name> | 144 | <name>text</name> |
149 | <bool>false</bool> | 145 | <string>Name</string> |
150 | </property> | 146 | </property> |
151 | </widget> | 147 | </widget> |
152 | <widget row="0" column="0" > | 148 | <widget row="0" column="0" > |
153 | <class>QLabel</class> | 149 | <class>QLabel</class> |
154 | <property stdset="1"> | 150 | <property stdset="1"> |
155 | <name>name</name> | 151 | <name>name</name> |
156 | <cstring>modeLabel</cstring> | 152 | <cstring>modeLabel</cstring> |
157 | </property> | 153 | </property> |
158 | <property stdset="1"> | 154 | <property stdset="1"> |
159 | <name>enabled</name> | 155 | <name>enabled</name> |
160 | <bool>true</bool> | 156 | <bool>true</bool> |
161 | </property> | 157 | </property> |
162 | <property stdset="1"> | 158 | <property stdset="1"> |
163 | <name>sizePolicy</name> | 159 | <name>sizePolicy</name> |
164 | <sizepolicy> | 160 | <sizepolicy> |
165 | <hsizetype>1</hsizetype> | 161 | <hsizetype>1</hsizetype> |
166 | <vsizetype>1</vsizetype> | 162 | <vsizetype>1</vsizetype> |
167 | </sizepolicy> | 163 | </sizepolicy> |
168 | </property> | 164 | </property> |
169 | <property stdset="1"> | 165 | <property stdset="1"> |
170 | <name>text</name> | 166 | <name>text</name> |
171 | <string>Mode</string> | 167 | <string>Mode</string> |
172 | </property> | 168 | </property> |
173 | </widget> | 169 | </widget> |
174 | <widget row="0" column="1" > | 170 | <widget row="1" column="1" > |
175 | <class>QComboBox</class> | 171 | <class>QLineEdit</class> |
176 | <item> | ||
177 | <property> | ||
178 | <name>text</name> | ||
179 | <string>Infrastructure</string> | ||
180 | </property> | ||
181 | </item> | ||
182 | <item> | ||
183 | <property> | ||
184 | <name>text</name> | ||
185 | <string>Auto</string> | ||
186 | </property> | ||
187 | </item> | ||
188 | <item> | ||
189 | <property> | ||
190 | <name>text</name> | ||
191 | <string>Managed</string> | ||
192 | </property> | ||
193 | </item> | ||
194 | <item> | ||
195 | <property> | ||
196 | <name>text</name> | ||
197 | <string>Ad-Hoc</string> | ||
198 | </property> | ||
199 | </item> | ||
200 | <property stdset="1"> | 172 | <property stdset="1"> |
201 | <name>name</name> | 173 | <name>name</name> |
202 | <cstring>Mode_CB</cstring> | 174 | <cstring>ESSID_LE</cstring> |
175 | </property> | ||
176 | </widget> | ||
177 | <widget row="1" column="0" > | ||
178 | <class>QLabel</class> | ||
179 | <property stdset="1"> | ||
180 | <name>name</name> | ||
181 | <cstring>essidLabel</cstring> | ||
203 | </property> | 182 | </property> |
204 | <property stdset="1"> | 183 | <property stdset="1"> |
205 | <name>enabled</name> | 184 | <name>enabled</name> |
206 | <bool>true</bool> | 185 | <bool>true</bool> |
207 | </property> | 186 | </property> |
208 | <property stdset="1"> | 187 | <property stdset="1"> |
209 | <name>sizePolicy</name> | 188 | <name>sizePolicy</name> |
210 | <sizepolicy> | 189 | <sizepolicy> |
211 | <hsizetype>1</hsizetype> | 190 | <hsizetype>1</hsizetype> |
212 | <vsizetype>0</vsizetype> | 191 | <vsizetype>1</vsizetype> |
213 | </sizepolicy> | 192 | </sizepolicy> |
214 | </property> | 193 | </property> |
194 | <property stdset="1"> | ||
195 | <name>text</name> | ||
196 | <string>ESS-ID</string> | ||
197 | </property> | ||
198 | </widget> | ||
199 | <widget row="2" column="1" > | ||
200 | <class>QLineEdit</class> | ||
201 | <property stdset="1"> | ||
202 | <name>name</name> | ||
203 | <cstring>NodeName_LE</cstring> | ||
204 | </property> | ||
205 | <property stdset="1"> | ||
206 | <name>text</name> | ||
207 | <string><UseHostName></string> | ||
208 | </property> | ||
215 | </widget> | 209 | </widget> |
216 | </grid> | 210 | </grid> |
217 | </widget> | 211 | </widget> |
218 | <widget> | 212 | <widget> |
219 | <class>QLayoutWidget</class> | 213 | <class>QLayoutWidget</class> |
220 | <property stdset="1"> | 214 | <property stdset="1"> |
221 | <name>name</name> | 215 | <name>name</name> |
222 | <cstring>Layout8</cstring> | 216 | <cstring>Layout8</cstring> |
223 | </property> | 217 | </property> |
224 | <property> | 218 | <property> |
225 | <name>layoutMargin</name> | 219 | <name>layoutMargin</name> |
226 | </property> | 220 | </property> |
227 | <property> | 221 | <property> |
228 | <name>layoutSpacing</name> | 222 | <name>layoutSpacing</name> |
229 | </property> | 223 | </property> |
230 | <grid> | 224 | <grid> |
231 | <property stdset="1"> | 225 | <property stdset="1"> |
232 | <name>margin</name> | 226 | <name>margin</name> |
233 | <number>1</number> | 227 | <number>1</number> |
234 | </property> | 228 | </property> |
235 | <property stdset="1"> | 229 | <property stdset="1"> |
236 | <name>spacing</name> | 230 | <name>spacing</name> |
237 | <number>2</number> | 231 | <number>2</number> |
238 | </property> | 232 | </property> |
239 | <widget row="0" column="0" rowspan="1" colspan="3" > | 233 | <widget row="0" column="0" rowspan="1" colspan="3" > |
240 | <class>QCheckBox</class> | 234 | <class>QCheckBox</class> |
241 | <property stdset="1"> | 235 | <property stdset="1"> |
242 | <name>name</name> | 236 | <name>name</name> |
243 | <cstring>SpecifyAP_CB</cstring> | 237 | <cstring>SpecifyAP_CB</cstring> |
244 | </property> | 238 | </property> |
245 | <property stdset="1"> | 239 | <property stdset="1"> |
246 | <name>text</name> | 240 | <name>text</name> |
247 | <string>Specify &Access Point</string> | 241 | <string>Specify Access Point</string> |
248 | </property> | 242 | </property> |
249 | </widget> | 243 | </widget> |
250 | <widget row="1" column="1" > | 244 | <widget row="1" column="1" > |
251 | <class>QLabel</class> | 245 | <class>QLabel</class> |
252 | <property stdset="1"> | 246 | <property stdset="1"> |
253 | <name>name</name> | 247 | <name>name</name> |
254 | <cstring>macLabel</cstring> | 248 | <cstring>macLabel</cstring> |
255 | </property> | 249 | </property> |
256 | <property stdset="1"> | 250 | <property stdset="1"> |
257 | <name>enabled</name> | 251 | <name>enabled</name> |
258 | <bool>false</bool> | 252 | <bool>false</bool> |
259 | </property> | 253 | </property> |
260 | <property stdset="1"> | 254 | <property stdset="1"> |
261 | <name>sizePolicy</name> | 255 | <name>sizePolicy</name> |
262 | <sizepolicy> | 256 | <sizepolicy> |
263 | <hsizetype>0</hsizetype> | 257 | <hsizetype>0</hsizetype> |
264 | <vsizetype>1</vsizetype> | 258 | <vsizetype>1</vsizetype> |
265 | </sizepolicy> | 259 | </sizepolicy> |
266 | </property> | 260 | </property> |
267 | <property stdset="1"> | 261 | <property stdset="1"> |
268 | <name>text</name> | 262 | <name>text</name> |
269 | <string>MAC</string> | 263 | <string>MAC</string> |
270 | </property> | 264 | </property> |
271 | </widget> | 265 | </widget> |
272 | <widget row="1" column="2" > | 266 | <widget row="1" column="2" > |
273 | <class>QLineEdit</class> | 267 | <class>QLineEdit</class> |
274 | <property stdset="1"> | 268 | <property stdset="1"> |
275 | <name>name</name> | 269 | <name>name</name> |
276 | <cstring>APMac_LE</cstring> | 270 | <cstring>APMac_LE</cstring> |
277 | </property> | 271 | </property> |
278 | <property stdset="1"> | 272 | <property stdset="1"> |
279 | <name>enabled</name> | 273 | <name>enabled</name> |
280 | <bool>false</bool> | 274 | <bool>false</bool> |
281 | </property> | 275 | </property> |
282 | <property stdset="1"> | 276 | <property stdset="1"> |
283 | <name>sizePolicy</name> | 277 | <name>sizePolicy</name> |
284 | <sizepolicy> | 278 | <sizepolicy> |
285 | <hsizetype>7</hsizetype> | 279 | <hsizetype>7</hsizetype> |
286 | <vsizetype>1</vsizetype> | 280 | <vsizetype>1</vsizetype> |
287 | </sizepolicy> | 281 | </sizepolicy> |
288 | </property> | 282 | </property> |
289 | </widget> | 283 | </widget> |
290 | <spacer row="1" column="0" > | 284 | <spacer row="1" column="0" > |
291 | <property> | 285 | <property> |
292 | <name>name</name> | 286 | <name>name</name> |
293 | <cstring>Spacer8</cstring> | 287 | <cstring>Spacer8</cstring> |
294 | </property> | 288 | </property> |
295 | <property stdset="1"> | 289 | <property stdset="1"> |
296 | <name>orientation</name> | 290 | <name>orientation</name> |
297 | <enum>Horizontal</enum> | 291 | <enum>Horizontal</enum> |
298 | </property> | 292 | </property> |
299 | <property stdset="1"> | 293 | <property stdset="1"> |
300 | <name>sizeType</name> | 294 | <name>sizeType</name> |
301 | <enum>Fixed</enum> | 295 | <enum>Fixed</enum> |
302 | </property> | 296 | </property> |
303 | <property> | 297 | <property> |
304 | <name>sizeHint</name> | 298 | <name>sizeHint</name> |
305 | <size> | 299 | <size> |
306 | <width>20</width> | 300 | <width>20</width> |
307 | <height>20</height> | 301 | <height>20</height> |
308 | </size> | 302 | </size> |
309 | </property> | 303 | </property> |
310 | </spacer> | 304 | </spacer> |
311 | </grid> | 305 | </grid> |
312 | </widget> | 306 | </widget> |
313 | <widget> | ||
314 | <class>QLayoutWidget</class> | ||
315 | <property stdset="1"> | ||
316 | <name>name</name> | ||
317 | <cstring>Layout7</cstring> | ||
318 | </property> | ||
319 | <property> | ||
320 | <name>layoutMargin</name> | ||
321 | </property> | ||
322 | <hbox> | ||
323 | <property stdset="1"> | ||
324 | <name>margin</name> | ||
325 | <number>1</number> | ||
326 | </property> | ||
327 | <property stdset="1"> | ||
328 | <name>spacing</name> | ||
329 | <number>6</number> | ||
330 | </property> | ||
331 | <widget> | ||
332 | <class>QCheckBox</class> | ||
333 | <property stdset="1"> | ||
334 | <name>name</name> | ||
335 | <cstring>SpecifyChannel_CB</cstring> | ||
336 | </property> | ||
337 | <property stdset="1"> | ||
338 | <name>text</name> | ||
339 | <string>Specific &Channel</string> | ||
340 | </property> | ||
341 | </widget> | ||
342 | <widget> | ||
343 | <class>QSpinBox</class> | ||
344 | <property stdset="1"> | ||
345 | <name>name</name> | ||
346 | <cstring>ChannelNr_SB</cstring> | ||
347 | </property> | ||
348 | <property stdset="1"> | ||
349 | <name>enabled</name> | ||
350 | <bool>false</bool> | ||
351 | </property> | ||
352 | <property stdset="1"> | ||
353 | <name>maxValue</name> | ||
354 | <number>15</number> | ||
355 | </property> | ||
356 | <property stdset="1"> | ||
357 | <name>minValue</name> | ||
358 | <number>1</number> | ||
359 | </property> | ||
360 | <property stdset="1"> | ||
361 | <name>value</name> | ||
362 | <number>1</number> | ||
363 | </property> | ||
364 | </widget> | ||
365 | </hbox> | ||
366 | </widget> | ||
367 | <spacer> | 307 | <spacer> |
368 | <property> | 308 | <property> |
369 | <name>name</name> | 309 | <name>name</name> |
370 | <cstring>Spacer7</cstring> | 310 | <cstring>Spacer7</cstring> |
371 | </property> | 311 | </property> |
372 | <property stdset="1"> | 312 | <property stdset="1"> |
373 | <name>orientation</name> | 313 | <name>orientation</name> |
374 | <enum>Vertical</enum> | 314 | <enum>Vertical</enum> |
375 | </property> | 315 | </property> |
376 | <property stdset="1"> | 316 | <property stdset="1"> |
377 | <name>sizeType</name> | 317 | <name>sizeType</name> |
378 | <enum>Expanding</enum> | 318 | <enum>Expanding</enum> |
379 | </property> | 319 | </property> |
380 | <property> | 320 | <property> |
381 | <name>sizeHint</name> | 321 | <name>sizeHint</name> |
382 | <size> | 322 | <size> |
383 | <width>20</width> | 323 | <width>20</width> |
384 | <height>20</height> | 324 | <height>20</height> |
385 | </size> | 325 | </size> |
386 | </property> | 326 | </property> |
387 | </spacer> | 327 | </spacer> |
388 | </vbox> | 328 | </vbox> |
389 | </widget> | 329 | </widget> |
390 | <widget> | 330 | <widget> |
391 | <class>QWidget</class> | 331 | <class>QWidget</class> |
392 | <property stdset="1"> | 332 | <property stdset="1"> |
393 | <name>name</name> | 333 | <name>name</name> |
394 | <cstring>WepPage</cstring> | 334 | <cstring>WepPage</cstring> |
395 | </property> | 335 | </property> |
396 | <attribute> | 336 | <attribute> |
397 | <name>title</name> | 337 | <name>title</name> |
398 | <string>Encryption</string> | 338 | <string>Encryption</string> |
399 | </attribute> | 339 | </attribute> |
400 | <vbox> | 340 | <vbox> |
401 | <property stdset="1"> | 341 | <property stdset="1"> |
402 | <name>margin</name> | 342 | <name>margin</name> |
403 | <number>2</number> | 343 | <number>2</number> |
404 | </property> | 344 | </property> |
405 | <property stdset="1"> | 345 | <property stdset="1"> |
406 | <name>spacing</name> | 346 | <name>spacing</name> |
407 | <number>2</number> | 347 | <number>2</number> |
408 | </property> | 348 | </property> |
409 | <widget> | 349 | <widget> |
410 | <class>QCheckBox</class> | 350 | <class>QCheckBox</class> |
411 | <property stdset="1"> | 351 | <property stdset="1"> |
412 | <name>name</name> | 352 | <name>name</name> |
413 | <cstring>EnableWEB_CB</cstring> | 353 | <cstring>EnableWEP_CB</cstring> |
414 | </property> | 354 | </property> |
415 | <property stdset="1"> | 355 | <property stdset="1"> |
416 | <name>text</name> | 356 | <name>text</name> |
417 | <string>&Enable Encryption</string> | 357 | <string>&Enable Encryption</string> |
418 | </property> | 358 | </property> |
419 | </widget> | 359 | </widget> |
420 | <widget> | 360 | <widget> |
421 | <class>QButtonGroup</class> | 361 | <class>QButtonGroup</class> |
422 | <property stdset="1"> | 362 | <property stdset="1"> |
423 | <name>name</name> | 363 | <name>name</name> |
424 | <cstring>KeyButtonGroup</cstring> | 364 | <cstring>KeyButtonGroup</cstring> |
425 | </property> | 365 | </property> |
426 | <property stdset="1"> | 366 | <property stdset="1"> |
427 | <name>enabled</name> | 367 | <name>enabled</name> |
428 | <bool>false</bool> | 368 | <bool>false</bool> |
429 | </property> | 369 | </property> |
430 | <property stdset="1"> | 370 | <property stdset="1"> |
431 | <name>title</name> | 371 | <name>title</name> |
432 | <string>&Key Setting</string> | 372 | <string>&Key Setting</string> |
433 | </property> | 373 | </property> |
434 | <property> | 374 | <property> |
435 | <name>layoutMargin</name> | 375 | <name>layoutMargin</name> |
436 | </property> | 376 | </property> |
437 | <property> | 377 | <property> |
438 | <name>layoutSpacing</name> | 378 | <name>layoutSpacing</name> |
439 | </property> | 379 | </property> |
440 | <grid> | 380 | <grid> |
441 | <property stdset="1"> | 381 | <property stdset="1"> |
442 | <name>margin</name> | 382 | <name>margin</name> |
443 | <number>2</number> | 383 | <number>2</number> |
444 | </property> | 384 | </property> |
445 | <property stdset="1"> | 385 | <property stdset="1"> |
446 | <name>spacing</name> | 386 | <name>spacing</name> |
447 | <number>2</number> | 387 | <number>2</number> |
448 | </property> | 388 | </property> |
449 | <widget row="0" column="0" > | 389 | <widget row="0" column="0" > |
450 | <class>QRadioButton</class> | 390 | <class>QRadioButton</class> |
451 | <property stdset="1"> | 391 | <property stdset="1"> |
452 | <name>name</name> | 392 | <name>name</name> |
453 | <cstring>Key1_RB</cstring> | 393 | <cstring>Key1_RB</cstring> |
454 | </property> | 394 | </property> |
455 | <property stdset="1"> | 395 | <property stdset="1"> |
456 | <name>text</name> | 396 | <name>text</name> |
457 | <string>Key &1</string> | 397 | <string>Key &1</string> |
458 | </property> | 398 | </property> |
459 | <property stdset="1"> | 399 | <property stdset="1"> |
460 | <name>checked</name> | 400 | <name>checked</name> |
461 | <bool>true</bool> | 401 | <bool>true</bool> |
462 | </property> | 402 | </property> |
463 | </widget> | 403 | </widget> |
464 | <widget row="3" column="0" > | 404 | <widget row="3" column="0" > |
465 | <class>QRadioButton</class> | 405 | <class>QRadioButton</class> |
466 | <property stdset="1"> | 406 | <property stdset="1"> |
467 | <name>name</name> | 407 | <name>name</name> |
468 | <cstring>Key4_RB</cstring> | 408 | <cstring>Key4_RB</cstring> |
469 | </property> | 409 | </property> |
470 | <property stdset="1"> | 410 | <property stdset="1"> |
471 | <name>text</name> | 411 | <name>text</name> |
472 | <string>Key &4</string> | 412 | <string>Key &4</string> |
473 | </property> | 413 | </property> |
474 | </widget> | 414 | </widget> |
475 | <widget row="0" column="1" > | 415 | <widget row="0" column="1" > |
476 | <class>QLineEdit</class> | 416 | <class>QLineEdit</class> |
477 | <property stdset="1"> | 417 | <property stdset="1"> |
478 | <name>name</name> | 418 | <name>name</name> |
479 | <cstring>Key1_LE</cstring> | 419 | <cstring>Key1_LE</cstring> |
480 | </property> | 420 | </property> |
481 | <property stdset="1"> | 421 | <property stdset="1"> |
482 | <name>frame</name> | 422 | <name>frame</name> |
483 | <bool>true</bool> | 423 | <bool>true</bool> |
484 | </property> | 424 | </property> |
485 | </widget> | 425 | </widget> |
486 | <widget row="1" column="0" > | 426 | <widget row="1" column="0" > |
487 | <class>QRadioButton</class> | 427 | <class>QRadioButton</class> |
488 | <property stdset="1"> | 428 | <property stdset="1"> |
489 | <name>name</name> | 429 | <name>name</name> |
490 | <cstring>Key2_RB</cstring> | 430 | <cstring>Key2_RB</cstring> |
491 | </property> | 431 | </property> |
492 | <property stdset="1"> | 432 | <property stdset="1"> |
493 | <name>text</name> | 433 | <name>text</name> |
494 | <string>Key &2</string> | 434 | <string>Key &2</string> |
495 | </property> | 435 | </property> |
496 | </widget> | 436 | </widget> |
497 | <widget row="2" column="0" > | 437 | <widget row="2" column="0" > |
498 | <class>QRadioButton</class> | 438 | <class>QRadioButton</class> |
499 | <property stdset="1"> | 439 | <property stdset="1"> |
500 | <name>name</name> | 440 | <name>name</name> |
501 | <cstring>Key3_RB</cstring> | 441 | <cstring>Key3_RB</cstring> |
502 | </property> | 442 | </property> |
503 | <property stdset="1"> | 443 | <property stdset="1"> |
504 | <name>text</name> | 444 | <name>text</name> |
505 | <string>Key &3</string> | 445 | <string>Key &3</string> |
506 | </property> | 446 | </property> |
507 | </widget> | 447 | </widget> |
508 | <widget row="1" column="1" > | 448 | <widget row="1" column="1" > |
509 | <class>QLineEdit</class> | 449 | <class>QLineEdit</class> |
510 | <property stdset="1"> | 450 | <property stdset="1"> |
511 | <name>name</name> | 451 | <name>name</name> |
512 | <cstring>Key2_LE</cstring> | 452 | <cstring>Key2_LE</cstring> |
513 | </property> | 453 | </property> |
454 | <property stdset="1"> | ||
455 | <name>enabled</name> | ||
456 | <bool>false</bool> | ||
457 | </property> | ||
514 | </widget> | 458 | </widget> |
515 | <widget row="3" column="1" > | 459 | <widget row="3" column="1" > |
516 | <class>QLineEdit</class> | 460 | <class>QLineEdit</class> |
517 | <property stdset="1"> | 461 | <property stdset="1"> |
518 | <name>name</name> | 462 | <name>name</name> |
519 | <cstring>Key4_LE</cstring> | 463 | <cstring>Key4_LE</cstring> |
520 | </property> | 464 | </property> |
465 | <property stdset="1"> | ||
466 | <name>enabled</name> | ||
467 | <bool>false</bool> | ||
468 | </property> | ||
521 | </widget> | 469 | </widget> |
522 | <widget row="2" column="1" > | 470 | <widget row="2" column="1" > |
523 | <class>QLineEdit</class> | 471 | <class>QLineEdit</class> |
524 | <property stdset="1"> | 472 | <property stdset="1"> |
525 | <name>name</name> | 473 | <name>name</name> |
526 | <cstring>Key3_LE</cstring> | 474 | <cstring>Key3_LE</cstring> |
527 | </property> | 475 | </property> |
476 | <property stdset="1"> | ||
477 | <name>enabled</name> | ||
478 | <bool>false</bool> | ||
479 | </property> | ||
528 | </widget> | 480 | </widget> |
529 | </grid> | 481 | </grid> |
530 | </widget> | 482 | </widget> |
531 | <widget> | 483 | <widget> |
532 | <class>QCheckBox</class> | 484 | <class>QCheckBox</class> |
533 | <property stdset="1"> | 485 | <property stdset="1"> |
534 | <name>name</name> | 486 | <name>name</name> |
535 | <cstring>CheckBox4</cstring> | 487 | <cstring>AcceptNonEncrypted_CB</cstring> |
536 | </property> | 488 | </property> |
537 | <property stdset="1"> | 489 | <property stdset="1"> |
538 | <name>enabled</name> | 490 | <name>enabled</name> |
539 | <bool>false</bool> | 491 | <bool>false</bool> |
540 | </property> | 492 | </property> |
541 | <property stdset="1"> | 493 | <property stdset="1"> |
542 | <name>text</name> | 494 | <name>text</name> |
543 | <string>Accept Non-Encrypted packets</string> | 495 | <string>Accept Non-Encrypted packets</string> |
544 | </property> | 496 | </property> |
545 | </widget> | 497 | </widget> |
546 | <spacer> | 498 | <spacer> |
547 | <property> | 499 | <property> |
548 | <name>name</name> | 500 | <name>name</name> |
549 | <cstring>Spacer30</cstring> | 501 | <cstring>Spacer30</cstring> |
550 | </property> | 502 | </property> |
551 | <property stdset="1"> | 503 | <property stdset="1"> |
552 | <name>orientation</name> | 504 | <name>orientation</name> |
553 | <enum>Vertical</enum> | 505 | <enum>Vertical</enum> |
554 | </property> | 506 | </property> |
555 | <property stdset="1"> | 507 | <property stdset="1"> |
556 | <name>sizeType</name> | 508 | <name>sizeType</name> |
557 | <enum>Expanding</enum> | 509 | <enum>Expanding</enum> |
558 | </property> | 510 | </property> |
559 | <property> | 511 | <property> |
560 | <name>sizeHint</name> | 512 | <name>sizeHint</name> |
561 | <size> | 513 | <size> |
562 | <width>20</width> | 514 | <width>20</width> |
563 | <height>20</height> | 515 | <height>20</height> |
564 | </size> | 516 | </size> |
565 | </property> | 517 | </property> |
566 | </spacer> | 518 | </spacer> |
567 | </vbox> | 519 | </vbox> |
568 | </widget> | 520 | </widget> |
569 | <widget> | 521 | <widget> |
570 | <class>QWidget</class> | 522 | <class>QWidget</class> |
571 | <property stdset="1"> | 523 | <property stdset="1"> |
572 | <name>name</name> | 524 | <name>name</name> |
573 | <cstring>tab</cstring> | 525 | <cstring>tab</cstring> |
574 | </property> | 526 | </property> |
575 | <attribute> | 527 | <attribute> |
576 | <name>title</name> | 528 | <name>title</name> |
577 | <string>State</string> | 529 | <string>State</string> |
578 | </attribute> | 530 | </attribute> |
579 | <vbox> | 531 | <vbox> |
580 | <property stdset="1"> | 532 | <property stdset="1"> |
581 | <name>margin</name> | 533 | <name>margin</name> |
582 | <number>0</number> | 534 | <number>0</number> |
583 | </property> | 535 | </property> |
584 | <property stdset="1"> | 536 | <property stdset="1"> |
585 | <name>spacing</name> | 537 | <name>spacing</name> |
586 | <number>2</number> | 538 | <number>2</number> |
587 | </property> | 539 | </property> |
588 | <widget> | 540 | <widget> |
589 | <class>QLayoutWidget</class> | 541 | <class>QLayoutWidget</class> |
590 | <property stdset="1"> | 542 | <property stdset="1"> |
591 | <name>name</name> | 543 | <name>name</name> |
592 | <cstring>Layout12</cstring> | 544 | <cstring>Layout13</cstring> |
593 | </property> | 545 | </property> |
594 | <property> | 546 | <property> |
595 | <name>layoutSpacing</name> | 547 | <name>layoutSpacing</name> |
596 | </property> | 548 | </property> |
597 | <grid> | 549 | <grid> |
598 | <property stdset="1"> | 550 | <property stdset="1"> |
599 | <name>margin</name> | 551 | <name>margin</name> |
600 | <number>0</number> | 552 | <number>0</number> |
601 | </property> | 553 | </property> |
602 | <property stdset="1"> | 554 | <property stdset="1"> |
603 | <name>spacing</name> | 555 | <name>spacing</name> |
604 | <number>2</number> | 556 | <number>2</number> |
605 | </property> | 557 | </property> |
606 | <widget row="0" column="0" > | 558 | <widget row="4" column="1" > |
607 | <class>QLabel</class> | ||
608 | <property stdset="1"> | ||
609 | <name>name</name> | ||
610 | <cstring>TextLabel1_3</cstring> | ||
611 | </property> | ||
612 | <property stdset="1"> | ||
613 | <name>text</name> | ||
614 | <string>Station</string> | ||
615 | </property> | ||
616 | </widget> | ||
617 | <widget row="3" column="1" > | ||
618 | <class>QLabel</class> | 559 | <class>QLabel</class> |
619 | <property stdset="1"> | 560 | <property stdset="1"> |
620 | <name>name</name> | 561 | <name>name</name> |
621 | <cstring>Channel_LBL</cstring> | 562 | <cstring>Frequency_LBL</cstring> |
622 | </property> | 563 | </property> |
623 | <property stdset="1"> | 564 | <property stdset="1"> |
624 | <name>frameShape</name> | 565 | <name>frameShape</name> |
625 | <enum>Panel</enum> | 566 | <enum>Box</enum> |
626 | </property> | 567 | </property> |
627 | <property stdset="1"> | 568 | <property stdset="1"> |
628 | <name>frameShadow</name> | 569 | <name>frameShadow</name> |
629 | <enum>Plain</enum> | 570 | <enum>Plain</enum> |
630 | </property> | 571 | </property> |
631 | <property stdset="1"> | 572 | <property stdset="1"> |
632 | <name>indent</name> | 573 | <name>indent</name> |
633 | <number>0</number> | 574 | <number>0</number> |
634 | </property> | 575 | </property> |
635 | </widget> | 576 | </widget> |
636 | <widget row="3" column="0" > | ||
637 | <class>QLabel</class> | ||
638 | <property stdset="1"> | ||
639 | <name>name</name> | ||
640 | <cstring>TextLabel4_3</cstring> | ||
641 | </property> | ||
642 | <property stdset="1"> | ||
643 | <name>text</name> | ||
644 | <string>Channel</string> | ||
645 | </property> | ||
646 | </widget> | ||
647 | <widget row="2" column="0" > | 577 | <widget row="2" column="0" > |
648 | <class>QLabel</class> | 578 | <class>QLabel</class> |
649 | <property stdset="1"> | 579 | <property stdset="1"> |
650 | <name>name</name> | 580 | <name>name</name> |
651 | <cstring>TextLabel3_3</cstring> | 581 | <cstring>TextLabel9_2</cstring> |
652 | </property> | 582 | </property> |
653 | <property stdset="1"> | 583 | <property stdset="1"> |
654 | <name>text</name> | 584 | <name>text</name> |
655 | <string>Mode</string> | 585 | <string>AP</string> |
656 | </property> | 586 | </property> |
657 | </widget> | 587 | </widget> |
658 | <widget row="1" column="0" > | 588 | <widget row="5" column="1" > |
659 | <class>QLabel</class> | 589 | <class>QLabel</class> |
660 | <property stdset="1"> | 590 | <property stdset="1"> |
661 | <name>name</name> | 591 | <name>name</name> |
662 | <cstring>TextLabel2_3</cstring> | 592 | <cstring>Channel_LBL</cstring> |
663 | </property> | 593 | </property> |
664 | <property stdset="1"> | 594 | <property stdset="1"> |
665 | <name>text</name> | 595 | <name>frameShape</name> |
666 | <string>ESSID</string> | 596 | <enum>Box</enum> |
667 | </property> | 597 | </property> |
668 | </widget> | ||
669 | <widget row="4" column="0" > | ||
670 | <class>QLabel</class> | ||
671 | <property stdset="1"> | 598 | <property stdset="1"> |
672 | <name>name</name> | 599 | <name>frameShadow</name> |
673 | <cstring>TextLabel9_2</cstring> | 600 | <enum>Plain</enum> |
674 | </property> | 601 | </property> |
675 | <property stdset="1"> | 602 | <property stdset="1"> |
676 | <name>text</name> | 603 | <name>indent</name> |
677 | <string>AP</string> | 604 | <number>0</number> |
678 | </property> | 605 | </property> |
679 | </widget> | 606 | </widget> |
680 | <widget row="0" column="1" > | 607 | <widget row="0" column="1" > |
681 | <class>QLabel</class> | 608 | <class>QLabel</class> |
682 | <property stdset="1"> | 609 | <property stdset="1"> |
683 | <name>name</name> | 610 | <name>name</name> |
684 | <cstring>Station_LBL</cstring> | 611 | <cstring>Station_LBL</cstring> |
685 | </property> | 612 | </property> |
686 | <property stdset="1"> | 613 | <property stdset="1"> |
687 | <name>frameShape</name> | 614 | <name>frameShape</name> |
688 | <enum>Panel</enum> | 615 | <enum>Box</enum> |
689 | </property> | 616 | </property> |
690 | <property stdset="1"> | 617 | <property stdset="1"> |
691 | <name>frameShadow</name> | 618 | <name>frameShadow</name> |
692 | <enum>Plain</enum> | 619 | <enum>Plain</enum> |
693 | </property> | 620 | </property> |
694 | <property stdset="1"> | 621 | <property stdset="1"> |
695 | <name>indent</name> | 622 | <name>indent</name> |
696 | <number>0</number> | 623 | <number>0</number> |
697 | </property> | 624 | </property> |
698 | </widget> | 625 | </widget> |
699 | <widget row="5" column="1" > | 626 | <widget row="6" column="0" > |
627 | <class>QLabel</class> | ||
628 | <property stdset="1"> | ||
629 | <name>name</name> | ||
630 | <cstring>TextLabel4_2_2</cstring> | ||
631 | </property> | ||
632 | <property stdset="1"> | ||
633 | <name>text</name> | ||
634 | <string>Rate</string> | ||
635 | </property> | ||
636 | </widget> | ||
637 | <widget row="6" column="1" > | ||
700 | <class>QLabel</class> | 638 | <class>QLabel</class> |
701 | <property stdset="1"> | 639 | <property stdset="1"> |
702 | <name>name</name> | 640 | <name>name</name> |
703 | <cstring>Rate_LBL</cstring> | 641 | <cstring>Rate_LBL</cstring> |
704 | </property> | 642 | </property> |
705 | <property stdset="1"> | 643 | <property stdset="1"> |
706 | <name>sizePolicy</name> | 644 | <name>sizePolicy</name> |
707 | <sizepolicy> | 645 | <sizepolicy> |
708 | <hsizetype>7</hsizetype> | 646 | <hsizetype>7</hsizetype> |
709 | <vsizetype>1</vsizetype> | 647 | <vsizetype>1</vsizetype> |
710 | </sizepolicy> | 648 | </sizepolicy> |
711 | </property> | 649 | </property> |
712 | <property stdset="1"> | 650 | <property stdset="1"> |
713 | <name>frameShape</name> | 651 | <name>frameShape</name> |
714 | <enum>Panel</enum> | 652 | <enum>Box</enum> |
715 | </property> | 653 | </property> |
716 | <property stdset="1"> | 654 | <property stdset="1"> |
717 | <name>frameShadow</name> | 655 | <name>frameShadow</name> |
718 | <enum>Plain</enum> | 656 | <enum>Plain</enum> |
719 | </property> | 657 | </property> |
720 | <property stdset="1"> | 658 | <property stdset="1"> |
721 | <name>indent</name> | 659 | <name>indent</name> |
722 | <number>0</number> | 660 | <number>0</number> |
723 | </property> | 661 | </property> |
724 | </widget> | 662 | </widget> |
725 | <widget row="5" column="0" > | 663 | <widget row="2" column="1" > |
726 | <class>QLabel</class> | 664 | <class>QLabel</class> |
727 | <property stdset="1"> | 665 | <property stdset="1"> |
728 | <name>name</name> | 666 | <name>name</name> |
729 | <cstring>TextLabel4_2_2</cstring> | 667 | <cstring>AP_LBL</cstring> |
730 | </property> | 668 | </property> |
731 | <property stdset="1"> | 669 | <property stdset="1"> |
732 | <name>text</name> | 670 | <name>frameShape</name> |
733 | <string>Rate</string> | 671 | <enum>Box</enum> |
672 | </property> | ||
673 | <property stdset="1"> | ||
674 | <name>frameShadow</name> | ||
675 | <enum>Plain</enum> | ||
676 | </property> | ||
677 | <property stdset="1"> | ||
678 | <name>indent</name> | ||
679 | <number>0</number> | ||
734 | </property> | 680 | </property> |
735 | </widget> | 681 | </widget> |
736 | <widget row="4" column="1" > | 682 | <widget row="3" column="1" > |
737 | <class>QLabel</class> | 683 | <class>QLabel</class> |
738 | <property stdset="1"> | 684 | <property stdset="1"> |
739 | <name>name</name> | 685 | <name>name</name> |
740 | <cstring>AP_LBL</cstring> | 686 | <cstring>Mode_LBL</cstring> |
741 | </property> | 687 | </property> |
742 | <property stdset="1"> | 688 | <property stdset="1"> |
743 | <name>frameShape</name> | 689 | <name>frameShape</name> |
744 | <enum>Panel</enum> | 690 | <enum>Box</enum> |
745 | </property> | 691 | </property> |
746 | <property stdset="1"> | 692 | <property stdset="1"> |
747 | <name>frameShadow</name> | 693 | <name>frameShadow</name> |
748 | <enum>Plain</enum> | 694 | <enum>Plain</enum> |
749 | </property> | 695 | </property> |
750 | <property stdset="1"> | 696 | <property stdset="1"> |
751 | <name>indent</name> | 697 | <name>indent</name> |
752 | <number>0</number> | 698 | <number>0</number> |
753 | </property> | 699 | </property> |
754 | </widget> | 700 | </widget> |
755 | <widget row="1" column="1" > | 701 | <widget row="1" column="1" > |
756 | <class>QLabel</class> | 702 | <class>QLabel</class> |
757 | <property stdset="1"> | 703 | <property stdset="1"> |
758 | <name>name</name> | 704 | <name>name</name> |
759 | <cstring>ESSID_LBL</cstring> | 705 | <cstring>ESSID_LBL</cstring> |
760 | </property> | 706 | </property> |
761 | <property stdset="1"> | 707 | <property stdset="1"> |
762 | <name>frameShape</name> | 708 | <name>frameShape</name> |
763 | <enum>Panel</enum> | 709 | <enum>Box</enum> |
764 | </property> | 710 | </property> |
765 | <property stdset="1"> | 711 | <property stdset="1"> |
766 | <name>frameShadow</name> | 712 | <name>frameShadow</name> |
767 | <enum>Plain</enum> | 713 | <enum>Plain</enum> |
768 | </property> | 714 | </property> |
769 | <property stdset="1"> | 715 | <property stdset="1"> |
770 | <name>indent</name> | 716 | <name>indent</name> |
771 | <number>0</number> | 717 | <number>0</number> |
772 | </property> | 718 | </property> |
773 | </widget> | 719 | </widget> |
774 | <widget row="2" column="1" > | 720 | <widget row="3" column="0" > |
775 | <class>QLabel</class> | 721 | <class>QLabel</class> |
776 | <property stdset="1"> | 722 | <property stdset="1"> |
777 | <name>name</name> | 723 | <name>name</name> |
778 | <cstring>Mode_LBL</cstring> | 724 | <cstring>TextLabel3_3</cstring> |
779 | </property> | 725 | </property> |
780 | <property stdset="1"> | 726 | <property stdset="1"> |
781 | <name>frameShape</name> | 727 | <name>text</name> |
782 | <enum>Panel</enum> | 728 | <string>Mode</string> |
783 | </property> | 729 | </property> |
730 | </widget> | ||
731 | <widget row="5" column="0" > | ||
732 | <class>QLabel</class> | ||
784 | <property stdset="1"> | 733 | <property stdset="1"> |
785 | <name>frameShadow</name> | 734 | <name>name</name> |
786 | <enum>Plain</enum> | 735 | <cstring>TextLabel4_3</cstring> |
787 | </property> | 736 | </property> |
788 | <property stdset="1"> | 737 | <property stdset="1"> |
789 | <name>indent</name> | 738 | <name>text</name> |
790 | <number>0</number> | 739 | <string>Channel</string> |
740 | </property> | ||
741 | </widget> | ||
742 | <widget row="0" column="0" > | ||
743 | <class>QLabel</class> | ||
744 | <property stdset="1"> | ||
745 | <name>name</name> | ||
746 | <cstring>TextLabel1_3</cstring> | ||
747 | </property> | ||
748 | <property stdset="1"> | ||
749 | <name>text</name> | ||
750 | <string>Station</string> | ||
751 | </property> | ||
752 | </widget> | ||
753 | <widget row="1" column="0" > | ||
754 | <class>QLabel</class> | ||
755 | <property stdset="1"> | ||
756 | <name>name</name> | ||
757 | <cstring>TextLabel2_3</cstring> | ||
758 | </property> | ||
759 | <property stdset="1"> | ||
760 | <name>text</name> | ||
761 | <string>ESSID</string> | ||
762 | </property> | ||
763 | </widget> | ||
764 | <widget row="4" column="0" > | ||
765 | <class>QLabel</class> | ||
766 | <property stdset="1"> | ||
767 | <name>name</name> | ||
768 | <cstring>TextLabel4_3_2</cstring> | ||
769 | </property> | ||
770 | <property stdset="1"> | ||
771 | <name>text</name> | ||
772 | <string>Frequency</string> | ||
791 | </property> | 773 | </property> |
792 | </widget> | 774 | </widget> |
793 | </grid> | 775 | </grid> |
794 | </widget> | 776 | </widget> |
795 | <widget> | 777 | <widget> |
796 | <class>QGroupBox</class> | 778 | <class>QGroupBox</class> |
797 | <property stdset="1"> | 779 | <property stdset="1"> |
798 | <name>name</name> | 780 | <name>name</name> |
799 | <cstring>GroupBox1</cstring> | 781 | <cstring>GroupBox1</cstring> |
800 | </property> | 782 | </property> |
801 | <property stdset="1"> | 783 | <property stdset="1"> |
784 | <name>margin</name> | ||
785 | <number>0</number> | ||
786 | </property> | ||
787 | <property stdset="1"> | ||
802 | <name>title</name> | 788 | <name>title</name> |
803 | <string>Link Quality</string> | 789 | <string>Link Quality</string> |
804 | </property> | 790 | </property> |
805 | <property> | 791 | <property> |
806 | <name>layoutMargin</name> | 792 | <name>layoutMargin</name> |
807 | </property> | 793 | </property> |
808 | <property> | 794 | <property> |
809 | <name>layoutSpacing</name> | 795 | <name>layoutSpacing</name> |
810 | </property> | 796 | </property> |
811 | <grid> | 797 | <grid> |
812 | <property stdset="1"> | 798 | <property stdset="1"> |
813 | <name>margin</name> | 799 | <name>margin</name> |
814 | <number>2</number> | 800 | <number>2</number> |
815 | </property> | 801 | </property> |
816 | <property stdset="1"> | 802 | <property stdset="1"> |
817 | <name>spacing</name> | 803 | <name>spacing</name> |
818 | <number>2</number> | 804 | <number>0</number> |
819 | </property> | 805 | </property> |
820 | <widget row="1" column="0" > | 806 | <widget row="1" column="0" > |
821 | <class>QLabel</class> | 807 | <class>QLabel</class> |
822 | <property stdset="1"> | 808 | <property stdset="1"> |
823 | <name>name</name> | 809 | <name>name</name> |
824 | <cstring>TextLabel2_2_2</cstring> | 810 | <cstring>TextLabel2_2_2</cstring> |
825 | </property> | 811 | </property> |
826 | <property stdset="1"> | 812 | <property stdset="1"> |
827 | <name>text</name> | 813 | <name>text</name> |
828 | <string>Noise</string> | 814 | <string>Noise</string> |
829 | </property> | 815 | </property> |
830 | </widget> | 816 | </widget> |
831 | <widget row="2" column="0" > | 817 | <widget row="2" column="0" > |
832 | <class>QLabel</class> | 818 | <class>QLabel</class> |
833 | <property stdset="1"> | 819 | <property stdset="1"> |
834 | <name>name</name> | 820 | <name>name</name> |
835 | <cstring>TextLabel3_2_2</cstring> | 821 | <cstring>TextLabel3_2_2</cstring> |
836 | </property> | 822 | </property> |
837 | <property stdset="1"> | 823 | <property stdset="1"> |
838 | <name>text</name> | 824 | <name>text</name> |
839 | <string>Quality</string> | 825 | <string>Quality</string> |
840 | </property> | 826 | </property> |
841 | </widget> | 827 | </widget> |
842 | <widget row="1" column="2" > | 828 | <widget row="1" column="2" > |
843 | <class>QProgressBar</class> | 829 | <class>QProgressBar</class> |
844 | <property stdset="1"> | 830 | <property stdset="1"> |
845 | <name>name</name> | 831 | <name>name</name> |
846 | <cstring>Noise_PB</cstring> | 832 | <cstring>Noise_PB</cstring> |
847 | </property> | 833 | </property> |
848 | <property stdset="1"> | 834 | <property stdset="1"> |
849 | <name>progress</name> | 835 | <name>progress</name> |
850 | <number>0</number> | 836 | <number>10</number> |
851 | </property> | 837 | </property> |
852 | </widget> | 838 | </widget> |
853 | <widget row="2" column="2" > | 839 | <widget row="2" column="2" > |
854 | <class>QProgressBar</class> | 840 | <class>QProgressBar</class> |
855 | <property stdset="1"> | 841 | <property stdset="1"> |
856 | <name>name</name> | 842 | <name>name</name> |
857 | <cstring>Quality_PB</cstring> | 843 | <cstring>Quality_PB</cstring> |
858 | </property> | 844 | </property> |
859 | <property stdset="1"> | 845 | <property stdset="1"> |
860 | <name>progress</name> | 846 | <name>progress</name> |
861 | <number>0</number> | 847 | <number>10</number> |
862 | </property> | 848 | </property> |
863 | </widget> | 849 | </widget> |
864 | <widget row="0" column="0" > | 850 | <widget row="0" column="0" > |
865 | <class>QLabel</class> | 851 | <class>QLabel</class> |
866 | <property stdset="1"> | 852 | <property stdset="1"> |
867 | <name>name</name> | 853 | <name>name</name> |
868 | <cstring>TextLabel1_2_2</cstring> | 854 | <cstring>TextLabel1_2_2</cstring> |
869 | </property> | 855 | </property> |
870 | <property stdset="1"> | 856 | <property stdset="1"> |
871 | <name>text</name> | 857 | <name>text</name> |
872 | <string>Signal</string> | 858 | <string>Signal</string> |
873 | </property> | 859 | </property> |
874 | </widget> | 860 | </widget> |
875 | <spacer row="0" column="1" > | ||
876 | <property> | ||
877 | <name>name</name> | ||
878 | <cstring>Spacer28</cstring> | ||
879 | </property> | ||
880 | <property stdset="1"> | ||
881 | <name>orientation</name> | ||
882 | <enum>Horizontal</enum> | ||
883 | </property> | ||
884 | <property stdset="1"> | ||
885 | <name>sizeType</name> | ||
886 | <enum>Fixed</enum> | ||
887 | </property> | ||
888 | <property> | ||
889 | <name>sizeHint</name> | ||
890 | <size> | ||
891 | <width>16</width> | ||
892 | <height>20</height> | ||
893 | </size> | ||
894 | </property> | ||
895 | </spacer> | ||
896 | <widget row="0" column="2" > | 861 | <widget row="0" column="2" > |
897 | <class>QProgressBar</class> | 862 | <class>QProgressBar</class> |
898 | <property stdset="1"> | 863 | <property stdset="1"> |
899 | <name>name</name> | 864 | <name>name</name> |
900 | <cstring>Signal_PB</cstring> | 865 | <cstring>Signal_PB</cstring> |
901 | </property> | 866 | </property> |
902 | <property stdset="1"> | 867 | <property stdset="1"> |
903 | <name>frameShadow</name> | 868 | <name>frameShadow</name> |
904 | <enum>Plain</enum> | 869 | <enum>Plain</enum> |
905 | </property> | 870 | </property> |
906 | <property stdset="1"> | 871 | <property stdset="1"> |
907 | <name>lineWidth</name> | 872 | <name>lineWidth</name> |
908 | <number>1</number> | 873 | <number>1</number> |
909 | </property> | 874 | </property> |
910 | <property stdset="1"> | 875 | <property stdset="1"> |
911 | <name>progress</name> | 876 | <name>progress</name> |
912 | <number>0</number> | 877 | <number>10</number> |
913 | </property> | 878 | </property> |
914 | </widget> | 879 | </widget> |
915 | </grid> | 880 | </grid> |
916 | </widget> | 881 | </widget> |
917 | <spacer> | 882 | <spacer> |
918 | <property> | 883 | <property> |
919 | <name>name</name> | 884 | <name>name</name> |
920 | <cstring>Spacer11</cstring> | 885 | <cstring>Spacer11</cstring> |
921 | </property> | 886 | </property> |
922 | <property stdset="1"> | 887 | <property stdset="1"> |
923 | <name>orientation</name> | 888 | <name>orientation</name> |
924 | <enum>Vertical</enum> | 889 | <enum>Vertical</enum> |
925 | </property> | 890 | </property> |
926 | <property stdset="1"> | 891 | <property stdset="1"> |
927 | <name>sizeType</name> | 892 | <name>sizeType</name> |
928 | <enum>Expanding</enum> | 893 | <enum>Expanding</enum> |
929 | </property> | 894 | </property> |
930 | <property> | 895 | <property> |
931 | <name>sizeHint</name> | 896 | <name>sizeHint</name> |
932 | <size> | 897 | <size> |
933 | <width>20</width> | 898 | <width>20</width> |
934 | <height>20</height> | 899 | <height>20</height> |
935 | </size> | 900 | </size> |
936 | </property> | 901 | </property> |
937 | </spacer> | 902 | </spacer> |
903 | <widget> | ||
904 | <class>QLayoutWidget</class> | ||
905 | <property stdset="1"> | ||
906 | <name>name</name> | ||
907 | <cstring>Layout21</cstring> | ||
908 | </property> | ||
909 | <hbox> | ||
910 | <property stdset="1"> | ||
911 | <name>margin</name> | ||
912 | <number>0</number> | ||
913 | </property> | ||
914 | <property stdset="1"> | ||
915 | <name>spacing</name> | ||
916 | <number>6</number> | ||
917 | </property> | ||
918 | <widget> | ||
919 | <class>QCheckBox</class> | ||
920 | <property stdset="1"> | ||
921 | <name>name</name> | ||
922 | <cstring>Refresh_CB</cstring> | ||
923 | </property> | ||
924 | <property stdset="1"> | ||
925 | <name>sizePolicy</name> | ||
926 | <sizepolicy> | ||
927 | <hsizetype>1</hsizetype> | ||
928 | <vsizetype>5</vsizetype> | ||
929 | </sizepolicy> | ||
930 | </property> | ||
931 | <property stdset="1"> | ||
932 | <name>text</name> | ||
933 | <string>Live feed </string> | ||
934 | </property> | ||
935 | </widget> | ||
936 | <spacer> | ||
937 | <property> | ||
938 | <name>name</name> | ||
939 | <cstring>Spacer16</cstring> | ||
940 | </property> | ||
941 | <property stdset="1"> | ||
942 | <name>orientation</name> | ||
943 | <enum>Horizontal</enum> | ||
944 | </property> | ||
945 | <property stdset="1"> | ||
946 | <name>sizeType</name> | ||
947 | <enum>Expanding</enum> | ||
948 | </property> | ||
949 | <property> | ||
950 | <name>sizeHint</name> | ||
951 | <size> | ||
952 | <width>20</width> | ||
953 | <height>20</height> | ||
954 | </size> | ||
955 | </property> | ||
956 | </spacer> | ||
957 | </hbox> | ||
958 | </widget> | ||
938 | </vbox> | 959 | </vbox> |
939 | </widget> | 960 | </widget> |
940 | </widget> | 961 | </widget> |
941 | </vbox> | 962 | </vbox> |
942 | </widget> | 963 | </widget> |
943 | <connections> | 964 | <connections> |
944 | <connection> | 965 | <connection> |
945 | <sender>EnableWEB_CB</sender> | 966 | <sender>EnableWEP_CB</sender> |
946 | <signal>toggled(bool)</signal> | 967 | <signal>toggled(bool)</signal> |
947 | <receiver>KeyButtonGroup</receiver> | 968 | <receiver>KeyButtonGroup</receiver> |
948 | <slot>setEnabled(bool)</slot> | 969 | <slot>setEnabled(bool)</slot> |
949 | </connection> | 970 | </connection> |
950 | <connection> | 971 | <connection> |
951 | <sender>SpecifyAP_CB</sender> | 972 | <sender>SpecifyAP_CB</sender> |
952 | <signal>toggled(bool)</signal> | 973 | <signal>toggled(bool)</signal> |
953 | <receiver>APMac_LE</receiver> | 974 | <receiver>APMac_LE</receiver> |
954 | <slot>setEnabled(bool)</slot> | 975 | <slot>setEnabled(bool)</slot> |
955 | </connection> | 976 | </connection> |
956 | <connection> | 977 | <connection> |
957 | <sender>SpecifyAP_CB</sender> | 978 | <sender>SpecifyAP_CB</sender> |
958 | <signal>toggled(bool)</signal> | 979 | <signal>toggled(bool)</signal> |
959 | <receiver>macLabel</receiver> | 980 | <receiver>macLabel</receiver> |
960 | <slot>setEnabled(bool)</slot> | 981 | <slot>setEnabled(bool)</slot> |
961 | </connection> | 982 | </connection> |
962 | <connection> | 983 | <connection> |
963 | <sender>SpecifyChannel_CB</sender> | 984 | <sender>EnableWEP_CB</sender> |
985 | <signal>toggled(bool)</signal> | ||
986 | <receiver>AcceptNonEncrypted_CB</receiver> | ||
987 | <slot>setEnabled(bool)</slot> | ||
988 | </connection> | ||
989 | <connection> | ||
990 | <sender>Key1_RB</sender> | ||
991 | <signal>toggled(bool)</signal> | ||
992 | <receiver>Key1_LE</receiver> | ||
993 | <slot>setEnabled(bool)</slot> | ||
994 | </connection> | ||
995 | <connection> | ||
996 | <sender>Key2_RB</sender> | ||
997 | <signal>toggled(bool)</signal> | ||
998 | <receiver>Key2_LE</receiver> | ||
999 | <slot>setEnabled(bool)</slot> | ||
1000 | </connection> | ||
1001 | <connection> | ||
1002 | <sender>Key3_RB</sender> | ||
964 | <signal>toggled(bool)</signal> | 1003 | <signal>toggled(bool)</signal> |
965 | <receiver>ChannelNr_SB</receiver> | 1004 | <receiver>Key3_LE</receiver> |
966 | <slot>setEnabled(bool)</slot> | 1005 | <slot>setEnabled(bool)</slot> |
967 | </connection> | 1006 | </connection> |
968 | <connection> | 1007 | <connection> |
969 | <sender>EnableWEB_CB</sender> | 1008 | <sender>Key4_RB</sender> |
970 | <signal>toggled(bool)</signal> | 1009 | <signal>toggled(bool)</signal> |
971 | <receiver>CheckBox4</receiver> | 1010 | <receiver>Key4_LE</receiver> |
972 | <slot>setEnabled(bool)</slot> | 1011 | <slot>setEnabled(bool)</slot> |
973 | </connection> | 1012 | </connection> |
1013 | <connection> | ||
1014 | <sender>Refresh_CB</sender> | ||
1015 | <signal>toggled(bool)</signal> | ||
1016 | <receiver>WLanGUI</receiver> | ||
1017 | <slot>SLOT_AutoRefresh(bool)</slot> | ||
1018 | </connection> | ||
1019 | <slot access="public">SLOT_AutoRefresh(bool)</slot> | ||
974 | </connections> | 1020 | </connections> |
975 | </UI> | 1021 | </UI> |
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp index 78e756c..61969f2 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp | |||
@@ -1,36 +1,140 @@ | |||
1 | #include <unistd.h> | ||
1 | #include "wlanedit.h" | 2 | #include "wlanedit.h" |
2 | #include "wlan_NNI.h" | 3 | #include "wlan_NNI.h" |
3 | #include "wlan_NN.h" | 4 | #include "wlan_NN.h" |
4 | 5 | ||
5 | AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) { | 6 | AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) { |
6 | GUI = 0; | 7 | GUI = 0; |
7 | RT = 0; | 8 | RT = 0; |
9 | Data.ESSID = ""; | ||
10 | Data.NodeName = tr("<UseHostName>"); | ||
11 | Data.Mode = 0; | ||
12 | Data.SpecificAP = 0; | ||
13 | Data.APMac = ""; | ||
14 | Data.Encrypted = 0; | ||
15 | Data.AcceptNonEncrypted = 0; | ||
16 | Data.Key[0] = ""; | ||
17 | Data.Key[1] = ""; | ||
18 | Data.Key[2] = ""; | ||
19 | Data.Key[3] = ""; | ||
8 | } | 20 | } |
9 | 21 | ||
10 | void AWLan::setSpecificAttribute( QString & , QString & ) { | 22 | void AWLan::setSpecificAttribute( QString & A, QString & V ) { |
23 | if( A == "essid" ) { | ||
24 | Data.ESSID = V; | ||
25 | } else if( A == "nodename" ) { | ||
26 | Data.NodeName = V; | ||
27 | } else if( A == "mode" ) { | ||
28 | Data.Mode = V.toShort(); | ||
29 | } else if( A == "specificap" ) { | ||
30 | Data.SpecificAP = (V=="yes"); | ||
31 | } else if( A == "apmac" ) { | ||
32 | Data.APMac = V; | ||
33 | } else if( A == "encrypted" ) { | ||
34 | Data.Encrypted = (V=="yes"); | ||
35 | } else if( A == "acceptnonencrypted" ) { | ||
36 | Data.AcceptNonEncrypted = (V=="yes"); | ||
37 | } else if( A == "key0" ) { | ||
38 | Data.Key[0] = V; | ||
39 | } else if( A == "key1" ) { | ||
40 | Data.Key[1] = V; | ||
41 | } else if( A == "key2" ) { | ||
42 | Data.Key[2] = V; | ||
43 | } else if( A == "key3" ) { | ||
44 | Data.Key[3] = V; | ||
45 | } | ||
11 | } | 46 | } |
12 | 47 | ||
13 | void AWLan::saveSpecificAttribute( QTextStream & ) { | 48 | void AWLan::saveSpecificAttribute( QTextStream & S ) { |
49 | S << "essid=" << quote( Data.ESSID ) << endl; | ||
50 | S << "nodename=" << quote( Data.NodeName ) << endl; | ||
51 | S << "mode=" << Data.Mode << endl; | ||
52 | S << "specificap=" | ||
53 | << ((Data.SpecificAP) ? "yes" : "no") | ||
54 | << endl; | ||
55 | S << "apmac=" << Data.APMac << endl; | ||
56 | S << "encrypted=" | ||
57 | << ((Data.Encrypted) ? "yes" : "no") | ||
58 | << endl; | ||
59 | S << "acceptnonencrypted=" | ||
60 | << ((Data.AcceptNonEncrypted) ? "yes" : "no") | ||
61 | << endl; | ||
62 | for( int i = 0 ;i < 4 ; i ++ ) { | ||
63 | S << "key" << i << "=" << Data.Key[i] << endl; | ||
64 | } | ||
14 | } | 65 | } |
15 | 66 | ||
16 | QWidget * AWLan::edit( QWidget * parent ) { | 67 | QWidget * AWLan::edit( QWidget * parent ) { |
17 | GUI = new WLanEdit( parent ); | 68 | GUI = new WLanEdit( parent, this ); |
18 | GUI->showData( Data ); | 69 | GUI->showData( Data ); |
19 | return GUI; | 70 | return GUI; |
20 | } | 71 | } |
21 | 72 | ||
22 | QString AWLan::acceptable( void ) { | 73 | QString AWLan::acceptable( void ) { |
23 | return ( GUI ) ? GUI->acceptable( ) : QString(); | 74 | return ( GUI ) ? GUI->acceptable( ) : QString(); |
24 | } | 75 | } |
25 | 76 | ||
26 | void AWLan::commit( void ) { | 77 | void AWLan::commit( void ) { |
27 | if( GUI && GUI->commit( Data ) ) | 78 | if( GUI && GUI->commit( Data ) ) |
28 | setModified( 1 ); | 79 | setModified( 1 ); |
29 | } | 80 | } |
30 | 81 | ||
31 | bool AWLan::generateDataForCommonFile( | 82 | bool AWLan::generateDataForCommonFile( |
32 | SystemFile &, | 83 | SystemFile & S, |
33 | long ) { | 84 | long ) { |
34 | return 1; | 85 | |
86 | S << " wireless_essid \"" | ||
87 | << Data.ESSID | ||
88 | << "\"" | ||
89 | << endl; | ||
90 | |||
91 | if( ! Data.NodeName.isEmpty() ) { | ||
92 | if( Data.NodeName == tr("<UseHostName>") ) { | ||
93 | char Buf[100]; | ||
94 | if( gethostname(Buf, sizeof(Buf) ) == 0 ) { | ||
95 | Buf[99] = '\0'; // just to make sure | ||
96 | S << " wireless_nick " | ||
97 | << Buf | ||
98 | << endl; | ||
99 | } | ||
100 | } else { | ||
101 | S << " wireless_nick \"" | ||
102 | << Data.NodeName | ||
103 | << "\"" | ||
104 | << endl; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | char * M; | ||
109 | switch ( Data.Mode ) { | ||
110 | case 0 : | ||
111 | M = "Auto"; | ||
112 | break; | ||
113 | case 1 : | ||
114 | M = "Managed"; | ||
115 | break; | ||
116 | case 2 : | ||
117 | M = "Ad-Hoc"; | ||
118 | break; | ||
119 | } | ||
120 | |||
121 | S << " wireless_mode " | ||
122 | << M | ||
123 | << endl; | ||
124 | if( Data.Encrypted ) { | ||
125 | for( int i = 0; i < 4; i ++ ) { | ||
126 | if( ! Data.Key[i].isEmpty() ) { | ||
127 | S << " wireless_key" | ||
128 | << i | ||
129 | << " " | ||
130 | << Data.Key[i] | ||
131 | << endl; | ||
132 | } | ||
133 | } | ||
134 | S << " wireless_keymode " | ||
135 | << ((Data.AcceptNonEncrypted) ? "open" : "restricted") | ||
136 | << endl; | ||
137 | } | ||
138 | return 0; | ||
35 | } | 139 | } |
36 | 140 | ||
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.h b/noncore/settings/networksettings2/wlan/wlan_NNI.h index d861d13..2211c47 100644 --- a/noncore/settings/networksettings2/wlan/wlan_NNI.h +++ b/noncore/settings/networksettings2/wlan/wlan_NNI.h | |||
@@ -1,47 +1,47 @@ | |||
1 | #ifndef WLAN_H | 1 | #ifndef WLAN_H |
2 | #define WLAN_H | 2 | #define WLAN_H |
3 | 3 | ||
4 | #include <netnode.h> | 4 | #include <netnode.h> |
5 | #include "wlandata.h" | 5 | #include "wlandata.h" |
6 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
7 | 7 | ||
8 | class WLanNetNode; | 8 | class WLanNetNode; |
9 | class WLanEdit; | 9 | class WLanEdit; |
10 | 10 | ||
11 | class AWLan : public ANetNodeInstance { | 11 | class AWLan : public ANetNodeInstance { |
12 | 12 | ||
13 | public : | 13 | public : |
14 | 14 | ||
15 | AWLan( WLanNetNode * PNN ); | 15 | AWLan( WLanNetNode * PNN ); |
16 | 16 | ||
17 | QWidget * edit( QWidget * parent ); | 17 | QWidget * edit( QWidget * parent ); |
18 | QString acceptable( void ); | 18 | QString acceptable( void ); |
19 | void commit( void ); | 19 | void commit( void ); |
20 | 20 | ||
21 | RuntimeInfo * runtime( void ) | 21 | RuntimeInfo * runtime( void ) |
22 | { if( RT == 0 ) | 22 | { if( RT == 0 ) |
23 | RT = new WLanRun( this, Data ); | 23 | RT = new WLanRun( this, Data ); |
24 | return RT; | 24 | return RT; |
25 | } | 25 | } |
26 | 26 | ||
27 | virtual void * data( void ) | 27 | virtual void * data( void ) |
28 | { return (void *)&Data; } | 28 | { return (void *)&Data; } |
29 | 29 | ||
30 | virtual bool hasDataFor( const QString & ) | 30 | virtual bool hasDataFor( const QString & ) |
31 | { return 0; } | 31 | { return 1; } |
32 | virtual bool generateDataForCommonFile( | 32 | virtual bool generateDataForCommonFile( |
33 | SystemFile & SF, long DevNr ); | 33 | SystemFile & SF, long DevNr ); |
34 | protected : | 34 | protected : |
35 | 35 | ||
36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); | 36 | virtual void setSpecificAttribute( QString & Attr, QString & Value ); |
37 | virtual void saveSpecificAttribute( QTextStream & TS ); | 37 | virtual void saveSpecificAttribute( QTextStream & TS ); |
38 | 38 | ||
39 | private : | 39 | private : |
40 | 40 | ||
41 | WLanEdit * GUI; | 41 | WLanEdit * GUI; |
42 | WLanData Data; | 42 | WLanData Data; |
43 | WLanRun * RT; | 43 | WLanRun * RT; |
44 | 44 | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif | 47 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlandata.h b/noncore/settings/networksettings2/wlan/wlandata.h index ba1f2c2..36990a9 100644 --- a/noncore/settings/networksettings2/wlan/wlandata.h +++ b/noncore/settings/networksettings2/wlan/wlandata.h | |||
@@ -1,17 +1,16 @@ | |||
1 | #ifndef WLAN_DATA_H | 1 | #ifndef WLAN_DATA_H |
2 | #define WLAN_DATA_H | 2 | #define WLAN_DATA_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | typedef struct WLanData { | 5 | typedef struct WLanData { |
6 | QString Device; | 6 | QString ESSID; |
7 | QString LockFile; | 7 | QString NodeName; |
8 | long Speed; | 8 | short Mode; |
9 | short Parity; | 9 | bool SpecificAP; |
10 | short DataBits; | 10 | QString APMac; |
11 | short StopBits; | 11 | bool Encrypted; |
12 | bool HardwareControl; | 12 | QString Key[4]; |
13 | bool SoftwareControl; | 13 | bool AcceptNonEncrypted; |
14 | |||
15 | } WLanData_t; | 14 | } WLanData_t; |
16 | 15 | ||
17 | #endif | 16 | #endif |
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.cpp b/noncore/settings/networksettings2/wlan/wlanedit.cpp index c884886..8d3979e 100644 --- a/noncore/settings/networksettings2/wlan/wlanedit.cpp +++ b/noncore/settings/networksettings2/wlan/wlanedit.cpp | |||
@@ -1,16 +1,115 @@ | |||
1 | #include <qlineedit.h> | ||
2 | #include <qprogressbar.h> | ||
3 | #include <qcombobox.h> | ||
4 | #include <qlabel.h> | ||
5 | #include <qregexp.h> | ||
6 | #include <qcheckbox.h> | ||
1 | #include <GUIUtils.h> | 7 | #include <GUIUtils.h> |
8 | #include <resources.h> | ||
9 | #include <wextensions.h> | ||
10 | |||
2 | #include "wlanedit.h" | 11 | #include "wlanedit.h" |
12 | #include "wlan_NN.h" | ||
13 | #include "wlan_NNI.h" | ||
14 | |||
15 | WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : | ||
16 | WLanGUI( Parent ), RefreshTimer(this){ | ||
17 | |||
18 | InterfaceInfo * II; | ||
19 | |||
20 | NNI = TNNI; | ||
21 | Dev = NNI->runtime()->device(); | ||
22 | WE = 0; | ||
23 | if( ( II = Dev->assignedInterface() ) ) { | ||
24 | // show data | ||
25 | WE = new WExtensions( II->Name ); | ||
26 | |||
27 | if( WE->doesHaveWirelessExtensions() ) { | ||
28 | QString S; | ||
29 | Station_LBL->setText( WE->station() ); | ||
30 | ESSID_LBL->setText( WE->essid() ); | ||
31 | Mode_LBL->setText( WE->mode() ); | ||
32 | S.setNum( WE->frequency() ); | ||
33 | Frequency_LBL->setText( S ); | ||
34 | S.setNum( WE->channel() ); | ||
35 | Channel_LBL->setText( S ); | ||
36 | S.setNum( WE->rate() ); | ||
37 | Rate_LBL->setText( S ); | ||
38 | AP_LBL->setText( WE->ap() ); | ||
39 | |||
40 | SLOT_Refresh(); | ||
41 | |||
42 | connect( &RefreshTimer, SIGNAL( timeout() ), | ||
43 | this, SLOT( SLOT_Refresh() ) ); | ||
44 | } | ||
45 | } | ||
46 | } | ||
3 | 47 | ||
4 | WLanEdit::WLanEdit( QWidget * Parent ) : WLanGUI( Parent ){ | 48 | WLanEdit::~WLanEdit( void ) { |
49 | if( WE ) | ||
50 | delete WE; | ||
5 | } | 51 | } |
6 | 52 | ||
7 | QString WLanEdit::acceptable( void ) { | 53 | QString WLanEdit::acceptable( void ) { |
54 | if( ESSID_LE->text().isEmpty() ) { | ||
55 | return QString("ESSID is mandatory"); | ||
56 | } | ||
57 | if( SpecifyAP_CB->isChecked() && | ||
58 | APMac_LE->text().isEmpty() ) { | ||
59 | return QString("APMac must have value"); | ||
60 | } | ||
8 | return QString(); | 61 | return QString(); |
9 | } | 62 | } |
10 | 63 | ||
11 | void WLanEdit::showData( WLanData_t & Data ) { | 64 | void WLanEdit::showData( WLanData_t & Data ) { |
65 | Mode_CB->setCurrentItem( Data.Mode ); | ||
66 | ESSID_LE->setText( Data.ESSID ); | ||
67 | NodeName_LE->setText( Data.NodeName ); | ||
68 | SpecifyAP_CB->setChecked( Data.SpecificAP ); | ||
69 | APMac_LE->setText( Data.APMac ); | ||
70 | |||
71 | EnableWEP_CB->setChecked( Data.Encrypted ); | ||
72 | AcceptNonEncrypted_CB->setChecked( Data.AcceptNonEncrypted ); | ||
73 | Key1_LE->setText( Data.Key[0] ); | ||
74 | Key2_LE->setText( Data.Key[1] ); | ||
75 | Key3_LE->setText( Data.Key[2] ); | ||
76 | Key4_LE->setText( Data.Key[3] ); | ||
12 | } | 77 | } |
13 | 78 | ||
14 | bool WLanEdit::commit( WLanData_t & Data ) { | 79 | bool WLanEdit::commit( WLanData_t & Data ) { |
80 | bool SM = 0; | ||
81 | |||
82 | TXTM( Data.ESSID, ESSID_LE, SM ); | ||
83 | TXTM( Data.NodeName, NodeName_LE, SM ); | ||
84 | TXTM( Data.APMac, APMac_LE, SM ); | ||
85 | TXTM( Data.Key[0], Key1_LE, SM ); | ||
86 | TXTM( Data.Key[1], Key2_LE, SM ); | ||
87 | TXTM( Data.Key[2], Key3_LE, SM ); | ||
88 | TXTM( Data.Key[3], Key4_LE, SM ); | ||
89 | CBM( Data.SpecificAP, SpecifyAP_CB, SM ); | ||
90 | CBM( Data.Encrypted, EnableWEP_CB, SM ); | ||
91 | CBM( Data.AcceptNonEncrypted, AcceptNonEncrypted_CB, SM ); | ||
92 | CIM( Data.Mode, Mode_CB, SM ); | ||
15 | return 0; | 93 | return 0; |
16 | } | 94 | } |
95 | |||
96 | void WLanEdit::SLOT_Refresh( void ) { | ||
97 | if( WE ) { | ||
98 | int signal, noise, quality; | ||
99 | WE->stats( signal, noise, quality); | ||
100 | |||
101 | Signal_PB->setProgress( signal ); | ||
102 | Noise_PB->setProgress( noise ); | ||
103 | Quality_PB->setProgress( quality ); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | void WLanEdit::SLOT_AutoRefresh( bool ar ) { | ||
108 | if( ar ) { | ||
109 | RefreshTimer.start( 1000 ); | ||
110 | SLOT_Refresh(); | ||
111 | } else { | ||
112 | RefreshTimer.stop(); | ||
113 | } | ||
114 | } | ||
115 | |||
diff --git a/noncore/settings/networksettings2/wlan/wlanedit.h b/noncore/settings/networksettings2/wlan/wlanedit.h index b7442d5..e550c14 100644 --- a/noncore/settings/networksettings2/wlan/wlanedit.h +++ b/noncore/settings/networksettings2/wlan/wlanedit.h | |||
@@ -1,12 +1,32 @@ | |||
1 | #include <qtimer.h> | ||
2 | #include <wextensions.h> | ||
1 | #include "wlandata.h" | 3 | #include "wlandata.h" |
2 | #include "wlanGUI.h" | 4 | #include "wlanGUI.h" |
3 | 5 | ||
6 | class ANetNodeInstance; | ||
7 | class AsDevice; | ||
8 | class WExtensions; | ||
9 | |||
4 | class WLanEdit : public WLanGUI { | 10 | class WLanEdit : public WLanGUI { |
5 | 11 | ||
6 | public : | 12 | public : |
7 | 13 | ||
8 | WLanEdit( QWidget * parent ); | 14 | WLanEdit( QWidget * parent, ANetNodeInstance * NNI ); |
15 | ~WLanEdit( void ); | ||
9 | QString acceptable( void ); | 16 | QString acceptable( void ); |
10 | void showData( WLanData_t & Data ); | 17 | void showData( WLanData_t & Data ); |
11 | bool commit( WLanData_t & Data ); | 18 | bool commit( WLanData_t & Data ); |
19 | |||
20 | public slots : | ||
21 | |||
22 | void SLOT_AutoRefresh( bool ); | ||
23 | void SLOT_Refresh( void ); | ||
24 | |||
25 | private : | ||
26 | |||
27 | ANetNodeInstance * NNI; | ||
28 | AsDevice * Dev; | ||
29 | QTimer RefreshTimer; | ||
30 | WExtensions * WE; | ||
31 | |||
12 | }; | 32 | }; |
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.cpp b/noncore/settings/networksettings2/wlan/wlanrun.cpp index 79f11f7..3f1d4a9 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.cpp +++ b/noncore/settings/networksettings2/wlan/wlanrun.cpp | |||
@@ -1,5 +1,185 @@ | |||
1 | |||
2 | #include <qfile.h> | ||
3 | #include <qtextstream.h> | ||
4 | #include <qstringlist.h> | ||
5 | #include <resources.h> | ||
1 | #include "wlanrun.h" | 6 | #include "wlanrun.h" |
2 | 7 | ||
8 | void WLanRun::detectState( NodeCollection * NC ) { | ||
9 | |||
10 | // unavailable : no card found | ||
11 | // available : card found and assigned to us or free | ||
12 | // up : card found and assigned to us and up | ||
13 | |||
14 | QString S = QString( "/tmp/profile-%1.up" ).arg(NC->number()); | ||
15 | System & Sys = NSResources->system(); | ||
16 | InterfaceInfo * Run; | ||
17 | |||
18 | QFile F( S ); | ||
19 | |||
20 | if( F.open( IO_ReadOnly ) ) { | ||
21 | // could open file -> read interface and assign | ||
22 | QString X; | ||
23 | QTextStream TS(&F); | ||
24 | X = TS.readLine(); | ||
25 | // find interface | ||
26 | if( handlesInterface( X ) ) { | ||
27 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
28 | It.current(); | ||
29 | ++It ) { | ||
30 | Run = It.current(); | ||
31 | if( X == Run->Name ) { | ||
32 | Run->assignNode( netNode() ); | ||
33 | assignInterface( Run ); | ||
34 | NC->setCurrentState( IsUp ); | ||
35 | return; | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | } | ||
40 | |||
41 | if( ( Run = assignedInterface() ) ) { | ||
42 | // we already have an interface assigned -> still present ? | ||
43 | if( ! Run->IsUp ) { | ||
44 | // usb is still free -> keep assignment | ||
45 | NC->setCurrentState( Available ); | ||
46 | return; | ||
47 | } // else interface is up but NOT us -> some other profile | ||
48 | } | ||
49 | |||
50 | // nothing (valid) assigned to us | ||
51 | assignInterface( 0 ); | ||
52 | |||
53 | // find possible interface | ||
54 | for( QDictIterator<InterfaceInfo> It(Sys.interfaces()); | ||
55 | It.current(); | ||
56 | ++It ) { | ||
57 | Run = It.current(); | ||
58 | if( handlesInterface( *Run ) && | ||
59 | ( Run->CardType == ARPHRD_ETHER | ||
60 | #ifdef ARPHRD_IEEE1394 | ||
61 | || Run->CardType == ARPHRD_IEEE1394 | ||
62 | #endif | ||
63 | ) && | ||
64 | ! Run->IsUp | ||
65 | ) { | ||
66 | // proper type, and Not UP -> free | ||
67 | NC->setCurrentState( Off ); | ||
68 | return; | ||
69 | } | ||
70 | } | ||
71 | // no free found | ||
72 | |||
73 | NC->setCurrentState( Unavailable ); | ||
74 | |||
75 | } | ||
76 | |||
77 | bool WLanRun::setState( NodeCollection * NC, Action_t A, bool ) { | ||
78 | |||
79 | // we only handle activate and deactivate | ||
80 | switch( A ) { | ||
81 | case Activate : | ||
82 | { | ||
83 | if( NC->currentState() != Off ) { | ||
84 | return 0; | ||
85 | } | ||
86 | InterfaceInfo * N = getInterface(); | ||
87 | if( ! N ) { | ||
88 | // no interface available | ||
89 | NC->setCurrentState( Unavailable ); | ||
90 | return 0; | ||
91 | } | ||
92 | // because we were OFF the interface | ||
93 | // we get back is NOT assigned | ||
94 | N->assignNode( netNode() ); | ||
95 | assignInterface( N ); | ||
96 | NC->setCurrentState( Available ); | ||
97 | return 1; | ||
98 | } | ||
99 | case Deactivate : | ||
100 | if( NC->currentState() == IsUp ) { | ||
101 | // bring down first | ||
102 | if( ! connection()->setState( Down ) ) | ||
103 | // could not ... | ||
104 | return 0; | ||
105 | } else if( NC->currentState() != Available ) { | ||
106 | return 1; | ||
107 | } | ||
108 | assignedInterface()->assignNode( 0 ); // release | ||
109 | assignInterface( 0 ); | ||
110 | NC->setCurrentState( Off ); | ||
111 | return 1; | ||
112 | default : | ||
113 | // FT | ||
114 | break; | ||
115 | } | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | bool WLanRun::canSetState( State_t Curr, Action_t A ) { | ||
120 | // we only handle up down activate and deactivate | ||
121 | switch( A ) { | ||
122 | case Activate : | ||
123 | { // at least available | ||
124 | if( Curr == Available ) { | ||
125 | return 1; | ||
126 | } | ||
127 | // or we can make one available | ||
128 | InterfaceInfo * N = getInterface(); | ||
129 | if( ! N || N->assignedNode() != 0 ) { | ||
130 | // non available or assigned | ||
131 | return 0; | ||
132 | } | ||
133 | return 1; | ||
134 | } | ||
135 | case Deactivate : | ||
136 | return ( Curr >= Available ); | ||
137 | default : | ||
138 | // FT | ||
139 | break; | ||
140 | } | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | // get interface that is free or assigned to us | ||
145 | InterfaceInfo * WLanRun::getInterface( void ) { | ||
146 | |||
147 | System & S = NSResources->system(); | ||
148 | InterfaceInfo * best = 0, * Run; | ||
149 | |||
150 | for( QDictIterator<InterfaceInfo> It(S.interfaces()); | ||
151 | It.current(); | ||
152 | ++It ) { | ||
153 | Run = It.current(); | ||
154 | if( handlesInterface( *Run ) && | ||
155 | ( Run->CardType == ARPHRD_ETHER | ||
156 | #ifdef ARPHRD_IEEE1394 | ||
157 | || Run->CardType == ARPHRD_IEEE1394 | ||
158 | #endif | ||
159 | ) | ||
160 | ) { | ||
161 | // this is a LAN card | ||
162 | if( Run->assignedNode() == netNode() ) { | ||
163 | // assigned to us | ||
164 | return Run; | ||
165 | } else if( Run->assignedNode() == 0 ) { | ||
166 | // free | ||
167 | best = Run; | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | return best; // can be 0 | ||
172 | } | ||
173 | |||
3 | bool WLanRun::handlesInterface( const QString & S ) { | 174 | bool WLanRun::handlesInterface( const QString & S ) { |
175 | InterfaceInfo * II; | ||
176 | II = NSResources->system().interface( S ); | ||
177 | if( ( II = NSResources->system().interface( S ) ) ) { | ||
178 | return handlesInterface( *II ); | ||
179 | } | ||
4 | return Pat.match( S ) >= 0; | 180 | return Pat.match( S ) >= 0; |
5 | } | 181 | } |
182 | |||
183 | bool WLanRun::handlesInterface( const InterfaceInfo & II ) { | ||
184 | return ( Pat.match( II.Name ) < 0 ); | ||
185 | } | ||
diff --git a/noncore/settings/networksettings2/wlan/wlanrun.h b/noncore/settings/networksettings2/wlan/wlanrun.h index f46bcb7..25d5b96 100644 --- a/noncore/settings/networksettings2/wlan/wlanrun.h +++ b/noncore/settings/networksettings2/wlan/wlanrun.h | |||
@@ -1,40 +1,37 @@ | |||
1 | #ifndef WLANRUN_H | 1 | #ifndef WLANRUN_H |
2 | #define WLANRUN_H | 2 | #define WLANRUN_H |
3 | 3 | ||
4 | #include <qregexp.h> | 4 | #include <qregexp.h> |
5 | #include <asdevice.h> | 5 | #include <asdevice.h> |
6 | #include "wlandata.h" | 6 | #include "wlandata.h" |
7 | 7 | ||
8 | class WLanRun : public AsDevice { | 8 | class WLanRun : public AsDevice { |
9 | 9 | ||
10 | public : | 10 | public : |
11 | 11 | ||
12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : | 12 | WLanRun( ANetNodeInstance * NNI, WLanData & Data ) : |
13 | AsDevice( NNI ), | 13 | AsDevice( NNI ), |
14 | Pat( "wlan[0-9]" ) | 14 | Pat( "wlan[0-9]" ) |
15 | { } | 15 | { } |
16 | 16 | ||
17 | virtual AsDevice * device( void ) | 17 | virtual AsDevice * device( void ) |
18 | { return (AsDevice *)this; } | 18 | { return (AsDevice *)this; } |
19 | virtual AsDevice * asDevice( void ) | 19 | virtual AsDevice * asDevice( void ) |
20 | { return (AsDevice *)this; } | 20 | { return (AsDevice *)this; } |
21 | 21 | ||
22 | protected : | 22 | protected : |
23 | 23 | ||
24 | void detectState( NodeCollection * ) | 24 | void detectState( NodeCollection * ); |
25 | { } | 25 | bool setState( NodeCollection *, Action_t, bool ); |
26 | 26 | bool canSetState( State_t, Action_t ); | |
27 | bool setState( NodeCollection *, Action_t ) | ||
28 | { return 0; } | ||
29 | |||
30 | bool canSetState( State_t, Action_t ) | ||
31 | { return 0; } | ||
32 | |||
33 | bool handlesInterface( const QString & I ); | 27 | bool handlesInterface( const QString & I ); |
28 | bool handlesInterface( const InterfaceInfo & II ); | ||
34 | 29 | ||
35 | private : | 30 | private : |
36 | 31 | ||
32 | InterfaceInfo * getInterface( void ); | ||
37 | QRegExp Pat; | 33 | QRegExp Pat; |
34 | WLanData * Data; | ||
38 | }; | 35 | }; |
39 | 36 | ||
40 | #endif | 37 | #endif |