mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-24 23:14:49 -04:00
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "BaseThreadRecordModel.hpp"
|
|
#include "application-messages/ApplicationMessages.hpp"
|
|
#include "application-messages/MessagesStyle.hpp"
|
|
#include "service-db/api/DBServiceAPI.hpp"
|
|
#include <cassert>
|
|
|
|
BaseThreadRecordModel::BaseThreadRecordModel(app::Application *app) : DatabaseModel(app)
|
|
{}
|
|
|
|
void BaseThreadRecordModel::requestRecordsCount(void)
|
|
{
|
|
recordsCount = DBServiceAPI::ThreadGetCount(application);
|
|
|
|
if (recordsCount > 0) {
|
|
|
|
DBServiceAPI::ThreadGetLimitOffset(application, 0, style::messages::threads::pageSize);
|
|
}
|
|
}
|
|
bool BaseThreadRecordModel::updateRecords(std::unique_ptr<std::vector<ThreadRecord>> records,
|
|
const uint32_t offset,
|
|
const uint32_t limit,
|
|
uint32_t count)
|
|
{
|
|
DatabaseModel::updateRecords(std::move(records), offset, limit, count);
|
|
|
|
if (direction == style::listview::Direction::Top)
|
|
modelIndex = this->records.size() - 1;
|
|
else if (direction == style::listview::Direction::Bottom)
|
|
modelIndex = 0;
|
|
|
|
list->onProviderDataUpdate();
|
|
return true;
|
|
}
|
|
|
|
void BaseThreadRecordModel::requestRecords(uint32_t offset, uint32_t limit)
|
|
{
|
|
DBServiceAPI::ThreadGetLimitOffset(application, offset, limit);
|
|
}
|