mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-05-19 05:57:30 -04:00
* [EGD-2569] added # and * as numeric inputs * [EGD-2569] added '+' input sign * [EGD-2569] created defines with window names for call app * [EGD-2547] contact recognition during call * [EGD-2547] moved UiCommon * [fix][EGD-2547] fix for setting empty UTF string to text gui field * [EGD-2547] adding new contact from call enter window * [EGD-2547] minor clean up and added param validation * [EGD-2547] easier method to add contact * [EGD-2569] added new keyboard profile (numeric with special signs) Desktop is passing it properly to Call app. * [EGD-2569] added transaltor to enternumberwindow * [EGD-2569] reverted unnecessary changes [EGD-2569] revert [EGD-2569] revert of not needed changes * [EGD-2569] fix in phone.kprof * [EGD-2547] unified API to call and send sms * [EGD-2547] changed default to true * [EGD-2547] minor clean up. * [EGD-2569] revert changes in PinLockWindow.cpp * [EGD-2569][fix] eneter as null char * [EGD-2547] PR fixes [EGD-2547] code review fixes / refactored UiCommon [EGD-2547] more code review fixes [EGD-2547] rem not needed cast * [EGD-2547] PR fixes * [EGD-2547] splitting of UiCommon * [EGD-2547] typo fix * [EGD-2547] revereted one line conversion from char to string.
113 lines
3.2 KiB
C++
113 lines
3.2 KiB
C++
/*
|
|
* @file CallLogMainWindow.cpp
|
|
* @author Aleksander Rudnik (aleksander.rudnik@mudita.com)
|
|
* @date 19.09.2019
|
|
* @brief Application Call Log Main Window
|
|
* @copyright Copyright (C) 2019 mudita.com
|
|
* @details
|
|
*/
|
|
#include "CallLogMainWindow.hpp"
|
|
#include <cassert>
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
#include "application-call/ApplicationCall.hpp"
|
|
#include "service-appmgr/ApplicationManager.hpp"
|
|
|
|
#include "../ApplicationCallLog.hpp"
|
|
#include "../widgets/CalllogItem.hpp"
|
|
|
|
#include "service-db/messages/DBMessage.hpp"
|
|
#include "i18/i18.hpp"
|
|
|
|
#include "../data/CallLogInternals.hpp" // TODO: alek: add easier paths
|
|
#include "Label.hpp"
|
|
#include "Margins.hpp"
|
|
#include "UiCommonActions.hpp"
|
|
#include <Style.hpp>
|
|
|
|
using namespace style;
|
|
using namespace callLogStyle;
|
|
|
|
namespace gui {
|
|
|
|
CallLogMainWindow::CallLogMainWindow( app::Application* app ) :
|
|
AppWindow( app, calllog::settings::MainWindowStr ), calllogModel{ new 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("common_call") );
|
|
bottomBar->setText( BottomBar::Side::CENTER, utils::localize.get("common_open") );
|
|
bottomBar->setText( BottomBar::Side::RIGHT, utils::localize.get("common_back") );
|
|
|
|
topBar->setActive( TopBar::Elements::TIME, true );
|
|
|
|
list = new gui::ListView(this, mainWindow::x, mainWindow::y, mainWindow::w, mainWindow::h);
|
|
list->setMaxElements(calllog::settings::pageSize);
|
|
list->setPageSize(calllog::settings::pageSize);
|
|
list->setProvider(calllogModel);
|
|
|
|
setFocusItem( list );
|
|
}
|
|
void CallLogMainWindow::destroyInterface() {
|
|
AppWindow::destroyInterface();
|
|
|
|
if( list ) { removeWidget(list); delete list; list= nullptr; };
|
|
|
|
children.clear();
|
|
delete calllogModel;
|
|
}
|
|
|
|
CallLogMainWindow::~CallLogMainWindow() {
|
|
destroyInterface();
|
|
}
|
|
|
|
void CallLogMainWindow::onBeforeShow( ShowMode mode, SwitchData* data ) {
|
|
if( mode == ShowMode::GUI_SHOW_INIT ){
|
|
calllogModel->clear();
|
|
calllogModel->requestRecordsCount();
|
|
list->clear();
|
|
list->setElementsCount( calllogModel->getItemCount() );
|
|
}
|
|
}
|
|
|
|
bool CallLogMainWindow::onInput( const InputEvent& inputEvent ) {
|
|
//process only if key is released
|
|
if(( inputEvent.state != InputEvent::State::keyReleasedShort ) || ( inputEvent.state != InputEvent::State::keyReleasedLong )) {
|
|
if( inputEvent.keyCode == KeyCode::KEY_LF ) {
|
|
LOG_DEBUG("calling");
|
|
auto it = dynamic_cast<CalllogItem *>(list->getSelectedItem());
|
|
if (it == nullptr)
|
|
{
|
|
LOG_ERROR("wrong item type");
|
|
assert(0);
|
|
return false;
|
|
}
|
|
return app::call(application, app::CallOperation::ExecuteCall, it->getCall().number);
|
|
}
|
|
}
|
|
|
|
return AppWindow::onInput( inputEvent );
|
|
}
|
|
|
|
bool CallLogMainWindow::onDatabaseMessage( sys::Message* msgl ) {
|
|
DBCalllogResponseMessage* msg = reinterpret_cast<DBCalllogResponseMessage*>( msgl );
|
|
if( calllogModel->updateRecords( std::move(msg->records), msg->offset, msg->limit, msg->count ) ) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} /* namespace gui */
|