1 #include "authsecudlg.h"
4 #include <qbuttongroup.h>
8 #include <qpushbutton.h>
9 #include <qradiobutton.h>
12 #include <qwhatsthis.h>
13 #include <qmessagebox.h>
16 * Constructs a Security which is a child of 'parent', with the
17 * name 'name' and widget flags set to 'f'.
19 * The dialog will by default be modeless, unless you set 'modal' to
20 * TRUE to construct a modal dialog.
22 AuthSecuDlg::AuthSecuDlg( QWidget
* parent
, const char* name
, bool modal
, WFlags fl
)
23 : QDialog( parent
, name
, modal
, fl
)
26 setName( "AuthSecuDlg" );
28 setMinimumSize( 580, 325 );
29 setMaximumSize( 580, 325 );
30 setCaption("Authentication & AuthSecuDlg");
32 Security_TextLabel1
= new QLabel( this, "Security_TextLabel1" );
33 Security_TextLabel1
->setGeometry( QRect( 20, 14, 120, 30 ) );
34 Security_TextLabel1
->setText("Authentication Type:");
36 Security_ComboBox_AuthType
= new QComboBox( FALSE
, this, "Security_ComboBox_AuthType" );
37 Security_ComboBox_AuthType
->insertItem("OPEN");
38 Security_ComboBox_AuthType
->insertItem("SHARED");
39 Security_ComboBox_AuthType
->setGeometry( QRect( 150, 14, 120, 30 ) );
41 Security_TextLabel2
= new QLabel( this, "Security_TextLabel2" );
42 Security_TextLabel2
->setGeometry( QRect( 313, 14, 120, 30 ) );
43 Security_TextLabel2
->setText("Encryptiion Type:");
45 Security_ComboBox_Encrypt
= new QComboBox( FALSE
, this, "Security_ComboBox_Encrypt" );
46 Security_ComboBox_Encrypt
->insertItem("None");
47 Security_ComboBox_Encrypt
->insertItem("WEP");
48 Security_ComboBox_Encrypt
->setGeometry( QRect( 440, 15, 120, 30 ) );
50 Security_TextLabel3
= new QLabel( this, "Security_TextLabel3" );
51 Security_TextLabel3
->setGeometry( QRect( 20, 59, 120, 31 ) );
52 Security_TextLabel3
->setText("WPA Pre-Shared Key:");
54 Security_LineEdit_PSK
= new QLineEdit( this, "Security_LineEdit_PSK" );
55 Security_LineEdit_PSK
->setGeometry( QRect( 150, 59, 410, 30 ) );
56 Security_LineEdit_PSK
->setMaxLength(64);
57 Security_LineEdit_PSK
->setEnabled( FALSE
);
59 Security_ButtonGroup_Key
= new QButtonGroup( this, "Security_ButtonGroup_Key" );
60 Security_ButtonGroup_Key
->setGeometry( QRect( 21, 98, 535, 170 ) );
61 Security_ButtonGroup_Key
->setTitle("WEP Key");
63 Security_RadioButton_Key1
= new QRadioButton( Security_ButtonGroup_Key
, "Security_RadioButton_Key1" );
64 Security_RadioButton_Key1
->setGeometry( QRect( 10, 20, 70, 30 ) );
65 Security_RadioButton_Key1
->setText("Key#1");
66 Security_RadioButton_Key1
->setEnabled( FALSE
);
67 Security_RadioButton_Key1
->setChecked( TRUE
);
68 Security_ButtonGroup_Key
->insert( Security_RadioButton_Key1
, 0 );
70 Security_RadioButton_Key2
= new QRadioButton( Security_ButtonGroup_Key
, "Security_RadioButton_Key2" );
71 Security_RadioButton_Key2
->setGeometry( QRect( 10, 55, 70, 30 ) );
72 Security_RadioButton_Key2
->setText("Key#2");
73 Security_RadioButton_Key2
->setEnabled( FALSE
);
74 Security_RadioButton_Key2
->setChecked( FALSE
);
75 Security_ButtonGroup_Key
->insert( Security_RadioButton_Key2
, 1 );
77 Security_RadioButton_Key3
= new QRadioButton( Security_ButtonGroup_Key
, "Security_RadioButton_Key3" );
78 Security_RadioButton_Key3
->setGeometry( QRect( 10, 90, 70, 30 ) );
79 Security_RadioButton_Key3
->setText("Key#3");
80 Security_RadioButton_Key3
->setEnabled( FALSE
);
81 Security_RadioButton_Key3
->setChecked( FALSE
);
82 Security_ButtonGroup_Key
->insert( Security_RadioButton_Key3
, 2 );
84 Security_RadioButton_Key4
= new QRadioButton( Security_ButtonGroup_Key
, "Security_RadioButton_Key4" );
85 Security_RadioButton_Key4
->setGeometry( QRect( 10, 125, 70, 30 ) );
86 Security_RadioButton_Key4
->setText("Key#4");
87 Security_RadioButton_Key4
->setEnabled( FALSE
);
88 Security_RadioButton_Key4
->setChecked( FALSE
);
89 Security_ButtonGroup_Key
->insert( Security_RadioButton_Key4
, 3 );
91 Security_ComboBox_KeyType1
= new QComboBox( FALSE
, Security_ButtonGroup_Key
, "Security_ComboBox_KeyType1" );
92 Security_ComboBox_KeyType1
->insertItem("Hexadecimal");
93 Security_ComboBox_KeyType1
->insertItem("Ascii");
94 Security_ComboBox_KeyType1
->setGeometry( QRect( 90, 20, 120, 30 ) );
95 Security_ComboBox_KeyType1
->setEnabled( FALSE
);
97 Security_ComboBox_KeyType2
= new QComboBox( FALSE
, Security_ButtonGroup_Key
, "Security_ComboBox_KeyType2" );
98 Security_ComboBox_KeyType2
->insertItem("Hexadecimal");
99 Security_ComboBox_KeyType2
->insertItem("Ascii");
100 Security_ComboBox_KeyType2
->setGeometry( QRect( 90, 55, 120, 30 ) );
101 Security_ComboBox_KeyType2
->setEnabled( FALSE
);
103 Security_ComboBox_KeyType3
= new QComboBox( FALSE
, Security_ButtonGroup_Key
, "Security_ComboBox_KeyType3" );
104 Security_ComboBox_KeyType3
->insertItem("Hexadecimal");
105 Security_ComboBox_KeyType3
->insertItem("Ascii");
106 Security_ComboBox_KeyType3
->setGeometry( QRect( 90, 90, 120, 30 ) );
107 Security_ComboBox_KeyType3
->setEnabled( FALSE
);
109 Security_ComboBox_KeyType4
= new QComboBox( FALSE
, Security_ButtonGroup_Key
, "Security_ComboBox_KeyType4" );
110 Security_ComboBox_KeyType4
->insertItem("Hexadecimal");
111 Security_ComboBox_KeyType4
->insertItem("Ascii");
112 Security_ComboBox_KeyType4
->setGeometry( QRect( 90, 125, 120, 30 ) );
113 Security_ComboBox_KeyType4
->setEnabled( FALSE
);
115 m_hexValidator
= new QHexValidator(this);
117 Security_LineEdit_Key1Hex
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key1Hex" );
118 Security_LineEdit_Key1Hex
->setGeometry( QRect( 225, 20, 290, 30 ) );
119 Security_LineEdit_Key1Hex
->setMaxLength(26);
120 Security_LineEdit_Key1Hex
->setEnabled( FALSE
);
121 Security_LineEdit_Key1Hex
->setValidator(m_hexValidator
);
123 Security_LineEdit_Key1Ascii
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key1Ascii" );
124 Security_LineEdit_Key1Ascii
->setGeometry( QRect( 225, 20, 290, 30 ) );
125 Security_LineEdit_Key1Ascii
->setMaxLength(13);
126 Security_LineEdit_Key1Ascii
->hide();
127 Security_LineEdit_Key1Ascii
->setEnabled( FALSE
);
129 Security_LineEdit_Key2Hex
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key2Hex" );
130 Security_LineEdit_Key2Hex
->setGeometry( QRect( 225, 55, 290, 30 ) );
131 Security_LineEdit_Key2Hex
->setMaxLength(26);
132 Security_LineEdit_Key2Hex
->setEnabled( FALSE
);
133 Security_LineEdit_Key2Hex
->setValidator(m_hexValidator
);
135 Security_LineEdit_Key2Ascii
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key2Ascii" );
136 Security_LineEdit_Key2Ascii
->setGeometry( QRect( 225, 55, 290, 30 ) );
137 Security_LineEdit_Key2Ascii
->setMaxLength(13);
138 Security_LineEdit_Key2Ascii
->hide();
139 Security_LineEdit_Key2Ascii
->setEnabled( FALSE
);
141 Security_LineEdit_Key3Hex
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key3Hex" );
142 Security_LineEdit_Key3Hex
->setGeometry( QRect( 225, 90, 290, 30 ) );
143 Security_LineEdit_Key3Hex
->setMaxLength(26);
144 Security_LineEdit_Key3Hex
->setEnabled( FALSE
);
145 Security_LineEdit_Key3Hex
->setValidator(m_hexValidator
);
147 Security_LineEdit_Key3Ascii
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key3Ascii" );
148 Security_LineEdit_Key3Ascii
->setGeometry( QRect( 225, 90, 290, 30 ) );
149 Security_LineEdit_Key3Ascii
->setMaxLength(13);
150 Security_LineEdit_Key3Ascii
->hide();
151 Security_LineEdit_Key3Ascii
->setEnabled( FALSE
);
153 Security_LineEdit_Key4Hex
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key4Hex" );
154 Security_LineEdit_Key4Hex
->setGeometry( QRect( 225, 125, 290, 30 ) );
155 Security_LineEdit_Key4Hex
->setMaxLength(26);
156 Security_LineEdit_Key4Hex
->setEnabled( FALSE
);
157 Security_LineEdit_Key4Hex
->setValidator(m_hexValidator
);
159 Security_LineEdit_Key4Ascii
= new QLineEdit( Security_ButtonGroup_Key
, "Security_LineEdit_Key4Ascii" );
160 Security_LineEdit_Key4Ascii
->setGeometry( QRect( 225, 125, 290, 30 ) );
161 Security_LineEdit_Key4Ascii
->setMaxLength(13);
162 Security_LineEdit_Key4Ascii
->hide();
163 Security_LineEdit_Key4Ascii
->setEnabled( FALSE
);
165 PushButton_OK
= new QPushButton( this, "PushButton_OK" );
166 PushButton_OK
->setGeometry( QRect( 144, 282, 120, 30 ) );
167 PushButton_OK
->setText("&OK");
169 PushButton_Cancel
= new QPushButton( this, "PushButton_Cancel" );
170 PushButton_Cancel
->setGeometry( QRect( 314, 282, 120, 30 ) );
171 PushButton_Cancel
->setText("&CANCEL");
173 connect( PushButton_OK
, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
174 connect( PushButton_Cancel
, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
175 connect( Security_ComboBox_AuthType
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectAuthenType(int) ) );
176 connect( Security_ComboBox_Encrypt
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectEncryptType(int) ) );
177 connect( Security_ComboBox_KeyType1
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectKey1Type(int) ) );
178 connect( Security_ComboBox_KeyType2
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectKey2Type(int) ) );
179 connect( Security_ComboBox_KeyType3
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectKey3Type(int) ) );
180 connect( Security_ComboBox_KeyType4
, SIGNAL( activated(int) ), this, SLOT( Security_OnSelectKey4Type(int) ) );
186 * Destroys the object and frees any allocated resources
188 AuthSecuDlg::~AuthSecuDlg()
190 // no need to delete child widgets, Qt does it all for us
193 int AuthSecuDlg::Security_GetWepKeyType(int index
)
200 num
= Security_ComboBox_KeyType2
->currentItem();
203 num
= Security_ComboBox_KeyType3
->currentItem();
206 num
= Security_ComboBox_KeyType4
->currentItem();
210 num
= Security_ComboBox_KeyType1
->currentItem();
217 QString
AuthSecuDlg::Security_GetWepKeyString(int index
)
222 if ( Security_GetWepKeyType(index
) == 0) //Hex
223 return (Security_LineEdit_Key2Hex
->text());
225 return (Security_LineEdit_Key2Ascii
->text());
228 if ( Security_GetWepKeyType(index
) == 0) //Hex
229 return (Security_LineEdit_Key3Hex
->text());
231 return (Security_LineEdit_Key3Ascii
->text());
234 if ( Security_GetWepKeyType(index
) == 0) //Hex
235 return (Security_LineEdit_Key4Hex
->text());
237 return (Security_LineEdit_Key4Ascii
->text());
241 if ( Security_GetWepKeyType(index
) == 0) //Hex
242 return (Security_LineEdit_Key1Hex
->text());
244 return (Security_LineEdit_Key1Ascii
->text());
249 QString
AuthSecuDlg::Security_GetPSKString()
251 return (Security_LineEdit_PSK
->text());
254 NDIS_802_11_AUTHENTICATION_MODE
AuthSecuDlg::Security_GetAuthticationMode()
257 NDIS_802_11_AUTHENTICATION_MODE mode
= Ndis802_11AuthModeOpen
;
259 qstr
= Security_ComboBox_AuthType
->currentText();
260 if (qstr
.compare("OPEN") == 0)
261 mode
= Ndis802_11AuthModeOpen
;
262 else if (qstr
.compare("SHARED") == 0)
263 mode
= Ndis802_11AuthModeShared
;
264 else if (qstr
.compare("WPAPSK") == 0)
265 mode
= Ndis802_11AuthModeWPAPSK
;
270 NDIS_802_11_ENCRYPTION_STATUS
AuthSecuDlg::Security_GetEncryptType()
273 NDIS_802_11_ENCRYPTION_STATUS type
= Ndis802_11WEPDisabled
;
275 qstr
= Security_ComboBox_Encrypt
->currentText();
276 if (qstr
.compare("NONE") == 0)
277 type
= Ndis802_11WEPDisabled
;
278 else if (qstr
.compare("WEP") == 0)
279 type
= Ndis802_11WEPEnabled
;
280 else if (qstr
.compare("TKIP") == 0)
281 type
= Ndis802_11Encryption2Enabled
;
282 else if (qstr
.compare("AES") == 0)
283 type
= Ndis802_11Encryption3Enabled
;
288 void AuthSecuDlg::Security_SetAuthModeAndEncryType(NDIS_802_11_AUTHENTICATION_MODE mode
, NDIS_802_11_ENCRYPTION_STATUS type
)
290 if ((mode
== Ndis802_11AuthModeOpen
) || (mode
== Ndis802_11AuthModeShared
))
292 Security_LineEdit_PSK
->setEnabled( FALSE
);
294 Security_ComboBox_AuthType
->clear();
295 Security_ComboBox_AuthType
->insertItem("OPEN");
296 Security_ComboBox_AuthType
->insertItem("SHARED");
298 Security_ComboBox_Encrypt
->clear();
299 Security_ComboBox_Encrypt
->insertItem("NONE");
300 Security_ComboBox_Encrypt
->insertItem("WEP");
302 if (type
== Ndis802_11WEPEnabled
)
304 Security_ComboBox_Encrypt
->setCurrentItem( 1 );
306 Security_RadioButton_Key1
->setEnabled( TRUE
);
307 Security_RadioButton_Key2
->setEnabled( TRUE
);
308 Security_RadioButton_Key3
->setEnabled( TRUE
);
309 Security_RadioButton_Key4
->setEnabled( TRUE
);
311 Security_ComboBox_KeyType1
->setEnabled( TRUE
);
312 Security_ComboBox_KeyType2
->setEnabled( TRUE
);
313 Security_ComboBox_KeyType3
->setEnabled( TRUE
);
314 Security_ComboBox_KeyType4
->setEnabled( TRUE
);
316 Security_LineEdit_Key1Hex
->setEnabled( TRUE
);
317 Security_LineEdit_Key1Ascii
->setEnabled( TRUE
);
318 Security_LineEdit_Key2Hex
->setEnabled( TRUE
);
319 Security_LineEdit_Key2Ascii
->setEnabled( TRUE
);
320 Security_LineEdit_Key3Hex
->setEnabled( TRUE
);
321 Security_LineEdit_Key3Ascii
->setEnabled( TRUE
);
322 Security_LineEdit_Key4Hex
->setEnabled( TRUE
);
323 Security_LineEdit_Key4Ascii
->setEnabled( TRUE
);
327 Security_ComboBox_Encrypt
->setCurrentItem( 0 );
329 Security_RadioButton_Key1
->setEnabled( FALSE
);
330 Security_RadioButton_Key2
->setEnabled( FALSE
);
331 Security_RadioButton_Key3
->setEnabled( FALSE
);
332 Security_RadioButton_Key4
->setEnabled( FALSE
);
334 Security_ComboBox_KeyType1
->setEnabled( FALSE
);
335 Security_ComboBox_KeyType2
->setEnabled( FALSE
);
336 Security_ComboBox_KeyType3
->setEnabled( FALSE
);
337 Security_ComboBox_KeyType4
->setEnabled( FALSE
);
339 Security_LineEdit_Key1Hex
->setEnabled( FALSE
);
340 Security_LineEdit_Key1Ascii
->setEnabled( FALSE
);
341 Security_LineEdit_Key2Hex
->setEnabled( FALSE
);
342 Security_LineEdit_Key2Ascii
->setEnabled( FALSE
);
343 Security_LineEdit_Key3Hex
->setEnabled( FALSE
);
344 Security_LineEdit_Key3Ascii
->setEnabled( FALSE
);
345 Security_LineEdit_Key4Hex
->setEnabled( FALSE
);
346 Security_LineEdit_Key4Ascii
->setEnabled( FALSE
);
349 else if ((mode
== Ndis802_11AuthModeWPAPSK
) || (mode
== Ndis802_11AuthModeWPANone
))
351 Security_LineEdit_PSK
->setEnabled( TRUE
);
353 Security_ComboBox_AuthType
->clear();
354 if (mode
== Ndis802_11AuthModeWPAPSK
)
355 Security_ComboBox_AuthType
->insertItem("WPAPSK");
356 else if (mode
== Ndis802_11AuthModeWPANone
)
357 Security_ComboBox_AuthType
->insertItem("WPA-None");
360 Security_ComboBox_AuthType
->insertItem("WPAPSK");
361 Security_ComboBox_AuthType
->insertItem("WPA-None");
364 Security_ComboBox_Encrypt
->clear();
365 Security_ComboBox_Encrypt
->insertItem("TKIP");
366 Security_ComboBox_Encrypt
->insertItem("AES");
368 if (type
== Ndis802_11Encryption2Enabled
)
369 Security_ComboBox_Encrypt
->setCurrentItem( 0 );
370 else if(type
== Ndis802_11Encryption3Enabled
)
371 Security_ComboBox_Encrypt
->setCurrentItem( 1 );
373 Security_RadioButton_Key1
->setEnabled( FALSE
);
374 Security_RadioButton_Key2
->setEnabled( FALSE
);
375 Security_RadioButton_Key3
->setEnabled( FALSE
);
376 Security_RadioButton_Key4
->setEnabled( FALSE
);
378 Security_ComboBox_KeyType1
->setEnabled( FALSE
);
379 Security_ComboBox_KeyType2
->setEnabled( FALSE
);
380 Security_ComboBox_KeyType3
->setEnabled( FALSE
);
381 Security_ComboBox_KeyType4
->setEnabled( FALSE
);
383 Security_LineEdit_Key1Hex
->setEnabled( FALSE
);
384 Security_LineEdit_Key1Ascii
->setEnabled( FALSE
);
385 Security_LineEdit_Key2Hex
->setEnabled( FALSE
);
386 Security_LineEdit_Key2Ascii
->setEnabled( FALSE
);
387 Security_LineEdit_Key3Hex
->setEnabled( FALSE
);
388 Security_LineEdit_Key3Ascii
->setEnabled( FALSE
);
389 Security_LineEdit_Key4Hex
->setEnabled( FALSE
);
390 Security_LineEdit_Key4Ascii
->setEnabled( FALSE
);
394 int AuthSecuDlg::Security_GetDefaultKeyId()
398 keyId
= Security_ButtonGroup_Key
->id(Security_ButtonGroup_Key
->selected());
403 void AuthSecuDlg::Security_SetDefaultKeyId(int keyId
)
405 Security_ButtonGroup_Key
->setButton(keyId
);
408 void AuthSecuDlg::Security_SetKeyTypeAndKeyString(int keyIndex
, int keyType
, char *keyString
)
413 if (keyType
== 0) //Hex
415 Security_ComboBox_KeyType1
->setCurrentItem( 0 );
416 Security_LineEdit_Key1Hex
->setText(keyString
);
417 Security_LineEdit_Key1Hex
->show();
418 Security_LineEdit_Key1Ascii
->hide();
422 Security_ComboBox_KeyType1
->setCurrentItem( 1 );
423 Security_LineEdit_Key1Ascii
->setText(keyString
);
424 Security_LineEdit_Key1Ascii
->show();
425 Security_LineEdit_Key1Hex
->hide();
429 if (keyType
== 0) //Hex
431 Security_ComboBox_KeyType2
->setCurrentItem( 0 );
432 Security_LineEdit_Key2Hex
->setText(keyString
);
433 Security_LineEdit_Key2Hex
->show();
434 Security_LineEdit_Key2Ascii
->hide();
438 Security_ComboBox_KeyType2
->setCurrentItem( 1 );
439 Security_LineEdit_Key2Ascii
->setText(keyString
);
440 Security_LineEdit_Key2Ascii
->show();
441 Security_LineEdit_Key2Hex
->hide();
445 if (keyType
== 0) //Hex
447 Security_ComboBox_KeyType3
->setCurrentItem( 0 );
448 Security_LineEdit_Key3Hex
->setText(keyString
);
449 Security_LineEdit_Key3Hex
->show();
450 Security_LineEdit_Key3Ascii
->hide();
454 Security_ComboBox_KeyType3
->setCurrentItem( 1 );
455 Security_LineEdit_Key3Ascii
->setText(keyString
);
456 Security_LineEdit_Key3Ascii
->show();
457 Security_LineEdit_Key3Hex
->hide();
461 if (keyType
== 0) //Hex
463 Security_ComboBox_KeyType4
->setCurrentItem( 0 );
464 Security_LineEdit_Key4Hex
->setText(keyString
);
465 Security_LineEdit_Key4Hex
->show();
466 Security_LineEdit_Key4Ascii
->hide();
470 Security_ComboBox_KeyType4
->setCurrentItem( 1 );
471 Security_LineEdit_Key4Ascii
->setText(keyString
);
472 Security_LineEdit_Key4Ascii
->show();
473 Security_LineEdit_Key4Hex
->hide();
479 void AuthSecuDlg::OnOK()
487 qstrAuthen
= Security_ComboBox_AuthType
->currentText();
488 qstrEncryp
= Security_ComboBox_Encrypt
->currentText();
489 if (qstrAuthen
.compare("WPAPSK") == 0)
491 qstr
= Security_LineEdit_PSK
->text();
492 if (qstr
.length() < 8)
494 QMessageBox::warning(this, "Warning", "Invalid WPA Pre-Shared key. WPAPSK used field should use more than 8 characters.");
495 Security_LineEdit_PSK
->setFocus();
499 else if (qstrEncryp
.compare("WEP") == 0)
501 keyid
= Security_ButtonGroup_Key
->id(Security_ButtonGroup_Key
->selected());
502 qstr
= Security_GetWepKeyString(keyid
);
503 if (Security_GetWepKeyType(keyid
) == 0)
505 if ((qstr
.length() != 10) && (qstr
.length() != 26))
507 sprintf(msg
, "Invalid WEP KEY length. Key should be 10 or 26 hex digits!");
508 QMessageBox::warning(this, "Warning", msg
);
512 Security_LineEdit_Key1Hex
->setFocus();
515 Security_LineEdit_Key2Hex
->setFocus();
518 Security_LineEdit_Key3Hex
->setFocus();
521 Security_LineEdit_Key4Hex
->setFocus();
529 if ((qstr
.length() != 5) && (qstr
.length() != 13))
531 sprintf(msg
, "Invalid WEP KEY length. Key should be 5 or 13 ascii characters!");
532 QMessageBox::warning(this, "Warning", msg
);
536 Security_LineEdit_Key1Ascii
->setFocus();
539 Security_LineEdit_Key2Ascii
->setFocus();
542 Security_LineEdit_Key3Ascii
->setFocus();
545 Security_LineEdit_Key4Ascii
->setFocus();
557 void AuthSecuDlg::OnCancel()
563 void AuthSecuDlg::Security_OnSelectAuthenType(int id
)
567 textAuthen
= Security_ComboBox_AuthType
->text(id
);
568 if ((textAuthen
.compare("OPEN") == 0) || (textAuthen
.compare("SHARED") == 0))
570 Security_LineEdit_PSK
->setEnabled( FALSE
);
572 Security_ComboBox_Encrypt
->clear();
573 Security_ComboBox_Encrypt
->insertItem("NONE");
574 Security_ComboBox_Encrypt
->insertItem("WEP");
575 Security_ComboBox_Encrypt
->setCurrentItem( 1 );
577 Security_RadioButton_Key1
->setEnabled( TRUE
);
578 Security_RadioButton_Key2
->setEnabled( TRUE
);
579 Security_RadioButton_Key3
->setEnabled( TRUE
);
580 Security_RadioButton_Key4
->setEnabled( TRUE
);
582 Security_ComboBox_KeyType1
->setEnabled( TRUE
);
583 Security_ComboBox_KeyType2
->setEnabled( TRUE
);
584 Security_ComboBox_KeyType3
->setEnabled( TRUE
);
585 Security_ComboBox_KeyType4
->setEnabled( TRUE
);
587 Security_LineEdit_Key1Hex
->setEnabled( TRUE
);
588 Security_LineEdit_Key1Ascii
->setEnabled( TRUE
);
589 Security_LineEdit_Key2Hex
->setEnabled( TRUE
);
590 Security_LineEdit_Key2Ascii
->setEnabled( TRUE
);
591 Security_LineEdit_Key3Hex
->setEnabled( TRUE
);
592 Security_LineEdit_Key3Ascii
->setEnabled( TRUE
);
593 Security_LineEdit_Key4Hex
->setEnabled( TRUE
);
594 Security_LineEdit_Key4Ascii
->setEnabled( TRUE
);
597 else if (textAuthen
.compare("WPAPSK") == 0)
599 Security_LineEdit_PSK
->setEnabled( TRUE
);
601 Security_ComboBox_Encrypt
->clear();
602 Security_ComboBox_Encrypt
->insertItem("TKIP");
603 Security_ComboBox_Encrypt
->insertItem("AES");
604 Security_ComboBox_Encrypt
->setCurrentItem( 0 );
606 Security_RadioButton_Key1
->setEnabled( FALSE
);
607 Security_RadioButton_Key2
->setEnabled( FALSE
);
608 Security_RadioButton_Key3
->setEnabled( FALSE
);
609 Security_RadioButton_Key4
->setEnabled( FALSE
);
611 Security_ComboBox_KeyType1
->setEnabled( FALSE
);
612 Security_ComboBox_KeyType2
->setEnabled( FALSE
);
613 Security_ComboBox_KeyType3
->setEnabled( FALSE
);
614 Security_ComboBox_KeyType4
->setEnabled( FALSE
);
616 Security_LineEdit_Key1Hex
->setEnabled( FALSE
);
617 Security_LineEdit_Key1Ascii
->setEnabled( FALSE
);
618 Security_LineEdit_Key2Hex
->setEnabled( FALSE
);
619 Security_LineEdit_Key2Ascii
->setEnabled( FALSE
);
620 Security_LineEdit_Key3Hex
->setEnabled( FALSE
);
621 Security_LineEdit_Key3Ascii
->setEnabled( FALSE
);
622 Security_LineEdit_Key4Hex
->setEnabled( FALSE
);
623 Security_LineEdit_Key4Ascii
->setEnabled( FALSE
);
627 void AuthSecuDlg::Security_OnSelectEncryptType(int id
)
632 textEncry
= Security_ComboBox_Encrypt
->text(id
);
633 textAuthen
= Security_ComboBox_AuthType
->currentText();
634 if ((textAuthen
.compare("OPEN") == 0) || (textAuthen
.compare("SHARED") == 0))
636 if (textEncry
.compare("NONE") == 0)
638 Security_RadioButton_Key1
->setEnabled( FALSE
);
639 Security_RadioButton_Key2
->setEnabled( FALSE
);
640 Security_RadioButton_Key3
->setEnabled( FALSE
);
641 Security_RadioButton_Key4
->setEnabled( FALSE
);
643 Security_ComboBox_KeyType1
->setEnabled( FALSE
);
644 Security_ComboBox_KeyType2
->setEnabled( FALSE
);
645 Security_ComboBox_KeyType3
->setEnabled( FALSE
);
646 Security_ComboBox_KeyType4
->setEnabled( FALSE
);
648 Security_LineEdit_Key1Hex
->setEnabled( FALSE
);
649 Security_LineEdit_Key1Ascii
->setEnabled( FALSE
);
650 Security_LineEdit_Key2Hex
->setEnabled( FALSE
);
651 Security_LineEdit_Key2Ascii
->setEnabled( FALSE
);
652 Security_LineEdit_Key3Hex
->setEnabled( FALSE
);
653 Security_LineEdit_Key3Ascii
->setEnabled( FALSE
);
654 Security_LineEdit_Key4Hex
->setEnabled( FALSE
);
655 Security_LineEdit_Key4Ascii
->setEnabled( FALSE
);
657 Security_ComboBox_AuthType
->setCurrentItem(0);
661 Security_RadioButton_Key1
->setEnabled( TRUE
);
662 Security_RadioButton_Key2
->setEnabled( TRUE
);
663 Security_RadioButton_Key3
->setEnabled( TRUE
);
664 Security_RadioButton_Key4
->setEnabled( TRUE
);
666 Security_ComboBox_KeyType1
->setEnabled( TRUE
);
667 Security_ComboBox_KeyType2
->setEnabled( TRUE
);
668 Security_ComboBox_KeyType3
->setEnabled( TRUE
);
669 Security_ComboBox_KeyType4
->setEnabled( TRUE
);
671 Security_LineEdit_Key1Hex
->setEnabled( TRUE
);
672 Security_LineEdit_Key1Ascii
->setEnabled( TRUE
);
673 Security_LineEdit_Key2Hex
->setEnabled( TRUE
);
674 Security_LineEdit_Key2Ascii
->setEnabled( TRUE
);
675 Security_LineEdit_Key3Hex
->setEnabled( TRUE
);
676 Security_LineEdit_Key3Ascii
->setEnabled( TRUE
);
677 Security_LineEdit_Key4Hex
->setEnabled( TRUE
);
678 Security_LineEdit_Key4Ascii
->setEnabled( TRUE
);
683 void AuthSecuDlg::Security_OnSelectKey1Type(int id
)
687 Security_LineEdit_Key1Hex
->show();
688 Security_LineEdit_Key1Ascii
->hide();
692 Security_LineEdit_Key1Hex
->hide();
693 Security_LineEdit_Key1Ascii
->show();
697 void AuthSecuDlg::Security_OnSelectKey2Type(int id
)
701 Security_LineEdit_Key2Hex
->show();
702 Security_LineEdit_Key2Ascii
->hide();
706 Security_LineEdit_Key2Hex
->hide();
707 Security_LineEdit_Key2Ascii
->show();
711 void AuthSecuDlg::Security_OnSelectKey3Type(int id
)
715 Security_LineEdit_Key3Hex
->show();
716 Security_LineEdit_Key3Ascii
->hide();
720 Security_LineEdit_Key3Hex
->hide();
721 Security_LineEdit_Key3Ascii
->show();
725 void AuthSecuDlg::Security_OnSelectKey4Type(int id
)
729 Security_LineEdit_Key4Hex
->show();
730 Security_LineEdit_Key4Ascii
->hide();
734 Security_LineEdit_Key4Hex
->hide();
735 Security_LineEdit_Key4Ascii
->show();
739 bool AuthSecuDlg::Security_IsClickOk()
741 return (m_isClickOk
);