summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/wlan/wlanedit.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/wlan/wlanedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/wlan/wlanedit.cpp101
1 files changed, 100 insertions, 1 deletions
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
15WLanEdit::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
4WLanEdit::WLanEdit( QWidget * Parent ) : WLanGUI( Parent ){ 48WLanEdit::~WLanEdit( void ) {
49 if( WE )
50 delete WE;
5} 51}
6 52
7QString WLanEdit::acceptable( void ) { 53QString 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
11void WLanEdit::showData( WLanData_t & Data ) { 64void 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
14bool WLanEdit::commit( WLanData_t & Data ) { 79bool 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
96void 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
107void WLanEdit::SLOT_AutoRefresh( bool ar ) {
108 if( ar ) {
109 RefreshTimer.start( 1000 );
110 SLOT_Refresh();
111 } else {
112 RefreshTimer.stop();
113 }
114}
115