route delete fixed (Windows)
This commit is contained in:
parent
d831d68e73
commit
c2f6c7d939
10 changed files with 24 additions and 15 deletions
|
@ -34,10 +34,10 @@ bool Router::clearSavedRoutes()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool Router::routeDelete(const QString &ip)
|
||||
bool Router::routeDelete(const QString &ip, const QString &gw)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return RouterWin::Instance().routeDelete(ip);
|
||||
return RouterWin::Instance().routeDelete(ip, gw);
|
||||
#elif defined (Q_OS_MAC)
|
||||
return RouterMac::Instance().routeDelete(ip);
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
static bool routeAdd(const QString &ip, const QString &gw, QString mask = QString());
|
||||
static int routeAddList(const QString &gw, const QStringList &ips);
|
||||
static bool clearSavedRoutes();
|
||||
static bool routeDelete(const QString &ip);
|
||||
static bool routeDelete(const QString &ip, const QString &gw);
|
||||
static void flushDns();
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ bool RouterMac::routeDelete(const QString &ip)
|
|||
p.waitForFinished();
|
||||
qDebug().noquote() << "OUTPUT routeDelete: " + p.readAll();
|
||||
|
||||
return p.exitCode() == 0;}
|
||||
return p.exitCode() == 0;
|
||||
}
|
||||
|
||||
void RouterMac::flushDns()
|
||||
{
|
||||
|
|
|
@ -274,14 +274,13 @@ bool RouterWin::clearSavedRoutes()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool RouterWin::routeDelete(const QString &ip)
|
||||
bool RouterWin::routeDelete(const QString &ip, const QString &gw)
|
||||
{
|
||||
qDebug().noquote() << QString("ROUTE DELETE, IP: %1").arg(ip);
|
||||
qDebug().noquote() << QString("ROUTE DELETE, IP: %1 GW %2").arg(ip).arg(gw);
|
||||
|
||||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
QString command = QString("route delete %1")
|
||||
.arg(ip);
|
||||
QString command = QString("route delete %1 %2").arg(ip).arg(gw);
|
||||
|
||||
p.start(command);
|
||||
p.waitForFinished();
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
bool routeAdd(const QString &ip, const QString &gw, QString mask = QString());
|
||||
int routeAddList(const QString &gw, const QStringList &ips);
|
||||
bool clearSavedRoutes();
|
||||
bool routeDelete(const QString &ip);
|
||||
bool routeDelete(const QString &ip, const QString &gw);
|
||||
void flushDns();
|
||||
|
||||
public slots:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue