From c09763c61cff2f4db6c01797caa61cacd5d34121 Mon Sep 17 00:00:00 2001 From: Multica Agent Date: Thu, 3 Sep 2026 11:52:11 +0800 Subject: [PATCH 1/2] fix: suppress three not-find warnings in net-view control center DDE-151: control center network module logs three runtime warnings for NetWiredDisabledItem / NetWirelessDisabledItem / NetAirplaneModeTipsItem. 1. NetWiredDisabledItem / NetWirelessDisabledItem are never instantiated (factory returns nullptr; no NetItemNew+addItem). Remove the dead updateItemVisible calls in updateControlEnabled() and updateAirplaneMode(). Preserve pEnabled/pEnabledable logic and parentItem->updateenabled()/ updateenabledable(). 2. NetAirplaneModeTipsItem is created in init() under Net_AirplaneTips guard, but updateAirplaneMode() called updateItemVisible on it unconditionally. Net_DccFlags lacks Net_AirplaneTips, so the item is not created in control center and the call warns. Add symmetric flags().testFlags(Net_AirplaneTips) guard. dock/lock/greeter unchanged. m_airplaneMode tracking and airplaneModeChanged signal unchanged. PMS: https://pms.uniontech.com/task-view-392413.html Issue: DDE-151 --- net-view/operation/netmanager.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/net-view/operation/netmanager.cpp b/net-view/operation/netmanager.cpp index a3d28ae36..ef9969258 100644 --- a/net-view/operation/netmanager.cpp +++ b/net-view/operation/netmanager.cpp @@ -1029,13 +1029,6 @@ void NetManagerPrivate::updateControlEnabled(int type) parentItem->updateenabled(pEnabled); parentItem->updateenabledable(pEnabledable); } - - bool devDisabled = false; - int index = ((type & NET_MASK_TYPE) == NET_WIRELESS) ? WirelessDeviceIndex : WiredDeviceIndex; - if (m_deviceCount[index] == 1 && (m_deviceCount[WiredDeviceIndex] + m_deviceCount[WirelessDeviceIndex] == 1)) { - devDisabled = !pEnabled; - } - updateItemVisible(index == WirelessDeviceIndex ? "NetWirelessDisabledItem" : "NetWiredDisabledItem", devDisabled); } void NetManagerPrivate::updateAirplaneMode(bool enabled) @@ -1045,10 +1038,8 @@ void NetManagerPrivate::updateAirplaneMode(bool enabled) Q_Q(NetManager); Q_EMIT q->airplaneModeChanged(m_airplaneMode); } - updateItemVisible("NetAirplaneModeTipsItem", enabled && m_supportWireless); - if (enabled) { - updateItemVisible("NetWirelessDisabledItem", false); - updateItemVisible("NetWiredDisabledItem", false); + if (flags().testFlags(NetType::Net_AirplaneTips)) { + updateItemVisible("NetAirplaneModeTipsItem", enabled && m_supportWireless); } } From b41d5bdd49f37f872ca41e13c4bdef3620022fee Mon Sep 17 00:00:00 2001 From: Multica Agent Date: Thu, 3 Sep 2026 16:50:53 +0800 Subject: [PATCH 2/2] fix: remove dead code for NetWiredDisabledItem/NetWirelessDisabledItem Remove the never-instantiated NetWiredDisabledItem and NetWirelessDisabledItem item types and all associated dead code: - enum values WirelessDisabledItem/WiredDisabledItem (nettype.h) - class declarations NetWiredDisabledItem/NetWirelessDisabledItem (netitem.h) - factory empty break cases (netitemprivate.cpp) - delegate branches in getItemSpacing/paint/createEditor (netdelegate.cpp) - NetDisabledWidget class declaration and implementation (netdelegate.h/cpp) - unused #include (netdelegate.cpp) These types were never created by the factory (empty break), so all delegate branches handling them were unreachable dead code. This completes the cleanup started in the previous commit, making the removal of the 'not find' warning calls consistent with the removal of all rendering/display scaffolding for the abandoned placeholder feature. PMS: https://pms.uniontech.com/task-view-392413.html Issue: DDE-151 --- net-view/operation/netitem.h | 14 ------- net-view/operation/nettype.h | 2 - net-view/operation/private/netitemprivate.cpp | 3 -- net-view/window/private/netdelegate.cpp | 42 ------------------- net-view/window/private/netdelegate.h | 9 ---- 5 files changed, 70 deletions(-) diff --git a/net-view/operation/netitem.h b/net-view/operation/netitem.h index 53ff2c10d..5ff0e0d33 100644 --- a/net-view/operation/netitem.h +++ b/net-view/operation/netitem.h @@ -214,13 +214,6 @@ class NetWiredItem : public NetConnectionItem void portalUrlChanged(const QString &url); }; -class NetWiredDisabledItem : public NetItem -{ - Q_OBJECT -protected: - using NetItem::NetItem; -}; - class NetWirelessHiddenItem : public NetItem { Q_OBJECT @@ -284,13 +277,6 @@ class NetWirelessMineItem : public NetItem using NetItem::NetItem; }; -class NetWirelessDisabledItem : public NetItem -{ - Q_OBJECT -protected: - using NetItem::NetItem; -}; - /////////////////////////////////////////// class NetVPNControlItem : public NetDeviceItem diff --git a/net-view/operation/nettype.h b/net-view/operation/nettype.h index 28e5fa8e5..7abf0486e 100644 --- a/net-view/operation/nettype.h +++ b/net-view/operation/nettype.h @@ -29,12 +29,10 @@ class NetType WirelessOtherItem, // 其他网络,2级,虚拟项 WirelessItem, // 无线项,3级 WirelessHiddenItem, // 无线隐藏项,3级,虚拟项 - WirelessDisabledItem, // 无线禁用项,1级,虚拟项 AirplaneModeTipsItem, // 飞行模式提示项,1级 WiredControlItem = NET_WIRED | NET_CONTROL, // 有线开关,1级,虚拟项 WiredDeviceItem = NET_WIRED | NET_DEVICE, // 有线设备,1级 WiredItem, // 有线项,2级 - WiredDisabledItem, // 有线禁用项,1级,虚拟项 VPNControlItem, // vpn控制项 VPNTipsItem, // vpn提示项 SystemProxyControlItem, // 系统代理控制项 diff --git a/net-view/operation/private/netitemprivate.cpp b/net-view/operation/private/netitemprivate.cpp index 581c4ac7b..27680d8e7 100644 --- a/net-view/operation/private/netitemprivate.cpp +++ b/net-view/operation/private/netitemprivate.cpp @@ -76,9 +76,6 @@ NetItemPrivate *NetItemPrivate::New(NetType::NetItemType type, const QString &id CaseNewItem(AppProxyControlItem); CaseNewItem(AirplaneModeTipsItem); CaseNewItem(VPNTipsItem); - case NetType::WirelessDisabledItem: - case NetType::WiredDisabledItem: - break; } return netItemPrivate; } diff --git a/net-view/window/private/netdelegate.cpp b/net-view/window/private/netdelegate.cpp index 5b55b4696..6f46a19a1 100644 --- a/net-view/window/private/netdelegate.cpp +++ b/net-view/window/private/netdelegate.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -119,10 +118,6 @@ ItemSpacing NetDelegate::getItemSpacing(const QModelIndex &index) const spacing.height = 24; spacing.bottom = 4; } break; - case NetType::WirelessDisabledItem: - case NetType::WiredDisabledItem: - spacing.height = 220; - break; default: break; } @@ -154,8 +149,6 @@ void NetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, c bgColor.setAlphaF(0.05); } } break; - case NetType::WirelessDisabledItem: - case NetType::WiredDisabledItem: case NetType::WirelessMineItem: { textColor = boption.dpalette.brightText().color(); textColor.setAlphaF(0.6); @@ -232,10 +225,6 @@ QWidget *NetDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & widget->setFlag(m_flag); netWidget = widget; } break; - case NetType::WirelessDisabledItem: - case NetType::WiredDisabledItem: { - netWidget = new NetDisabledWidget(item, parent); - } break; case NetType::AirplaneModeTipsItem: { netWidget = new NetAirplaneModeTipsWidget(static_cast(item), parent); } break; @@ -883,37 +872,6 @@ int NetWiredWidget::leftSpacing() const return m_iconBut->width() + 10; } -NetDisabledWidget::NetDisabledWidget(NetItem *item, QWidget *parent) - : NetWidget(item, parent) -{ - QWidget *widget = new QWidget(this); - QVBoxLayout *layout = new QVBoxLayout(widget); - layout->setSpacing(0); - layout->setContentsMargins(3, 0, 5, 10); - - QToolButton *icon = new QToolButton(this); - icon->setIconSize(QSize(96, 96)); - icon->setFixedSize(96, 96); - icon->setAttribute(Qt::WA_TransparentForMouseEvents); - icon->setFocusPolicy(Qt::NoFocus); - if (item->itemType() == NetType::WiredDisabledItem) { - icon->setIcon(QIcon::fromTheme("network-wired-disabled")); - } else { - icon->setIcon(QIcon::fromTheme("network-wireless-disabled")); - } - - QLabel *label = createNemeLabel(item, this, DFontSizeManager::T8); - label->setAlignment(Qt::AlignCenter); - label->setFixedWidth(QWIDGETSIZE_MAX); - layout->addStretch(); - layout->addWidget(icon, 0, Qt::AlignHCenter); - layout->addWidget(label); - layout->addStretch(); - setCentralWidget(widget); -} - -NetDisabledWidget::~NetDisabledWidget() { } - NetItemWidget::NetItemWidget(NetItem *item, QWidget *parent) : NetWidget (item, parent) , m_portalLabel (nullptr) diff --git a/net-view/window/private/netdelegate.h b/net-view/window/private/netdelegate.h index 9551b9533..8c12d453f 100644 --- a/net-view/window/private/netdelegate.h +++ b/net-view/window/private/netdelegate.h @@ -274,15 +274,6 @@ public Q_SLOTS: dde::network::NetType::NetConnectionStatus m_status; }; -class NetDisabledWidget : public NetWidget -{ - Q_OBJECT - -public: - explicit NetDisabledWidget(NetItem *item, QWidget *parent = nullptr); - ~NetDisabledWidget() Q_DECL_OVERRIDE; -}; - } // namespace network } // namespace dde