~ubuntu-branches/ubuntu/gutsy/wpasupplicant/gutsy

« back to all changes in this revision

Viewing changes to wpa_supplicant/wpa_gui/userdatarequest.ui.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2007-08-26 16:06:57 UTC
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20070826160657-mxk5ivjjh65ptxlr
Tags: upstream-0.6.0+0.5.8
ImportĀ upstreamĀ versionĀ 0.6.0+0.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
** ui.h extension file, included from the uic-generated form implementation.
3
 
**
4
 
** If you want to add, delete, or rename functions or slots, use
5
 
** Qt Designer to update this file, preserving your code.
6
 
**
7
 
** You should not define a constructor or destructor in this file.
8
 
** Instead, write your code in functions called init() and destroy().
9
 
** These will automatically be called by the form's constructor and
10
 
** destructor.
11
 
*****************************************************************************/
12
 
 
13
 
int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
14
 
{
15
 
    char *tmp, *pos, *pos2;
16
 
    wpagui = _wpagui;
17
 
    tmp = strdup(reqMsg);
18
 
    if (tmp == NULL)
19
 
        return -1;
20
 
    pos = strchr(tmp, '-');
21
 
    if (pos == NULL) {
22
 
        free(tmp);
23
 
        return -1;
24
 
    }
25
 
    *pos++ = '\0';
26
 
    field = tmp;
27
 
    pos2 = strchr(pos, ':');
28
 
    if (pos2 == NULL) {
29
 
        free(tmp);
30
 
        return -1;
31
 
    }
32
 
    *pos2++ = '\0';
33
 
    
34
 
    networkid = atoi(pos);
35
 
    queryInfo->setText(pos2);
36
 
    if (strcmp(tmp, "PASSWORD") == 0) {
37
 
        queryField->setText("Password: ");
38
 
        queryEdit->setEchoMode(QLineEdit::Password);
39
 
    } else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
40
 
        queryField->setText("New password: ");
41
 
        queryEdit->setEchoMode(QLineEdit::Password);
42
 
    } else if (strcmp(tmp, "IDENTITY") == 0)
43
 
        queryField->setText("Identity: ");
44
 
    else if (strcmp(tmp, "PASSPHRASE") == 0) {
45
 
        queryField->setText("Private key passphrase: ");
46
 
        queryEdit->setEchoMode(QLineEdit::Password);
47
 
    } else
48
 
        queryField->setText(field + ":");
49
 
    free(tmp);
50
 
    
51
 
    return 0;
52
 
}
53
 
 
54
 
 
55
 
void UserDataRequest::sendReply()
56
 
{
57
 
    char reply[10];
58
 
    size_t reply_len = sizeof(reply);
59
 
    
60
 
    if (wpagui == NULL) {
61
 
        reject();
62
 
        return;
63
 
    }
64
 
    
65
 
    QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
66
 
                  QString::number(networkid) + ':' +
67
 
                  queryEdit->text();
68
 
    wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
69
 
    accept();
70
 
}