#include <fcntl.h>
#include <sstream>
#include <app.h>
+#include <contacts.h>
SINGLETON_INSTANCE(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()
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)
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);
}