$search
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 #include <stdlib.h> 00014 00015 int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg) 00016 { 00017 char *tmp, *pos, *pos2; 00018 wpagui = _wpagui; 00019 tmp = strdup(reqMsg); 00020 if (tmp == NULL) 00021 return -1; 00022 pos = strchr(tmp, '-'); 00023 if (pos == NULL) { 00024 free(tmp); 00025 return -1; 00026 } 00027 *pos++ = '\0'; 00028 field = tmp; 00029 pos2 = strchr(pos, ':'); 00030 if (pos2 == NULL) { 00031 free(tmp); 00032 return -1; 00033 } 00034 *pos2++ = '\0'; 00035 00036 networkid = atoi(pos); 00037 queryInfo->setText(pos2); 00038 if (strcmp(tmp, "PASSWORD") == 0) { 00039 queryField->setText("Password: "); 00040 queryEdit->setEchoMode(QLineEdit::Password); 00041 } else if (strcmp(tmp, "NEW_PASSWORD") == 0) { 00042 queryField->setText("New password: "); 00043 queryEdit->setEchoMode(QLineEdit::Password); 00044 } else if (strcmp(tmp, "IDENTITY") == 0) 00045 queryField->setText("Identity: "); 00046 else if (strcmp(tmp, "PASSPHRASE") == 0) { 00047 queryField->setText("Private key passphrase: "); 00048 queryEdit->setEchoMode(QLineEdit::Password); 00049 } else 00050 queryField->setText(field + ":"); 00051 free(tmp); 00052 00053 return 0; 00054 } 00055 00056 00057 void UserDataRequest::sendReply() 00058 { 00059 char reply[10]; 00060 size_t reply_len = sizeof(reply); 00061 00062 if (wpagui == NULL) { 00063 reject(); 00064 return; 00065 } 00066 00067 QString cmd = QString(WPA_CTRL_RSP) + field + '-' + 00068 QString::number(networkid) + ':' + 00069 queryEdit->text(); 00070 wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len); 00071 accept(); 00072 }