2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FSclAddressbook.cpp
19 * @brief This is the implementation for Addressbook class.
21 * This file contains definitions of @e Addressbook class.
25 #include <FBaseColIList.h>
26 #include <FBaseResult.h>
27 #include <FBaseString.h>
28 #include <FBaseSysLog.h>
29 #include <FSclAddressbook.h>
30 #include <FSclCategory.h>
31 #include <FSclContact.h>
32 #include <FSclUserProfile.h>
33 #include <FSec_AccessController.h>
34 #include "FScl_AddressbookImpl.h"
35 #include "FScl_CategoryImpl.h"
36 #include "FScl_ContactImpl.h"
37 #include "FScl_RecordImpl.h"
39 using namespace Tizen::Base;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::Security;
43 namespace Tizen { namespace Social
46 Addressbook::Addressbook(void)
47 : __pAddressbookImpl(null)
52 Addressbook::~Addressbook(void)
54 delete __pAddressbookImpl;
58 Addressbook::Construct(IRecordEventListener* pListener)
62 SysAssertf(__pAddressbookImpl == null,
63 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
65 __pAddressbookImpl = new (std::nothrow) _AddressbookImpl();
66 SysTryReturn(NID_SCL, __pAddressbookImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
68 r = __pAddressbookImpl->Construct();
69 SysTryCatch(NID_SCL, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
71 if (pListener != null)
73 r = __pAddressbookImpl->SetRecordEventListener(pListener);
74 SysTryCatch(NID_SCL, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
80 delete __pAddressbookImpl;
81 __pAddressbookImpl = null;
87 Addressbook::SetEventListener(IAddressbookEventListener* pListener)
89 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
90 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
91 SysAssertf(__pAddressbookImpl != null,
92 "Not yet constructed. Construct() should be called before use.");
94 result r = __pAddressbookImpl->SetAddressbookEventListener(pListener);
95 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
101 Addressbook::SetAddressbookChangeEventListener(IAddressbookChangeEventListener* pListener)
103 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
104 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
105 SysAssertf(__pAddressbookImpl != null,
106 "Not yet constructed. Construct() should be called before use.");
108 result r = __pAddressbookImpl->SetAddressbookChangeEventListener(pListener);
109 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
115 Addressbook::GetName(void) const
117 SysAssertf(__pAddressbookImpl != null,
118 "Not yet constructed. Construct() should be called before use.");
120 return __pAddressbookImpl->GetName();
124 Addressbook::GetId(void) const
126 SysAssertf(__pAddressbookImpl != null,
127 "Not yet constructed. Construct() should be called before use.");
129 return __pAddressbookImpl->GetId();
133 Addressbook::GetAccountId(void) const
135 SysAssertf(__pAddressbookImpl != null,
136 "Not yet constructed. Construct() should be called before use.");
138 return __pAddressbookImpl->GetAccountId();
142 Addressbook::AddContact(Contact& contact)
144 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
145 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
146 SysAssertf(__pAddressbookImpl != null,
147 "Not yet constructed. Construct() should be called before use.");
149 result r = __pAddressbookImpl->AddContact(contact);
150 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
156 Addressbook::AddCategory(Category& category)
158 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
159 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
160 SysAssertf(__pAddressbookImpl != null,
161 "Not yet constructed. Construct() should be called before use.");
163 result r = __pAddressbookImpl->AddCategory(category);
164 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
170 Addressbook::RemoveContact(Contact& contact)
172 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
173 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
174 SysAssertf(__pAddressbookImpl != null,
175 "Not yet constructed. Construct() should be called before use.");
177 result r = __pAddressbookImpl->RemoveContact(contact);
178 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
184 Addressbook::RemoveContact(RecordId contactId)
186 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
187 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
188 SysAssertf(__pAddressbookImpl != null,
189 "Not yet constructed. Construct() should be called before use.");
191 result r = __pAddressbookImpl->RemoveContact(contactId);
192 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
198 Addressbook::RemoveCategory(Category& category)
200 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
201 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
202 SysAssertf(__pAddressbookImpl != null,
203 "Not yet constructed. Construct() should be called before use.");
205 result r = __pAddressbookImpl->RemoveCategory(category.GetRecordId());
206 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
208 _CategoryImpl::GetInstance(category)->Invalidate();
209 _RecordImpl::GetInstance(category)->SetRecordId(INVALID_RECORD_ID);
215 Addressbook::RemoveCategory(RecordId categoryId)
217 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
218 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
219 SysAssertf(__pAddressbookImpl != null,
220 "Not yet constructed. Construct() should be called before use.");
222 result r = __pAddressbookImpl->RemoveCategory(categoryId);
223 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
229 Addressbook::UpdateContact(const Contact& contact)
231 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
232 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
233 SysAssertf(__pAddressbookImpl != null,
234 "Not yet constructed. Construct() should be called before use.");
236 result r = __pAddressbookImpl->UpdateContact(contact);
237 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
243 Addressbook::UpdateCategory(const Category& category)
245 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
246 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
247 SysAssertf(__pAddressbookImpl != null,
248 "Not yet constructed. Construct() should be called before use.");
250 result r = __pAddressbookImpl->UpdateCategory(category);
251 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
257 Addressbook::GetAllContactsN(void) const
259 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
260 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
261 SysAssertf(__pAddressbookImpl != null,
262 "Not yet constructed. Construct() should be called before use.");
264 IList* pList = __pAddressbookImpl->GetAllContactsN();
265 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
271 Addressbook::GetContactsByCategoryN(RecordId categoryId) const
273 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
274 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
275 SysAssertf(__pAddressbookImpl != null,
276 "Not yet constructed. Construct() should be called before use.");
278 IList* pList = __pAddressbookImpl->GetContactsByCategoryN(categoryId);
279 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
285 Addressbook::AddMemberToCategory(RecordId categoryId, RecordId contactId)
287 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
288 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
289 SysAssertf(__pAddressbookImpl != null,
290 "Not yet constructed. Construct() should be called before use.");
292 result r = __pAddressbookImpl->AddMemberToCategory(categoryId, contactId);
293 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
299 Addressbook::RemoveMemberFromCategory(RecordId categoryId, RecordId contactId)
301 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
302 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
303 SysAssertf(__pAddressbookImpl != null,
304 "Not yet constructed. Construct() should be called before use.");
306 result r = __pAddressbookImpl->RemoveMemberFromCategory(categoryId, contactId);
307 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
313 Addressbook::GetAllCategoriesN(void) const
315 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
316 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
317 SysAssertf(__pAddressbookImpl != null,
318 "Not yet constructed. Construct() should be called before use.");
320 IList* pList = __pAddressbookImpl->GetAllCategoriesN();
321 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
327 Addressbook::GetCategoriesByContactN(RecordId contactId) const
329 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
330 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
331 SysAssertf(__pAddressbookImpl != null,
332 "Not yet constructed. Construct() should be called before use.");
334 IList* pList = __pAddressbookImpl->GetCategoriesByContactN(contactId);
335 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
341 Addressbook::GetContactsN(int pageNo, int countPerPage) const
343 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
344 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
345 SysAssertf(__pAddressbookImpl != null,
346 "Not yet constructed. Construct() should be called before use.");
348 IList* pList = __pAddressbookImpl->GetContactsN(pageNo, countPerPage);
349 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
355 Addressbook::GetContactsInN(const Category& category, int pageNo, int countPerPage) const
357 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
358 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
359 SysAssertf(__pAddressbookImpl != null,
360 "Not yet constructed. Construct() should be called before use.");
362 IList* pList = __pAddressbookImpl->GetContactsInN(category, pageNo, countPerPage);
363 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
369 Addressbook::SearchContactsByEmailN(const String& email) const
371 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
372 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
373 SysAssertf(__pAddressbookImpl != null,
374 "Not yet constructed. Construct() should be called before use.");
376 IList* pList = __pAddressbookImpl->SearchContactsByEmailN(email);
377 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
383 Addressbook::SearchContactsByNameN(const String& name) const
385 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
386 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
387 SysAssertf(__pAddressbookImpl != null,
388 "Not yet constructed. Construct() should be called before use.");
390 IList* pList = __pAddressbookImpl->SearchContactsByNameN(name);
391 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
397 Addressbook::SearchContactsByPhoneNumberN(const String& phoneNumber) const
399 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
400 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
401 SysAssertf(__pAddressbookImpl != null,
402 "Not yet constructed. Construct() should be called before use.");
404 IList* pList = __pAddressbookImpl->SearchContactsByPhoneNumberN(phoneNumber);
405 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
411 Addressbook::GetCategoryCount(void) const
413 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, -1, E_PRIVILEGE_DENIED,
414 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
415 SysAssertf(__pAddressbookImpl != null,
416 "Not yet constructed. Construct() should be called before use.");
418 int count = __pAddressbookImpl->GetCategoryCount();
419 SysTryReturn(NID_SCL, count != -1, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
425 Addressbook::GetContactCount(void) const
427 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, -1, E_PRIVILEGE_DENIED,
428 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
429 SysAssertf(__pAddressbookImpl != null,
430 "Not yet constructed. Construct() should be called before use.");
432 int count = __pAddressbookImpl->GetContactCount();
433 SysTryReturn(NID_SCL, count != -1, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
439 Addressbook::GetContactN(RecordId contactId) const
441 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
442 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
443 SysAssertf(__pAddressbookImpl != null,
444 "Not yet constructed. Construct() should be called before use.");
446 Contact* pContact = __pAddressbookImpl->GetContactN(contactId);
447 SysTryReturn(NID_SCL, pContact != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
453 Addressbook::GetCategoryN(RecordId categoryId) const
455 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
456 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
457 SysAssertf(__pAddressbookImpl != null,
458 "Not yet constructed. Construct() should be called before use.");
460 Category* pCategory = __pAddressbookImpl->GetCategoryN(categoryId);
461 SysTryReturn(NID_SCL, pCategory != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
467 Addressbook::GetLatestVersion(void) const
469 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, -1, E_PRIVILEGE_DENIED,
470 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
471 SysAssertf(__pAddressbookImpl != null,
472 "Not yet constructed. Construct() should be called before use.");
474 int latestVersion = __pAddressbookImpl->GetLatestVersion();
475 SysTryReturn(NID_SCL, latestVersion != -1, -1, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
477 return latestVersion;
481 Addressbook::GetChangedContactsAfterN(int version, int& latestVersion) const
483 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
484 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
485 SysAssertf(__pAddressbookImpl != null,
486 "Not yet constructed. Construct() should be called before use.");
488 IList* pList = __pAddressbookImpl->GetChangedContactsAfterN(version, latestVersion);
489 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
495 Addressbook::GetChangedCategoriesAfterN(int version, int& latestVersion) const
497 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
498 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
499 SysAssertf(__pAddressbookImpl != null,
500 "Not yet constructed. Construct() should be called before use.");
502 IList* pList = __pAddressbookImpl->GetChangedCategoriesAfterN(version, latestVersion);
503 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
509 Addressbook::GetChangedContactInfoListN(int version, int& latestVersion) const
511 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
512 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
513 SysAssertf(__pAddressbookImpl != null,
514 "Not yet constructed. Construct() should be called before use.");
516 IList* pList = __pAddressbookImpl->GetChangedContactInfoListN(version, latestVersion);
517 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
523 Addressbook::GetChangedCategoryInfoListN(int version, int& latestVersion) const
525 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
526 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
527 SysAssertf(__pAddressbookImpl != null,
528 "Not yet constructed. Construct() should be called before use.");
530 IList* pList = __pAddressbookImpl->GetChangedCategoryInfoListN(version, latestVersion);
531 SysTryReturn(NID_SCL, pList != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
537 Addressbook::AddContacts(const IList& contactList, IListT<RecordId>* pContactIdList)
539 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
540 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
541 SysAssertf(__pAddressbookImpl != null,
542 "Not yet constructed. Construct() should be called before use.");
544 result r = E_SUCCESS;
546 r = __pAddressbookImpl->AddContacts(contactList, pContactIdList);
552 Addressbook::UpdateContacts(const IList& contactList)
554 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
555 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
556 SysAssertf(__pAddressbookImpl != null,
557 "Not yet constructed. Construct() should be called before use.");
559 result r = E_SUCCESS;
561 r = __pAddressbookImpl->UpdateContacts(contactList);
567 Addressbook::RemoveContacts(const IListT<RecordId>& contactIdList)
569 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_CONTACT_WRITE) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
570 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
571 SysAssertf(__pAddressbookImpl != null,
572 "Not yet constructed. Construct() should be called before use.");
574 result r = E_SUCCESS;
576 r = __pAddressbookImpl->RemoveContacts(contactIdList);
582 Addressbook::SetUserProfile(const UserProfile* pUserProfile)
584 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_USERPROFILE_WRITE) == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED,
585 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
586 SysAssertf(__pAddressbookImpl != null,
587 "Not yet constructed. Construct() should be called before use.");
589 result r = __pAddressbookImpl->SetUserProfile(pUserProfile);
590 SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
596 Addressbook::GetUserProfileN(void) const
598 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_USERPROFILE_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
599 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
600 SysAssertf(__pAddressbookImpl != null,
601 "Not yet constructed. Construct() should be called before use.");
603 UserProfile* pProfile = __pAddressbookImpl->GetUserProfileN();
604 SysTryReturn(NID_SCL, pProfile != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
610 Addressbook::IsUserProfileChangedAfter(int version) const
612 SysTryReturn(NID_SCL, _AccessController::CheckUserPrivilege(_PRV_USERPROFILE_READ) == E_SUCCESS, null, E_PRIVILEGE_DENIED,
613 "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
614 SysAssertf(__pAddressbookImpl != null,
615 "Not yet constructed. Construct() should be called before use.");
617 bool isChanged = __pAddressbookImpl->IsUserProfileChangedAfter(version);
618 SysTryReturn(NID_SCL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));