summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet
authorsandman <sandman>2002-10-31 02:12:34 (UTC)
committer sandman <sandman>2002-10-31 02:12:34 (UTC)
commit035eaf63bb2156ea7facd6b50f8891503d1f7bed (patch) (unidiff)
treecbb390a9a67952ea501eaa376ae72b425ae16f6b /noncore/applets/wirelessapplet
parentddd5f680b3dbd5e169d43f5216fbf24b04e4cb33 (diff)
downloadopie-035eaf63bb2156ea7facd6b50f8891503d1f7bed.zip
opie-035eaf63bb2156ea7facd6b50f8891503d1f7bed.tar.gz
opie-035eaf63bb2156ea7facd6b50f8891503d1f7bed.tar.bz2
Applied the same fix as in volume applet (parent widget should not be 0 for
taskbar applets) even though wireless applet seems not to be causing any troubles. But IMHO it's better to apply it now ...
Diffstat (limited to 'noncore/applets/wirelessapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index fb9522a..763aab8 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -170,97 +170,97 @@ void WirelessControl::displayStyleChange( int style )
170 applet->displayStyleChange( style ); 170 applet->displayStyleChange( style );
171 writeConfigEntry( "DisplayStyle", style ); 171 writeConfigEntry( "DisplayStyle", style );
172} 172}
173 173
174void WirelessControl::show ( bool ) 174void WirelessControl::show ( bool )
175{ 175{
176 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); 176 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) );
177 177
178 int w = sizeHint().width(); 178 int w = sizeHint().width();
179 int x = curPos.x() - ( w / 2 ); 179 int x = curPos.x() - ( w / 2 );
180 180
181 if ( ( x + w ) > QPEApplication::desktop()->width() ) 181 if ( ( x + w ) > QPEApplication::desktop()->width() )
182 x = QPEApplication::desktop ( )-> width ( ) - w; 182 x = QPEApplication::desktop ( )-> width ( ) - w;
183 183
184 move( x, curPos.y () - sizeHint().height () ); 184 move( x, curPos.y () - sizeHint().height () );
185 QFrame::show(); 185 QFrame::show();
186} 186}
187 187
188void WirelessControl::readConfig() 188void WirelessControl::readConfig()
189{ 189{
190 Config cfg( "qpe" ); 190 Config cfg( "qpe" );
191 cfg.setGroup( "Wireless" ); 191 cfg.setGroup( "Wireless" );
192 192
193 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 ); 193 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
194 displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA ); 194 displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA );
195 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false ); 195 rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false );
196 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false ); 196 rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false );
197 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false ); 197 rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false );
198 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false ); 198 rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false );
199} 199}
200 200
201void WirelessControl::writeConfigEntry( const char *entry, int val ) 201void WirelessControl::writeConfigEntry( const char *entry, int val )
202{ 202{
203 Config cfg( "qpe" ); 203 Config cfg( "qpe" );
204 cfg.setGroup( "Wireless" ); 204 cfg.setGroup( "Wireless" );
205 cfg.writeEntry( entry, val ); 205 cfg.writeEntry( entry, val );
206} 206}
207 207
208//=========================================================================== 208//===========================================================================
209 209
210WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) 210WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
211 : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), 211 : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ),
212 timer( 0 ), interface( 0 ), 212 timer( 0 ), interface( 0 ),
213 rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) 213 rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false )
214{ 214{
215 setFixedHeight( 18 ); 215 setFixedHeight( 18 );
216 setFixedWidth( 14 ); 216 setFixedWidth( 14 );
217 network = new MWirelessNetwork(); 217 network = new MWirelessNetwork();
218 status = new WirelessControl( this, 0, "wireless status" ); 218 status = new WirelessControl( this, this, "wireless status" );
219} 219}
220 220
221void WirelessApplet::checkInterface() 221void WirelessApplet::checkInterface()
222{ 222{
223 interface = network->getFirstInterface(); 223 interface = network->getFirstInterface();
224 if ( interface ) 224 if ( interface )
225 { 225 {
226#ifdef MDEBUG 226#ifdef MDEBUG
227 qDebug( "WIFIAPPLET: using interface '%s'", (const char*) interface->getName() ); 227 qDebug( "WIFIAPPLET: using interface '%s'", (const char*) interface->getName() );
228#endif 228#endif
229 } 229 }
230 else 230 else
231 { 231 {
232#ifdef MDEBUG 232#ifdef MDEBUG
233 qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" ); 233 qDebug( "WIFIAPPLET: D'oh! No Wireless interface present... :(" );
234#endif 234#endif
235 hide(); 235 hide();
236 } 236 }
237} 237}
238 238
239void WirelessApplet::renewDHCP() 239void WirelessApplet::renewDHCP()
240{ 240{
241#ifdef MDEBUG 241#ifdef MDEBUG
242 qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." ); 242 qDebug( "WIFIAPPLET: Going to request a DHCP configuration renew." );
243#endif 243#endif
244 244
245 QString pidfile; 245 QString pidfile;
246 if ( !interface ) 246 if ( !interface )
247 return; 247 return;
248 QString ifacename( interface->getName() ); 248 QString ifacename( interface->getName() );
249 249
250 // At first we are trying dhcpcd 250 // At first we are trying dhcpcd
251 251
252 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); 252 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename );
253#ifdef MDEBUG 253#ifdef MDEBUG
254 qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", (const char*) pidfile ); 254 qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", (const char*) pidfile );
255#endif 255#endif
256 int pid; 256 int pid;
257 QFile pfile( pidfile ); 257 QFile pfile( pidfile );
258 bool hasFile = pfile.open( IO_ReadOnly ); 258 bool hasFile = pfile.open( IO_ReadOnly );
259 QTextStream s( &pfile ); 259 QTextStream s( &pfile );
260 if ( hasFile ) 260 if ( hasFile )
261 { 261 {
262 s >> pid; 262 s >> pid;
263#ifdef MDEBUG 263#ifdef MDEBUG
264 qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid ); 264 qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid );
265#endif 265#endif
266 kill( pid, SIGALRM ); 266 kill( pid, SIGALRM );