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 FScl_AddressbookImpl.h
19 * @brief This is the header file for the _AddressbookImpl class.
21 * This header file contains the declarations of the _AddressbookImpl class.
24 #ifndef _FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_
25 #define _FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_
27 #include <unique_ptr.h>
29 #include <FBaseObject.h>
30 #include "FScl_IContactDbChangeEventListener.h"
32 namespace Tizen { namespace Base {
35 namespace Collection {
37 template<class Type> class IListT;
41 namespace Tizen { namespace Social
47 class IRecordEventListener;
48 class IAddressbookEventListener;
49 class IAddressbookChangeEventListener;
52 * @class _AddressbookImpl
53 * @brief This class handles the _AddressbookImpl operations.
58 class _AddressbookImpl
59 : public Tizen::Base::Object
60 , virtual public _IContactDbChangeEventListener
64 * This is default constructor for the class.
68 _AddressbookImpl(void);
71 * This destructor overrides Tizen::Base::Object::~Object().
75 virtual ~_AddressbookImpl(void);
77 result Construct(void);
79 result SetRecordEventListener(IRecordEventListener* pListener);
81 result SetAddressbookEventListener(IAddressbookEventListener* pListener);
83 result SetAddressbookChangeEventListener(IAddressbookChangeEventListener* pListener);
85 void SetId(AddressbookId addressbookId);
87 void SetAccountId(AccountId accountId);
89 void SetName(const Tizen::Base::String& name);
91 AddressbookId GetId(void) const;
93 AccountId GetAccountId(void) const;
95 Tizen::Base::String GetName(void) const;
97 result AddContact(Contact& contact);
99 result AddCategory(Category& category);
101 result RemoveContact(RecordId contactId);
103 result RemoveContact(Contact& contact);
105 result RemoveCategory(RecordId categoryId);
107 result UpdateContact(const Contact& contact);
109 result UpdateCategory(const Category& category);
111 Tizen::Base::Collection::IList* GetAllContactsN(void) const;
113 Tizen::Base::Collection::IList* GetContactsByCategoryN(RecordId categoryId) const;
115 Tizen::Base::Collection::IListT<RecordId>* GetContactIdsByCategoryN(RecordId categoryId) const;
117 result AddMemberToCategory(RecordId categoryId, RecordId contactId);
119 result RemoveMemberFromCategory(RecordId categoryId, RecordId contactId);
121 Tizen::Base::Collection::IList* GetAllCategoriesN(void) const;
123 Tizen::Base::Collection::IList* GetCategoriesByContactN(RecordId contactId) const;
125 Tizen::Base::Collection::IList* GetContactsN(int pageNo, int countPerPage) const;
127 Tizen::Base::Collection::IList* GetContactsInN(const Category& category, int pageNo, int countPerPage) const;
129 Tizen::Base::Collection::IList* SearchContactsByEmailN(const Tizen::Base::String& email) const;
131 Tizen::Base::Collection::IList* SearchContactsByNameN(const Tizen::Base::String& name) const;
133 Tizen::Base::Collection::IList* SearchContactsByPhoneNumberN(const Tizen::Base::String& phoneNumber) const;
135 int GetCategoryCount(void) const;
137 int GetContactCount(void) const;
139 Contact* GetContactN(RecordId contactId) const;
141 Category* GetCategoryN(RecordId categoryId) const;
143 int GetLatestVersion(void) const;
145 Tizen::Base::Collection::IList* GetChangedContactsAfterN(int version, int& latestVersion) const;
147 Tizen::Base::Collection::IList* GetChangedCategoriesAfterN(int version, int& latestVersion) const;
149 Tizen::Base::Collection::IList* GetChangedContactInfoListN(int version, int& latestVersion) const;
151 Tizen::Base::Collection::IList* GetChangedCategoryInfoListN(int version, int& latestVersion) const;
153 result AddContacts(const Tizen::Base::Collection::IList& contactList, Tizen::Base::Collection::IListT<RecordId>* pContactIdList);
155 result UpdateContacts(const Tizen::Base::Collection::IList& contactList);
157 result RemoveContacts(const Tizen::Base::Collection::IListT<RecordId>& contactIdList);
159 result SetUserProfile(const UserProfile* pUserProfile);
161 UserProfile* GetUserProfileN(void) const;
163 bool IsUserProfileChangedAfter(int version) const;
165 result CopyMyProfileContents(contacts_record_h srcHandle, contacts_record_h dstHandle);
167 virtual void OnContactChanged(void);
169 virtual void OnCategoryChanged(void);
171 virtual void OnRelationChanged(void);
173 static _AddressbookImpl* GetInstance(Addressbook& addressbook);
175 static const _AddressbookImpl* GetInstance(const Addressbook& addressbook);
179 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
183 _AddressbookImpl(const _AddressbookImpl& rhs);
185 Tizen::Base::Collection::IList* GetChangedGroupsAfterN(int, int&) const;
187 Tizen::Base::Collection::IList* GetChangedRelationsAfterN(int, int&) const;
190 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
194 _AddressbookImpl& operator =(const _AddressbookImpl& rhs);
197 IRecordEventListener* __pIRecordEventListener;
198 IAddressbookEventListener* __pIAddressbookEventListener;
199 IAddressbookChangeEventListener* __pIAddressbookChangeEventListener;
200 int __dbVersionForContact;
201 int __dbVersionForGroup;
202 int __dbVersionForRelation;
203 AddressbookId __addressbookId;
204 AccountId __accountId;
205 Tizen::Base::String __name;
206 }; // _AddressbookImpl
210 #endif //_FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_