Skip to content

Commit f944808

Browse files
committed
fix: correct update notification display logic
1. Refactored update state calculation to fix incorrect notification display 2. Separated system and security update mode checks for clarity 3. Fixed logic error where security updates were not properly considered 4. Now correctly handles all 5 update mode combinations (1,4,5,9,12,13) 5. Added explicit boolean variables to improve code readability Log: Fixed dock update plugin notification display logic to show updates correctly based on user settings Influence: 1. Test with different update mode settings (1,4,5,9,12,13) 2. Verify notifications appear for system updates when enabled 3. Verify notifications appear for security updates when enabled 4. Test combinations where both system and security updates are enabled 5. Verify no false positives when updates are not available 6. Test with different update statuses (needReboot, notDownload, etc.) fix: 修正更新通知显示逻辑 1. 重构更新状态计算逻辑,修复通知显示不正确的问题 2. 分离系统和安全更新模式检查,提高代码清晰度 3. 修复安全更新未被正确考虑的逻辑错误 4. 现在能正确处理所有5种更新模式组合(1,4,5,9,12,13) 5. 添加显式布尔变量以提高代码可读性 Log: 修复任务栏更新插件通知显示逻辑,根据用户设置正确显示更新通知 Influence: 1. 使用不同的更新模式设置进行测试(1,4,5,9,12,13) 2. 验证启用系统更新时通知是否正确显示 3. 验证启用安全更新时通知是否正确显示 4. 测试同时启用系统和安全更新的组合情况 5. 验证没有更新时不会出现误报 6. 测试不同的更新状态(needReboot, notDownload等) PMS: BUG-351487
1 parent ad8449b commit f944808

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/dock-update-plugin/pluginupdateplugin.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2025-2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -325,11 +325,14 @@ void PluginUpdatePlugin::updateStateFromUpdateStatus()
325325
QString securityUpgrade = updateStatusObj["security_upgrade"].toString();
326326

327327
qCInfo(dockUpdatePlugin) << "Parsing UpdateStatus - system_upgrade:" << systemUpgrade << "security_upgrade:" << securityUpgrade;
328-
329-
bool shouldShow = (m_updateMode == 1 || m_updateMode == 5 || m_updateMode == 9 || m_updateMode == 13 || m_updateMode == 4) &&
330-
(systemUpgrade == "needReboot" || securityUpgrade == "needReboot" || systemUpgrade == "notDownload" || securityUpgrade == "notDownload");
331-
332-
m_shouldShow = shouldShow;
328+
329+
const bool systemEnabled = (m_updateMode == 1 || m_updateMode == 5 || m_updateMode == 9 || m_updateMode == 13);
330+
const bool securityEnabled = (m_updateMode == 4 || m_updateMode == 5 || m_updateMode == 12 || m_updateMode == 13);
331+
332+
const bool systemHasUpdate = systemEnabled && (systemUpgrade == "needReboot" || systemUpgrade == "notDownload");
333+
const bool securityHasUpdate = securityEnabled && (securityUpgrade == "needReboot" || securityUpgrade == "notDownload");
334+
335+
m_shouldShow = systemHasUpdate || securityHasUpdate;
333336

334337
UpdateState newState = m_currentState;
335338
if (systemUpgrade == "needReboot" || securityUpgrade == "needReboot") {

0 commit comments

Comments
 (0)