small fixes

This commit is contained in:
arcan1s 2014-02-04 22:05:35 +04:00
parent 7a6930ce2c
commit 121ba0e54f

View File

@ -110,7 +110,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.start(cmd + QString(" list")); command.start(cmd + QString(" list"));
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) { if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
@ -125,7 +125,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.start(extIpCmd); command.start(extIpCmd);
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
if (cmdOutput != QString("")) if (!cmdOutput.isEmpty())
value = cmdOutput.split(QString("\n"), QString::SkipEmptyParts)[0]; value = cmdOutput.split(QString("\n"), QString::SkipEmptyParts)[0];
} }
setData(source, QString("value"), value); setData(source, QString("value"), value);
@ -145,7 +145,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.start(ipCmd + QString(" addr show ") + netDevices[i]); command.start(ipCmd + QString(" addr show ") + netDevices[i]);
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList deviceInfo = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList deviceInfo = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int j=0; j<deviceInfo.count(); j++) for (int j=0; j<deviceInfo.count(); j++)
if (deviceInfo[j].split(QString(" "), QString::SkipEmptyParts)[0] == QString("inet")) if (deviceInfo[j].split(QString(" "), QString::SkipEmptyParts)[0] == QString("inet"))
@ -160,7 +160,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
QStringList list; QStringList list;
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 1) if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 1)
@ -176,7 +176,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
value = QString("false"); value = QString("false");
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) { if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
@ -191,7 +191,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
QString currentProfile; QString currentProfile;
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList profileList = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++) for (int i=0; i<profileList.count(); i++)
if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) { if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) {
@ -202,7 +202,7 @@ bool Netctl::updateSourceEvent(const QString &source)
command.start(cmd + QString(" status ") + currentProfile); command.start(cmd + QString(" status ") + currentProfile);
command.waitForFinished(-1); command.waitForFinished(-1);
cmdOutput = command.readAllStandardOutput(); cmdOutput = command.readAllStandardOutput();
if (cmdOutput != QString("")) { if (!cmdOutput.isEmpty()) {
QStringList profile = cmdOutput.split(QString("\n"), QString::SkipEmptyParts); QStringList profile = cmdOutput.split(QString("\n"), QString::SkipEmptyParts);
for (int i=0; i<profile.count(); i++) for (int i=0; i<profile.count(); i++)
if (profile[i].split(QString(" "), QString::SkipEmptyParts)[0] == QString("Loaded:")) { if (profile[i].split(QString(" "), QString::SkipEmptyParts)[0] == QString("Loaded:")) {