Repository navigation
fix: skip cooperation UI and network monitor in onlyTransfer mode - #815
pppanghu77 wants to merge 1 commit into
Conversation
1. Root cause: dde-cooperation-transfer loads both cooperation-core and data-transfer/core plugins on Windows, each starting an independent 1s network monitor timer polling getFirstIp(); both emit onlineStateChanged(false) on disconnect, driving two separate UI surfaces to show network-disconnected pages 2. Fix: add onlyTransfer check in CooperaionCorePlugin::start() to skip mainWindow()->show() and MainController::instance()->start() when onlyTransfer is true, eliminating the duplicate network monitor from the source while keeping base services (regist, config, translations) 3. Impact: only affects onlyTransfer=true mode; normal cooperation mode behavior is unchanged; data-transfer side keeps its single monitor Log: fix duplicate network-disconnect popup in onlyTransfer mode Influence: 1. Test file transfer from UOS to Windows with onlyTransfer mode, verify only one network-disconnect popup appears when network drops 2. Test normal cooperation mode (non-onlyTransfer), verify both windows and network monitoring work as before 3. Verify cooperation module base services (regist, config) still work in onlyTransfer mode fix: onlyTransfer 模式下跳过协同模块 UI 显示和网络监控 1. 根因:dde-cooperation-transfer 在 Win 端同时加载 cooperation-core 和 data-transfer/core 两个插件,各自启动独立 1s 网络监控定时器轮询 getFirstIp(),断网时各自发射 onlineStateChanged(false),驱动不同 UI 表面切换到网络断开页面,产生两个提示框 2. 方案:在 CooperaionCorePlugin::start() 中增加 onlyTransfer 检查,当 onlyTransfer=true 时跳过 mainWindow()->show() 和 MainController::instance()->start(),从源头消除重复网络监控,保留 基础服务(regist、配置、翻译) 3. 影响:仅影响 onlyTransfer=true 模式;正常协同模式行为不变;数据迁移 侧保持单监控器 Log: 修复 onlyTransfer 模式下断网弹出两个提示框的问题 Influence: 1. 测试 onlyTransfer 模式下 UOS 向 Windows 投送文件,断网后验证仅弹出一个 网络断开提示框 2. 测试正常协同模式(非 onlyTransfer),验证窗口和网络监控功能无回归 3. 验证 onlyTransfer 模式下协同模块基础服务(regist、配置)仍正常工作 PMS: BUG-241813
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pppanghu77 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 GuideUpdates the cooperation core plugin startup path so onlyTransfer mode does not launch the cooperation UI or its duplicate network monitor, leaving the data-transfer monitor as the sole source of network-disconnection prompts while preserving shared registrations and normal-mode behavior. Sequence diagram for onlyTransfer startup behaviorsequenceDiagram
participant Plugin as CooperaionCorePlugin
participant App as qApp
participant UI as CooperationMainWindow
participant Controller as MainController
participant Transfer as DataTransferMonitor
Plugin->>App: property(onlyTransfer)
Plugin->>Controller: regist()
Plugin->>Transfer: regist()
alt onlyTransfer is false
Plugin->>UI: show()
Plugin->>Controller: start()
Controller-->>Controller: Start cooperation network monitor
else onlyTransfer is true
Plugin-->>UI: UI remains hidden
Plugin-->>Controller: Cooperation monitor remains stopped
Transfer-->>Transfer: Continue data-transfer network monitor
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['建议将第67行 !qApp->property("onlyTransfer").toBool() 改为 !onlyTransfer,复用已声明的局部变量,提升代码一致性和可维护性'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 建议复用 onlyTransfer 局部变量,将第67行也统一使用该变量: bool CooperaionCorePlugin::start() {
bool onlyTransfer = qApp->property("onlyTransfer").toBool();
if (!onlyTransfer)
CooperationUtil::instance()->mainWindow()->show();
MainController::instance()->regist();
TransferHelper::instance()->regist();
CooperationManager::instance()->regist();
if (!onlyTransfer)
MainController::instance()->start();
if (CommonUitls::isFirstStart() && !onlyTransfer) { // 复用局部变量
#ifdef linux
// ...
#endif
}
return true;
}本报告由 AI 代码审查工具自动生成 |
修复:onlyTransfer 模式下断网弹出两个网络断开提示框
问题
UOS 向 Windows 投送文件过程中断开 UOS 端网络,Win 端的
dde-cooperation-transfer弹出两个网络断开提示框,期望只弹一个。必现。根因
dde-cooperation-transfer在 Win 端同时加载cooperation-core和data-transfer/core两个插件,各自启动独立的 1 秒网络监控定时器,均轮询getFirstIp().size() > 0。断网时两个定时器先后发射onlineStateChanged(false),分别驱动协同窗口(mainwindow.cpp)和迁移窗口(mainwindow_p_win.cpp)切换到网络断开页面,用户看到两个提示框。根因点在
CooperaionCorePlugin::start()中无条件调用mainWindow()->show()和MainController::instance()->start(),未检查onlyTransfer属性。修复方案
在
CooperaionCorePlugin::start()中增加onlyTransfer检查:onlyTransfer=true时,跳过mainWindow()->show()(不显示协同窗口)和MainController::instance()->start()(不启动协同模块网络监控定时器)regist()、配置、翻译)改动
src/plugins/cooperation/core/cooperationcoreplugin.cpp:start()函数增加onlyTransfer条件检查(+5 行 -2 行)影响
regist等基础服务在 onlyTransfer 模式下仍正常执行PMS: BUG-241813
Summary by Sourcery
Bug Fixes: