2 * wpa_gui - UserDataRequest class
3 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "userdatarequest.h"
20 UserDataRequest::UserDataRequest(QWidget
*parent
, const char *, bool,
26 connect(buttonOk
, SIGNAL(clicked()), this, SLOT(sendReply()));
27 connect(buttonCancel
, SIGNAL(clicked()), this, SLOT(reject()));
28 connect(queryEdit
, SIGNAL(returnPressed()), this, SLOT(sendReply()));
32 UserDataRequest::~UserDataRequest()
37 void UserDataRequest::languageChange()
43 int UserDataRequest::setParams(WpaGui
*_wpagui
, const char *reqMsg
)
45 char *tmp
, *pos
, *pos2
;
50 pos
= strchr(tmp
, '-');
57 pos2
= strchr(pos
, ':');
64 networkid
= atoi(pos
);
65 queryInfo
->setText(pos2
);
66 if (strcmp(tmp
, "PASSWORD") == 0) {
67 queryField
->setText("Password: ");
68 queryEdit
->setEchoMode(QLineEdit::Password
);
69 } else if (strcmp(tmp
, "NEW_PASSWORD") == 0) {
70 queryField
->setText("New password: ");
71 queryEdit
->setEchoMode(QLineEdit::Password
);
72 } else if (strcmp(tmp
, "IDENTITY") == 0)
73 queryField
->setText("Identity: ");
74 else if (strcmp(tmp
, "PASSPHRASE") == 0) {
75 queryField
->setText("Private key passphrase: ");
76 queryEdit
->setEchoMode(QLineEdit::Password
);
78 queryField
->setText(field
+ ":");
85 void UserDataRequest::sendReply()
88 size_t reply_len
= sizeof(reply
);
95 QString cmd
= QString(WPA_CTRL_RSP
) + field
+ '-' +
96 QString::number(networkid
) + ':' +
98 wpagui
->ctrlRequest(cmd
.toAscii().constData(), reply
, &reply_len
);