add netctlgui.h

rewrited some functions
This commit is contained in:
arcan1s 2014-07-21 10:25:10 +04:00
parent 79e7aa1926
commit 4600aae8bc
10 changed files with 138 additions and 154 deletions

View File

@ -15,7 +15,7 @@ optdepends=('kdebase-runtime: sudo support'
'wpa_supplicant: wifi support') 'wpa_supplicant: wifi support')
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz") source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
install="${pkgbase}.install" install="${pkgbase}.install"
md5sums=('29542e7bd1978e5bae0a3523e59e533a') md5sums=('45eebb959b9a760240e5b7db5bdfbf48')
prepare() { prepare() {
@ -56,7 +56,7 @@ build() {
package_libnetctlgui() { package_libnetctlgui() {
pkgdesc="Qt library interacts with netctl. A part of netctl-gui" pkgdesc="Qt5 library which interacts with netctl. A part of netctl-gui"
depends=('netctl' 'qt5-base') depends=('netctl' 'qt5-base')
cd "${srcdir}/build-qt5/netctlgui" cd "${srcdir}/build-qt5/netctlgui"

View File

@ -23,9 +23,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QProcess> #include <QProcess>
#include <netctlgui/netctlinteract.h> #include <netctlgui/netctlgui.h>
#include <netctlgui/netctlprofile.h>
#include <netctlgui/wpasupinteract.h>
#include "aboutwindow.h" #include "aboutwindow.h"
#include "bridgewidget.h" #include "bridgewidget.h"
@ -1256,10 +1254,12 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
if (passwdWid != 0) if (passwdWid != 0)
delete passwdWid; delete passwdWid;
if (netctlCommand->getInterfaceList().isEmpty())
return;
QMap<QString, QString> settings; QMap<QString, QString> settings;
settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'"); settings[QString("Description")] = QString("'Automatically generated profile by Netctl GUI'");
settings[QString("Interface")] = wpaCommand->getInterfaceList()[0]; settings[QString("Interface")] = netctlCommand->getInterfaceList()[0];
settings[QString("Connection")] = QString("wireless"); settings[QString("Connection")] = QString("wireless");
QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text(); QString security = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 3)->text();
if (checkState(QString("WPA"), security)) if (checkState(QString("WPA"), security))

View File

@ -20,7 +20,7 @@
#include <QDebug> #include <QDebug>
#include <netctlgui/netctlinteract.h> #include <netctlgui/netctlgui.h>
NetctlAutoWindow::NetctlAutoWindow(QWidget *parent, const bool debugCmd, const QMap<QString, QString> settings) NetctlAutoWindow::NetctlAutoWindow(QWidget *parent, const bool debugCmd, const QMap<QString, QString> settings)

View File

@ -0,0 +1,35 @@
/***************************************************************************
* This file is part of netctl-gui *
* *
* netctl-gui is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* netctl-gui is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
/**
* @file netctlgui.h
* Header of netctlgui library
* @author Evgeniy Alekseev
* @copyright GPLv3
* @bug https://github.com/arcan1s/netctl-gui/issues
*/
#ifndef NETCTLGUI_H
#define NETCTLGUI_H
#include "netctlinteract.h"
#include "netctlprofile.h"
#include "sleepthread.h"
#include "wpasupinteract.h"
#endif /* NETCTLGUI_H */

View File

@ -31,6 +31,8 @@
#include <QObject> #include <QObject>
class WpaSup;
/** /**
* @brief The Netctl class interacts with netctl * @brief The Netctl class interacts with netctl
*/ */
@ -59,6 +61,11 @@ public:
*/ */
~Netctl(); ~Netctl();
// general information // general information
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return interface list. If PREFERED_IFACE is not empty it will be first element
*/
QStringList getInterfaceList();
/** /**
* @brief method which returns profile informations from netctl * @brief method which returns profile informations from netctl
* @return list of profiles. Available information is [NAME, DESCRIPTION, STATUS]: * @return list of profiles. Available information is [NAME, DESCRIPTION, STATUS]:
@ -101,12 +108,6 @@ public:
* "inactive (enabled)", "inactive (static)" * "inactive (enabled)", "inactive (static)"
*/ */
QStringList getProfileStatuses(const QStringList profileList); QStringList getProfileStatuses(const QStringList profileList);
/**
* @brief method which gets ESSID from profile
* @param profile profile name
* @return ESSID name or null string
*/
QString getSsidFromProfile(const QString profile);
/** /**
* @brief method which checks if profile is active * @brief method which checks if profile is active
* @param profile profile name * @param profile profile name
@ -265,11 +266,6 @@ private:
* @return netctl output * @return netctl output
*/ */
QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile = 0); QString getNetctlOutput(const bool sudo, const QString commandLine, const QString profile = 0);
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return first element from interface list. If PREFERED_IFACE is not empty it will be first element
*/
QString getWifiInterface();
/** /**
* @brief method which calls netctl * @brief method which calls netctl
* @param sudo set true if sudo is needed * @param sudo set true if sudo is needed

View File

@ -72,6 +72,13 @@ public:
* @return settings from profile * @return settings from profile
*/ */
QMap<QString, QString> getSettingsFromProfile(const QString profile); QMap<QString, QString> getSettingsFromProfile(const QString profile);
/**
* @brief method which return value from profile by key
* @param profile profile name
* @param key required key
* @return value by key
*/
QString getValueFromProfile(const QString profile, const QString key);
/** /**
* @brief method which removes profile * @brief method which removes profile
* @param profile profile name * @param profile profile name

View File

@ -32,6 +32,7 @@
class Netctl; class Netctl;
class NetctlProfile;
/** /**
* @brief The WpaSup class interacts with wpa_supplicant * @brief The WpaSup class interacts with wpa_supplicant
@ -47,8 +48,6 @@ public:
* @param settings default settings. Needed keys are * @param settings default settings. Needed keys are
* CTRL_DIR (path to ctrl_directory), * CTRL_DIR (path to ctrl_directory),
* CTRL_GROUP (group which is owner of CTRL_DIR), * CTRL_GROUP (group which is owner of CTRL_DIR),
* IFACE_DIR (path to directory with interfaces),
* PREFERED_IFACE (prefered interface for WiFi),
* PID_FILE (wpa_supplicant PID file), * PID_FILE (wpa_supplicant PID file),
* SUDO_PATH (path to sudo command), * SUDO_PATH (path to sudo command),
* WPACLI_PATH (path to wpa_cli command), * WPACLI_PATH (path to wpa_cli command),
@ -68,11 +67,6 @@ public:
* @return profile name * @return profile name
*/ */
QString existentProfile(const QString essid); QString existentProfile(const QString essid);
/**
* @brief method which gets interface list from PREFERED_IFACE and IFACE_DIR
* @return interface list. If PREFERED_IFACE is not empty it will be first element
*/
QStringList getInterfaceList();
/** /**
* @brief method which checks profile status by ESSID * @brief method which checks profile status by ESSID
* @param essid ESSID name * @param essid ESSID name
@ -117,6 +111,10 @@ private:
* @brief Netctl class * @brief Netctl class
*/ */
Netctl *netctlCommand; Netctl *netctlCommand;
/**
* @brief NetctlProfile class
*/
NetctlProfile *netctlProfile;
/** /**
* @brief show debug messages * @brief show debug messages
*/ */
@ -129,14 +127,6 @@ private:
* @brief group which is owner of CTRL_DIR. Default is "users" * @brief group which is owner of CTRL_DIR. Default is "users"
*/ */
QString ctrlGroup; QString ctrlGroup;
/**
* @brief directory with interfaces. Default is "/sys/class/net/"
*/
QDir *ifaceDirectory;
/**
* @brief prefered interface for WiFi. Default is ""
*/
QString mainInterface;
/** /**
* @brief wpa_supplicant PID file. Default is "/run/wpa_supplicant_netctl-gui.pid" * @brief wpa_supplicant PID file. Default is "/run/wpa_supplicant_netctl-gui.pid"
*/ */

View File

@ -27,7 +27,7 @@
#include <QFile> #include <QFile>
#include <QProcess> #include <QProcess>
#include <netctlgui/netctlinteract.h> #include <netctlgui/netctlgui.h>
/** /**
@ -121,36 +121,6 @@ QString Netctl::getNetctlOutput(const bool sudo, const QString commandLine, cons
} }
/**
* @fn getWifiInterface
*/
QString Netctl::getWifiInterface()
{
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]";
if (ifaceDirectory == 0) {
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]" << ":" << "Could not find directory";
return QString();
}
QStringList interfaces;
if (!mainInterface.isEmpty())
interfaces.append(mainInterface);
QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i=0; i<allInterfaces.count(); i++) {
if (debug) qDebug() << "[Netctl]" << "[getWifiInterface]" << ":" << "Check directory"
<< ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless");
if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] +
QDir::separator() + QString("wireless")).exists())
interfaces.append(allInterfaces[i]);
}
if (interfaces.isEmpty())
return QString("");
else
return interfaces[0];
}
/** /**
* @fn netctlCall * @fn netctlCall
*/ */
@ -243,10 +213,14 @@ bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
if (debug) qDebug() << "[Netctl]" << "[systemctlCall]" << ":" << "Could not find systemctl"; if (debug) qDebug() << "[Netctl]" << "[systemctlCall]" << ":" << "Could not find systemctl";
return false; return false;
} }
if (getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[Netctl]" << "[systemctlCall]" << ":" << "Could not interface";
return false;
}
QProcess command; QProcess command;
QString commandText; QString commandText;
QString interface = getWifiInterface(); QString interface = getInterfaceList()[0];
if (interface.isEmpty()) if (interface.isEmpty())
return false; return false;
if (sudo) if (sudo)
@ -268,6 +242,33 @@ bool Netctl::systemctlCall(const bool sudo, const QString commandLine)
// general information // general information
/**
* @fn getInterfaceList
*/
QStringList Netctl::getInterfaceList()
{
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]";
if (ifaceDirectory == 0) {
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]" << ":" << "Could not find directory";
return QStringList();
}
QStringList interfaces;
if (!mainInterface.isEmpty())
interfaces.append(mainInterface);
QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i=0; i<allInterfaces.count(); i++) {
if (debug) qDebug() << "[Netctl]" << "[getInterfaceList]" << ":" << "Check directory"
<< ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless");
if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] +
QDir::separator() + QString("wireless")).exists())
interfaces.append(allInterfaces[i]);
}
return interfaces;
}
/** /**
* @fn getProfileList * @fn getProfileList
*/ */
@ -450,42 +451,6 @@ QStringList Netctl::getProfileStatuses(const QStringList profileList)
} }
/**
* @fn getSsidFromProfile
*/
QString Netctl::getSsidFromProfile(const QString profile)
{
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]";
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]" << ":" << "Profile" << profile;
if (profileDirectory == 0) {
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]" << ":" << "Could not find directory";
return QString();
}
QString ssidName;
QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profile;
if (debug) qDebug() << "[Netctl]" << "[getSsidFromProfile]" << ":" << "Check" << profileUrl;
QFile profileFile(profileUrl);
QString fileStr;
if (!profileFile.open(QIODevice::ReadOnly))
return ssidName;
while (true) {
fileStr = QString(profileFile.readLine());
if (fileStr.isEmpty()) continue;
if (fileStr[0] == QChar('#')) continue;
if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2)
if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("ESSID"))
ssidName = fileStr.split(QChar('='), QString::SkipEmptyParts)[1].trimmed();
if (profileFile.atEnd())
break;
}
profileFile.close();
ssidName.remove(QChar('\'')).remove(QChar('"'));
return ssidName;
}
/** /**
* @fn isProfileActive * @fn isProfileActive
*/ */
@ -569,9 +534,13 @@ bool Netctl::isNetctlAutoEnabled()
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]" << ":" << "Could not find systemctl"; if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]" << ":" << "Could not find systemctl";
return false; return false;
} }
if (getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]" << ":" << "Could not interface";
return false;
}
QProcess command; QProcess command;
QString interface = getWifiInterface(); QString interface = getInterfaceList()[0];
QString commandText = systemctlCommand + QString(" is-enabled ") + netctlAutoService + QString("@") + QString commandText = systemctlCommand + QString(" is-enabled ") + netctlAutoService + QString("@") +
interface + QString(".service"); interface + QString(".service");
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]" << ":" << "Run cmd" << commandText; if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoEnabled]" << ":" << "Run cmd" << commandText;
@ -601,8 +570,12 @@ bool Netctl::isNetctlAutoRunning()
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not find systemctl"; if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not find systemctl";
return false; return false;
} }
if (getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[Netctl]" << "[isNetctlAutoRunning]" << ":" << "Could not interface";
return false;
}
QString interface = getWifiInterface(); QString interface = getInterfaceList()[0];
QProcess command; QProcess command;
QString commandText = systemctlCommand + QString(" is-active ") + netctlAutoService + QString("@") + QString commandText = systemctlCommand + QString(" is-active ") + netctlAutoService + QString("@") +
interface + QString(".service"); interface + QString(".service");

View File

@ -29,7 +29,7 @@
#include <QProcess> #include <QProcess>
#include <QTextStream> #include <QTextStream>
#include <netctlgui/netctlprofile.h> #include <netctlgui/netctlgui.h>
/** /**
@ -186,6 +186,24 @@ QMap<QString, QString> NetctlProfile::getSettingsFromProfile(const QString profi
} }
/**
* @fn ValueFromProfile
*/
QString NetctlProfile::getValueFromProfile(const QString profile, const QString key)
{
if (debug) qDebug() << "[NetctlProfile]" << "[getValueFromProfile]";
if (debug) qDebug() << "[NetctlProfile]" << "[getValueFromProfile]" << ":" << "Profile" << profile;
if (debug) qDebug() << "[NetctlProfile]" << "[getValueFromProfile]" << ":" << "Key" << key;
QMap<QString, QString> settings = getSettingsFromProfile(profile);
if (settings.contains(key))
return settings[key];
else
return QString("");
}
/** /**
* @fn removeProfile * @fn removeProfile
*/ */

View File

@ -26,9 +26,7 @@
#include <QDebug> #include <QDebug>
#include <QProcess> #include <QProcess>
#include <netctlgui/netctlinteract.h> #include <netctlgui/netctlgui.h>
#include <netctlgui/sleepthread.h>
#include <netctlgui/wpasupinteract.h>
/** /**
@ -41,6 +39,7 @@ WpaSup::WpaSup(const bool debugCmd, const QMap<QString, QString> settings)
: debug(debugCmd) : debug(debugCmd)
{ {
netctlCommand = new Netctl(debug, settings); netctlCommand = new Netctl(debug, settings);
netctlProfile = new NetctlProfile(debug, settings);
if (settings.contains(QString("CTRL_DIR"))) if (settings.contains(QString("CTRL_DIR")))
ctrlDir = settings[QString("CTRL_DIR")]; ctrlDir = settings[QString("CTRL_DIR")];
@ -50,14 +49,6 @@ WpaSup::WpaSup(const bool debugCmd, const QMap<QString, QString> settings)
ctrlGroup = settings[QString("CTRL_GROUP")]; ctrlGroup = settings[QString("CTRL_GROUP")];
else else
ctrlGroup = QString("users"); ctrlGroup = QString("users");
if (settings.contains(QString("IFACE_DIR")))
ifaceDirectory = new QDir(settings[QString("IFACE_DIR")]);
else
ifaceDirectory = new QDir(QString("/sys/class/net/"));
if (settings.contains(QString("PREFERED_IFACE")))
mainInterface = settings[QString("PREFERED_IFACE")];
else
mainInterface = QString("");
if (settings.contains(QString("PID_FILE"))) if (settings.contains(QString("PID_FILE")))
pidFile = settings[QString("PID_FILE")]; pidFile = settings[QString("PID_FILE")];
else else
@ -92,9 +83,10 @@ WpaSup::~WpaSup()
{ {
if (debug) qDebug() << "[WpaSup]" << "[~WpaSup]"; if (debug) qDebug() << "[WpaSup]" << "[~WpaSup]";
if (netctlCommand != 0)
delete netctlCommand; delete netctlCommand;
if (ifaceDirectory != 0) if (netctlProfile != 0)
delete ifaceDirectory; delete netctlProfile;
} }
@ -110,40 +102,13 @@ QString WpaSup::existentProfile(const QString essid)
QString profileFile = QString(""); QString profileFile = QString("");
QList<QStringList> profileList = netctlCommand->getProfileList(); QList<QStringList> profileList = netctlCommand->getProfileList();
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (essid == netctlCommand->getSsidFromProfile(profileList[i][0])) if (essid == netctlProfile->getValueFromProfile(profileList[i][0], QString("ESSID")))
profileFile = profileList[i][0]; profileFile = profileList[i][0];
return profileFile; return profileFile;
} }
/**
* @fn getInterfaceList
*/
QStringList WpaSup::getInterfaceList()
{
if (debug) qDebug() << "[WpaSup]" << "[getInterfaceList]";
if (ifaceDirectory == 0) {
if (debug) qDebug() << "[WpaSup]" << "[getInterfaceList]" << ":" << "Could not find directory";
return QStringList();
}
QStringList interfaces;
if (!mainInterface.isEmpty())
interfaces.append(mainInterface);
QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i=0; i<allInterfaces.count(); i++) {
if (debug) qDebug() << "[WpaSup]" << "[getInterfaceList]" << ":" << "Check directory"
<< ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless");
if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] +
QDir::separator() + QString("wireless")).exists())
interfaces.append(allInterfaces[i]);
}
return interfaces;
}
/** /**
* @fn isProfileActive * @fn isProfileActive
*/ */
@ -155,7 +120,7 @@ bool WpaSup::isProfileActive(const QString essid)
QString profileFile; QString profileFile;
QList<QStringList> profileList = netctlCommand->getProfileList(); QList<QStringList> profileList = netctlCommand->getProfileList();
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (essid == netctlCommand->getSsidFromProfile(profileList[i][0])) { if (essid == netctlProfile->getValueFromProfile(profileList[i][0], QString("ESSID"))) {
profileFile = profileList[i][0]; profileFile = profileList[i][0];
break; break;
} }
@ -175,7 +140,7 @@ bool WpaSup::isProfileExists(const QString essid)
bool exists = false; bool exists = false;
QList<QStringList> profileList = netctlCommand->getProfileList(); QList<QStringList> profileList = netctlCommand->getProfileList();
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (essid == netctlCommand->getSsidFromProfile(profileList[i][0])) { if (essid == netctlProfile->getValueFromProfile(profileList[i][0], QString("ESSID"))) {
exists = true; exists = true;
break; break;
} }
@ -287,7 +252,7 @@ bool WpaSup::startWpaSupplicant()
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find wpa_supplicant"; if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find wpa_supplicant";
return false; return false;
} }
if (getInterfaceList().isEmpty()) { if (netctlCommand->getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find interfaces"; if (debug) qDebug() << "[WpaSup]" << "[startWpaSupplicant]" << ":" << "Could not find interfaces";
return false; return false;
} }
@ -295,7 +260,7 @@ bool WpaSup::startWpaSupplicant()
if (QFile(pidFile).exists()) if (QFile(pidFile).exists())
return true; return true;
QProcess command; QProcess command;
QString interface = getInterfaceList()[0]; QString interface = netctlCommand->getInterfaceList()[0];
QString commandText = sudoCommand + QString(" ") + wpaSupPath + QString(" -B -P ") + pidFile + QString commandText = sudoCommand + QString(" ") + wpaSupPath + QString(" -B -P ") + pidFile +
QString(" -i ") + interface + QString(" -D ") + wpaDrivers + QString(" -i ") + interface + QString(" -D ") + wpaDrivers +
QString(" -C \"DIR=") + ctrlDir + QString(" GROUP=") + ctrlGroup + QString("\""); QString(" -C \"DIR=") + ctrlDir + QString(" GROUP=") + ctrlGroup + QString("\"");
@ -343,13 +308,13 @@ QString WpaSup::getWpaCliOutput(const QString commandLine)
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli"; if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find wpa_cli";
return QString(); return QString();
} }
if (getInterfaceList().isEmpty()) { if (netctlCommand->getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find interfaces"; if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Could not find interfaces";
return QString(); return QString();
} }
QProcess command; QProcess command;
QString interface = getInterfaceList()[0]; QString interface = netctlCommand->getInterfaceList()[0];
QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir + QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
QString(" -P ") + pidFile + QString(" ") + commandLine; QString(" -P ") + pidFile + QString(" ") + commandLine;
if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << commandText; if (debug) qDebug() << "[WpaSup]" << "[getWpaCliOutput]" << ":" << "Run cmd" << commandText;
@ -379,13 +344,13 @@ bool WpaSup::wpaCliCall(const QString commandLine)
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find wpa_cli"; if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find wpa_cli";
return false; return false;
} }
if (getInterfaceList().isEmpty()) { if (netctlCommand->getInterfaceList().isEmpty()) {
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find interfaces"; if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Could not find interfaces";
return false; return false;
} }
QProcess command; QProcess command;
QString interface = getInterfaceList()[0]; QString interface = netctlCommand->getInterfaceList()[0];
QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir + QString commandText = wpaCliPath + QString(" -i ") + interface + QString(" -p ") + ctrlDir +
QString(" -P ") + pidFile + QString(" ") + commandLine; QString(" -P ") + pidFile + QString(" ") + commandLine;
if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Run cmd" << commandText; if (debug) qDebug() << "[WpaSup]" << "[wpaCliCall]" << ":" << "Run cmd" << commandText;