wpa_gui-qt4/userdatarequest.ui.h

00001 /* **************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you want to add, delete, or rename functions or slots, use
00005 ** Qt Designer to update this file, preserving your code.
00006 **
00007 ** You should not define a constructor or destructor in this file.
00008 ** Instead, write your code in functions called init() and destroy().
00009 ** These will automatically be called by the form's constructor and
00010 ** destructor.
00011 *****************************************************************************/
00012 
00013 int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
00014 {
00015     char *tmp, *pos, *pos2;
00016     wpagui = _wpagui;
00017     tmp = strdup(reqMsg);
00018     if (tmp == NULL)
00019         return -1;
00020     pos = strchr(tmp, '-');
00021     if (pos == NULL) {
00022         free(tmp);
00023         return -1;
00024     }
00025     *pos++ = '\0';
00026     field = tmp;
00027     pos2 = strchr(pos, ':');
00028     if (pos2 == NULL) {
00029         free(tmp);
00030         return -1;
00031     }
00032     *pos2++ = '\0';
00033     
00034     networkid = atoi(pos);
00035     queryInfo->setText(pos2);
00036     if (strcmp(tmp, "PASSWORD") == 0) {
00037         queryField->setText("Password: ");
00038         queryEdit->setEchoMode(QLineEdit::Password);
00039     } else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
00040         queryField->setText("New password: ");
00041         queryEdit->setEchoMode(QLineEdit::Password);
00042     } else if (strcmp(tmp, "IDENTITY") == 0)
00043         queryField->setText("Identity: ");
00044     else if (strcmp(tmp, "PASSPHRASE") == 0) {
00045         queryField->setText("Private key passphrase: ");
00046         queryEdit->setEchoMode(QLineEdit::Password);
00047     } else
00048         queryField->setText(field + ":");
00049     free(tmp);
00050     
00051     return 0;
00052 }
00053 
00054 
00055 void UserDataRequest::sendReply()
00056 {
00057     char reply[10];
00058     size_t reply_len = sizeof(reply);
00059     
00060     if (wpagui == NULL) {
00061         reject();
00062         return;
00063     }
00064     
00065     QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
00066                   QString::number(networkid) + ':' +
00067                   queryEdit->text();
00068     wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
00069     accept();
00070 }
00071 

Generated on Sat May 6 21:13:41 2006 for wpa_supplicant by  doxygen 1.4.2