Tizen 3.0 Release TSAM-8478 Contact information does not change in Calendar details... 59/91059/2 submit/tizen/20161005.144601
authorNataliia Kamyshna <n.kamyshna@samsung.com>
Wed, 5 Oct 2016 11:42:35 +0000 (14:42 +0300)
committerNataliia Kamyshna <n.kamyshna@samsung.com>
Wed, 5 Oct 2016 12:37:43 +0000 (15:37 +0300)
Change-Id: I488644f758fc9bd1e420a69662c09eb104df1165
Signed-off-by: Nataliia Kamyshna <n.kamyshna@samsung.com>
common/model/CalDataManager.cpp
common/model/CalDataManager.h

index 313a901..123cd8e 100644 (file)
@@ -27,6 +27,7 @@
 #include <fcntl.h>
 #include <sstream>
 #include <app.h>
+#include <contacts.h>
 
 SINGLETON_INSTANCE(CalDataManager);
 
@@ -42,6 +43,9 @@ CalDataManager::~CalDataManager()
        WENTER();
        calendar_db_remove_changed_cb(_calendar_event._uri, __onChanged, NULL);
        calendar_disconnect();
+
+       contacts_db_remove_changed_cb(_contacts_image._uri, __onChanged, NULL);
+       contacts_disconnect();
 }
 
 void CalDataManager::init()
@@ -53,8 +57,18 @@ void CalDataManager::init()
        WASSERT(error == CALENDAR_ERROR_NONE);
        __localVersion = __version;
        WDEBUG("version = %d:%d", __localVersion, __version);
+
        error = calendar_db_add_changed_cb(_calendar_event._uri, __onChanged, NULL);
        WASSERT(error == CALENDAR_ERROR_NONE);
+
+       error = contacts_connect();
+       WASSERT(error == CONTACTS_ERROR_NONE);
+       error = calendar_db_get_current_version(&__contactsVersion);
+       WASSERT(error == CONTACTS_ERROR_NONE);
+       __contactsLocalVersion = __contactsVersion;
+
+       error = contacts_db_add_changed_cb(_contacts_image._uri, __onChanged, NULL);
+       WASSERT(error == CONTACTS_ERROR_NONE);
 }
 
 int CalDataManager::insertSchedule(const CalSchedule& schedule, int* newId)
@@ -996,11 +1010,16 @@ void CalDataManager::__onChanged(const char* uri, void* userData)
                return;
        }
 
+       error = contacts_db_get_current_version(&self.__contactsVersion);
+       WASSERT(error == CONTACTS_ERROR_NONE);
+
        WDEBUG("version = %d:%d", self.__localVersion, self.__version);
-       if (self.__localVersion == self.__version) {
+       if ((self.__localVersion == self.__version) && (self.__contactsLocalVersion == self.__contactsVersion) ) {
                WDEBUG("already updated");
                return;
        }
+
+       self.__contactsLocalVersion = self.__contactsVersion;
        self.__notify(CalEvent::REMOTE);
 }
 
index 647ae02..f277571 100644 (file)
@@ -217,6 +217,8 @@ private:
 
        int __localVersion;
        int __version;
+       int __contactsLocalVersion;
+       int __contactsVersion;
 };
 
 #endif