TSAM-12213 Name format in Call logs doesn't change as set in Contacts 50/107050/1 submit/tizen_3.0/20161226.152125 submit/tizen_3.0/20161228.074545 submit/tizen_3.0/20161229.001234
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Mon, 26 Dec 2016 08:27:27 +0000 (10:27 +0200)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Mon, 26 Dec 2016 08:27:51 +0000 (10:27 +0200)
Change-Id: I9051b2246949155b71c0208c842cec0c150bcd02
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
lib-logs/inc/Logs/Model/LogProvider.h
lib-logs/src/Logs/Model/LogProvider.cpp

index 4a9a9f1..52ee3c1 100644 (file)
@@ -141,6 +141,7 @@ namespace Logs
 
                        void onLogsChanged(const char *viewUri);
                        void onContactChanged(const char *viewUri);
+                       void onNameFormatChanged(contacts_name_display_order_e order);
 
                        int m_DbVersion;
 
index e19a670..c61e83c 100644 (file)
@@ -39,6 +39,7 @@ LogProvider::~LogProvider()
 
        contacts_db_remove_changed_cb(_contacts_phone_log._uri, makeCallbackWithLastParam(&LogProvider::onLogsChanged), this);
        contacts_db_remove_changed_cb(_contacts_person._uri, makeCallbackWithLastParam(&LogProvider::onContactChanged), this);
+       contacts_setting_remove_name_display_order_changed_cb(makeCallbackWithLastParam(&LogProvider::onNameFormatChanged), this);
 
        for (auto &&log : m_Logs) {
                delete log;
@@ -110,6 +111,7 @@ void LogProvider::onInitialize()
        contacts_db_get_current_version(&m_DbVersion);
        contacts_db_add_changed_cb(_contacts_phone_log._uri, makeCallbackWithLastParam(&LogProvider::onLogsChanged), this);
        contacts_db_add_changed_cb(_contacts_person._uri, makeCallbackWithLastParam(&LogProvider::onContactChanged), this);
+       contacts_setting_add_name_display_order_changed_cb(makeCallbackWithLastParam(&LogProvider::onNameFormatChanged), this);
        phone_number_connect();
 
        new Utils::Thread([this] {
@@ -374,3 +376,15 @@ void LogProvider::onContactChanged(const char *viewUri)
 
        contacts_list_destroy(list, true);
 }
+
+void LogProvider::onNameFormatChanged(contacts_name_display_order_e order)
+{
+       for (auto &&group : m_Groups) {
+               const Log &log = group->getFirstLog();
+               if (log.getContactId() != 0) {
+                       group->updateLogList();
+                       group->setChangedType(LogGroup::ChangeName);
+                       group->onChange();
+               }
+       }
+}