M module-apps/application-settings-new/windows/ChangeTimeZone.cpp => module-apps/application-settings-new/windows/ChangeTimeZone.cpp +4 -3
@@ 32,9 32,10 @@ namespace gui
options.emplace_back(std::make_unique<gui::option::OptionSettings>(
zone,
[=](const gui::Item &item) {
- application->bus.sendUnicast(
- std::make_shared<stm::message::SetTimezoneRequest>(extractTimeZoneName(zone)),
- service::name::service_time);
+ selectedTimeZone = extractTimeZoneName(zone);
+ application->bus.sendUnicast(std::make_shared<stm::message::SetTimezoneRequest>(selectedTimeZone),
+ service::name::service_time);
+ refreshOptionsList(setTimeZoneIndex());
return true;
},
nullptr,
M module-apps/application-settings-new/windows/DateAndTimeMainWindow.cpp => module-apps/application-settings-new/windows/DateAndTimeMainWindow.cpp +0 -16
@@ 17,7 17,6 @@ namespace gui
setTitle(utils::translate("app_settings_date_and_time"));
automaticDateAndTimeIsOn = stm::api::isAutomaticDateAndTime();
- automaticTimeZoneIsOn = stm::api::isAutomaticTimezone();
timeFormat = stm::api::timeFormat();
dateFormat = stm::api::dateFormat();
changeDateAndTimeWindow = window::name::change_date_and_time;
@@ 63,21 62,6 @@ namespace gui
application->switchWindow(changeDateAndTimeWindow, nullptr);
return true;
});
- }
-
- addSwitchOption(
- utils::translate("app_settings_date_and_time_automatic_time_zone"),
- [=](Item &item) {
- automaticTimeZoneIsOn = !automaticTimeZoneIsOn;
- application->bus.sendUnicast(
- std::make_shared<stm::message::SetAutomaticTimezoneRequest>(automaticDateAndTimeIsOn),
- service::name::service_time);
- refreshOptionsList();
- return true;
- },
- automaticTimeZoneIsOn ? option::SettingRightItem::On : option::SettingRightItem::Off);
-
- if (!automaticTimeZoneIsOn) {
addOption(utils::translate("app_settings_date_and_time_change_time_zone"), [=](Item &item) {
LOG_INFO("switching to %s page", window::name::change_time_zone);
application->switchWindow(window::name::change_time_zone, nullptr);
M module-apps/application-settings-new/windows/DateAndTimeMainWindow.hpp => module-apps/application-settings-new/windows/DateAndTimeMainWindow.hpp +0 -1
@@ 18,7 18,6 @@ namespace gui
virtual bool bottomBarCallback(Item &item);
bool automaticDateAndTimeIsOn = false;
- bool automaticTimeZoneIsOn = false;
utils::time::Locale::TimeFormat timeFormat = utils::time::Locale::defaultTimeFormat;
utils::time::Locale::DateFormat dateFormat = utils::time::Locale::defaultDateFormat;
M module-services/service-db/agents/settings/SystemSettings.hpp => module-services/service-db/agents/settings/SystemSettings.hpp +0 -1
@@ 14,7 14,6 @@ namespace settings
constexpr inline auto displayLanguage = "gs_display_language";
constexpr inline auto inputLanguage = "gs_input_language";
constexpr inline auto automaticDateAndTimeIsOn = "gs_automatic_date_and_time_is_on";
- constexpr inline auto automaticTimeZoneIsOn = "gs_automatic_time_zone_is_on";
constexpr inline auto timeFormat = "gs_time_format";
constexpr inline auto dateFormat = "gs_date_format";
constexpr inline auto onboardingDone = "gs_onboarding_done";
M module-services/service-time/ServiceTime.cpp => module-services/service-time/ServiceTime.cpp +10 -26
@@ 32,6 32,7 @@
namespace stm
{
constexpr auto automaticTimezoneName = "";
+ constexpr auto automaticTimezoneRules = "UTC0";
ServiceTime::ServiceTime() : sys::Service(service::name::service_time, "", StackDepth), calendarEvents(this)
{
@@ 149,10 150,6 @@ namespace stm
return handleSetAutomaticDateAndTimeRequest(request);
});
- connect(typeid(stm::message::SetAutomaticTimezoneRequest), [&](sys::Message *request) -> sys::MessagePointer {
- return handleSetAutomaticTimezoneRequest(request);
- });
-
connect(typeid(stm::message::SetTimeFormatRequest),
[&](sys::Message *request) -> sys::MessagePointer { return handleSetTimeFormatRequest(request); });
@@ 180,20 177,17 @@ namespace stm
settings->setValue(settings::SystemProperties::automaticDateAndTimeIsOn, std::to_string(message->getValue()));
stm::internal::StaticData::get().setAutomaticDateAndTime(message->getValue());
- bus.sendUnicast(std::make_shared<stm::message::AutomaticDateAndTimeChangedMessage>(message->getValue()),
- ServiceCellular::serviceName);
- return std::shared_ptr<sys::ResponseMessage>();
- }
+ if (!stm::api::isAutomaticDateAndTime()) {
+ timeManager->handleTimezoneChangeRequest(automaticTimezoneRules);
+ settings->setValue(settings::SystemProperties::currentTimezoneRules, automaticTimezoneRules);
+ stm::internal::StaticData::get().setTimezoneRules(automaticTimezoneRules);
- auto ServiceTime::handleSetAutomaticTimezoneRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>
- {
- auto message = static_cast<stm::message::SetAutomaticTimezoneRequest *>(request);
- if (stm::api::isAutomaticTimezone() == message->getValue()) {
- LOG_WARN("The selected value is already set. Ignore.");
- return std::shared_ptr<sys::ResponseMessage>();
+ settings->setValue(settings::SystemProperties::currentTimezoneName, automaticTimezoneName);
+ stm::internal::StaticData::get().setTimezoneName(automaticTimezoneName);
}
- settings->setValue(settings::SystemProperties::automaticTimeZoneIsOn, std::to_string(message->getValue()));
- stm::internal::StaticData::get().setAutomaticTimezoneOn(message->getValue());
+
+ bus.sendUnicast(std::make_shared<stm::message::AutomaticDateAndTimeChangedMessage>(message->getValue()),
+ ServiceCellular::serviceName);
return std::shared_ptr<sys::ResponseMessage>();
}
@@ 254,14 248,6 @@ namespace stm
settings->setValue(settings::SystemProperties::currentTimezoneName, automaticTimezoneName);
stm::internal::StaticData::get().setTimezoneName(automaticTimezoneName);
}
- else if (stm::api::isAutomaticTimezone()) {
- timeManager->handleTimezoneChangeRequest(timezoneRules);
- settings->setValue(settings::SystemProperties::currentTimezoneRules, timezoneRules);
- stm::internal::StaticData::get().setTimezoneRules(timezoneRules);
-
- settings->setValue(settings::SystemProperties::currentTimezoneName, automaticTimezoneName);
- stm::internal::StaticData::get().setTimezoneName(automaticTimezoneName);
- }
return std::make_shared<sys::ResponseMessage>();
}
@@ 270,8 256,6 @@ namespace stm
{
stm::internal::StaticData::get().setAutomaticDateAndTime(
utils::getNumericValue<bool>(settings->getValue(::settings::SystemProperties::automaticDateAndTimeIsOn)));
- stm::internal::StaticData::get().setAutomaticTimezoneOn(
- utils::getNumericValue<bool>(settings->getValue(::settings::SystemProperties::automaticTimeZoneIsOn)));
auto dateFormat = magic_enum::enum_cast<utils::time::Locale::DateFormat>(
utils::getNumericValue<unsigned int>(settings->getValue(::settings::SystemProperties::dateFormat)));
if (dateFormat != std::nullopt) {
M module-services/service-time/ServiceTime.hpp => module-services/service-time/ServiceTime.hpp +0 -1
@@ 39,7 39,6 @@ namespace stm
void registerMessageHandlers();
auto handleSetAutomaticDateAndTimeRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>;
- auto handleSetAutomaticTimezoneRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>;
auto handleSetTimeFormatRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>;
auto handleSetDateFormatRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>;
auto handleSetTimezoneRequest(sys::Message *request) -> std::shared_ptr<sys::ResponseMessage>;
M module-services/service-time/api/TimeSettingsApi.cpp => module-services/service-time/api/TimeSettingsApi.cpp +0 -5
@@ 13,11 13,6 @@ namespace stm::api
return stm::internal::StaticData::get().getAutomaticDateAndTime();
}
- bool isAutomaticTimezone()
- {
- return stm::internal::StaticData::get().getAutomaticTimezone();
- }
-
utils::time::Locale::DateFormat dateFormat()
{
return stm::internal::StaticData::get().getDateFormat();
M module-services/service-time/api/TimeSettingsApi.hpp => module-services/service-time/api/TimeSettingsApi.hpp +0 -5
@@ 13,11 13,6 @@ namespace stm::api
*/
bool isAutomaticDateAndTime();
/**
- * Gets value corresponded to current Automatic Timezone stored in DB
- * @return actual setting value
- */
- bool isAutomaticTimezone();
- /**
* Gets value corresponded to current Time format stored in DB
* @return actual setting value
*/
M module-services/service-time/internal/StaticData.cpp => module-services/service-time/internal/StaticData.cpp +0 -10
@@ 22,16 22,6 @@ namespace stm::internal
return isAutomaticDateAndTimeOn;
}
- void StaticData::setAutomaticTimezoneOn(bool value)
- {
- isAutomaticTimezoneOn = value;
- }
-
- bool StaticData::getAutomaticTimezone() const noexcept
- {
- return isAutomaticTimezoneOn;
- }
-
void StaticData::setDateFormat(utils::time::Locale::DateFormat format)
{
dateFormat = format;
M module-services/service-time/internal/StaticData.hpp => module-services/service-time/internal/StaticData.hpp +0 -11
@@ 14,7 14,6 @@ namespace stm::internal
{
private:
bool isAutomaticDateAndTimeOn = false;
- bool isAutomaticTimezoneOn = false;
utils::time::Locale::DateFormat dateFormat = utils::time::Locale::DateFormat::DD_MM_YYYY;
utils::time::Locale::TimeFormat timeFormat = utils::time::Locale::TimeFormat::FormatTime12H;
std::string timezoneName;
@@ 41,16 40,6 @@ namespace stm::internal
*/
[[nodiscard]] bool getAutomaticDateAndTime() const noexcept;
/**
- * ASets value corresponded to current Automatic Timezone setting
- * @param value new setting value
- */
- void setAutomaticTimezoneOn(bool value);
- /**
- * Gets value corresponded to current Automatic Timezone setting
- * @return actual setting value
- */
- [[nodiscard]] bool getAutomaticTimezone() const noexcept;
- /**
* Sets value corresponded to current Date format setting
* @param format new setting value
*/
M module-services/service-time/service-time/TimeMessage.hpp => module-services/service-time/service-time/TimeMessage.hpp +0 -14
@@ 141,20 141,6 @@ namespace stm::message
bool value;
};
- class SetAutomaticTimezoneRequest : public sys::DataMessage
- {
- public:
- explicit SetAutomaticTimezoneRequest(const bool value)
- : sys::DataMessage(MessageType::MessageTypeUninitialized), value(value){};
- auto getValue() const -> bool
- {
- return value;
- }
-
- private:
- bool value;
- };
-
class SetTimeFormatRequest : public sys::DataMessage
{
public: