2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FScl_AddressbookImpl.h
18 * @brief This is the header file for the _AddressbookImpl class.
20 * This header file contains the declarations of the _AddressbookImpl class.
23 #ifndef _FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_
24 #define _FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_
26 #include <unique_ptr.h>
28 #include <FBaseObject.h>
29 #include "FScl_IContactDbChangeEventListener.h"
31 namespace Tizen { namespace Base {
34 namespace Collection {
36 template<class Type> class IListT;
40 namespace Tizen { namespace Social
46 class IRecordEventListener;
47 class IAddressbookEventListener;
48 class IAddressbookChangeEventListener;
51 * @class _AddressbookImpl
52 * @brief This class handles the _AddressbookImpl operations.
57 class _AddressbookImpl
58 : public Tizen::Base::Object
59 , virtual public _IContactDbChangeEventListener
63 * This is default constructor for the class.
67 _AddressbookImpl(void);
70 * This destructor overrides Tizen::Base::Object::~Object().
74 virtual ~_AddressbookImpl(void);
76 result Construct(void);
78 result SetRecordEventListener(IRecordEventListener* pListener);
80 result SetAddressbookEventListener(IAddressbookEventListener* pListener);
82 result SetAddressbookChangeEventListener(IAddressbookChangeEventListener* pListener);
84 void SetId(AddressbookId addressbookId);
86 void SetAccountId(AccountId accountId);
88 void SetName(const Tizen::Base::String& name);
90 AddressbookId GetId(void) const;
92 AccountId GetAccountId(void) const;
94 Tizen::Base::String GetName(void) const;
96 result AddContact(Contact& contact);
98 result AddCategory(Category& category);
100 result RemoveContact(RecordId contactId);
102 result RemoveContact(Contact& contact);
104 result RemoveCategory(RecordId categoryId);
106 result UpdateContact(const Contact& contact);
108 result UpdateCategory(const Category& category);
110 Tizen::Base::Collection::IList* GetAllContactsN(void) const;
112 Tizen::Base::Collection::IList* GetContactsByCategoryN(RecordId categoryId) const;
114 Tizen::Base::Collection::IListT<RecordId>* GetContactIdsByCategoryN(RecordId categoryId) const;
116 result AddMemberToCategory(RecordId categoryId, RecordId contactId);
118 result RemoveMemberFromCategory(RecordId categoryId, RecordId contactId);
120 Tizen::Base::Collection::IList* GetAllCategoriesN(void) const;
122 Tizen::Base::Collection::IList* GetCategoriesByContactN(RecordId contactId) const;
124 Tizen::Base::Collection::IList* GetContactsN(int pageNo, int countPerPage) const;
126 Tizen::Base::Collection::IList* GetContactsInN(const Category& category, int pageNo, int countPerPage) const;
128 Tizen::Base::Collection::IList* SearchContactsByEmailN(const Tizen::Base::String& email) const;
130 Tizen::Base::Collection::IList* SearchContactsByNameN(const Tizen::Base::String& name) const;
132 Tizen::Base::Collection::IList* SearchContactsByPhoneNumberN(const Tizen::Base::String& phoneNumber) const;
134 int GetCategoryCount(void) const;
136 int GetContactCount(void) const;
138 Contact* GetContactN(RecordId contactId) const;
140 Category* GetCategoryN(RecordId categoryId) const;
142 int GetLatestVersion(void) const;
144 Tizen::Base::Collection::IList* GetChangedContactsAfterN(int version, int& latestVersion) const;
146 Tizen::Base::Collection::IList* GetChangedCategoriesAfterN(int version, int& latestVersion) const;
148 Tizen::Base::Collection::IList* GetChangedContactInfoListN(int version, int& latestVersion) const;
150 Tizen::Base::Collection::IList* GetChangedCategoryInfoListN(int version, int& latestVersion) const;
152 result AddContacts(const Tizen::Base::Collection::IList& contactList, Tizen::Base::Collection::IListT<RecordId>* pContactIdList);
154 result UpdateContacts(const Tizen::Base::Collection::IList& contactList);
156 result RemoveContacts(const Tizen::Base::Collection::IListT<RecordId>& contactIdList);
158 result SetUserProfile(const UserProfile* pUserProfile);
160 UserProfile* GetUserProfileN(void) const;
162 bool IsUserProfileChangedAfter(int version) const;
164 contacts_record_h CopyMyProfileRecordHandle(contacts_record_h srcHandle);
166 virtual void OnContactChanged(void);
168 virtual void OnCategoryChanged(void);
170 virtual void OnRelationChanged(void);
172 contacts_record_h CopyContactRecordHandle(contacts_record_h srcHandle);
174 static _AddressbookImpl* GetInstance(Addressbook& addressbook);
176 static const _AddressbookImpl* GetInstance(const Addressbook& addressbook);
180 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
184 _AddressbookImpl(const _AddressbookImpl& rhs);
186 Tizen::Base::Collection::IList* GetChangedGroupsAfterN(int, int&) const;
188 Tizen::Base::Collection::IList* GetChangedRelationsAfterN(int, int&) const;
191 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
195 _AddressbookImpl& operator =(const _AddressbookImpl& rhs);
198 IRecordEventListener* __pIRecordEventListener;
199 IAddressbookEventListener* __pIAddressbookEventListener;
200 IAddressbookChangeEventListener* __pIAddressbookChangeEventListener;
201 int __dbVersionForContact;
202 int __dbVersionForGroup;
203 int __dbVersionForRelation;
204 AddressbookId __addressbookId;
205 AccountId __accountId;
206 Tizen::Base::String __name;
207 }; // _AddressbookImpl
211 #endif //_FSCL_INTERNAL_ADDRESSBOOK_IMPL_H_