3 * Copyright 2014-2017 Roy Marples <roy@marples.name>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <QDialogButtonBox>
29 #include <QHBoxLayout>
32 #include <QSpacerItem>
33 #include <QVBoxLayout>
36 #include "dhcpcd-qt.h"
37 #include "dhcpcd-ssid.h"
38 #include "dhcpcd-wi.h"
40 DhcpcdSsid::DhcpcdSsid(DhcpcdWi *parent, DHCPCD_WI_SCAN *scan)
43 this->parent = parent;
45 setWindowIcon(DhcpcdQt::getIcon("status",
46 "network-wireless-encrypted"));
47 setWindowTitle(scan->ssid);
50 QPoint p = QCursor::pos();
53 layout = new QVBoxLayout(this);
55 QHBoxLayout *hbox = new QHBoxLayout();
56 layout->addLayout(hbox);
57 QLabel *label = new QLabel(tr("Pre Shared Key:"));
58 hbox->addWidget(label);
59 psk = new QLineEdit();
60 psk->setSizePolicy(QSizePolicy::Expanding,
64 hbox = new QHBoxLayout();
65 layout->addLayout(hbox);
66 hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding,
67 QSizePolicy::Expanding));
68 QDialogButtonBox *okcancel = new QDialogButtonBox(
69 QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
70 hbox->addWidget(okcancel);
71 connect(okcancel, SIGNAL(accepted()), this, SLOT(accept()));
72 connect(okcancel, SIGNAL(rejected()), this, SLOT(reject()));
75 QString DhcpcdSsid::getPsk(bool *ok)
79 if (result() == QDialog::Rejected) {
82 return QString::Null();