From ed87159726fd4caa6df2f6626b50c5734ee45820 Mon Sep 17 00:00:00 2001 From: zhoubin Date: Thu, 14 Mar 2024 17:17:30 +0800 Subject: [PATCH] Fix(datetime interface): cannot set Beijing time zone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: cannot set Beijing time zone Log: 时区设置北京无效 Bug: https://gitee.com/openkylin/ukui-control-center/issues/I981M3?from=project-issue --- plugins/personalized/theme/theme.cpp | 4 +++- registeredSession/plugins/datetime/datetimeinterface.cpp | 4 +++- registeredSession/plugins/datetime/datetimeinterface.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/personalized/theme/theme.cpp b/plugins/personalized/theme/theme.cpp index ff5f5df..3933728 100644 --- a/plugins/personalized/theme/theme.cpp +++ b/plugins/personalized/theme/theme.cpp @@ -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) diff --git a/registeredSession/plugins/datetime/datetimeinterface.cpp b/registeredSession/plugins/datetime/datetimeinterface.cpp index 9c0af73..abebec9 100644 --- a/registeredSession/plugins/datetime/datetimeinterface.cpp +++ b/registeredSession/plugins/datetime/datetimeinterface.cpp @@ -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; diff --git a/registeredSession/plugins/datetime/datetimeinterface.h b/registeredSession/plugins/datetime/datetimeinterface.h index e3d1580..7b098d2 100644 --- a/registeredSession/plugins/datetime/datetimeinterface.h +++ b/registeredSession/plugins/datetime/datetimeinterface.h @@ -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");