Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@
return m_MACAddress;
}

bool DeviceNetwork::canDisable()

Check warning on line 251 in deepin-devicemanager/src/DeviceManager/DeviceNetwork.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'canDisable' is never used.
{
if (m_SysPath.isEmpty()) {
return false;
}
return true;
}

void DeviceNetwork::initFilterKey()
{
// 初始化可显示属性
Expand Down
2 changes: 2 additions & 0 deletions deepin-devicemanager/src/DeviceManager/DeviceNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class DeviceNetwork : public DeviceBaseInfo
*/
QString hwAddress();

bool canDisable();

protected:

/**
Expand Down
1 change: 1 addition & 0 deletions deepin-devicemanager/src/Page/PageMultiInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ void PageMultiInfo::getTableListInfo(const QList<DeviceBaseInfo *> &lst, QList<Q
DeviceNetwork *network = dynamic_cast<DeviceNetwork *>(info);
if (network) {
menuControl.append(network->logicalName());
menuControl.append(network->canDisable() ? "true" : "false");
}

menuControlList.append(menuControl);
Expand Down
4 changes: 4 additions & 0 deletions deepin-devicemanager/src/Page/PageSingleInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ void PageSingleInfo::slotShowMenu(const QPoint &)
if (!mp_Device->enable())
mp_WakeupMachine->setEnabled(false);
mp_Menu->addAction(mp_WakeupMachine);

// 根据网卡情况判断是否支持禁用
if (!network->canDisable())
mp_Menu->removeAction(mp_Enable);
}

mp_Menu->exec(QCursor::pos());
Expand Down
8 changes: 8 additions & 0 deletions deepin-devicemanager/src/Widget/TableWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ void TableWidget::slotShowMenu(const QPoint &point)
mp_WakeupMachine->setEnabled(false);
mp_Menu->addAction(mp_WakeupMachine);
}

// 根据网卡情况判断是否支持禁用
QVariant canDisableForNetwork = item->data(Qt::UserRole + 3);
if (canDisableForNetwork.isValid()) {
if (canDisableForNetwork.toString() == "false")
mp_Menu->removeAction(mp_Enable);
}

mp_Menu->exec(QCursor::pos());
}

Expand Down