mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add some w\o
This commit is contained in:
parent
c2c14c4911
commit
fa27b80060
@ -185,6 +185,8 @@ QString Netctl::getExtIp(const QString cmd)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
|
||||
// test network connection
|
||||
if (!isNetworkActive()) return QString("N\\A");
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
if (process.exitCode != 0)
|
||||
@ -317,6 +319,22 @@ QString Netctl::getStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::isNetworkActive()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString cmd = QString("ping -c 1 google.com");
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
TaskResult process = runTask(cmd);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||
|
||||
if (process.exitCode == 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Netctl::updateSourceEvent(const QString &source)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QStringList getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
QString getStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
bool isNetworkActive();
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
|
Loading…
Reference in New Issue
Block a user