Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

wlanedit.cpp

Go to the documentation of this file.
00001 #include <qlineedit.h>
00002 #include <qprogressbar.h>
00003 #include <qcombobox.h>
00004 #include <qlabel.h>
00005 #include <qregexp.h>
00006 #include <qcheckbox.h>
00007 #include <GUIUtils.h>
00008 #include <resources.h>
00009 #include <wextensions.h>
00010 
00011 #include "wlanedit.h"
00012 #include "wlan_NN.h"
00013 #include "wlan_NNI.h"
00014 
00015 WLanEdit::WLanEdit( QWidget * Parent, ANetNodeInstance * TNNI ) : 
00016       WLanGUI( Parent ), RefreshTimer(this){
00017 
00018       InterfaceInfo * II;
00019 
00020       NNI = TNNI;
00021       Dev = NNI->runtime()->device();
00022       WE = 0;
00023       if( ( II = NNI->networkSetup()->assignedInterface() ) ) {
00024         // show data
00025         WE = new WExtensions( II->Name );
00026 
00027         if( WE->doesHaveWirelessExtensions() ) {
00028           QString S;
00029           Station_LBL->setText( WE->station() );
00030           ESSID_LBL->setText( WE->essid() );
00031           Mode_LBL->setText( WE->mode() );
00032           S.setNum( WE->frequency() );
00033           Frequency_LBL->setText( S );
00034           S.setNum( WE->channel() );
00035           Channel_LBL->setText( S );
00036           S.setNum( WE->rate() );
00037           Rate_LBL->setText( S );
00038           AP_LBL->setText( WE->ap() );
00039 
00040           SLOT_Refresh();
00041 
00042           connect( &RefreshTimer, SIGNAL( timeout() ),
00043                  this, SLOT( SLOT_Refresh() ) );
00044         }
00045       }
00046 }
00047 
00048 WLanEdit::~WLanEdit( void ) { 
00049       if( WE )
00050         delete WE;
00051 }
00052 
00053 QString WLanEdit::acceptable( void ) {
00054     if( ESSID_LE->text().isEmpty() ) {
00055       return QString("ESSID is mandatory");
00056     }
00057     if( SpecifyAP_CB->isChecked() &&
00058         APMac_LE->text().isEmpty() ) {
00059       return QString("APMac must have value");
00060     }
00061     return QString();
00062 }
00063 
00064 void WLanEdit::showData( WLanData & Data ) {
00065     Mode_CB->setCurrentItem( Data.Mode );
00066     ESSID_LE->setText( Data.ESSID );
00067     NodeName_LE->setText( Data.NodeName );
00068     SpecifyAP_CB->setChecked( Data.SpecificAP );
00069     APMac_LE->setText( Data.APMac );
00070 
00071     EnableWEP_CB->setChecked( Data.Encrypted );
00072     AcceptNonEncrypted_CB->setChecked( Data.AcceptNonEncrypted );
00073     Key1_LE->setText( Data.Key[0] );
00074     Key2_LE->setText( Data.Key[1] );
00075     Key3_LE->setText( Data.Key[2] );
00076     Key4_LE->setText( Data.Key[3] );
00077 }
00078 
00079 bool WLanEdit::commit( WLanData & Data ) {
00080     bool SM = 0;
00081 
00082     TXTM( Data.ESSID, ESSID_LE, SM );
00083     TXTM( Data.NodeName, NodeName_LE, SM );
00084     TXTM( Data.APMac, APMac_LE, SM );
00085     TXTM( Data.Key[0], Key1_LE, SM );
00086     TXTM( Data.Key[1], Key2_LE, SM );
00087     TXTM( Data.Key[2], Key3_LE, SM );
00088     TXTM( Data.Key[3], Key4_LE, SM );
00089     CBM( Data.SpecificAP, SpecifyAP_CB, SM );
00090     CBM( Data.Encrypted, EnableWEP_CB, SM );
00091     CBM( Data.AcceptNonEncrypted, AcceptNonEncrypted_CB, SM );
00092     CIM( Data.Mode, Mode_CB, SM );
00093     return 0;
00094 }
00095 
00096 void WLanEdit::SLOT_Refresh( void ) {
00097   if( WE ) {
00098     int signal, noise, quality;
00099     WE->stats( signal, noise, quality);
00100 
00101     Signal_PB->setProgress( signal );
00102     Noise_PB->setProgress( noise );
00103     Quality_PB->setProgress( quality );
00104   }
00105 }
00106 
00107 void WLanEdit::SLOT_AutoRefresh( bool ar ) {
00108     if( ar ) {
00109       RefreshTimer.start( 1000 );
00110       SLOT_Refresh();
00111     } else {
00112       RefreshTimer.stop();
00113     }
00114 }
00115 

Generated on Sat Nov 5 16:17:56 2005 for OPIE by  doxygen 1.4.2