fix: pass activation token to control center navigation#572
Conversation
1. Replace direct call to `m_manager->exec(NetManager::GoToControlCenter, "")` with `m_manager->gotoControlCenter(token)` 2. Retrieve `XDG_ACTIVATION_TOKEN` from environment for proper window activation chain 3. Fix focus issue when opening control center from network menu Log: Fixed control center window focus when navigating from network menu Influence: 1. Test opening control center via network tray menu on different desktop environments 2. Verify control center window is properly focused on activation 3. Test the navigation when launched from various contexts (tray, keyboard shortcut) 4. Verify no regression in other menu item functions (proxy settings, etc.) fix: 传递激活令牌到控制中心导航 1. 将对 `m_manager->exec(NetManager::GoToControlCenter, "")` 的直接调用 替换为 `m_manager->gotoControlCenter(token)` 2. 从环境变量获取 `XDG_ACTIVATION_TOKEN` 以实现正确的窗口激活链 3. 修复从网络菜单打开控制中心时的焦点问题 Log: 修复从网络菜单打开控制中心时的窗口焦点问题 Influence: 1. 验证在不同桌面环境通过网络托盘菜单打开控制中心 2. 验证控制中心窗口在激活时是否正确获得焦点 3. 测试从不同上下文(托盘、快捷键)启动导航的情况 4. 验证其他菜单项功能(代理设置等)无回归问题 PMS: BUG-367651
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates network menu handling so that opening the Control Center passes through the XDG activation token and uses a dedicated navigation API, fixing focus behavior when launched from the network tray. Sequence diagram for passing XDG activation token to Control Center navigationsequenceDiagram
actor User
participant NetStatus
participant NetManager
participant ControlCenter
User->>NetStatus: invokeMenuItem(MenuSettings)
NetStatus->>NetStatus: qEnvironmentVariable(XDG_ACTIVATION_TOKEN)
NetStatus->>NetManager: gotoControlCenter(token)
NetManager->>ControlCenter: gotoControlCenter(token)
ControlCenter-->>User: focused window activated
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider handling the case where
XDG_ACTIVATION_TOKENis empty or unset (e.g., Wayland vs. X11) by falling back to the previousexec(NetManager::GoToControlCenter, "")behavior or a suitable default to avoid changing behavior in non-Wayland environments. - The
MenuSettingscase block formatting (} break;) is slightly inconsistent with the surrounding switch cases; aligning the brace andbreakwith the project's usual style would improve readability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider handling the case where `XDG_ACTIVATION_TOKEN` is empty or unset (e.g., Wayland vs. X11) by falling back to the previous `exec(NetManager::GoToControlCenter, "")` behavior or a suitable default to avoid changing behavior in non-Wayland environments.
- The `MenuSettings` case block formatting (`} break;`) is slightly inconsistent with the surrounding switch cases; aligning the brace and `break` with the project's usual style would improve readability.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已为最佳实践,无需额外修改,此处展示完整上下文以供校验编译
void NetStatus::invokeMenuItem(const QString &menuId)
{
// ... 其他分支逻辑
case MenuItemKey::MenuProxyDisabled:
m_manager->setProxyEnabled(false);
break;
case MenuItemKey::MenuSettings: {
const auto token = qEnvironmentVariable("XDG_ACTIVATION_TOKEN");
m_manager->gotoControlCenter(token);
} break;
default:
break;
}
// ...
} |
m_manager->exec(NetManager::GoToControlCenter, "")withm_manager->gotoControlCenter(token)XDG_ACTIVATION_TOKENfrom environment for proper windowactivation chain
Log: Fixed control center window focus when navigating from network menu
Influence:
desktop environments
keyboard shortcut)
etc.)
fix: 传递激活令牌到控制中心导航
m_manager->exec(NetManager::GoToControlCenter, "")的直接调用替换为
m_manager->gotoControlCenter(token)XDG_ACTIVATION_TOKEN以实现正确的窗口激活链Log: 修复从网络菜单打开控制中心时的窗口焦点问题
Influence:
PMS: BUG-367651
Summary by Sourcery
Pass XDG activation token when navigating from the network status menu to the control center to ensure correct window activation and focus.
Bug Fixes:
Enhancements: