now DE works without any problems

This commit is contained in:
arcan1s 2014-01-30 21:26:04 +04:00
parent 0d227e93e3
commit b243a4d324
2 changed files with 16 additions and 15 deletions

View File

@ -1,18 +1,18 @@
# Configuration file for netctl data engine # Configuration file for netctl data engine
# Uncomment needed lines
## Commands ## Commands
# command # command
#CMD=/usr/bin/netctl CMD=/usr/bin/netctl
# ip command # ip command
#IPCMD=/usr/bin/ip IPCMD=/usr/bin/ip
## Network ## Network
# path to list of network devices # path to list of network devices
#NETDIR=/sys/class/net/ NETDIR=/sys/class/net/
## External IP ## External IP
# external ip check command # external ip check command
#EXTIPCMD=wget -qO- http://ifconfig.me/ip EXTIPCMD=wget -qO- http://ifconfig.me/ip
# 'true' - check external IP # 'true' - check external IP
#EXTIP=false EXTIP=false

View File

@ -105,7 +105,6 @@ bool Netctl::updateSourceEvent(const QString &source)
QProcess command; QProcess command;
QString cmdOutput = QString(""); QString cmdOutput = QString("");
QString value = QString(""); QString value = QString("");
QStringList valueList;
if (source == QString("currentProfile")) { if (source == QString("currentProfile")) {
command.start(cmd + QString(" list")); command.start(cmd + QString(" list"));
@ -133,15 +132,15 @@ bool Netctl::updateSourceEvent(const QString &source)
} }
else if (source == QString("interfaces")) { else if (source == QString("interfaces")) {
if (QDir(netDir).exists()) if (QDir(netDir).exists())
valueList = QDir(netDir).entryList(QDir::Dirs); value = QDir(netDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot).join(QString(","));
setData(source, QString("value"), valueList); setData(source, QString("value"), value);
} }
else if (source == QString("intIp")) { else if (source == QString("intIp")) {
if (QDir(netDir).exists()) { if (QDir(netDir).exists()) {
valueList = QDir(netDir).entryList(QDir::Dirs); QStringList netDevices = QDir(netDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i=0; i<valueList.count(); i++) { for (int i=0; i<netDevices.count(); i++) {
cmdOutput = QString(""); cmdOutput = QString("");
command.start(ipCmd + QString("ip addr show ") + valueList[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 != QString("")) {
@ -158,15 +157,17 @@ 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();
QStringList list;
if (cmdOutput != QString("")) { if (cmdOutput != QString("")) {
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)
valueList.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[0]); list.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[0]);
else if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2) else if (profileList[i].split(QString(" "), QString::SkipEmptyParts).count() == 2)
valueList.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[1]); list.append(profileList[i].split(QString(" "), QString::SkipEmptyParts)[1]);
} }
setData(source, QString("value"), valueList); value = list.join(QString(","));
setData(source, QString("value"), value);
} }
else if (source == QString("statusBool")) { else if (source == QString("statusBool")) {
command.start(cmd + QString(" list")); command.start(cmd + QString(" list"));