mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-18 22:18:38 -04:00
Due to vfs deprecation there is need to remove all vfs calls from code. This PR covers module gui. There are some modifications in other modules included which are necessary because of build system issues.
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "CallLogMainWindow.hpp"
|
|
#include "application-calllog/data/CallLogInternals.hpp"
|
|
#include "application-calllog/ApplicationCallLog.hpp"
|
|
#include "application-calllog/widgets/CalllogItem.hpp"
|
|
|
|
#include <application-call/ApplicationCall.hpp>
|
|
#include <service-appmgr/model/ApplicationManager.hpp>
|
|
#include <service-db/DBCalllogMessage.hpp>
|
|
#include <i18n/i18n.hpp>
|
|
#include <Label.hpp>
|
|
#include <Margins.hpp>
|
|
#include <Style.hpp>
|
|
|
|
#include <cassert>
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
using namespace style;
|
|
using namespace callLogStyle;
|
|
|
|
namespace gui
|
|
{
|
|
|
|
CallLogMainWindow::CallLogMainWindow(app::Application *app)
|
|
: AppWindow(app, calllog::settings::MainWindowStr), calllogModel{std::make_shared<CalllogModel>(app)}
|
|
{
|
|
|
|
buildInterface();
|
|
}
|
|
|
|
void CallLogMainWindow::rebuild()
|
|
{
|
|
destroyInterface();
|
|
buildInterface();
|
|
}
|
|
|
|
void CallLogMainWindow::buildInterface()
|
|
{
|
|
AppWindow::buildInterface();
|
|
|
|
setTitle(utils::localize.get("app_calllog_title_main"));
|
|
|
|
bottomBar->setText(BottomBar::Side::LEFT, utils::localize.get(style::strings::common::call));
|
|
bottomBar->setText(BottomBar::Side::CENTER, utils::localize.get(style::strings::common::open));
|
|
bottomBar->setText(BottomBar::Side::RIGHT, utils::localize.get(style::strings::common::back));
|
|
|
|
topBar->setActive(TopBar::Elements::TIME, true);
|
|
|
|
list = new gui::ListView(this, mainWindow::x, mainWindow::y, mainWindow::w, mainWindow::h, calllogModel);
|
|
|
|
setFocusItem(list);
|
|
}
|
|
|
|
void CallLogMainWindow::destroyInterface()
|
|
{
|
|
erase();
|
|
}
|
|
|
|
void CallLogMainWindow::onBeforeShow(ShowMode mode, SwitchData *data)
|
|
{
|
|
if (mode == ShowMode::GUI_SHOW_INIT) {
|
|
list->rebuildList();
|
|
}
|
|
auto app = dynamic_cast<app::ApplicationCallLog *>(application);
|
|
assert(app != nullptr);
|
|
app->setAllEntriesRead();
|
|
}
|
|
|
|
bool CallLogMainWindow::onDatabaseMessage(sys::Message *msgl)
|
|
{
|
|
DBCalllogResponseMessage *msg = reinterpret_cast<DBCalllogResponseMessage *>(msgl);
|
|
return calllogModel->updateRecords(std::move(*msg->records));
|
|
}
|
|
|
|
} /* namespace gui */
|