From 0e42b0016ee3e901ed2f27e71a6dba17035276af Mon Sep 17 00:00:00 2001 From: Wojtek Rzepecki Date: Mon, 5 Jul 2021 12:05:41 +0200 Subject: [PATCH] [EGD-7044] Strip down calendar code Stripping the calendar code to provide only MVP defined functionalities --- .../calendar_notification_icon.png | Bin 1900 -> 0 bytes .../images/calendar_notification_icon.vpi | Bin 1575 -> 0 bytes image/assets/lang/English.json | 38 +- image/assets/lang/Svenska.json | 35 +- .../windows/CustomRepeatWindow.cpp | 2 +- .../ApplicationCalendar.cpp | 144 +-- .../ApplicationCalendar.hpp | 30 +- .../application-calendar/CMakeLists.txt | 26 - .../data/CalendarData.hpp | 16 +- .../models/AllEventsModel.cpp | 91 -- .../models/AllEventsModel.hpp | 28 - .../models/CustomRepeatModel.cpp | 78 -- .../models/CustomRepeatModel.hpp | 30 - .../models/DayEventsModel.cpp | 104 -- .../models/DayEventsModel.hpp | 33 - .../models/EventDetailModel.cpp | 60 - .../models/EventDetailModel.hpp | 29 - .../models/MonthModel.cpp | 54 +- .../models/MonthModel.hpp | 16 +- .../models/NewEditEventModel.cpp | 268 ----- .../models/NewEditEventModel.hpp | 61 - .../widgets/AllEventsItem.cpp | 86 -- .../widgets/AllEventsItem.hpp | 29 - .../widgets/CalendarDateItem.cpp | 30 - .../widgets/CalendarDateItem.hpp | 26 - .../widgets/CalendarListItem.hpp | 12 - .../widgets/CalendarListView.cpp | 123 -- .../widgets/CalendarListView.hpp | 30 - .../widgets/CalendarStyle.hpp | 136 +-- .../widgets/CalendarTimeItem.cpp | 69 -- .../widgets/CalendarTimeItem.hpp | 30 - .../widgets/CheckBoxWithLabelItem.cpp | 116 -- .../widgets/CheckBoxWithLabelItem.hpp | 36 - .../widgets/DayEventsItem.cpp | 63 - .../widgets/DayEventsItem.hpp | 32 - .../application-calendar/widgets/DayLabel.cpp | 13 +- .../widgets/EventDetailDescriptionItem.cpp | 85 -- .../widgets/EventDetailDescriptionItem.hpp | 29 - .../application-calendar/widgets/MonthBox.cpp | 27 +- .../widgets/NewEventCheckBoxWithLabel.cpp | 63 - .../widgets/NewEventCheckBoxWithLabel.hpp | 31 - .../widgets/RepeatAndReminderItem.cpp | 118 -- .../widgets/RepeatAndReminderItem.hpp | 36 - .../widgets/SeveralOptionsItem.cpp | 227 ---- .../widgets/SeveralOptionsItem.hpp | 55 - .../widgets/TextWithLabelItem.cpp | 72 -- .../widgets/TextWithLabelItem.hpp | 27 - .../windows/AllEventsWindow.cpp | 105 -- .../windows/AllEventsWindow.hpp | 31 - .../windows/CalendarEventsOptionsWindow.cpp | 76 -- .../windows/CalendarEventsOptionsWindow.hpp | 25 - .../windows/CalendarMainWindow.cpp | 149 +-- .../windows/CalendarMainWindow.hpp | 26 +- .../windows/CustomRepeatWindow.cpp | 87 -- .../windows/CustomRepeatWindow.hpp | 32 - .../windows/DayEventsWindow.cpp | 118 -- .../windows/DayEventsWindow.hpp | 38 - .../windows/EventDetailWindow.cpp | 92 -- .../windows/EventDetailWindow.hpp | 31 - .../windows/EventReminderWindow.cpp | 163 --- .../windows/EventReminderWindow.hpp | 51 - .../windows/NewEditEventWindow.cpp | 102 -- .../windows/NewEditEventWindow.hpp | 39 - .../windows/DesktopMainWindow.cpp | 2 - .../ApplicationSettings.cpp | 6 - .../ApplicationSettings.hpp | 1 - .../application-settings-new/CMakeLists.txt | 1 - .../windows/AppsAndToolsWindow.cpp | 1 - .../windows/CalendarWindow.cpp | 66 -- .../windows/CalendarWindow.hpp | 49 - module-apps/apps-common/CMakeLists.txt | 1 - .../popups/lock-popups/PhoneLockedWindow.cpp | 3 +- module-apps/apps-common/windows/NoEvents.cpp | 57 - module-apps/apps-common/windows/NoEvents.hpp | 29 - module-db/CMakeLists.txt | 14 - module-db/Databases/EventsDB.cpp | 12 - module-db/Databases/EventsDB.hpp | 16 - module-db/Interface/BaseInterface.hpp | 3 - module-db/Interface/EventsRecord.cpp | 460 -------- module-db/Interface/EventsRecord.hpp | 114 -- module-db/Tables/EventsTable.cpp | 889 -------------- module-db/Tables/EventsTable.hpp | 90 -- module-db/queries/calendar/QueryEventsAdd.cpp | 33 - module-db/queries/calendar/QueryEventsAdd.hpp | 34 - .../queries/calendar/QueryEventsEdit.cpp | 33 - .../queries/calendar/QueryEventsEdit.hpp | 34 - .../queries/calendar/QueryEventsEditICS.cpp | 33 - .../queries/calendar/QueryEventsEditICS.hpp | 34 - module-db/queries/calendar/QueryEventsGet.cpp | 28 - module-db/queries/calendar/QueryEventsGet.hpp | 32 - .../queries/calendar/QueryEventsGetAll.cpp | 28 - .../queries/calendar/QueryEventsGetAll.hpp | 31 - .../calendar/QueryEventsGetAllLimited.cpp | 35 - .../calendar/QueryEventsGetAllLimited.hpp | 35 - .../calendar/QueryEventsGetFiltered.cpp | 35 - .../calendar/QueryEventsGetFiltered.hpp | 38 - .../calendar/QueryEventsGetFilteredByDay.cpp | 35 - .../calendar/QueryEventsGetFilteredByDay.hpp | 37 - .../queries/calendar/QueryEventsRemove.cpp | 28 - .../queries/calendar/QueryEventsRemove.hpp | 33 - .../queries/calendar/QueryEventsRemoveICS.cpp | 28 - .../queries/calendar/QueryEventsRemoveICS.hpp | 33 - .../QueryEventsSelectFirstUpcoming.cpp | 30 - .../QueryEventsSelectFirstUpcoming.hpp | 36 - module-db/tests/CMakeLists.txt | 2 - module-db/tests/EventsRecord_tests.cpp | 1039 ----------------- module-db/tests/EventsTable_tests.cpp | 838 ------------- .../service-appmgr/service-appmgr/Actions.hpp | 1 - module-services/service-db/ServiceDB.cpp | 12 - module-services/service-db/ServiceDB.hpp | 5 - .../service-desktop/CMakeLists.txt | 2 - .../service-desktop/endpoints/Context.hpp | 3 - .../endpoints/EndpointFactory.hpp | 3 - .../calendarEvents/CalendarEventsEndpoint.cpp | 27 - .../calendarEvents/CalendarEventsEndpoint.hpp | 22 - .../calendarEvents/CalendarEventsHelper.cpp | 486 -------- .../calendarEvents/CalendarEventsHelper.hpp | 45 - .../service-desktop/parser/ParserUtils.hpp | 1 - module-services/service-time/CMakeLists.txt | 2 - module-services/service-time/ServiceTime.cpp | 64 +- module-services/service-time/ServiceTime.hpp | 4 - .../service-time/CalendarTimeEvents.hpp | 49 - .../service-time/service-time/TimeEvents.hpp | 67 -- .../service-time/service-time/TimeMessage.hpp | 21 - .../service-time/TimeSettings.hpp | 1 + .../timeEvents/CalendarTimeEvents.cpp | 93 -- .../service-time/timeEvents/TimeEvents.cpp | 101 -- module-sys/Service/Common.hpp | 3 - source/MessageType.hpp | 5 - 129 files changed, 85 insertions(+), 9257 deletions(-) delete mode 100644 art/phone/home_notifications/calendar_notification_icon.png delete mode 100644 image/assets/images/calendar_notification_icon.vpi delete mode 100644 module-apps/application-calendar/models/AllEventsModel.cpp delete mode 100644 module-apps/application-calendar/models/AllEventsModel.hpp delete mode 100644 module-apps/application-calendar/models/CustomRepeatModel.cpp delete mode 100644 module-apps/application-calendar/models/CustomRepeatModel.hpp delete mode 100644 module-apps/application-calendar/models/DayEventsModel.cpp delete mode 100644 module-apps/application-calendar/models/DayEventsModel.hpp delete mode 100644 module-apps/application-calendar/models/EventDetailModel.cpp delete mode 100644 module-apps/application-calendar/models/EventDetailModel.hpp delete mode 100644 module-apps/application-calendar/models/NewEditEventModel.cpp delete mode 100644 module-apps/application-calendar/models/NewEditEventModel.hpp delete mode 100644 module-apps/application-calendar/widgets/AllEventsItem.cpp delete mode 100644 module-apps/application-calendar/widgets/AllEventsItem.hpp delete mode 100644 module-apps/application-calendar/widgets/CalendarDateItem.cpp delete mode 100644 module-apps/application-calendar/widgets/CalendarDateItem.hpp delete mode 100644 module-apps/application-calendar/widgets/CalendarListItem.hpp delete mode 100644 module-apps/application-calendar/widgets/CalendarListView.cpp delete mode 100644 module-apps/application-calendar/widgets/CalendarListView.hpp delete mode 100644 module-apps/application-calendar/widgets/CalendarTimeItem.cpp delete mode 100644 module-apps/application-calendar/widgets/CalendarTimeItem.hpp delete mode 100644 module-apps/application-calendar/widgets/CheckBoxWithLabelItem.cpp delete mode 100644 module-apps/application-calendar/widgets/CheckBoxWithLabelItem.hpp delete mode 100644 module-apps/application-calendar/widgets/DayEventsItem.cpp delete mode 100644 module-apps/application-calendar/widgets/DayEventsItem.hpp delete mode 100644 module-apps/application-calendar/widgets/EventDetailDescriptionItem.cpp delete mode 100644 module-apps/application-calendar/widgets/EventDetailDescriptionItem.hpp delete mode 100644 module-apps/application-calendar/widgets/NewEventCheckBoxWithLabel.cpp delete mode 100644 module-apps/application-calendar/widgets/NewEventCheckBoxWithLabel.hpp delete mode 100644 module-apps/application-calendar/widgets/RepeatAndReminderItem.cpp delete mode 100644 module-apps/application-calendar/widgets/RepeatAndReminderItem.hpp delete mode 100644 module-apps/application-calendar/widgets/SeveralOptionsItem.cpp delete mode 100644 module-apps/application-calendar/widgets/SeveralOptionsItem.hpp delete mode 100644 module-apps/application-calendar/widgets/TextWithLabelItem.cpp delete mode 100644 module-apps/application-calendar/widgets/TextWithLabelItem.hpp delete mode 100644 module-apps/application-calendar/windows/AllEventsWindow.cpp delete mode 100644 module-apps/application-calendar/windows/AllEventsWindow.hpp delete mode 100644 module-apps/application-calendar/windows/CalendarEventsOptionsWindow.cpp delete mode 100644 module-apps/application-calendar/windows/CalendarEventsOptionsWindow.hpp delete mode 100644 module-apps/application-calendar/windows/CustomRepeatWindow.cpp delete mode 100644 module-apps/application-calendar/windows/CustomRepeatWindow.hpp delete mode 100644 module-apps/application-calendar/windows/DayEventsWindow.cpp delete mode 100644 module-apps/application-calendar/windows/DayEventsWindow.hpp delete mode 100644 module-apps/application-calendar/windows/EventDetailWindow.cpp delete mode 100644 module-apps/application-calendar/windows/EventDetailWindow.hpp delete mode 100644 module-apps/application-calendar/windows/EventReminderWindow.cpp delete mode 100644 module-apps/application-calendar/windows/EventReminderWindow.hpp delete mode 100644 module-apps/application-calendar/windows/NewEditEventWindow.cpp delete mode 100644 module-apps/application-calendar/windows/NewEditEventWindow.hpp delete mode 100644 module-apps/application-settings-new/windows/CalendarWindow.cpp delete mode 100644 module-apps/application-settings-new/windows/CalendarWindow.hpp delete mode 100644 module-apps/apps-common/windows/NoEvents.cpp delete mode 100644 module-apps/apps-common/windows/NoEvents.hpp delete mode 100644 module-db/Databases/EventsDB.cpp delete mode 100644 module-db/Databases/EventsDB.hpp delete mode 100644 module-db/Interface/EventsRecord.cpp delete mode 100644 module-db/Interface/EventsRecord.hpp delete mode 100644 module-db/Tables/EventsTable.cpp delete mode 100644 module-db/Tables/EventsTable.hpp delete mode 100644 module-db/queries/calendar/QueryEventsAdd.cpp delete mode 100644 module-db/queries/calendar/QueryEventsAdd.hpp delete mode 100644 module-db/queries/calendar/QueryEventsEdit.cpp delete mode 100644 module-db/queries/calendar/QueryEventsEdit.hpp delete mode 100644 module-db/queries/calendar/QueryEventsEditICS.cpp delete mode 100644 module-db/queries/calendar/QueryEventsEditICS.hpp delete mode 100644 module-db/queries/calendar/QueryEventsGet.cpp delete mode 100644 module-db/queries/calendar/QueryEventsGet.hpp delete mode 100644 module-db/queries/calendar/QueryEventsGetAll.cpp delete mode 100644 module-db/queries/calendar/QueryEventsGetAll.hpp delete mode 100644 module-db/queries/calendar/QueryEventsGetAllLimited.cpp delete mode 100644 module-db/queries/calendar/QueryEventsGetAllLimited.hpp delete mode 100644 module-db/queries/calendar/QueryEventsGetFiltered.cpp delete mode 100644 module-db/queries/calendar/QueryEventsGetFiltered.hpp delete mode 100644 module-db/queries/calendar/QueryEventsGetFilteredByDay.cpp delete mode 100644 module-db/queries/calendar/QueryEventsGetFilteredByDay.hpp delete mode 100644 module-db/queries/calendar/QueryEventsRemove.cpp delete mode 100644 module-db/queries/calendar/QueryEventsRemove.hpp delete mode 100644 module-db/queries/calendar/QueryEventsRemoveICS.cpp delete mode 100644 module-db/queries/calendar/QueryEventsRemoveICS.hpp delete mode 100644 module-db/queries/calendar/QueryEventsSelectFirstUpcoming.cpp delete mode 100644 module-db/queries/calendar/QueryEventsSelectFirstUpcoming.hpp delete mode 100644 module-db/tests/EventsRecord_tests.cpp delete mode 100644 module-db/tests/EventsTable_tests.cpp delete mode 100644 module-services/service-desktop/endpoints/calendarEvents/CalendarEventsEndpoint.cpp delete mode 100644 module-services/service-desktop/endpoints/calendarEvents/CalendarEventsEndpoint.hpp delete mode 100644 module-services/service-desktop/endpoints/calendarEvents/CalendarEventsHelper.cpp delete mode 100644 module-services/service-desktop/endpoints/calendarEvents/CalendarEventsHelper.hpp delete mode 100644 module-services/service-time/service-time/CalendarTimeEvents.hpp delete mode 100644 module-services/service-time/service-time/TimeEvents.hpp delete mode 100644 module-services/service-time/timeEvents/CalendarTimeEvents.cpp delete mode 100644 module-services/service-time/timeEvents/TimeEvents.cpp diff --git a/art/phone/home_notifications/calendar_notification_icon.png b/art/phone/home_notifications/calendar_notification_icon.png deleted file mode 100644 index 2f2994caf54973ee1d927850a63a6f6ae95d2170..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1900 zcmbVN4Qvx-814oN<8K8LnU2ikaAuWV?|SXJ-q`|MTeog>o7>37kAdsm*Y0e4SMILc zZOSxrK*oJ6f?#c1a%VquIm~w_{Sx8_ucnB z-}AoD`@QdbEoCJIqenb5LZ{P>_7u9x;TzNL;mPp1UyXhZUn!BoS+Y(ya=dmY>DF&Z z)9Ic-_{wUf+B<`0#jug#L?1A!;Rrh6fx;kaI3&ol>Of<>G#qQwIEus|O3;DkX$FyM zZyDkgC4l4@tr%;v97)g$ay(2hV7SUeaFdbHB*lOno4`e)QYdDeV{s4yVIU|n#F`S=NR6n7 za*g;m)QRPX48YKOy$KtS^d%fln2;5BEtC-t$Rp8mWqkzTnVqZ^x zWF-d7B#_sDpGVB|CB^c%``sBipqs{ul z`v=1#OSbV%8SJP#qmJFW*Y7sC4acwV*#5%qf*UF6t^IpS?HMcXt=^+=l7(ICj@pJ) z-M)=*eV;y+T4a#c`fjc zdFITEeSvjDmcG4c+{Yhe7jK!m+rF65=c_$zYx!4cGSG|Ti68qL0~z~&W5=`2dUnR_ zIce+$`Rx1Kw;u@S&K>!sdZ~5O)^i12v(&3Uj6TsdR#>|5=hR!2w_=-m`qd)C{_}UL zu51VdKKr#jwEp>pRhLuM)%?!An{(@bXYI>M=GoV%z15w^*_PBbcSoS(Qm?+K{SQ6v L5?6cv{H8wvrC^`E diff --git a/image/assets/images/calendar_notification_icon.vpi b/image/assets/images/calendar_notification_icon.vpi deleted file mode 100644 index f5ec44d725c5f7687a9d81408db7869712bd1d9e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1575 zcmchY-A=+yZ2?S7JILPA_Li(~uv_&CbW>70%^rF0%! zYmavrQ_63AFDZ@gU-<^l_lvjVgni~9qKV+>Dncti&0eCy2IH_|v?BmZd+S0b6Skq$ zMs$9+{A!CW$9`nPinUAWlYJ(%mv)>+74r#;J_&VWUyAGHGE&_qB7>t-TWjkQ6H3O5L9ZC`;2hpDLX%LuxhoFrHmp6Y3pFFOn7 zH>j|iV3$>?9`P5lu;s=aVsCFwa+!xWSU;+k>Q>Rswo4UK?fF(m zwsX>lJj=AhW+~C%TioTdaHq=3&A#-(IneY`y+pp5PF1(Z5!K#NX}OzGm5HzS5{1JD z^XOe=)q_$c!z%i{vLc~TWVe(hphQ2_lm$&Lt9tgbsHYG9TjyyXC|#mH*6e>Hd~4Ka oQk!{ice~4L$L!;^V@~~u@$+J;0yz`OF(DlL=3DRmt^E^x1KoKR-v9sr diff --git a/image/assets/lang/English.json b/image/assets/lang/English.json index f845472131d83faa863308897fd7d8ee87474f14..63becf9c0d9ead58d61af456d4ef91a70a55da62 100644 --- a/image/assets/lang/English.json +++ b/image/assets/lang/English.json @@ -113,44 +113,9 @@ "app_alarm_clock_snooze_30_min": "30 min", "app_alarm_clock_play_pause": "PLAY/PAUSE", "app_alarm_clock_edit": "EDIT", + "app_alarm_clock_custom_repeat_title": "Custom repeat", "app_calendar_title_main": "Calendar", - "app_calendar_options_edit": "Edit", - "app_calendar_options_delete": "Delete", - "app_calendar_event_delete_confirmation": "Delete this event?", - "app_calendar_bar_month": "MONTH", - "app_calendar_bar_list": "LIST", - "app_calendar_event_detail": "Event", - "app_calendar_event_detail_repeat": "Repeat", - "app_calendar_event_detail_reminder": "Reminder", - "app_calendar_no_events_information": "No events yet.

Press left arrow to add new.

", - "app_calendar_repeat_never": "Never", - "app_calendar_repeat_daily": "Daily", - "app_calendar_repeat_weekly": "Weekly", - "app_calendar_repeat_two_weeks": "Two weeks", - "app_calendar_repeat_month": "Month", - "app_calendar_repeat_year": "Year", - "app_calendar_repeat_custom": "Custom", - "app_calendar_reminder_never": "Never", - "app_calendar_reminder_event_time": "At the time of the event", - "app_calendar_reminder_5_min_before": "5 mins before", - "app_calendar_reminder_15_min_before": "15 mins before", - "app_calendar_reminder_30_min_before": "30 mins before", - "app_calendar_reminder_1_hour_before": "1h before", - "app_calendar_reminder_2_hour_before": "2h before", - "app_calendar_reminder_1_day_before": "1 day before", - "app_calendar_reminder_2_days_before": "2 days before", - "app_calendar_reminder_1_week_before": "1 week before", - "app_calendar_custom_repeat_title": "Custom repeat", - "app_calendar_new_event_title": "New event", - "app_calendar_edit_event_title": "Edit event", - "app_calendar_edit": "EDIT", - "app_calendar_new_edit_event_name": "Event name", - "app_calendar_new_edit_event_allday": "All day event", "app_calendar_all_day": "All day", - "app_calendar_new_edit_event_start": "Start", - "app_calendar_new_edit_event_end": "End", - "app_calendar_event_error_dates": "The start date must be before\nthe end date", - "app_calendar_event_error_empty_name": "Event name must not be empty", "app_calculator_title_main": "Calculator", "app_calculator_equals": "EQUALS", "app_calculator_decimal_separator": ".", @@ -377,7 +342,6 @@ "app_settings_apps_phone": "Phone", "app_settings_apps_messages": "Messages", "app_settings_show_unread_first": "Show unread first", - "app_settings_apps_calendar": "Calendar", "app_settings_apps_alarm_clock": "Alarm clock", "app_settings_vibration": "Vibration", "app_settings_sound": "Sound", diff --git a/image/assets/lang/Svenska.json b/image/assets/lang/Svenska.json index 63f2f38210e4fb14c429c4703d908a5b4302fd34..b54897a48331313576e399035536182917b16e81 100644 --- a/image/assets/lang/Svenska.json +++ b/image/assets/lang/Svenska.json @@ -102,42 +102,9 @@ "app_alarm_clock_snooze_30_min": "30 min", "app_alarm_clock_play_pause": "SPELA/PAUSA", "app_alarm_clock_edit": "REDIGERA", + "app_alarm_clock_custom_repeat_title": "Välj veckodagar", "app_calendar_title_main": "Kalender", - "app_calendar_options_edit": "Redigera", - "app_calendar_options_delete": "Radera", - "app_calendar_event_delete_confirmation": "Radera den här händelsen?", - "app_calendar_bar_month": "MÅNAD", - "app_calendar_bar_list": "LISTA", - "app_calendar_event_detail": "Händelse", - "app_calendar_event_detail_repeat": "Upprepa", - "app_calendar_event_detail_reminder": "Påminnelse", - "app_calendar_no_events_information": "Inga händelser än.

Tryck vänsterpil för att lägga till en.

", - "app_calendar_repeat_never": "Ingen upprepning", - "app_calendar_repeat_daily": "Varje dag", - "app_calendar_repeat_weekly": "Varje vecka", - "app_calendar_repeat_two_weeks": "Varannan vecka", - "app_calendar_repeat_month": "Varje månad", - "app_calendar_repeat_year": "Varje år", - "app_calendar_repeat_custom": "Valfria veckodagar", - "app_calendar_reminder_never": "Ingen påminnelse", - "app_calendar_reminder_event_time": "När händelsen startar", - "app_calendar_reminder_5_min_before": "5 minuter före", - "app_calendar_reminder_15_min_before": "15 minuter före", - "app_calendar_reminder_30_min_before": "30 minuter före", - "app_calendar_reminder_1_hour_before": "1h före", - "app_calendar_reminder_2_hour_before": "2h före", - "app_calendar_reminder_1_day_before": "En dag före", - "app_calendar_reminder_2_days_before": "Två dagar före", - "app_calendar_reminder_1_week_before": "En vecka före", - "app_calendar_custom_repeat_title": "Välj veckodagar", - "app_calendar_new_event_title": "Ny händelse", - "app_calendar_edit_event_title": "Redigera händelse", - "app_calendar_edit": "REDIGERA", - "app_calendar_new_edit_event_name": "Händelsens namn", - "app_calendar_new_edit_event_allday": "Heldag", "app_calendar_all_day": "Hela dagen", - "app_calendar_new_edit_event_start": "Början", - "app_calendar_new_edit_event_end": "Slut", "app_calculator_title_main": "Miniräknare", "app_calculator_equals": "RESULTAT", "app_calculator_decimal_separator": ",", diff --git a/module-apps/application-alarm-clock/windows/CustomRepeatWindow.cpp b/module-apps/application-alarm-clock/windows/CustomRepeatWindow.cpp index 9bc511617e8b2a4e0a758ed9541e64f0f4d99972..28cb7bdbffaf4d00b789163ecfdbb80f22c18ede 100644 --- a/module-apps/application-alarm-clock/windows/CustomRepeatWindow.cpp +++ b/module-apps/application-alarm-clock/windows/CustomRepeatWindow.cpp @@ -23,7 +23,7 @@ namespace app::alarmClock bottomBar->setText(gui::BottomBar::Side::RIGHT, utils::translate(style::strings::common::back)); bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::save)); - setTitle(utils::translate("app_calendar_custom_repeat_title")); + setTitle(utils::translate("app_alarm_clock_custom_repeat_title")); list = new gui::ListView(this, style::alarmClock::window::listView_x, style::alarmClock::window::listView_y, diff --git a/module-apps/application-calendar/ApplicationCalendar.cpp b/module-apps/application-calendar/ApplicationCalendar.cpp index f0f3d67a78d142d95afdd5e8a65fcc80640d670f..23f1c1811ddadb52d902e8669e126d9cdf62873b 100644 --- a/module-apps/application-calendar/ApplicationCalendar.cpp +++ b/module-apps/application-calendar/ApplicationCalendar.cpp @@ -2,48 +2,10 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "ApplicationCalendar.hpp" -#include "DialogMetadataMessage.hpp" -#include "NoEvents.hpp" -#include "Dialog.hpp" - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include namespace app { - const std::map ApplicationCalendar::reminderOptions = { - {Reminder::never, "app_calendar_reminder_never"}, - {Reminder::event_time, "app_calendar_reminder_event_time"}, - {Reminder::five_min_before, "app_calendar_reminder_5_min_before"}, - {Reminder::fifteen_min_before, "app_calendar_reminder_15_min_before"}, - {Reminder::thirty_min_before, "app_calendar_reminder_30_min_before"}, - {Reminder::one_hour_before, "app_calendar_reminder_1_hour_before"}, - {Reminder::two_hour_before, "app_calendar_reminder_2_hour_before"}, - {Reminder::one_day_before, "app_calendar_reminder_1_day_before"}, - {Reminder::two_days_before, "app_calendar_reminder_2_days_before"}, - {Reminder::one_week_before, "app_calendar_reminder_1_week_before"}}; - - const std::map ApplicationCalendar::repeatOptions = { - {Repeat::never, "app_calendar_repeat_never"}, - {Repeat::daily, "app_calendar_repeat_daily"}, - {Repeat::weekly, "app_calendar_repeat_weekly"}, - {Repeat::biweekly, "app_calendar_repeat_two_weeks"}, - {Repeat::monthly, "app_calendar_repeat_month"}, - {Repeat::yearly, "app_calendar_repeat_year"}}; - ApplicationCalendar::ApplicationCalendar(std::string name, std::string parent, sys::phone_modes::PhoneMode mode, @@ -51,13 +13,7 @@ namespace app uint32_t stackDepth, sys::ServicePriority priority) : Application(name, parent, mode, startInBackground, stackDepth, priority) - { - bus.channels.push_back(sys::BusChannel::ServiceDBNotifications); - addActionReceiver(manager::actions::ShowReminder, [this](auto &&data) { - switchWindow(style::window::calendar::name::event_reminder_window, std::move(data)); - return actionHandled(); - }); - } + {} sys::MessagePointer ApplicationCalendar::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) { @@ -66,39 +22,11 @@ namespace app if (retMsg && (dynamic_cast(retMsg.get())->retCode == sys::ReturnCodes::Success)) { return retMsg; } - - auto msg = dynamic_cast(msgl); - if (msg != nullptr) { - LOG_DEBUG("Received notification"); - // window-specific actions - if (msg->interface == db::Interface::Name::Events) { - for (auto &[name, window] : windowsStack.windows) { - window->onDatabaseMessage(msg); - } - } - return std::make_shared(); - } - - // this variable defines whether message was processed. - bool handled = false; - // handle database response - if (resp != nullptr) { - handled = true; - if (auto command = callbackStorage->getCallback(resp); command->execute()) { - refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST); - } - } - if (handled) { - return std::make_shared(); - } - else { - return std::make_shared(sys::ReturnCodes::Unresolved); - } + return std::make_shared(); } sys::ReturnCodes ApplicationCalendar::InitHandler() { - applicationStartTime = std::time(nullptr); auto ret = Application::InitHandler(); createUserInterface(); return ret; @@ -106,47 +34,14 @@ namespace app sys::ReturnCodes ApplicationCalendar::DeinitHandler() { - return sys::ReturnCodes::Success; + return Application::DeinitHandler(); } void ApplicationCalendar::createUserInterface() { - using namespace style::window::calendar::name; - windowsFactory.attach(gui::name::window::main_window, [](Application *app, const std::string &name) { return std::make_unique(app, name); }); - windowsFactory.attach(day_events_window, [](Application *app, const std::string &name) { - return std::make_unique(app); - }); - windowsFactory.attach(no_events_window, [](Application *app, const std::string &name) { - return std::make_unique(app, name); - }); - windowsFactory.attach(style::window::calendar::name::events_options, - [](Application *app, const std::string &name) { - return std::make_unique(app); - }); - windowsFactory.attach(dialog_yes_no, [](Application *app, const std::string &name) { - return std::make_unique(app, dialog_yes_no); - }); - windowsFactory.attach(all_events_window, [](Application *app, const std::string &name) { - return std::make_unique(app, all_events_window); - }); - windowsFactory.attach(details_window, [](Application *app, const std::string &name) { - return std::make_unique(app, details_window); - }); - windowsFactory.attach(new_edit_event, [](Application *app, const std::string &name) { - return std::make_unique(app, new_edit_event); - }); - windowsFactory.attach(custom_repeat_window, [](Application *app, const std::string &name) { - return std::make_unique(app, custom_repeat_window); - }); - windowsFactory.attach(event_reminder_window, [](Application *app, const std::string &name) { - return std::make_unique(app, event_reminder_window); - }); - windowsFactory.attach(gui::window::name::dialog_confirm, [](Application *app, const std::string &name) { - return std::make_unique(app, name); - }); attachPopups( {gui::popup::ID::Volume, gui::popup::ID::Tethering, gui::popup::ID::PhoneModes, gui::popup::ID::PhoneLock}); @@ -155,37 +50,4 @@ namespace app void ApplicationCalendar::destroyUserInterface() {} - void ApplicationCalendar::switchToNoEventsWindow(const std::string &title, const TimePoint &dateFilter) - { - if (equivalentWindow == EquivalentWindow::DayEventsWindow) { - popToWindow(gui::name::window::main_window); - } - if (equivalentWindow == EquivalentWindow::AllEventsWindow) { - popToWindow(gui::name::window::main_window); - } - - LOG_DEBUG("Switch to no events window"); - - auto metaData = std::make_unique(gui::DialogMetadata{ - title, - "phonebook_empty_grey_circle_W_G", - utils::translate("app_calendar_no_events_information"), - "", - [=]() -> bool { - LOG_DEBUG("Switch to new event window"); - auto event = std::make_shared(); - event->date_from = dateFilter; - event->date_till = dateFilter + std::chrono::hours(utils::time::Locale::max_hour_24H_mode) + - std::chrono::minutes(utils::time::Locale::max_minutes); - - auto eventData = std::make_unique(std::move(event)); - eventData->setDescription(style::window::calendar::new_event); - switchWindow( - style::window::calendar::name::new_edit_event, gui::ShowMode::GUI_SHOW_INIT, std::move(eventData)); - return true; - }}); - - switchWindow(style::window::calendar::name::no_events_window, std::move(metaData)); - } - } /* namespace app */ diff --git a/module-apps/application-calendar/ApplicationCalendar.hpp b/module-apps/application-calendar/ApplicationCalendar.hpp index 10e5cf07a2762ec112d5f3eba077d68e780d41eb..10f9eb546790b4e9584b9564d2dadc49f78ee923 100644 --- a/module-apps/application-calendar/ApplicationCalendar.hpp +++ b/module-apps/application-calendar/ApplicationCalendar.hpp @@ -6,10 +6,6 @@ #include "Application.hpp" #include "Service/Message.hpp" #include "SystemManager/SystemManager.hpp" -#include "gui/widgets/Label.hpp" -#include -#include "application-calendar/widgets/CalendarStyle.hpp" -#include "NoEvents.hpp" namespace app { @@ -18,10 +14,6 @@ namespace app class ApplicationCalendar : public Application { - time_t applicationStartTime = 0; - int eventShift = 0; - EquivalentWindow equivalentWindow = EquivalentWindow::EmptyWindow; - public: ApplicationCalendar(std::string name, std::string parent, @@ -38,35 +30,15 @@ namespace app { return sys::ReturnCodes::Success; } - time_t getCurrentTimeStamp() - { - return applicationStartTime; - } - void setEquivalentToEmptyWindow(EquivalentWindow window) - { - equivalentWindow = window; - }; - EquivalentWindow getEquivalentToEmptyWindow() const - { - return equivalentWindow; - }; - int getEventShift() - { - return eventShift; - } void createUserInterface() override; void destroyUserInterface() override; - void switchToNoEventsWindow(const std::string &title = "", const TimePoint &dateFilter = TimePoint()); - - static const std::map reminderOptions; - static const std::map repeatOptions; }; template <> struct ManifestTraits { static auto GetManifest() -> manager::ApplicationManifest { - return {{manager::actions::Launch, manager::actions::ShowReminder, manager::actions::PhoneModeChanged}}; + return {{manager::actions::Launch, manager::actions::PhoneModeChanged}}; } }; } /* namespace app */ diff --git a/module-apps/application-calendar/CMakeLists.txt b/module-apps/application-calendar/CMakeLists.txt index 5a1f8397cc197811be04cded99be0874c67b8e27..da09081b6ef314ab240301631c4738d7dfa6edb5 100644 --- a/module-apps/application-calendar/CMakeLists.txt +++ b/module-apps/application-calendar/CMakeLists.txt @@ -5,37 +5,11 @@ "${CMAKE_CURRENT_LIST_DIR}/data/CalendarData.cpp" "${CMAKE_CURRENT_LIST_DIR}/models/MonthModel.cpp" "${CMAKE_CURRENT_LIST_DIR}/windows/CalendarMainWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/DayEventsWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/CalendarEventsOptionsWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/AllEventsWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/EventDetailWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/NewEditEventWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/CustomRepeatWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/models/AllEventsModel.cpp" - "${CMAKE_CURRENT_LIST_DIR}/models/EventDetailModel.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/EventDetailWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/windows/EventReminderWindow.cpp" - "${CMAKE_CURRENT_LIST_DIR}/models/CustomRepeatModel.cpp" - "${CMAKE_CURRENT_LIST_DIR}/models/NewEditEventModel.cpp" - "${CMAKE_CURRENT_LIST_DIR}/models/DayEventsModel.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/DayEventsItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/AllEventsItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CalendarListView.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/EventDetailDescriptionItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/RepeatAndReminderItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CheckBoxWithLabelItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/SeveralOptionsItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/TextWithLabelItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/NewEventCheckBoxWithLabel.cpp" "${CMAKE_CURRENT_LIST_DIR}/widgets/DayLabel.cpp" "${CMAKE_CURRENT_LIST_DIR}/widgets/MonthBox.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CalendarDateItem.cpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CalendarTimeItem.cpp" PUBLIC "${CMAKE_CURRENT_LIST_DIR}/ApplicationCalendar.hpp" "${CMAKE_CURRENT_LIST_DIR}/models/MonthModel.hpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CalendarListItem.hpp" - "${CMAKE_CURRENT_LIST_DIR}/widgets/CalendarStyle.hpp" "${CMAKE_CURRENT_LIST_DIR}/data/OptionParser.hpp" "${CMAKE_CURRENT_LIST_DIR}/data/CalendarData.hpp" ) diff --git a/module-apps/application-calendar/data/CalendarData.hpp b/module-apps/application-calendar/data/CalendarData.hpp index 7ed5f7dcb53cd9a19436d3e7b5b6f9f9fdc65045..7afe70d1de098bd165a1ccfd630329160a61c186 100644 --- a/module-apps/application-calendar/data/CalendarData.hpp +++ b/module-apps/application-calendar/data/CalendarData.hpp @@ -2,7 +2,8 @@ // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once -#include "module-db/Interface/EventsRecord.hpp" + +#include "dateCommon.hpp" #include #include "application-calendar/widgets/CalendarStyle.hpp" @@ -12,19 +13,6 @@ enum class EventAction Edit }; -class EventRecordData : public gui::SwitchData -{ - protected: - std::shared_ptr record; - - public: - explicit EventRecordData(std::shared_ptr record) : record{std::move(record)} {}; - std::shared_ptr getData() - { - return record; - }; -}; - class WeekDaysRepeatData : public gui::SwitchData { protected: diff --git a/module-apps/application-calendar/models/AllEventsModel.cpp b/module-apps/application-calendar/models/AllEventsModel.cpp deleted file mode 100644 index 71083f27d970249f84ca347530ae9055347b0630..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/AllEventsModel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#include "AllEventsModel.hpp" -#include "application-calendar/widgets/AllEventsItem.hpp" -#include "application-calendar/widgets/CalendarStyle.hpp" -#include "module-apps/application-calendar/data/CalendarData.hpp" -#include "module-apps/application-calendar/ApplicationCalendar.hpp" -#include -#include -#include - -AllEventsModel::AllEventsModel(app::Application *app) : DatabaseModel(app), app::AsyncCallbackReceiver{app} -{ - application = app; - assert(app != nullptr); -} - -unsigned int AllEventsModel::requestRecordsCount() -{ - return recordsCount; -} - -void AllEventsModel::requestRecords(const uint32_t offset, const uint32_t limit) -{ - auto query = std::make_unique(offset, limit); - auto task = app::AsyncQuery::createFromQuery(std::move(query), db::Interface::Name::Events); - task->setCallback([this](auto response) { return handleQueryResponse(response); }); - task->execute(application, this); -} - -unsigned int AllEventsModel::getMinimalItemHeight() const -{ - return style::window::label::big_h; -} - -gui::ListItem *AllEventsModel::getItem(gui::Order order) -{ - auto record = getRecord(order); - if (record == nullptr) { - LOG_DEBUG("Empty record in AllEventsModel::GetItem"); - return nullptr; - } - - auto *item = new gui::AllEventsItem(); - item->setEvent(record); - item->activatedCallback = [=](gui::Item &item) { - LOG_INFO("Switch to event details window"); - auto rec = std::make_unique(*record); - auto data = std::make_unique(std::move(rec)); - application->switchWindow(style::window::calendar::name::details_window, std::move(data)); - return true; - }; - - return item; -} - -bool AllEventsModel::updateRecords(std::vector records) -{ - DatabaseModel::updateRecords(std::move(records)); - list->onProviderDataUpdate(); - return true; -} - -auto AllEventsModel::handleQueryResponse(db::QueryResult *queryResult) -> bool -{ - auto response = dynamic_cast(queryResult); - assert(response != nullptr); - - auto records = response->getResult(); - list->setElementsCount(response->getCountResult()); - - auto app = dynamic_cast(application); - assert(application != nullptr); - - if (records.empty()) { - - if (app->getEquivalentToEmptyWindow() == EquivalentWindow::AllEventsWindow) { - auto filter = TimePointNow(); - app->switchToNoEventsWindow(utils::translate("app_calendar_title_main"), filter); - } - } - auto eventShift = app->getEventShift(); - if (eventShift) { - for (auto &record : records) { - record.date_from += std::chrono::hours(eventShift); - record.date_till += std::chrono::hours(eventShift); - } - } - return this->updateRecords(std::move(records)); -} diff --git a/module-apps/application-calendar/models/AllEventsModel.hpp b/module-apps/application-calendar/models/AllEventsModel.hpp deleted file mode 100644 index dd3ed33dbbfdd169a1730dd91624350e66434eba..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/AllEventsModel.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once -#include "Application.hpp" -#include -#include -#include -#include - -class AllEventsModel : public app::DatabaseModel, - public gui::ListItemProvider, - public app::AsyncCallbackReceiver -{ - app::Application *application = nullptr; - - public: - AllEventsModel(app::Application *app); - - void requestRecords(const uint32_t offset, const uint32_t limit) override; - bool updateRecords(std::vector records) override; - - auto handleQueryResponse(db::QueryResult *) -> bool; - // virtual methods for ListViewProvider - [[nodiscard]] unsigned int getMinimalItemHeight() const override; - gui::ListItem *getItem(gui::Order order) override; - [[nodiscard]] unsigned int requestRecordsCount() override; -}; diff --git a/module-apps/application-calendar/models/CustomRepeatModel.cpp b/module-apps/application-calendar/models/CustomRepeatModel.cpp deleted file mode 100644 index 03812e0cd6c01f00237785c37f68e799d4a738da..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/CustomRepeatModel.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#include "CustomRepeatModel.hpp" -#include "application-calendar/widgets/CheckBoxWithLabelItem.hpp" -#include -#include - -CustomRepeatModel::CustomRepeatModel(app::Application *app) : application(app) -{} - -unsigned int CustomRepeatModel::requestRecordsCount() -{ - return internalData.size(); -} - -unsigned int CustomRepeatModel::getMinimalItemHeight() const -{ - return style::window::calendar::item::checkBox::height; -} - -void CustomRepeatModel::requestRecords(const uint32_t offset, const uint32_t limit) -{ - setupModel(offset, limit); - list->onProviderDataUpdate(); -} - -gui::ListItem *CustomRepeatModel::getItem(gui::Order order) -{ - return getRecord(order); -} - -void CustomRepeatModel::createData(const std::shared_ptr &data) -{ - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Monday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Tuesday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Wednesday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Thursday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Friday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Saturday), data)); - internalData.push_back( - new gui::CheckBoxWithLabelItem(application, utils::translate(style::strings::common::Sunday), data)); - - for (auto &item : internalData) { - item->deleteByList = false; - } -} - -void CustomRepeatModel::loadData(const std::shared_ptr &data) -{ - list->reset(); - eraseInternalData(); - - createData(data); - - list->rebuildList(); -} - -std::vector CustomRepeatModel::getIsCheckedData() -{ - std::vector isCheckedData; - for (auto item : internalData) { - if (item->onContentChangedCallback && item->onContentChangedCallback()) { - isCheckedData.push_back(true); - } - else { - isCheckedData.push_back(false); - } - } - - return isCheckedData; -} diff --git a/module-apps/application-calendar/models/CustomRepeatModel.hpp b/module-apps/application-calendar/models/CustomRepeatModel.hpp deleted file mode 100644 index 7e7b01d29c3e92527fd68a9be3918f1d1d50d638..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/CustomRepeatModel.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once - -#include "Application.hpp" -#include "application-calendar/widgets/CalendarStyle.hpp" -#include "application-calendar/widgets/CalendarListItem.hpp" -#include "module-apps/application-calendar/data/CalendarData.hpp" -#include "InternalModel.hpp" -#include - -class CustomRepeatModel : public app::InternalModel, public gui::ListItemProvider -{ - app::Application *application = nullptr; - - public: - CustomRepeatModel(app::Application *app); - - void loadData(const std::shared_ptr &data); - - [[nodiscard]] unsigned int getMinimalItemHeight() const override; - [[nodiscard]] unsigned int requestRecordsCount() override; - gui::ListItem *getItem(gui::Order order) override; - void requestRecords(const uint32_t offset, const uint32_t limit) override; - std::vector getIsCheckedData(); - - private: - void createData(const std::shared_ptr &data); -}; diff --git a/module-apps/application-calendar/models/DayEventsModel.cpp b/module-apps/application-calendar/models/DayEventsModel.cpp deleted file mode 100644 index 0677053a7874ddb2a47388db5a97f02b320e14ec..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/DayEventsModel.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#include "DayEventsModel.hpp" -#include "application-calendar/widgets/DayEventsItem.hpp" -#include "application-calendar/data/CalendarData.hpp" -#include "application-calendar/ApplicationCalendar.hpp" -#include -#include -#include -#include -#include - -DayEventsModel::DayEventsModel(app::Application *app) - : DatabaseModel(app), app::AsyncCallbackReceiver{app}, application(app) -{} - -unsigned int DayEventsModel::requestRecordsCount() -{ - return recordsCount; -} - -unsigned int DayEventsModel::getMinimalItemHeight() const -{ - return style::window::calendar::item::dayEvents::height; -} - -void DayEventsModel::requestRecords(const uint32_t offset, const uint32_t limit) -{ - auto query = std::make_unique(filterFrom, offset, limit); - auto task = app::AsyncQuery::createFromQuery(std::move(query), db::Interface::Name::Events); - task->setCallback([this](auto response) { return handleQueryResponse(response); }); - task->execute(application, this); -} - -gui::ListItem *DayEventsModel::getItem(gui::Order order) -{ - auto record = getRecord(order); - if (record == nullptr) { - LOG_DEBUG("Empty record in DayEventsModel::GetItem"); - return nullptr; - } - - auto *item = new gui::DayEventsItem(); - item->setEvent(record); - item->activatedCallback = [=](gui::Item &item) { - LOG_INFO("Switch to event details window"); - auto rec = std::make_unique(*record); - auto data = std::make_unique(std::move(rec)); - application->switchWindow(style::window::calendar::name::details_window, std::move(data)); - return true; - }; - - return item; -} - -bool DayEventsModel::updateRecords(std::vector records) -{ - DatabaseModel::updateRecords(std::move(records)); - list->onProviderDataUpdate(); - return true; -} - -auto DayEventsModel::handleQueryResponse(db::QueryResult *queryResult) -> bool -{ - if (auto response = dynamic_cast(queryResult); response != nullptr) { - if (recordsCount != (response->getCountResult())) { - recordsCount = response->getCountResult(); - list->rebuildList(gui::listview::RebuildType::Full, 0, true); - return false; - } - - if (auto app = dynamic_cast(application); app != nullptr) { - if (response->getCountResult() == 0) { - LOG_DEBUG("Empty records"); - if (app->getEquivalentToEmptyWindow() == EquivalentWindow::DayEventsWindow) { - app->switchToNoEventsWindow(dayMonthTitle, filterFrom); - return true; - } - } - auto eventShift = app->getEventShift(); - auto records = response->getResult(); - if (eventShift) { - for (auto &record : records) { - record.date_from += std::chrono::hours(eventShift); - record.date_till += std::chrono::hours(eventShift); - } - } - return updateRecords(std::move(records)); - } - LOG_ERROR("App is not a calendar"); - return false; - } - LOG_ERROR("GetFilteredResult response is nullptr"); - return false; -} - -void DayEventsModel::setFilters(TimePoint from, TimePoint till, const std::string &dayMonth) -{ - /// TODO: change to one filter - this->filterFrom = from; - this->filterTill = till; - this->dayMonthTitle = dayMonth; -} diff --git a/module-apps/application-calendar/models/DayEventsModel.hpp b/module-apps/application-calendar/models/DayEventsModel.hpp deleted file mode 100644 index 2cfac0f24460449c1ac60ae69850820e552031fc..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/DayEventsModel.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once -#include "Application.hpp" -#include "application-calendar/widgets/CalendarStyle.hpp" -#include "DatabaseModel.hpp" -#include -#include -#include - -class DayEventsModel : public app::DatabaseModel, - public gui::ListItemProvider, - public app::AsyncCallbackReceiver -{ - app::Application *application = nullptr; - std::string dayMonthTitle; - TimePoint filterFrom = TIME_POINT_INVALID; - TimePoint filterTill = TIME_POINT_INVALID; - - public: - DayEventsModel(app::Application *app); - - void setFilters(TimePoint from, TimePoint till, const std::string &dayMonth); - - bool updateRecords(std::vector records) override; - auto handleQueryResponse(db::QueryResult *) -> bool; - - [[nodiscard]] unsigned int getMinimalItemHeight() const override; - [[nodiscard]] unsigned int requestRecordsCount() override; - gui::ListItem *getItem(gui::Order order) override; - void requestRecords(const uint32_t offset, const uint32_t limit) override; -}; diff --git a/module-apps/application-calendar/models/EventDetailModel.cpp b/module-apps/application-calendar/models/EventDetailModel.cpp deleted file mode 100644 index f1772295c26eb51b684d3456351d252a0d2d6464..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/EventDetailModel.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#include "EventDetailModel.hpp" -#include "application-calendar/widgets/EventDetailDescriptionItem.hpp" -#include "application-calendar/widgets/RepeatAndReminderItem.hpp" -#include - -EventDetailModel::EventDetailModel(app::Application *app) : application(app) -{} - -auto EventDetailModel::requestRecordsCount() -> unsigned int -{ - return internalData.size(); -} - -unsigned int EventDetailModel::getMinimalItemHeight() const -{ - return style::window::calendar::item::eventDetail::height_max; -} - -void EventDetailModel::requestRecords(const uint32_t offset, const uint32_t limit) -{ - setupModel(offset, limit); - list->onProviderDataUpdate(); -} - -gui::ListItem *EventDetailModel::getItem(gui::Order order) -{ - return getRecord(order); -} - -void EventDetailModel::createData() -{ - auto app = dynamic_cast(application); - assert(app != nullptr); - - internalData.push_back(new gui::EventDetailDescriptionItem()); - internalData.push_back(new gui::RepeatAndReminderItem(app)); - - for (auto &item : internalData) { - item->deleteByList = false; - } -} - -void EventDetailModel::loadData(std::shared_ptr record) -{ - list->reset(); - eraseInternalData(); - - createData(); - - for (auto &item : internalData) { - if (item->onLoadCallback) { - item->onLoadCallback(record); - } - } - - list->rebuildList(); -} diff --git a/module-apps/application-calendar/models/EventDetailModel.hpp b/module-apps/application-calendar/models/EventDetailModel.hpp deleted file mode 100644 index 43cdfa9bc2b50448e42d1c213ed761afa904b7eb..0000000000000000000000000000000000000000 --- a/module-apps/application-calendar/models/EventDetailModel.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. -// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md - -#pragma once - -#include "application-calendar/widgets/CalendarStyle.hpp" -#include "application-calendar/widgets/CalendarListItem.hpp" -#include "module-apps/application-calendar/ApplicationCalendar.hpp" -#include "Application.hpp" -#include "InternalModel.hpp" -#include - -class EventDetailModel : public app::InternalModel, public gui::ListItemProvider -{ - app::Application *application = nullptr; - - public: - EventDetailModel(app::Application *app); - - void loadData(std::shared_ptr record); - - [[nodiscard]] auto requestRecordsCount() -> unsigned int override; - [[nodiscard]] unsigned int getMinimalItemHeight() const override; - gui::ListItem *getItem(gui::Order order) override; - void requestRecords(const uint32_t offset, const uint32_t limit) override; - - private: - void createData(); -}; diff --git a/module-apps/application-calendar/models/MonthModel.cpp b/module-apps/application-calendar/models/MonthModel.cpp index 5b6479dbf922976658bb2c9e54753ee0e7f377ab..89f448eb0feeee135ef36ac592cdf95d906a89a1 100644 --- a/module-apps/application-calendar/models/MonthModel.cpp +++ b/module-apps/application-calendar/models/MonthModel.cpp @@ -1,33 +1,10 @@ -// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include "MonthModel.hpp" #include