有线deleteConnect dbus接口
This commit is contained in:
parent
6f10fa6689
commit
b542af10ee
|
@ -356,9 +356,11 @@ void NetConnect::runExternalApp() {
|
|||
}
|
||||
|
||||
//刪除
|
||||
void NetConnect::deleteOneLan(QString ssid)
|
||||
void NetConnect::deleteOneLan(QString ssid, int type)
|
||||
{
|
||||
Q_EMIT lanRemove(ssid);
|
||||
qDebug() << "[NetConnect]call deleteConnect" << __LINE__;
|
||||
m_interface->call(QStringLiteral("deleteConnect"), type, ssid);
|
||||
qDebug() << "[NetConnect]call deleteConnect respond" << __LINE__;
|
||||
}
|
||||
|
||||
//激活
|
||||
|
@ -457,6 +459,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
});
|
||||
|
||||
lanItem->isAcitve = isActived;
|
||||
lanItem->setConnectActionText(lanItem->isAcitve);
|
||||
|
||||
connect(lanItem, &QPushButton::clicked, this, [=] {
|
||||
if (lanItem->isAcitve || lanItem->loading) {
|
||||
|
@ -473,7 +476,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL
|
|||
deActiveConnect(lanItem->uuid, devName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::deleteActionTriggered, this, [=] {
|
||||
deleteOneLan(lanItem->dbusPath);
|
||||
deleteOneLan(lanItem->uuid, WIRED_TYPE);
|
||||
});
|
||||
|
||||
//记录到deviceFrame的itemMap中
|
||||
|
@ -736,6 +739,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
});
|
||||
|
||||
lanItem->isAcitve = false;
|
||||
lanItem->setConnectActionText(lanItem->isAcitve);
|
||||
|
||||
connect(lanItem, &QPushButton::clicked, this, [=] {
|
||||
if (lanItem->isAcitve || lanItem->loading) {
|
||||
|
@ -745,6 +749,16 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis
|
|||
}
|
||||
});
|
||||
|
||||
connect(lanItem, &LanItem::connectActionTriggered, this, [=] {
|
||||
activeConnect(lanItem->uuid, deviceName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::disconnectActionTriggered, this, [=] {
|
||||
deActiveConnect(lanItem->uuid, deviceName, WIRED_TYPE);
|
||||
});
|
||||
connect(lanItem, &LanItem::deleteActionTriggered, this, [=] {
|
||||
deleteOneLan(lanItem->uuid, WIRED_TYPE);
|
||||
});
|
||||
|
||||
//记录到deviceFrame的itemMap中
|
||||
deviceFrameMap[deviceName]->itemMap.insert(connUuid, lanItem);
|
||||
int index = getInsertPos(connName, deviceName);
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
int getInsertPos(QString connName, QString deviceName);
|
||||
|
||||
|
||||
void deleteOneLan(QString ssid);
|
||||
void deleteOneLan(QString ssid, int type);
|
||||
void activeConnect(QString ssid, QString deviceName, int type);
|
||||
void deActiveConnect(QString ssid, QString deviceName, int type);
|
||||
|
||||
|
@ -153,8 +153,6 @@ private slots:
|
|||
void onDeviceStatusChanged();
|
||||
void onDeviceNameChanged(QString, QString, int);
|
||||
|
||||
Q_SIGNALS:
|
||||
void lanRemove(QString dbusPath);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QList<QDBusObjectPath>);
|
||||
|
|
|
@ -148,6 +148,18 @@ void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
|
|||
// return deviceName;
|
||||
//}
|
||||
|
||||
//删除
|
||||
void DbusAdaptor::deleteConnect(int type, QString ssid)
|
||||
{
|
||||
if (type == WIRED) {
|
||||
parent()->deleteWired(ssid);
|
||||
} else if (type == WIRELESS) {
|
||||
//待实现
|
||||
} else {
|
||||
qDebug() << "[DbusAdaptor] deleteConnect type is invalid";
|
||||
}
|
||||
}
|
||||
|
||||
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,8 @@ public Q_SLOTS: // METHODS
|
|||
// QString getDefaultWiredDevice();
|
||||
// Q_NOREPLY void setDefaultWirelessDevice(QString deviceName);
|
||||
// QString getDefaultWirelessDevice();
|
||||
//刪除 根据网络名称 参数1 0:lan 1:wlan 参数2 为ssid/uuid
|
||||
Q_NOREPLY void deleteConnect(int type, QString ssid);
|
||||
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
Q_NOREPLY void activateConnect(int type, QString devName, QString ssid);
|
||||
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||
|
|
|
@ -868,6 +868,12 @@ void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
|
|||
m_wlanWidget->getWirelessDeviceCap(map);
|
||||
}
|
||||
|
||||
//有线连接删除
|
||||
void MainWindow::deleteWired(const QString &connUuid)
|
||||
{
|
||||
m_lanWidget->deleteWired(connUuid);
|
||||
}
|
||||
|
||||
//有线连接断开
|
||||
void MainWindow::activateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
|
|
|
@ -81,6 +81,8 @@ public:
|
|||
void getApConnectionPath(QString &path, QString uuid);
|
||||
//获取热点ActivePath
|
||||
void getActiveConnectionPath(QString &path, QString uuid);
|
||||
//删除有线连接
|
||||
void deleteWired(const QString& connUuid);
|
||||
//有线连接断开
|
||||
void activateWired(const QString& devName, const QString& connUuid);
|
||||
void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
|
|
|
@ -1270,6 +1270,15 @@ bool LanPage::eventFilter(QObject *watched, QEvent *event)
|
|||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void LanPage::deleteWired(const QString &connUuid)
|
||||
{
|
||||
qDebug() << "[LanPage] deleteWired" << connUuid;
|
||||
if (connUuid == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_wiredConnectOperation->deleteWiredConnect(connUuid);
|
||||
}
|
||||
|
||||
void LanPage::activateWired(const QString& devName, const QString& connUuid)
|
||||
{
|
||||
qDebug() << "[LanPage] activateWired" << devName << connUuid;
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
|
||||
//for dbus
|
||||
void getWiredList(QMap<QString, QVector<QStringList> > &map);
|
||||
void deleteWired(const QString& connUuid);
|
||||
void activateWired(const QString& devName, const QString& connUuid);
|
||||
void deactivateWired(const QString& devName, const QString& connUuid);
|
||||
void showDetailPage(QString devName, QString uuid);
|
||||
|
|
Loading…
Reference in New Issue