~ubuntu-branches/ubuntu/vivid/wpasupplicant/vivid

« back to all changes in this revision

Viewing changes to wpa_gui-qt4/userdatarequest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2008-03-12 20:03:04 UTC
  • mfrom: (1.1.10 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080312200304-4331y9wj46pdd34z
Tags: 0.6.3-1
* New upstream release.
* Drop patches applied upstream:
  - debian/patches/30_wpa_gui_qt4_eventhistoryui_rework.patch
  - debian/patches/31_wpa_gui_qt4_eventhistory_always_scrollbar.patch
  - debian/patches/32_wpa_gui_qt4_eventhistory_scroll_with_events.patch
  - debian/patches/40_dbus_ssid_data.patch
* Tidy up the clean target of debian/rules. Now that the madwifi headers are
  handled differently we no longer need to do any cleanup.
* Fix formatting error in debian/ifupdown/wpa_action.8 to make lintian
  quieter.
* Add patch to fix formatting errors in manpages build from sgml source. Use
  <emphasis> tags to hightlight keywords instead of surrounding them in
  strong quotes.
  - debian/patches/41_manpage_format_fixes.patch
* wpasupplicant binary package no longer suggests pcscd, guessnet, iproute
  or wireless-tools, nor does it recommend dhcp3-client. These are not
  needed.
* Add debian/patches/10_silence_siocsiwauth_icotl_failure.patch to disable
  ioctl failure messages that occur under normal conditions.
* Cherry pick two upstream git commits concerning the dbus interface:
  - debian/patches/11_avoid_dbus_version_namespace.patch
  - debian/patches/12_fix_potential_use_after_free.patch
* Add debian/patches/42_manpage_explain_available_drivers.patch to explain
  that not all of the driver backends are available in the provided
  wpa_supplicant binary, and that the canonical list of supported driver
  backends can be retrieved from the wpa_supplicant -h (help) output.
  (Closes: #466910)
* Add debian/patches/20_wpa_gui_qt4_disable_link_prl.patch to remove
  link_prl CONFIG compile flag added by qmake-qt4 >= 4.3.4-2 to avoid excess
  linking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * wpa_gui - UserDataRequest class
3
 
 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
4
 
 *
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.
8
 
 *
9
 
 * Alternatively, this software may be distributed under the terms of BSD
10
 
 * license.
11
 
 *
12
 
 * See README and COPYING for more details.
13
 
 */
14
 
 
15
 
#include "userdatarequest.h"
16
 
#include "wpagui.h"
17
 
#include "wpa_ctrl.h"
18
 
 
19
 
 
20
 
UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool,
21
 
                                 Qt::WFlags)
22
 
        : QDialog(parent)
23
 
{
24
 
        setupUi(this);
25
 
 
26
 
        connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply()));
27
 
        connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
28
 
        connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply()));
29
 
}
30
 
 
31
 
 
32
 
UserDataRequest::~UserDataRequest()
33
 
{
34
 
}
35
 
 
36
 
 
37
 
void UserDataRequest::languageChange()
38
 
{
39
 
        retranslateUi(this);
40
 
}
41
 
 
42
 
 
43
 
int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
44
 
{
45
 
        char *tmp, *pos, *pos2;
46
 
        wpagui = _wpagui;
47
 
        tmp = strdup(reqMsg);
48
 
        if (tmp == NULL)
49
 
                return -1;
50
 
        pos = strchr(tmp, '-');
51
 
        if (pos == NULL) {
52
 
                free(tmp);
53
 
                return -1;
54
 
        }
55
 
        *pos++ = '\0';
56
 
        field = tmp;
57
 
        pos2 = strchr(pos, ':');
58
 
        if (pos2 == NULL) {
59
 
                free(tmp);
60
 
                return -1;
61
 
        }
62
 
        *pos2++ = '\0';
63
 
 
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);
77
 
        } else
78
 
                queryField->setText(field + ":");
79
 
        free(tmp);
80
 
 
81
 
        return 0;
82
 
}
83
 
 
84
 
 
85
 
void UserDataRequest::sendReply()
86
 
{
87
 
        char reply[10];
88
 
        size_t reply_len = sizeof(reply);
89
 
 
90
 
        if (wpagui == NULL) {
91
 
                reject();
92
 
                return;
93
 
        }
94
 
 
95
 
        QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
96
 
                QString::number(networkid) + ':' +
97
 
                queryEdit->text();
98
 
        wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
99
 
        accept();
100
 
}