-
Notifications
You must be signed in to change notification settings - Fork 12
fix: Fix the issue where the time does not follow the regional format #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#54
Fix the issue where the time does not follow the regional format Log: Fix the issue where the time does not follow the regional format pms: BUG-342705
de193ab to
08cef5e
Compare
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#54
deepin pr auto review我来对这个代码变更进行审查:
改进建议:
具体改进建议:
/**
* @brief 获取用户的语言环境设置
* @param user 用户对象指针
* @return 返回用户的locale字符串,如果获取失败则返回系统默认locale
*/
QString CenterTopWidget::getUserLocale(const User *user) const
QString CenterTopWidget::getUserLocale(const User *user) const
{
if (!user)
return QLocale::system().name();
if (qApp->applicationName() == "dde-lock")
return QLocale::system().name();
QString userConfigDbusPath = getRegionFormatConfigPath(user);
QString localeName = getRegionFormatValue(userConfigDbusPath, localeNameKey);
if (localeName.isEmpty()) {
localeName = user->locale();
}
// 确保返回值不为空
return localeName.isEmpty() ? QLocale::system().name() : localeName;
}
private:
static const QString LOCALE_NAME_KEY; // 在cpp文件中初始化总体来说,这是一个良好的代码重构,提高了代码的可维护性和复用性,同时没有引入额外的性能或安全问题。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx, yixinshark 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 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
Fix the issue where the time does not follow the regional format
Log: Fix the issue where the time does not follow the regional format
pms: BUG-342705