summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet
Unidiff
Diffstat (limited to 'noncore/applets/wirelessapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp62
1 files changed, 44 insertions, 18 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 649cf20..fb9522a 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -53,5 +53,5 @@
53#define STYLE_ANTENNA 1 53#define STYLE_ANTENNA 1
54 54
55//#define MDEBUG 0 55//#define MDEBUG
56#undef MDEBUG 56#undef MDEBUG
57 57
@@ -63,10 +63,10 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
63 writeConfigEntry( "UpdateFrequency", updateFrequency ); 63 writeConfigEntry( "UpdateFrequency", updateFrequency );
64 writeConfigEntry( "DisplayStyle", displayStyle ); 64 writeConfigEntry( "DisplayStyle", displayStyle );
65 65
66 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 66 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
67 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" ); 67 QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
68 68
69 /* status label */ 69 /* status label */
70 70
71 statusLabel = new QLabel( this, "statuslabel" ); 71 statusLabel = new QLabel( this, "statuslabel" );
72 QString text( "Wireless Status:<br>" 72 QString text( "Wireless Status:<br>"
@@ -85,5 +85,5 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
85 85
86 /* visualization group box */ 86 /* visualization group box */
87 87
88 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this ); 88 QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this );
89 QRadioButton* r1 = new QRadioButton( "Color Bars", group ); 89 QRadioButton* r1 = new QRadioButton( "Color Bars", group );
@@ -96,5 +96,5 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
96 96
97 /* quality graph */ 97 /* quality graph */
98 98
99 mgraph = new MGraph( this ); 99 mgraph = new MGraph( this );
100 mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 100 mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
@@ -103,7 +103,7 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
103 grid->addWidget( mgraph, 1, 0 ); 103 grid->addWidget( mgraph, 1, 0 );
104 mgraph->setFocusPolicy( QWidget::NoFocus ); 104 mgraph->setFocusPolicy( QWidget::NoFocus );
105 105
106 /* advanced configuration Button */ 106 /* advanced configuration Button */
107 107
108 QPushButton* advanced = new QPushButton( "Advanced...", this ); 108 QPushButton* advanced = new QPushButton( "Advanced...", this );
109 advanced->setFocusPolicy( QWidget::NoFocus ); 109 advanced->setFocusPolicy( QWidget::NoFocus );
@@ -113,5 +113,5 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
113 113
114 /* update Frequency Label */ 114 /* update Frequency Label */
115 115
116 updateLabel = new QLabel( this ); 116 updateLabel = new QLabel( this );
117 text.sprintf( "Update every %d s", updateFrequency ); 117 text.sprintf( "Update every %d s", updateFrequency );
@@ -120,5 +120,5 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
120 120
121 /* update Frequency Slider */ 121 /* update Frequency Slider */
122 122
123 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); 123 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
124 updateSlider->setRange( 0, 9 ); 124 updateSlider->setRange( 0, 9 );
@@ -234,6 +234,6 @@ void WirelessApplet::checkInterface()
234#endif 234#endif
235 hide(); 235 hide();
236 } 236 }
237} 237}
238 238
239void WirelessApplet::renewDHCP() 239void WirelessApplet::renewDHCP()
@@ -247,7 +247,10 @@ void WirelessApplet::renewDHCP()
247 return; 247 return;
248 QString ifacename( interface->getName() ); 248 QString ifacename( interface->getName() );
249
250 // At first we are trying dhcpcd
251
249 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename ); 252 pidfile.sprintf( "/var/run/dhcpcd-%s.pid", (const char* ) ifacename );
250#ifdef MDEBUG 253#ifdef MDEBUG
251 qDebug( "WIFIAPPLET: pidfile is '%s'", (const char*) pidfile ); 254 qDebug( "WIFIAPPLET: dhcpcd pidfile is '%s'", (const char*) pidfile );
252#endif 255#endif
253 int pid; 256 int pid;
@@ -256,11 +259,34 @@ void WirelessApplet::renewDHCP()
256 QTextStream s( &pfile ); 259 QTextStream s( &pfile );
257 if ( hasFile ) 260 if ( hasFile )
261 {
258 s >> pid; 262 s >> pid;
259#ifdef MDEBUG 263#ifdef MDEBUG
260 qDebug( "WIFIAPPLET: sent -14 to pid %d", pid ); 264 qDebug( "WIFIAPPLET: sent SIGALARM to pid %d", pid );
261#endif 265#endif
262 kill( pid, -14 ); 266 kill( pid, SIGALRM );
267 return;
268 }
263 269
264} 270 // No dhcpcd, so we are trying udhcpc
271#ifdef MDEBUG
272 qDebug( "WIFIAPPLET: dhcpcd not available." );
273#endif
274 pidfile.sprintf( "/var/run/udhcpc.%s.pid", (const char*) ifacename );
275#ifdef MDEBUG
276 qDebug( "WIFIAPPLET: udhcpc pidfile is '%s'", (const char*) pidfile );
277#endif
278 QFile pfile2( pidfile );
279 hasFile = pfile2.open( IO_ReadOnly );
280 QTextStream s2( &pfile2 );
281 if ( hasFile )
282 {
283 s2 >> pid;
284#ifdef MDEBUG
285 qDebug( "WIFIAPPLET: sent SIGUSR1 to pid %d", pid );
286#endif
287 kill( pid, SIGUSR1 );
288 return;
289 }
290}
265 291
266void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE ) 292void WirelessApplet::updateDHCPConfig( bool ESSID, bool FREQ, bool AP, bool MODE )