2 * wpa_gui - ScanResults class
3 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
17 #include "scanresults.h"
19 #include "networkconfig.h"
22 ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags)
27 connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
28 connect(scanButton, SIGNAL(clicked()), this, SLOT(scanRequest()));
29 connect(scanResultsView, SIGNAL(doubleClicked(Q3ListViewItem *)), this,
30 SLOT(bssSelected(Q3ListViewItem *)));
36 ScanResults::~ScanResults()
42 void ScanResults::languageChange()
48 void ScanResults::setWpaGui(WpaGui *_wpagui)
53 timer = new QTimer(this);
54 connect(timer, SIGNAL(timeout()), SLOT(getResults()));
55 timer->start(10000, FALSE);
59 void ScanResults::updateResults()
67 reply_len = sizeof(reply) - 1;
68 if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
70 reply[reply_len] = '\0';
72 scanResultsView->clear();
75 QStringList lines = QStringList::split(QChar('\n'), res);
77 for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++)
84 QStringList cols = QStringList::split(QChar('\t'), *it, true);
85 QString ssid, bssid, freq, signal, flags;
86 bssid = cols.count() > 0 ? cols[0] : "";
87 freq = cols.count() > 1 ? cols[1] : "";
88 signal = cols.count() > 2 ? cols[2] : "";
89 flags = cols.count() > 3 ? cols[3] : "";
90 ssid = cols.count() > 4 ? cols[4] : "";
91 new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal,
97 void ScanResults::scanRequest()
100 size_t reply_len = sizeof(reply);
105 wpagui->ctrlRequest("SCAN", reply, &reply_len);
109 void ScanResults::getResults()
115 void ScanResults::bssSelected( Q3ListViewItem * sel )
117 NetworkConfig *nc = new NetworkConfig();
120 nc->setWpaGui(wpagui);
121 nc->paramsFromScanResults(sel);