From fbcfcf912568ea5790be92ccb32d4721440e2950 Mon Sep 17 00:00:00 2001 From: zhangkun Date: Fri, 11 Sep 2026 16:25:36 +0800 Subject: [PATCH] fix(power): start countdown from the configured value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Drop the remaining-time calculation and the clamping in PowerManager::scheduledShutdown, so the countdown is re-armed with m_shutdownCountdown instead of the seconds left until the shutdown time. Log: Scheduled shutdown countdown starts from the configured value again. Influence: Countdown banner shows the full configured time again. fix(power): 定时关机倒计时改回按配置值开始 1. 移除 PowerManager::scheduledShutdown 中按实际剩余时间计算并夹取倒计时起点的逻辑, 重新使用 m_shutdownCountdown 启动倒计时。 Log: 定时关机倒计时重新从配置值开始。 PMS: BUG-375855 Influence: 倒计时横幅重新展示完整配置时长。 Change-Id: I58455dad1f65863844c0076e228bce46b9b9c3fd --- src/plugin-qt/power/session/powermanager.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugin-qt/power/session/powermanager.cpp b/src/plugin-qt/power/session/powermanager.cpp index 12c08999..3eed4429 100644 --- a/src/plugin-qt/power/session/powermanager.cpp +++ b/src/plugin-qt/power/session/powermanager.cpp @@ -1466,13 +1466,7 @@ void PowerManager::scheduledShutdown(int state) } case SchedCountdowning: { m_shutdownStatus = SchedCountdowning; - // 用实际剩余时间做倒计时起点,避免切换会话重新调度后从头倒数 - qint64 secsLeft = now.secsTo(next); - if (secsLeft < 1) - secsLeft = 1; - else if (secsLeft > m_shutdownCountdown) - secsLeft = m_shutdownCountdown; - int remaining = static_cast(secsLeft); + int remaining = qMax(1, m_shutdownCountdown); shutdownCountdownNotify(remaining, true); // Use member m_countdownTimer (matching Go: m.shutdownTimer in countdown goroutine)