Fix(datetime interface): cannot set Beijing time zone

Description: cannot set Beijing time zone
Log: 时区设置北京无效
Bug: https://gitee.com/openkylin/ukui-control-center/issues/I981M3?from=project-issue
This commit is contained in:
zhoubin 2024-03-14 17:17:30 +08:00
parent 34cd7d241d
commit ed87159726
3 changed files with 7 additions and 3 deletions

View File

@ -1336,7 +1336,9 @@ void Theme::changeEffectSlot(bool checked)
// 提供给外部监听特效接口
setEffectStatus(checked);
mTranWidget->setVisible(checked && !UkccCommon::isTablet());
mCornerWidget->setVisible(checked && !UkccCommon::isTablet());
#ifdef Nile
mCornerWidget->setVisible(checked);
#endif
}
void Theme::changeEffectBtnSlot(bool checked)

View File

@ -44,7 +44,7 @@ QStringList DatetimeInterface::getTimezone()
QString showTimezone = reply.value();
if (!reply.isValid() || reply.value() != timezoneT) {
// showTimezone 异常,重新设置
if (showTimezone.isEmpty()) {
if (!LINK_SHANGHAI_TIMEZONE.contains(showTimezone) || showTimezone.isEmpty()) {
showTimezone = timezoneT;
UniversalInterface::self()->ukccSystemDbus()->call("setShowTimezone", showTimezone);
}
@ -91,6 +91,8 @@ QString DatetimeInterface::getTimeMode()
void DatetimeInterface::setTimezone(QString timezone)
{
QString setTimezone = timezone;
if (LINK_SHANGHAI_TIMEZONE.contains(timezone))
setTimezone = "Asia/Shanghai";
QDBusMessage retDBus = timeDateInterface->call("SetTimezone", setTimezone, true);
if (retDBus.type() == QDBusMessage::ErrorMessage) {
return;

View File

@ -39,7 +39,7 @@ private:
QDBusInterface *timeDateInterface = nullptr;
const QStringList LINK_SHANGHAI_TIMEZONE = {
"Asia/Beijing",
"Asia/Urumqi"
// "Asia/Urumqi"
};
const QString TIMEZONES_KEY = QString("timezones");