|
Lines 27-37
Link Here
|
| 27 |
|
27 |
|
| 28 |
// Own Header |
28 |
// Own Header |
| 29 |
#include "wepkeyinputdialog.h" |
29 |
#include "wepkeyinputdialog.h" |
|
|
30 |
#include <kwallet.h> |
| 31 |
|
| 32 |
#define WALLET_NAME "kinternet_wepkeys" |
| 33 |
|
| 34 |
KWallet::Wallet* wallet = 0; |
| 35 |
QString essid; |
| 36 |
QString idtype, idmode; |
| 30 |
|
37 |
|
| 31 |
/*! The default constructor of the class */ |
38 |
/*! The default constructor of the class */ |
| 32 |
WepkeyInputDialog::WepkeyInputDialog(QWidget *parent, const char *name) |
39 |
WepkeyInputDialog::WepkeyInputDialog(QString _essid, QWidget *parent, const char *name) |
| 33 |
: wepKey_Inputdialog(parent, name) |
40 |
: wepKey_Inputdialog(parent, name) |
| 34 |
{ |
41 |
{ |
|
|
42 |
|
| 43 |
QString walletName = tr(WALLET_NAME); |
| 44 |
QString wepkey, keytype, authmode; |
| 45 |
bool walletOK = false; |
| 46 |
|
| 47 |
essid = _essid; |
| 48 |
|
| 49 |
idtype = (&essid)->append( 't' ); |
| 50 |
idmode = (&essid)->append( 'm' ); |
| 51 |
|
| 35 |
// fill the dropdownbox |
52 |
// fill the dropdownbox |
| 36 |
comboB_authmode->insertItem("open"); |
53 |
comboB_authmode->insertItem("open"); |
| 37 |
comboB_authmode->insertItem("shared"); |
54 |
comboB_authmode->insertItem("shared"); |
|
Lines 40-45
Link Here
|
| 40 |
comboB_keytype->insertItem("ascii"); |
57 |
comboB_keytype->insertItem("ascii"); |
| 41 |
comboB_keytype->insertItem("hash (64 bit)"); |
58 |
comboB_keytype->insertItem("hash (64 bit)"); |
| 42 |
comboB_keytype->insertItem("hash (128 bit)"); |
59 |
comboB_keytype->insertItem("hash (128 bit)"); |
|
|
60 |
|
| 61 |
if (KWallet::Wallet::isEnabled()) |
| 62 |
{ |
| 63 |
// Open local wallet |
| 64 |
wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet()); |
| 65 |
if (wallet != 0) |
| 66 |
{ |
| 67 |
// Check if folder exists, otherwise create it |
| 68 |
walletOK = wallet->hasFolder(walletName); |
| 69 |
if (walletOK == false) |
| 70 |
{ |
| 71 |
walletOK = wallet->createFolder(walletName); |
| 72 |
} |
| 73 |
// Read password entry |
| 74 |
if (walletOK == true) |
| 75 |
{ |
| 76 |
if(wallet->readPassword( essid, wepkey ) == 0) |
| 77 |
{ |
| 78 |
lineEdit_wepkey->setText( wepkey ); |
| 79 |
} |
| 80 |
// if(wallet->readPassword( idtype, keytype ) == 0) |
| 81 |
// { |
| 82 |
// comboB_keytype->setCurrentText( keytype ); |
| 83 |
// } |
| 84 |
// if(wallet->readPassword( idmode, authmode ) == 0) |
| 85 |
// { |
| 86 |
// comboB_authmode->setCurrentText( authmode ); |
| 87 |
// } |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 43 |
} |
92 |
} |
| 44 |
|
93 |
|
| 45 |
/*! The default destructor of the class */ |
94 |
/*! The default destructor of the class */ |
|
Lines 52-59
Link Here
|
| 52 |
*/ |
101 |
*/ |
| 53 |
void WepkeyInputDialog::accept(){ |
102 |
void WepkeyInputDialog::accept(){ |
| 54 |
wep_key = lineEdit_wepkey->text(); |
103 |
wep_key = lineEdit_wepkey->text(); |
| 55 |
|
104 |
wallet->writePassword( essid, wep_key ); |
|
|
105 |
|
| 56 |
wep_key_type = comboB_keytype->currentText(); |
106 |
wep_key_type = comboB_keytype->currentText(); |
|
|
107 |
// wallet->writePassword( idtype, wep_key_type ); |
| 57 |
|
108 |
|
| 58 |
if(wep_key_type.startsWith("hash (64 bit)")) { |
109 |
if(wep_key_type.startsWith("hash (64 bit)")) { |
| 59 |
wep_key_type = "hash40"; |
110 |
wep_key_type = "hash40"; |
|
Lines 63-68
Link Here
|
| 63 |
} |
114 |
} |
| 64 |
|
115 |
|
| 65 |
authmode = comboB_authmode->currentText(); |
116 |
authmode = comboB_authmode->currentText(); |
|
|
117 |
// wallet->writePassword( idmode, authmode ); |
| 66 |
|
118 |
|
| 67 |
close(); |
119 |
close(); |
| 68 |
} |
120 |
} |