sync: from linuxdeepin/dde-session-shell#488
Conversation
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#57
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideExtends the shutdown-inhibit guard logic in WarningContent to also consider new RequireShutdown and RequireRestart power action states, preventing unintended transition to lock content during these actions. Class diagram for updated shutdown inhibit logic in WarningContentclassDiagram
class WarningContent {
- SessionBaseModel m_model
- SessionBaseModel_PowerAction m_powerAction
+ void doAcceptShutdownInhibit()
}
class SessionBaseModel {
<<enumeration>> ModeStatus
<<enumeration>> PowerAction
+ ModeStatus currentModeState()
+ void setCurrentContentType(ContentType type)
}
class SessionBaseModel_ModeStatus {
ShutDownMode
PowerMode
}
class SessionBaseModel_PowerAction {
RequireUpdateShutdown
RequireUpdateRestart
RequireShutdown
RequireRestart
}
class FullScreenBackground {
+ static void setContent(LockContent content)
}
class LockContent {
+ static LockContent instance()
}
WarningContent --> SessionBaseModel : uses
WarningContent --> FullScreenBackground : calls
WarningContent --> LockContent : calls
SessionBaseModel --> SessionBaseModel_ModeStatus : defines
SessionBaseModel --> SessionBaseModel_PowerAction : defines
Flow diagram for extended shutdown inhibit guard in WarningContent::doAcceptShutdownInhibitflowchart TD
A[doAcceptShutdownInhibit called] --> B{currentModeState is ShutDownMode or PowerMode}
B -- yes --> Z[Skip lock transition]
B -- no --> C{m_powerAction is RequireUpdateShutdown}
C -- yes --> Z[Skip lock transition]
C -- no --> D{m_powerAction is RequireUpdateRestart}
D -- yes --> Z[Skip lock transition]
D -- no --> E{m_powerAction is RequireShutdown}
E -- yes --> Z[Skip lock transition]
E -- no --> F{m_powerAction is RequireRestart}
F -- yes --> Z[Skip lock transition]
F -- no --> G[FullScreenBackground setContent with LockContent instance]
G --> H[m_model setCurrentContentType to LockContent]
H --> I[End]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码的修改主要是在 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结这段代码的修改是正确的,逻辑上填补了之前可能存在的边界情况处理缺失。代码本身没有明显的语法错误或严重的性能问题。主要的改进空间在于代码的可读性和维护性,建议将复杂的条件判断提取为独立的辅助函数。此外,确认 |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The compound
ifcondition combining multiplecurrentModeStateandm_powerActionchecks is getting hard to read and reason about; consider extracting the power-action check into a small helper (e.g.isNormalPowerAction(...)) or using aswitchto make the allowed/blocked cases more explicit.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The compound `if` condition combining multiple `currentModeState` and `m_powerAction` checks is getting hard to read and reason about; consider extracting the power-action check into a small helper (e.g. `isNormalPowerAction(...)`) or using a `switch` to make the allowed/blocked cases more explicit.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Synchronize source files from linuxdeepin/dde-session-shell.
Source-pull-request: linuxdeepin/dde-session-shell#57
Summary by Sourcery
Bug Fixes: