-rw-r--r-- | noncore/applets/wirelessapplet/advancedconfig.cpp | 55 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/advancedconfig.h | 36 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/advancedconfigbase.ui | 159 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/networkinfo.cpp | 30 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/networkinfo.h | 4 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 139 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.h | 18 | ||||
-rw-r--r-- | noncore/applets/wirelessapplet/wirelessapplet.pro | 7 |
8 files changed, 427 insertions, 21 deletions
diff --git a/noncore/applets/wirelessapplet/advancedconfig.cpp b/noncore/applets/wirelessapplet/advancedconfig.cpp new file mode 100644 index 0000000..97b008d --- a/dev/null +++ b/noncore/applets/wirelessapplet/advancedconfig.cpp | |||
@@ -0,0 +1,55 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer | ||
3 | ** <mickey@tm.informatik.uni-frankfurt.de> | ||
4 | ** http://www.Vanille.de | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "advancedconfig.h" | ||
17 | |||
18 | #include <qpe/config.h> | ||
19 | #include <qwidget.h> | ||
20 | #include <qcheckbox.h> | ||
21 | |||
22 | AdvancedConfig::AdvancedConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
23 | : AdvancedConfigBase( parent, name, modal, fl ) | ||
24 | { | ||
25 | Config cfg( "qpe" ); | ||
26 | cfg.setGroup( "Wireless" ); | ||
27 | |||
28 | bool rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); | ||
29 | bool rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); | ||
30 | bool rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); | ||
31 | bool rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); | ||
32 | |||
33 | cbESSID->setChecked( rocESSID ); | ||
34 | cbFrequency->setChecked( rocFREQ ); | ||
35 | cbAccessPoint->setChecked( rocAP ); | ||
36 | cbMODE->setChecked( rocMODE ); | ||
37 | } | ||
38 | |||
39 | AdvancedConfig::~AdvancedConfig() | ||
40 | { | ||
41 | } | ||
42 | |||
43 | void AdvancedConfig::accept() | ||
44 | { | ||
45 | |||
46 | Config cfg( "qpe" ); | ||
47 | cfg.setGroup( "Wireless" ); | ||
48 | cfg.writeEntry( "renew_dhcp_on_essid_change", cbESSID->isChecked() ); | ||
49 | cfg.writeEntry( "renew_dhcp_on_freq_change", cbFrequency->isChecked() ); | ||
50 | cfg.writeEntry( "renew_dhcp_on_ap_change", cbAccessPoint->isChecked() ); | ||
51 | cfg.writeEntry( "renew_dhcp_on_mode_change", cbMODE->isChecked() ); | ||
52 | |||
53 | AdvancedConfigBase::accept(); | ||
54 | } | ||
55 | |||
diff --git a/noncore/applets/wirelessapplet/advancedconfig.h b/noncore/applets/wirelessapplet/advancedconfig.h new file mode 100644 index 0000000..17ba3c5 --- a/dev/null +++ b/noncore/applets/wirelessapplet/advancedconfig.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer | ||
3 | ** <mickey@tm.informatik.uni-frankfurt.de> | ||
4 | ** http://www.Vanille.de | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef ADVANCED_CONFIG_H | ||
17 | #define ADVANCED_CONFIG_H | ||
18 | |||
19 | #include "advancedconfigbase.h" | ||
20 | |||
21 | #include <qnamespace.h> | ||
22 | |||
23 | class AdvancedConfig: public AdvancedConfigBase | ||
24 | { | ||
25 | Q_OBJECT | ||
26 | |||
27 | public: | ||
28 | AdvancedConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
29 | ~AdvancedConfig(); | ||
30 | |||
31 | protected: | ||
32 | virtual void accept(); | ||
33 | |||
34 | }; | ||
35 | |||
36 | #endif | ||
diff --git a/noncore/applets/wirelessapplet/advancedconfigbase.ui b/noncore/applets/wirelessapplet/advancedconfigbase.ui new file mode 100644 index 0000000..c7c4a10 --- a/dev/null +++ b/noncore/applets/wirelessapplet/advancedconfigbase.ui | |||
@@ -0,0 +1,159 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>AdvancedConfigBase</class> | ||
3 | <comment>/********************************************************************** | ||
4 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | ||
5 | ** | ||
6 | ** This file is part of Qt Palmtop Environment. | ||
7 | ** | ||
8 | ** This file may be distributed and/or modified under the terms of the | ||
9 | ** GNU General Public License version 2 as published by the Free Software | ||
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
11 | ** packaging of this file. | ||
12 | ** | ||
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
15 | ** | ||
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
17 | ** | ||
18 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
19 | ** not clear to you. | ||
20 | ** | ||
21 | ** $Id$ | ||
22 | ** | ||
23 | **********************************************************************/</comment> | ||
24 | <widget> | ||
25 | <class>QDialog</class> | ||
26 | <property stdset="1"> | ||
27 | <name>name</name> | ||
28 | <cstring>AdvancedConfigBase</cstring> | ||
29 | </property> | ||
30 | <property stdset="1"> | ||
31 | <name>geometry</name> | ||
32 | <rect> | ||
33 | <x>0</x> | ||
34 | <y>0</y> | ||
35 | <width>197</width> | ||
36 | <height>158</height> | ||
37 | </rect> | ||
38 | </property> | ||
39 | <property stdset="1"> | ||
40 | <name>sizePolicy</name> | ||
41 | <sizepolicy> | ||
42 | <hsizetype>1</hsizetype> | ||
43 | <vsizetype>1</vsizetype> | ||
44 | </sizepolicy> | ||
45 | </property> | ||
46 | <property stdset="1"> | ||
47 | <name>caption</name> | ||
48 | <string>Advanced Config</string> | ||
49 | </property> | ||
50 | <property> | ||
51 | <name>layoutMargin</name> | ||
52 | </property> | ||
53 | <property> | ||
54 | <name>layoutSpacing</name> | ||
55 | </property> | ||
56 | <widget> | ||
57 | <class>QGroupBox</class> | ||
58 | <property stdset="1"> | ||
59 | <name>name</name> | ||
60 | <cstring>fraStart</cstring> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>geometry</name> | ||
64 | <rect> | ||
65 | <x>11</x> | ||
66 | <y>11</y> | ||
67 | <width>175</width> | ||
68 | <height>136</height> | ||
69 | </rect> | ||
70 | </property> | ||
71 | <property stdset="1"> | ||
72 | <name>frameShape</name> | ||
73 | <enum>Box</enum> | ||
74 | </property> | ||
75 | <property stdset="1"> | ||
76 | <name>frameShadow</name> | ||
77 | <enum>Sunken</enum> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>title</name> | ||
81 | <string>Renew DHCP on changing</string> | ||
82 | </property> | ||
83 | <widget> | ||
84 | <class>QLayoutWidget</class> | ||
85 | <property stdset="1"> | ||
86 | <name>name</name> | ||
87 | <cstring>Layout5</cstring> | ||
88 | </property> | ||
89 | <property stdset="1"> | ||
90 | <name>geometry</name> | ||
91 | <rect> | ||
92 | <x>10</x> | ||
93 | <y>21</y> | ||
94 | <width>98</width> | ||
95 | <height>96</height> | ||
96 | </rect> | ||
97 | </property> | ||
98 | <grid> | ||
99 | <property stdset="1"> | ||
100 | <name>margin</name> | ||
101 | <number>0</number> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>spacing</name> | ||
105 | <number>6</number> | ||
106 | </property> | ||
107 | <widget row="1" column="0" > | ||
108 | <class>QCheckBox</class> | ||
109 | <property stdset="1"> | ||
110 | <name>name</name> | ||
111 | <cstring>cbFrequency</cstring> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>text</name> | ||
115 | <string>Frequency</string> | ||
116 | </property> | ||
117 | </widget> | ||
118 | <widget row="3" column="0" > | ||
119 | <class>QCheckBox</class> | ||
120 | <property stdset="1"> | ||
121 | <name>name</name> | ||
122 | <cstring>cbMODE</cstring> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>text</name> | ||
126 | <string>MODE</string> | ||
127 | </property> | ||
128 | </widget> | ||
129 | <widget row="0" column="0" > | ||
130 | <class>QCheckBox</class> | ||
131 | <property stdset="1"> | ||
132 | <name>name</name> | ||
133 | <cstring>cbESSID</cstring> | ||
134 | </property> | ||
135 | <property stdset="1"> | ||
136 | <name>text</name> | ||
137 | <string>ESSID</string> | ||
138 | </property> | ||
139 | </widget> | ||
140 | <widget row="2" column="0" > | ||
141 | <class>QCheckBox</class> | ||
142 | <property stdset="1"> | ||
143 | <name>name</name> | ||
144 | <cstring>cbAccessPoint</cstring> | ||
145 | </property> | ||
146 | <property stdset="1"> | ||
147 | <name>text</name> | ||
148 | <string>AccessPoint</string> | ||
149 | </property> | ||
150 | </widget> | ||
151 | </grid> | ||
152 | </widget> | ||
153 | </widget> | ||
154 | </widget> | ||
155 | <connections> | ||
156 | <slot access="protected">itemUp()</slot> | ||
157 | <slot access="protected">itemDown()</slot> | ||
158 | </connections> | ||
159 | </UI> | ||
diff --git a/noncore/applets/wirelessapplet/networkinfo.cpp b/noncore/applets/wirelessapplet/networkinfo.cpp index 22d7d83..8531fd5 100644 --- a/noncore/applets/wirelessapplet/networkinfo.cpp +++ b/noncore/applets/wirelessapplet/networkinfo.cpp | |||
@@ -53,2 +53,4 @@ | |||
53 | 53 | ||
54 | #define MDEBUG 0 | ||
55 | |||
54 | //--------------------------------------------------------------------------- | 56 | //--------------------------------------------------------------------------- |
@@ -71,4 +73,5 @@ MNetworkInterface::~MNetworkInterface() | |||
71 | 73 | ||
72 | void MNetworkInterface::updateStatistics() | 74 | bool MNetworkInterface::updateStatistics() |
73 | { | 75 | { |
76 | return true; | ||
74 | } | 77 | } |
@@ -106,5 +109,7 @@ int MWirelessNetworkInterface::noisePercent() | |||
106 | 109 | ||
107 | void MWirelessNetworkInterface::updateStatistics() | 110 | bool MWirelessNetworkInterface::updateStatistics() |
108 | { | 111 | { |
109 | MNetworkInterface::updateStatistics(); | 112 | bool base = MNetworkInterface::updateStatistics(); |
113 | if ( !base ) | ||
114 | return false; | ||
110 | 115 | ||
@@ -183,3 +188,5 @@ void MWirelessNetworkInterface::updateStatistics() | |||
183 | { | 188 | { |
189 | #ifdef MDEBUG | ||
184 | qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); | 190 | qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); |
191 | #endif | ||
185 | quality = -1; | 192 | quality = -1; |
@@ -187,3 +194,3 @@ void MWirelessNetworkInterface::updateStatistics() | |||
187 | noise = IW_LOWER; | 194 | noise = IW_LOWER; |
188 | return; | 195 | return false; |
189 | } | 196 | } |
@@ -193,7 +200,16 @@ void MWirelessNetworkInterface::updateStatistics() | |||
193 | if ( quality > 92 ) | 200 | if ( quality > 92 ) |
201 | #ifdef MDEBUG | ||
194 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); | 202 | qDebug( "WIFIAPPLET: D'oh! Quality %d > estimated max!\n", quality ); |
203 | #endif | ||
195 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) | 204 | if ( ( signal > IW_UPPER ) || ( signal < IW_LOWER ) ) |
205 | #ifdef MDEBUG | ||
196 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); | 206 | qDebug( "WIFIAPPLET: Doh! Strength %d > estimated max!\n", signal ); |
207 | #endif | ||
197 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) | 208 | if ( ( noise > IW_UPPER ) || ( noise < IW_LOWER ) ) |
209 | #ifdef MDEBUG | ||
198 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); | 210 | qDebug( "WIFIAPPLET: Doh! Noise %d > estimated max!\n", noise ); |
211 | #endif | ||
212 | |||
213 | return true; | ||
214 | |||
199 | } | 215 | } |
@@ -206,3 +222,2 @@ MNetwork::MNetwork() | |||
206 | { | 222 | { |
207 | //qDebug( "MNetwork::MNetwork()" ); | ||
208 | procfile = PROCNETDEV; | 223 | procfile = PROCNETDEV; |
@@ -212,3 +227,2 @@ MNetwork::~MNetwork() | |||
212 | { | 227 | { |
213 | //qDebug( "MNetwork::~MNetwork()" ); | ||
214 | } | 228 | } |
@@ -221,3 +235,2 @@ MWirelessNetwork::MWirelessNetwork() | |||
221 | { | 235 | { |
222 | //qDebug( "MWirelessNetwork::MWirelessNetwork()" ); | ||
223 | procfile = PROCNETWIRELESS; | 236 | procfile = PROCNETWIRELESS; |
@@ -227,3 +240,2 @@ MWirelessNetwork::~MWirelessNetwork() | |||
227 | { | 240 | { |
228 | //qDebug( "MWirelessNetwork::~MWirelessNetwork()" ); | ||
229 | } | 241 | } |
@@ -261,3 +273,5 @@ void MNetwork::enumerateInterfaces() | |||
261 | str.truncate( str.find( ':' ) ); | 273 | str.truncate( str.find( ':' ) ); |
274 | #ifdef MDEBUG | ||
262 | qDebug( "WIFIAPPLET: found interface '%s'", (const char*) str ); | 275 | qDebug( "WIFIAPPLET: found interface '%s'", (const char*) str ); |
276 | #endif | ||
263 | interfaces.insert( str, createInterface( str ) ); | 277 | interfaces.insert( str, createInterface( str ) ); |
diff --git a/noncore/applets/wirelessapplet/networkinfo.h b/noncore/applets/wirelessapplet/networkinfo.h index c5eb743..7e50bc4 100644 --- a/noncore/applets/wirelessapplet/networkinfo.h +++ b/noncore/applets/wirelessapplet/networkinfo.h | |||
@@ -39,3 +39,3 @@ public: | |||
39 | 39 | ||
40 | virtual void updateStatistics(); | 40 | virtual bool updateStatistics(); |
41 | 41 | ||
@@ -72,3 +72,3 @@ public: | |||
72 | 72 | ||
73 | virtual void updateStatistics(); | 73 | virtual bool updateStatistics(); |
74 | 74 | ||
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 183aab8..a5aabb0 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -23,3 +23,3 @@ | |||
23 | #include <qradiobutton.h> | 23 | #include <qradiobutton.h> |
24 | #include <qcheckbox.h> | 24 | #include <qpushbutton.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
@@ -33,2 +33,6 @@ | |||
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | ||
35 | |||
36 | #include <sys/types.h> | ||
37 | #include <signal.h> | ||
34 | 38 | ||
@@ -37,2 +41,4 @@ | |||
37 | 41 | ||
42 | #include "advancedconfig.h" | ||
43 | |||
38 | #include "connect0.xpm" | 44 | #include "connect0.xpm" |
@@ -48,2 +54,4 @@ | |||
48 | 54 | ||
55 | #define MDEBUG 0 | ||
56 | |||
49 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) | 57 | WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name ) |
@@ -96,8 +104,9 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
96 | 104 | ||
97 | /* dhcp renew CheckBox */ | 105 | /* advanced configuration Button */ |
98 | 106 | ||
99 | //FIXME: under construction | 107 | QPushButton* advanced = new QPushButton( "Advanced...", this ); |
100 | //QCheckBox* dhcpCheckBox = new QCheckBox( "DHCP renew", this ); | 108 | advanced->setFocusPolicy( QWidget::NoFocus ); |
101 | //dhcpCheckBox->setFocusPolicy( QWidget::NoFocus ); | 109 | grid->addWidget( advanced, 2, 0, Qt::AlignCenter ); |
102 | //grid->addWidget( dhcpCheckBox, 2, 0, Qt::AlignCenter ); | 110 | connect( advanced, SIGNAL( clicked() ), |
111 | this, SLOT( advancedConfigClicked() ) ); | ||
103 | 112 | ||
@@ -131,2 +140,17 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const | |||
131 | this, SLOT( displayStyleChange( int ) ) ); | 140 | this, SLOT( displayStyleChange( int ) ) ); |
141 | |||
142 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | ||
143 | } | ||
144 | |||
145 | void WirelessControl::advancedConfigClicked() | ||
146 | { | ||
147 | AdvancedConfig* a = new AdvancedConfig( this, "dialog", TRUE ); | ||
148 | int result = a->exec(); | ||
149 | a->hide(); | ||
150 | delete a; | ||
151 | if ( result == QDialog::Accepted ) | ||
152 | { | ||
153 | readConfig(); | ||
154 | applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE ); | ||
155 | } | ||
132 | } | 156 | } |
@@ -169,2 +193,6 @@ void WirelessControl::readConfig() | |||
169 | displayStyle = cfg. readNumEntry( "DisplayStyle", STYLE_ANTENNA ); | 193 | displayStyle = cfg. readNumEntry( "DisplayStyle", STYLE_ANTENNA ); |
194 | rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); | ||
195 | rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); | ||
196 | rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); | ||
197 | rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); | ||
170 | } | 198 | } |
@@ -182,3 +210,4 @@ WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) | |||
182 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), | 210 | : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), |
183 | timer( 0 ), interface( 0 ) | 211 | timer( 0 ), interface( 0 ), |
212 | rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) | ||
184 | { | 213 | { |
@@ -195,3 +224,5 @@ void WirelessApplet::checkInterface() | |||
195 | { | 224 | { |
225 | #ifdef MDEBUG | ||
196 | qDebug( "WIFIAPPLET: using interface '%s'", (const char*) | 226 | qDebug( "WIFIAPPLET: using interface '%s'", (const char*) |
227 | #endif | ||
197 | interface->getName() ); | 228 | interface->getName() ); |
@@ -200,4 +231,42 @@ void WirelessApplet::checkInterface() | |||
200 | { | 231 | { |
232 | #ifdef MDEBUG | ||
201 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); | 233 | qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); |
234 | hide(); | ||
235 | #endif | ||
236 | } | ||
237 | } | ||
238 | |||
239 | void WirelessApplet::renewDHCP() | ||
240 | { | ||
241 | #ifdef MDEBUG | ||
242 | qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); | ||
243 | #endif | ||
244 | |||
245 | QString pidfile; | ||
246 | if ( !interface ) | ||
247 | return; | ||
248 | QString ifacename( interface->getName() ); | ||
249 | pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); | ||
250 | #ifdef MDEBUG | ||
251 | qDebug( "WIFIAPPLET: pidfile is '%s'", (const char*) pidfile ); | ||
252 | #endif | ||
253 | int pid; | ||
254 | QFile pfile( pidfile ); | ||
255 | bool hasFile = pfile.open( IO_ReadOnly ); | ||
256 | QTextStream s( &pfile ); | ||
257 | if ( hasFile ) | ||
258 | s >> pid; | ||
259 | #ifdef MDEBUG | ||
260 | qDebug( "WIFIAPPLET: sent -14 to pid %d", pid ); | ||
261 | #endif | ||
262 | kill( pid, -14 ); | ||
263 | |||
202 | } | 264 | } |
265 | |||
266 | void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) | ||
267 | { | ||
268 | rocESSID = ESSID; | ||
269 | rocFREQ = FREQ; | ||
270 | rocAP = AP; | ||
271 | rocMODE = MODE; | ||
203 | } | 272 | } |
@@ -230,3 +299,9 @@ void WirelessApplet::timerEvent( QTimerEvent* ) | |||
230 | { | 299 | { |
231 | iface->updateStatistics(); | 300 | bool statResult = iface->updateStatistics(); |
301 | if ( !statResult ) | ||
302 | { | ||
303 | interface = 0; | ||
304 | mustRepaint(); | ||
305 | return; | ||
306 | } else | ||
232 | if ( mustRepaint() ) | 307 | if ( mustRepaint() ) |
@@ -261,4 +336,18 @@ bool WirelessApplet::mustRepaint() | |||
261 | oldiface = iface; | 336 | oldiface = iface; |
337 | if ( iface ) | ||
338 | { | ||
339 | #ifdef MDEBUG | ||
340 | qDebug( "WIFIAPPLET: We had no interface but now we have one! :-)" ); | ||
341 | #endif | ||
342 | show(); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | #ifdef MDEBUG | ||
347 | qDebug( "WIFIAPPLET: We had a interface but now we don't have one! ;-(" ); | ||
348 | #endif | ||
349 | hide(); | ||
262 | return true; | 350 | return true; |
263 | } | 351 | } |
352 | } | ||
264 | 353 | ||
@@ -286,2 +375,36 @@ bool WirelessApplet::mustRepaint() | |||
286 | 375 | ||
376 | if ( rocESSID && ( oldESSID != iface->essid ) ) | ||
377 | { | ||
378 | #ifdef MDEBUG | ||
379 | qDebug( "WIFIAPPLET: ESSID has changed."); | ||
380 | #endif | ||
381 | renewDHCP(); | ||
382 | } | ||
383 | else if ( rocFREQ && ( oldFREQ != iface->freq ) ) | ||
384 | { | ||
385 | #ifdef MDEBUG | ||
386 | qDebug( "WIFIAPPLET: FREQ has changed."); | ||
387 | #endif | ||
388 | renewDHCP(); | ||
389 | } | ||
390 | else if ( rocAP && ( oldAP != iface->APAddr ) ) | ||
391 | { | ||
392 | #ifdef MDEBUG | ||
393 | qDebug( "WIFIAPPLET: AP has changed."); | ||
394 | #endif | ||
395 | renewDHCP(); | ||
396 | } | ||
397 | else if ( rocMODE && ( oldMODE != iface->mode ) ) | ||
398 | { | ||
399 | #ifdef MDEBUG | ||
400 | qDebug( "WIFIAPPLET: MODE has changed."); | ||
401 | #endif | ||
402 | renewDHCP(); | ||
403 | } | ||
404 | |||
405 | oldESSID = iface->essid; | ||
406 | oldMODE = iface->mode; | ||
407 | oldFREQ = iface->freq; | ||
408 | oldAP = iface->APAddr; | ||
409 | |||
287 | return false; | 410 | return false; |
diff --git a/noncore/applets/wirelessapplet/wireless.h b/noncore/applets/wirelessapplet/wireless.h index 45c519d..51a3fab 100644 --- a/noncore/applets/wirelessapplet/wireless.h +++ b/noncore/applets/wirelessapplet/wireless.h | |||
@@ -47,2 +47,3 @@ public slots: | |||
47 | void displayStyleChange( int ); | 47 | void displayStyleChange( int ); |
48 | void advancedConfigClicked(); | ||
48 | 49 | ||
@@ -54,2 +55,6 @@ private: | |||
54 | 55 | ||
56 | bool rocESSID; | ||
57 | bool rocFREQ; | ||
58 | bool rocAP; | ||
59 | bool rocMODE; | ||
55 | }; | 60 | }; |
@@ -68,2 +73,4 @@ public: | |||
68 | 73 | ||
74 | void updateDHCPConfig( bool, bool, bool, bool ); | ||
75 | |||
69 | private: | 76 | private: |
@@ -72,2 +79,3 @@ private: | |||
72 | void checkInterface(); | 79 | void checkInterface(); |
80 | void renewDHCP(); | ||
73 | 81 | ||
@@ -91,2 +99,12 @@ private: | |||
91 | int oldnoiseH; | 99 | int oldnoiseH; |
100 | |||
101 | QString oldESSID; | ||
102 | QString oldAP; | ||
103 | QString oldMODE; | ||
104 | double oldFREQ; | ||
105 | |||
106 | bool rocESSID; | ||
107 | bool rocFREQ; | ||
108 | bool rocAP; | ||
109 | bool rocMODE; | ||
92 | }; | 110 | }; |
diff --git a/noncore/applets/wirelessapplet/wirelessapplet.pro b/noncore/applets/wirelessapplet/wirelessapplet.pro index b758d4f..390b271 100644 --- a/noncore/applets/wirelessapplet/wirelessapplet.pro +++ b/noncore/applets/wirelessapplet/wirelessapplet.pro | |||
@@ -2,4 +2,5 @@ TEMPLATE = lib | |||
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = wireless.h wirelessappletimpl.h networkinfo.h mgraph.h | 3 | HEADERS = wireless.h wirelessappletimpl.h networkinfo.h mgraph.h advancedconfig.h |
4 | SOURCES = wireless.cpp wirelessappletimpl.cpp networkinfo.cpp mgraph.cpp | 4 | SOURCES = wireless.cpp wirelessappletimpl.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp |
5 | INTERFACES = advancedconfigbase.ui | ||
5 | TARGET = wirelessapplet | 6 | TARGET = wirelessapplet |
@@ -9,3 +10,3 @@ DEPENDPATH += ../$(OPIEDIR)/include | |||
9 | LIBS += -lqpe | 10 | LIBS += -lqpe |
10 | VERSION = 0.0.3 | 11 | VERSION = 0.1.0 |
11 | 12 | ||