2 * wpa_gui - UserDataRequest class
3 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #include "userdatarequest.h"
11 #include "common/wpa_ctrl.h"
14 UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool,
20 connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply()));
21 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
22 connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply()));
26 UserDataRequest::~UserDataRequest()
31 void UserDataRequest::languageChange()
37 int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
39 char *tmp, *pos, *pos2;
44 pos = strchr(tmp, '-');
51 pos2 = strchr(pos, ':');
58 networkid = atoi(pos);
59 queryInfo->setText(pos2);
60 if (strcmp(tmp, "PASSWORD") == 0) {
61 queryField->setText(tr("Password: "));
62 queryEdit->setEchoMode(QLineEdit::Password);
63 } else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
64 queryField->setText(tr("New password: "));
65 queryEdit->setEchoMode(QLineEdit::Password);
66 } else if (strcmp(tmp, "IDENTITY") == 0)
67 queryField->setText(tr("Identity: "));
68 else if (strcmp(tmp, "PASSPHRASE") == 0) {
69 queryField->setText(tr("Private key passphrase: "));
70 queryEdit->setEchoMode(QLineEdit::Password);
72 queryField->setText(field + ":");
79 void UserDataRequest::sendReply()
82 size_t reply_len = sizeof(reply);
89 QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
90 QString::number(networkid) + ':' +
92 wpagui->ctrlRequest(cmd.toLocal8Bit().constData(), reply, &reply_len);