From cb2490b309ea41ffd82e66aaae49bcc4e087215c Mon Sep 17 00:00:00 2001 From: chenyuanbo Date: Mon, 21 Sep 2026 15:37:56 +0800 Subject: [PATCH] feat: add language update support to system service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add initializator() accessor method to SystemContainer class 2. Include networkinitialization.h header in systemservice.cpp 3. Implement UpdateLanguage slot in SystemService to handle locale updates 4. Declare UpdateLanguage slot in SystemService header 5. Enable language updates to be propagated through the system container to network initialization component Log: Added support for updating language settings in system service Influence: 1. Test UpdateLanguage method with various locale strings 2. Verify that language updates are properly propagated to network initialization 3. Test the initializator() accessor returns valid pointer 4. Verify system service handles language updates without crashes 5. Test integration with existing connectivity and IP conflict functionality 6. Verify no memory leaks or null pointer issues when updating language feat: 为系统服务添加语言更新支持 1. 在 SystemContainer 类中添加 initializator() 访问器方法 2. 在 systemservice.cpp 中包含 networkinitialization.h 头文件 3. 在 SystemService 中实现 UpdateLanguage 槽函数以处理区域设置更新 4. 在 SystemService 头文件中声明 UpdateLanguage 槽函数 5. 使语言更新能够通过系统容器传播到网络初始化组件 Log: 新增系统服务语言设置更新功能 Influence: 1. 使用不同的区域设置字符串测试 UpdateLanguage 方法 2. 验证语言更新是否正确传播到网络初始化组件 3. 测试 initializator() 访问器返回有效的指针 4. 验证系统服务处理语言更新时不会崩溃 5. 测试与现有连接性和 IP 冲突功能的集成 6. 验证更新语言时没有内存泄漏或空指针问题 PMS: TASK-395869 --- network-service-plugin/src/system/systemcontainer.cpp | 5 +++++ network-service-plugin/src/system/systemcontainer.h | 1 + network-service-plugin/src/system/systemservice.cpp | 8 +++++++- network-service-plugin/src/system/systemservice.h | 3 ++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/network-service-plugin/src/system/systemcontainer.cpp b/network-service-plugin/src/system/systemcontainer.cpp index 03be639cd..271b92f72 100644 --- a/network-service-plugin/src/system/systemcontainer.cpp +++ b/network-service-plugin/src/system/systemcontainer.cpp @@ -30,3 +30,8 @@ ConnectivityProcesser *SystemContainer::connectivityProcesser() const { return m_connectivityHelper; } + +NetworkInitialization *SystemContainer::initializator() const +{ + return m_initializator; +} diff --git a/network-service-plugin/src/system/systemcontainer.h b/network-service-plugin/src/system/systemcontainer.h index 0dc9369c1..1a222134d 100644 --- a/network-service-plugin/src/system/systemcontainer.h +++ b/network-service-plugin/src/system/systemcontainer.h @@ -24,6 +24,7 @@ class SystemContainer : public QObject ~SystemContainer(); SystemIPConflict *ipConfilctedChecker() const; ConnectivityProcesser *connectivityProcesser() const; + NetworkInitialization *initializator() const; private: SystemIPConflict *m_ipConflictHandler; diff --git a/network-service-plugin/src/system/systemservice.cpp b/network-service-plugin/src/system/systemservice.cpp index 7050ace96..aae11fe19 100644 --- a/network-service-plugin/src/system/systemservice.cpp +++ b/network-service-plugin/src/system/systemservice.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -6,6 +6,7 @@ #include "systemcontainer.h" #include "systemipconfilct.h" #include "connectivityprocesser.h" +#include "networkinitialization.h" using namespace network::systemservice; @@ -30,6 +31,11 @@ void SystemService::CheckConnectivity() m_network->connectivityProcesser()->checkConnectivity(); } +void SystemService::UpdateLanguage(const QString &locale) +{ + m_network->initializator()->updateLanguage(locale); +} + int SystemService::Connectivity() { return static_cast(m_network->connectivityProcesser()->connectivity()); diff --git a/network-service-plugin/src/system/systemservice.h b/network-service-plugin/src/system/systemservice.h index 14dbfd75e..108d00c4a 100644 --- a/network-service-plugin/src/system/systemservice.h +++ b/network-service-plugin/src/system/systemservice.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -49,6 +49,7 @@ class SystemService : public QObject public slots: bool IpConflicted(const QString &devicePath); void CheckConnectivity(); + void UpdateLanguage(const QString &locale); private: SystemContainer *m_network;