From 8b33ec859bfe24c71965af1f2381731d75cdc9bb Mon Sep 17 00:00:00 2001 From: arcan1s Date: Thu, 26 Feb 2015 06:20:23 +0300 Subject: [PATCH] refactoring of library part --- sources/netctlgui/src/netctlinteract.cpp | 119 +++++++++-------------- sources/netctlgui/src/netctlprofile.cpp | 61 ++++++------ sources/netctlgui/src/wpasupinteract.cpp | 97 ++++++++---------- 3 files changed, 114 insertions(+), 163 deletions(-) diff --git a/sources/netctlgui/src/netctlinteract.cpp b/sources/netctlgui/src/netctlinteract.cpp index 80f3725..123ae90 100644 --- a/sources/netctlgui/src/netctlinteract.cpp +++ b/sources/netctlgui/src/netctlinteract.cpp @@ -59,8 +59,7 @@ Netctl::Netctl(const bool debugCmd, const QMap settings) if (settings.contains(QString("SYSTEMCTL_PATH"))) systemctlCommand = settings[QString("SYSTEMCTL_PATH")]; if (settings.contains(QString("FORCE_SUDO"))) - if (settings[QString("FORCE_SUDO")] == QString("true")) - useSuid = false; + useSuid = (settings[QString("FORCE_SUDO")] != QString("true")); if (useSuid) sudoCommand = QString(""); @@ -89,27 +88,24 @@ bool Netctl::cmdCall(const bool sudo, const QString command, const QString comma if (debug) qDebug() << PDEBUG << ":" << "Command" << command; if (debug) qDebug() << PDEBUG << ":" << "Command line" << commandLine; if (debug) qDebug() << PDEBUG << ":" << "Argument" << argument; - if (command == 0) { + if (command.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find command"; return false; } QString cmd = QString(""); if (sudo) - cmd = sudoCommand + QString(" "); - cmd += command + QString(" ") + commandLine; - if (argument != 0) - cmd += QString(" \"") + argument + QString("\""); + cmd = QString("%1 ").arg(sudoCommand); + cmd += QString("%1 %2").arg(command).arg(commandLine); + if (!argument.isEmpty()) + cmd += QString(" \"%1\"").arg(argument); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd, (useSuid && sudo)); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; if (process.exitCode != 0) if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - if (process.exitCode == 0) - return true; - else - return false; + return (process.exitCode == 0); } @@ -122,17 +118,17 @@ QString Netctl::getCmdOutput(const bool sudo, const QString command, const QStri if (debug) qDebug() << PDEBUG << ":" << "Command" << command; if (debug) qDebug() << PDEBUG << ":" << "Command line" << commandLine; if (debug) qDebug() << PDEBUG << ":" << "Argument" << argument; - if (command == 0) { + if (command.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find command"; return QString(); } QString cmd = QString(""); if (sudo) - cmd = sudoCommand + QString(" "); - cmd += command + QString(" ") + commandLine; - if (argument != 0) - cmd += QString(" \"") + argument + QString("\""); + cmd = QString("%1 ").arg(sudoCommand); + cmd += QString("%1 %2").arg(command).arg(commandLine); + if (!argument.isEmpty()) + cmd += QString(" \"%1\"").arg(argument); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd, (useSuid && sudo)); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; @@ -194,10 +190,7 @@ QList Netctl::getProfileList() netctlProfileInfo profileInfo; profileInfo.name = output[i].mid(2, -1); profileInfo.description = getProfileDescription(profileInfo.name); - if (output[i][0] == QChar('*')) - profileInfo.active = true; - else - profileInfo.active = false; + profileInfo.active = (output[i][0] == QChar('*')); profileInfo.enabled = isProfileEnabled(profileInfo.name); fullProfilesInfo.append(profileInfo); } @@ -220,12 +213,8 @@ QList Netctl::getProfileListFromNetctlAuto() netctlProfileInfo profileInfo; profileInfo.name = output[i].mid(2, -1); profileInfo.description = getProfileDescription(profileInfo.name); - profileInfo.active = false; - profileInfo.enabled = true; - if (output[i][0] == QChar('*')) - profileInfo.active = true; - else if (output[i][0] == QChar('!')) - profileInfo.enabled = false; + profileInfo.active = (output[i][0] == QChar('*')); + profileInfo.enabled = (output[i][0] != QChar('!')); fullProfilesInfo.append(profileInfo); } @@ -279,12 +268,9 @@ bool Netctl::isProfileActive(const QString profile) if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; - bool status = false; QString output = getCmdOutput(false, netctlCommand, QString("status"), profile); - if (output.contains(QString("Active: active"))) - status = true; - return status; + return (output.contains(QString("Active: active"))); } @@ -346,17 +332,17 @@ bool Netctl::autoIsProfileEnabled(const QString profile) bool Netctl::isNetctlAutoEnabled() { if (debug) qDebug() << PDEBUG; - if (netctlAutoService == 0) { + if (netctlAutoService.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find service"; return false; } - if (getWirelessInterfaceList().isEmpty()) { + QStringList interfaces = getWirelessInterfaceList(); + if (interfaces.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not interface"; return false; } - QString interface = getWirelessInterfaceList()[0]; - QString argument = netctlAutoService + QString("@") + interface + QString(".service"); + QString argument = QString("%1@%2.service").arg(netctlAutoService).arg(interfaces[0]); return cmdCall(false, systemctlCommand, QString("is-enabled"), argument); } @@ -368,7 +354,7 @@ bool Netctl::isNetctlAutoEnabled() bool Netctl::isNetctlAutoRunning() { if (debug) qDebug() << PDEBUG; - if (netctlAutoService == 0) { + if (netctlAutoService.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find service"; return false; } @@ -378,8 +364,7 @@ bool Netctl::isNetctlAutoRunning() return false; } - QString interface = interfaces[0]; - QString argument = netctlAutoService + QString("@") + interface + QString(".service"); + QString argument = QString("%1@%2.service").arg(netctlAutoService).arg(interfaces[0]); return cmdCall(false, systemctlCommand, QString("is-active"), argument); } @@ -391,7 +376,6 @@ bool Netctl::isNetctlAutoRunning() QMap Netctl::getRecommendedConfiguration() { QMap settings; - QString cmd; TaskResult process; QStringList recommended; // force sudo @@ -401,8 +385,7 @@ QMap Netctl::getRecommendedConfiguration() recommended.append(QString("netctlgui-helper")); recommended.append(QString("netctlgui-helper-suid")); for (int i=0; i Netctl::getRecommendedConfiguration() recommended.clear(); recommended.append("netctl"); for (int i=0; i Netctl::getRecommendedConfiguration() recommended.clear(); recommended.append("netctl-auto"); for (int i=0; i Netctl::getRecommendedConfiguration() recommended.append("kdesu"); recommended.append("gksu"); for (int i=0; i Netctl::getRecommendedConfiguration() recommended.clear(); recommended.append("systemctl"); for (int i=0; i Netctl::getRecommendedConfiguration() QStringList Netctl::getWirelessInterfaceList() { if (debug) qDebug() << PDEBUG; - if (ifaceDirectory == 0) { + if (ifaceDirectory == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return QStringList(); } @@ -515,10 +494,11 @@ QStringList Netctl::getWirelessInterfaceList() interfaces.append(mainInterface); QStringList allInterfaces = ifaceDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot); for (int i=0; ipath() + QDir::separator() + allInterfaces[i] + QDir::separator() + QString("wireless"); - if (QDir(ifaceDirectory->path() + QDir::separator() + allInterfaces[i] + - QDir::separator() + QString("wireless")).exists()) + QString dir = QString("%1%2%3%2wireless").arg(ifaceDirectory->path()) + .arg(QDir::separator()) + .arg(allInterfaces[i]); + if (debug) qDebug() << PDEBUG << ":" << "Check directory" << dir; + if (QDir(dir).exists()) interfaces.append(allInterfaces[i]); } @@ -624,10 +604,8 @@ bool Netctl::switchToProfile(const QString profile) if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; - if (isProfileActive(profile)) - return true; - else - return cmdCall(true, netctlCommand, QString("switch-to"), profile); + return ((isProfileActive(profile)) || + (cmdCall(true, netctlCommand, QString("switch-to"), profile))); } @@ -676,10 +654,8 @@ bool Netctl::autoStartProfile(const QString profile) if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; - if (autoIsProfileActive(profile)) - return true; - else - return cmdCall(false, netctlAutoCommand, QString("switch-to"), profile); + return ((autoIsProfileActive(profile)) || + (cmdCall(false, netctlAutoCommand, QString("switch-to"), profile))); } @@ -689,7 +665,7 @@ bool Netctl::autoStartProfile(const QString profile) bool Netctl::autoEnableService() { if (debug) qDebug() << PDEBUG; - if (netctlAutoService == 0) { + if (netctlAutoService.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find service"; return false; } @@ -699,8 +675,7 @@ bool Netctl::autoEnableService() return false; } - QString interface = interfaces[0]; - QString argument = netctlAutoService + QString("@") + interface + QString(".service"); + QString argument = QString("%1@%2.service").arg(netctlAutoService).arg(interfaces[0]); if (isNetctlAutoEnabled()) return cmdCall(true, systemctlCommand, QString("disable"), argument); @@ -715,7 +690,7 @@ bool Netctl::autoEnableService() bool Netctl::autoRestartService() { if (debug) qDebug() << PDEBUG; - if (netctlAutoService == 0) { + if (netctlAutoService.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find service"; return false; } @@ -725,13 +700,10 @@ bool Netctl::autoRestartService() return false; } - QString interface = interfaces[0]; - QString argument = netctlAutoService + QString("@") + interface + QString(".service"); + QString argument = QString("%1@%2.service").arg(netctlAutoService).arg(interfaces[0]); - if (isNetctlAutoRunning()) - return cmdCall(true, systemctlCommand, QString("restart"), argument); - else - return true; + return ((!isNetctlAutoRunning()) || + (cmdCall(true, systemctlCommand, QString("restart"), argument))); } @@ -741,7 +713,7 @@ bool Netctl::autoRestartService() bool Netctl::autoStartService() { if (debug) qDebug() << PDEBUG; - if (netctlAutoService == 0) { + if (netctlAutoService.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find service"; return false; } @@ -751,8 +723,7 @@ bool Netctl::autoStartService() return false; } - QString interface = interfaces[0]; - QString argument = netctlAutoService + QString("@") + interface + QString(".service"); + QString argument = QString("%1@%2.service").arg(netctlAutoService).arg(interfaces[0]); if (isNetctlAutoRunning()) return cmdCall(true, systemctlCommand, QString("stop"), argument); diff --git a/sources/netctlgui/src/netctlprofile.cpp b/sources/netctlgui/src/netctlprofile.cpp index 7806f4d..79827bc 100644 --- a/sources/netctlgui/src/netctlprofile.cpp +++ b/sources/netctlgui/src/netctlprofile.cpp @@ -50,8 +50,7 @@ NetctlProfile::NetctlProfile(const bool debugCmd, const QMap s if (settings.contains(QString("SUDO_PATH"))) sudoCommand = settings[QString("SUDO_PATH")]; if (settings.contains(QString("FORCE_SUDO"))) - if (settings[QString("FORCE_SUDO")] == QString("true")) - useSuid = false; + useSuid = (settings[QString("FORCE_SUDO")] != QString("true")); if (useSuid) sudoCommand = QString(""); @@ -76,23 +75,24 @@ bool NetctlProfile::copyProfile(const QString oldPath) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Path" << oldPath; - if (profileDirectory == 0) { + if (profileDirectory == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return false; } - QString newPath = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(oldPath).fileName(); - QString cmd = sudoCommand + QString(" /usr/bin/mv \"") + oldPath + QString("\" \"") + newPath + QString("\""); + QString newPath = QString("%1%2%3").arg(profileDirectory->absolutePath()) + .arg(QDir::separator()) + .arg(QFileInfo(oldPath).fileName()); + QString cmd = QString("%1 /usr/bin/mv \"%2\" \"%3\"").arg(sudoCommand) + .arg(oldPath) + .arg(newPath); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd, useSuid); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; if (process.exitCode != 0) if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - if (process.exitCode == 0) - return true; - else - return false; + return (process.exitCode == 0); } @@ -104,7 +104,9 @@ QString NetctlProfile::createProfile(const QString profile, const QMap NetctlProfile::getRecommendedConfiguration() { QMap settings; - QString cmd; TaskResult process; QStringList recommended; // force sudo @@ -149,8 +150,7 @@ QMap NetctlProfile::getRecommendedConfiguration() recommended.append(QString("netctlgui-helper")); recommended.append(QString("netctlgui-helper-suid")); for (int i=0; i NetctlProfile::getRecommendedConfiguration() recommended.append("kdesu"); recommended.append("gksu"); for (int i=0; i NetctlProfile::getSettingsFromProfile(const QString profi { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; - if (profileDirectory == 0) { + if (profileDirectory == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return QMap(); } @@ -216,8 +215,10 @@ QMap NetctlProfile::getSettingsFromProfile(const QString profi systemVariables.append(output[i].split(QChar('='))[0]); // profile variables QMap settings; - QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + QFileInfo(profile).fileName(); - cmd = QString("env -i bash -c \"source '") + profileUrl + QString("'; set\""); + QString profileUrl = QString("%1%2%3").arg(profileDirectory->absolutePath()) + .arg(QDir::separator()) + .arg(QFileInfo(profile).fileName()); + cmd = QString("env -i bash -c \"source '%1'; set\"").arg(profileUrl); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; process = runTask(cmd, false); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; @@ -231,9 +232,7 @@ QMap NetctlProfile::getSettingsFromProfile(const QString profi if (!systemVariables.contains(output[i].split(QChar('='))[0])) keys.append(output[i].split(QChar('='))[0]); for (int i=0; iabsolutePath() + QDir::separator() + QFileInfo(profile).fileName(); - QString cmd = sudoCommand + QString(" /usr/bin/rm \"") + profilePath + QString("\""); + QString profilePath = QString("%1%2%3").arg(profileDirectory->absolutePath()) + .arg(QDir::separator()) + .arg(QFileInfo(profile).fileName()); + QString cmd = QString("%1 /usr/bin/rm \"%2\"").arg(sudoCommand).arg(profilePath); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd, useSuid); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; if (process.exitCode != 0) if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - if (process.exitCode == 0) - return true; - else - return false; + return (process.exitCode == 0); } diff --git a/sources/netctlgui/src/wpasupinteract.cpp b/sources/netctlgui/src/wpasupinteract.cpp index fb26aba..65a77ce 100644 --- a/sources/netctlgui/src/wpasupinteract.cpp +++ b/sources/netctlgui/src/wpasupinteract.cpp @@ -58,8 +58,7 @@ WpaSup::WpaSup(const bool debugCmd, const QMap settings) if (settings.contains(QString("WPASUP_PATH"))) wpaSupPath = settings[QString("WPASUP_PATH")]; if (settings.contains(QString("FORCE_SUDO"))) - if (settings[QString("FORCE_SUDO")] == QString("true")) - useSuid = false; + useSuid = (settings[QString("FORCE_SUDO")] != QString("true")); if (useSuid) sudoCommand = QString(""); @@ -86,11 +85,11 @@ QString WpaSup::existentProfile(const QString essid) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "ESSID" << essid; - if (netctlCommand == 0) { + if (netctlCommand == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find library"; return QString(); } - if (netctlProfile == 0) { + if (netctlProfile == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find library"; return QString(); } @@ -112,7 +111,6 @@ QMap WpaSup::getRecommendedConfiguration() { QMap settings; int size = 99; - QString cmd; TaskResult process; QStringList recommended; // ctrl directory @@ -142,8 +140,7 @@ QMap WpaSup::getRecommendedConfiguration() recommended.append(QString("netctlgui-helper")); recommended.append(QString("netctlgui-helper-suid")); for (int i=0; i WpaSup::getRecommendedConfiguration() recommended.append("kdesu"); recommended.append("gksu"); for (int i=0; i WpaSup::getRecommendedConfiguration() recommended.clear(); recommended.append("wpa_cli"); for (int i=0; i WpaSup::getRecommendedConfiguration() recommended.clear(); recommended.append("wpa_supplicant"); for (int i=0; i WpaSup::scanWifi() stopWpaSupplicant(); return scanResults; } - if (!wpaCliCall(QString("scan"))) - return scanResults; + if (!wpaCliCall(QString("scan"))) return scanResults; waitForProcess(3); QStringList rawOutput = getWpaCliOutput(QString("scan_results")).split(QChar('\n'), QString::SkipEmptyParts); @@ -278,22 +271,22 @@ QList WpaSup::scanWifi() rawOutput.removeFirst(); // remove duplicates QStringList rawList; + QStringList names; for (int i=0; i 4) - for (int j=0; j 4) - if (rawOutput[i].split(QChar('\t'), QString::SkipEmptyParts)[4] == - rawList[j].split(QChar('\t'), QString::SkipEmptyParts)[4]) - exist = true; - if (!exist) + if (rawOutput[i].split(QChar('\t'), QString::SkipEmptyParts).count() == 4) { rawList.append(rawOutput[i]); + continue; + } else if (rawOutput[i].split(QChar('\t'), QString::SkipEmptyParts).count() == 5) { + if (names.contains(rawOutput[i].split(QChar('\t'), QString::SkipEmptyParts)[4])) continue; + names.append(rawOutput[i].split(QChar('\t'), QString::SkipEmptyParts)[4]); + rawList.append(rawOutput[i]); + } } for (int i=0; i 4) + if (rawList[i].split(QChar('\t'), QString::SkipEmptyParts).count() == 5) wifiPoint.name = rawList[i].split(QChar('\t'), QString::SkipEmptyParts)[4]; else wifiPoint.name = QString(""); @@ -327,27 +320,27 @@ QList WpaSup::scanWifi() bool WpaSup::startWpaSupplicant() { if (debug) qDebug() << PDEBUG; - if (ctrlDir == 0) { + if (ctrlDir.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return false; } - if (ctrlGroup == 0) { + if (ctrlGroup.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find group"; return false; } - if (pidFile == 0) { + if (pidFile.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find PID file"; return false; } - if (wpaDrivers == 0) { + if (wpaDrivers.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find drivers"; return false; } - if (wpaSupPath == 0) { + if (wpaSupPath.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find wpa_supplicant"; return false; } - if (netctlCommand == 0) { + if (netctlCommand == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find library"; return false; } @@ -357,12 +350,10 @@ bool WpaSup::startWpaSupplicant() return false; } - if (QFile(pidFile).exists()) - return true; - QString interface = interfaces[0]; - QString cmd = sudoCommand + QString(" ") + wpaSupPath + QString(" -B -P ") + pidFile + - QString(" -i ") + interface + QString(" -D ") + wpaDrivers + - QString(" -C \"DIR=") + ctrlDir + QString(" GROUP=") + ctrlGroup + QString("\""); + if (QFile(pidFile).exists()) return true; + QString cmd = QString("%1 %2 -B -P \"%3\" -i %4 -D %5 -C \"DIR=%6 GROUP=%7\"") + .arg(sudoCommand).arg(wpaSupPath).arg(pidFile).arg(interfaces[0]) + .arg(wpaDrivers).arg(ctrlDir).arg(ctrlGroup); if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd; TaskResult process = runTask(cmd, useSuid); waitForProcess(1); @@ -370,10 +361,7 @@ bool WpaSup::startWpaSupplicant() if (process.exitCode != 0) if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - if (process.exitCode == 0) - return true; - else - return false; + return (process.exitCode == 0); } @@ -396,19 +384,19 @@ QString WpaSup::getWpaCliOutput(const QString commandLine) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Command" << commandLine; - if (ctrlDir == 0) { + if (ctrlDir.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return QString(); } - if (pidFile == 0) { + if (pidFile.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find PID file"; return QString(); } - if (wpaCliPath == 0) { + if (wpaCliPath.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find wpa_cli"; return QString(); } - if (netctlCommand == 0) { + if (netctlCommand == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find library"; return QString(); } @@ -453,19 +441,19 @@ bool WpaSup::wpaCliCall(const QString commandLine) { if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG << ":" << "Command" << commandLine; - if (ctrlDir == 0) { + if (ctrlDir.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find directory"; return false; } - if (pidFile == 0) { + if (pidFile.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find PID file"; return false; } - if (wpaCliPath == 0) { + if (wpaCliPath.isEmpty()) { if (debug) qDebug() << PDEBUG << ":" << "Could not find wpa_cli"; return false; } - if (netctlCommand == 0) { + if (netctlCommand == nullptr) { if (debug) qDebug() << PDEBUG << ":" << "Could not find library"; return false; } @@ -485,8 +473,5 @@ bool WpaSup::wpaCliCall(const QString commandLine) if (process.exitCode != 0) if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; - if (process.exitCode == 0) - return true; - else - return false; + return (process.exitCode == 0); }