From 3bfd6bc55fa501d7459eeb9c7cd508f36291b891 Mon Sep 17 00:00:00 2001 From: Maciej Gibowicz Date: Sun, 28 Nov 2021 17:17:06 +0100 Subject: [PATCH] [EGD-7871] Fix refreshing calllog details after editing contact After editing a contact from the calllog level, the calllog details will be refreshed. --- .../windows/CallLogDetailsWindow.cpp | 22 +++++++++++++++++++ .../windows/CallLogDetailsWindow.hpp | 1 + 2 files changed, 23 insertions(+) diff --git a/module-apps/application-calllog/windows/CallLogDetailsWindow.cpp b/module-apps/application-calllog/windows/CallLogDetailsWindow.cpp index d1518d56531ef00f86f506a9e0b71d608caba441..fe6d36410f457a8675465039ac0ce18e3623a24c 100644 --- a/module-apps/application-calllog/windows/CallLogDetailsWindow.cpp +++ b/module-apps/application-calllog/windows/CallLogDetailsWindow.cpp @@ -12,6 +12,7 @@ #include "windows/CallLogOptionsWindow.hpp" #include #include +#include #include #include @@ -234,4 +235,25 @@ namespace gui return AppWindow::onInput(inputEvent); } + bool CallLogDetailsWindow::onDatabaseMessage(sys::Message *msgl) + { + auto msgNotification = dynamic_cast(msgl); + if (msgNotification != nullptr) { + if (msgNotification->interface == db::Interface::Name::Contact) { + if (msgNotification->dataModified()) { + if (auto contact = DBServiceAPI::MatchContactByPhoneNumber(application, record.phoneNumber); + contact && !contact->isTemporary()) { + record.name = contact->getFormattedName(); + } + else { + record.name = UTF8(record.phoneNumber.getFormatted()); + } + setTitle(record.name); + return true; + } + } + } + return false; + } + } /* namespace gui */ diff --git a/module-apps/application-calllog/windows/CallLogDetailsWindow.hpp b/module-apps/application-calllog/windows/CallLogDetailsWindow.hpp index 3ddeee08e447ec248f1285b5f38e5ef34ffc6c48..c30d5c9b6d0a1a103ff3a7135d32fd6f27533bf4 100644 --- a/module-apps/application-calllog/windows/CallLogDetailsWindow.hpp +++ b/module-apps/application-calllog/windows/CallLogDetailsWindow.hpp @@ -40,6 +40,7 @@ namespace gui // virtual methods bool onInput(const InputEvent &inputEvent) override; void onBeforeShow(ShowMode mode, SwitchData *data) override; + bool onDatabaseMessage(sys::Message *msgl) override; void rebuild() override; void buildInterface() override;