mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-21 15:38:23 -04:00
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#include "EventDetailModel.hpp"
|
|
#include "application-calendar/widgets/EventDetailDescriptionItem.hpp"
|
|
#include "application-calendar/widgets/RepeatAndReminderItem.hpp"
|
|
#include <ListView.hpp>
|
|
|
|
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()
|
|
{
|
|
internalData.push_back(new gui::EventDetailDescriptionItem());
|
|
internalData.push_back(new gui::RepeatAndReminderItem());
|
|
|
|
for (auto &item : internalData) {
|
|
item->deleteByList = false;
|
|
}
|
|
}
|
|
|
|
void EventDetailModel::loadData()
|
|
{
|
|
list->clear();
|
|
eraseInternalData();
|
|
|
|
createData();
|
|
|
|
requestRecords(0, internalData.size());
|
|
|
|
for (auto &item : internalData) {
|
|
if (item->onLoadCallback) {
|
|
item->onLoadCallback();
|
|
}
|
|
}
|
|
}
|