/* * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef __CT_LIST_MODEL_VCARD_H_ #define __CT_LIST_MODEL_VCARD_H_ #include #include #include #include #include #include #include #include "CtType.h" #include "CtCommon.h" #include "ContactsCommon.h" #include "CtListModel.h" #include "CtListDataPerson.h" class ICtChangeListener; class CtListModelVcard : public CtListModel { public: CtListModelVcard(const std::string& vcardPath); virtual ~CtListModelVcard(); public: // CtListModel interfaces virtual int getContactsCount(CtListQueryType queryType); virtual int getContacts(CtListQueryType queryType, CtGetContactsType syncType); virtual int cancelGetContacts() { return 0; } virtual std::shared_ptr getAtPersonData(int index, CtListQueryType queryType); virtual int getPersonListCount(CtListQueryType queryType); virtual void attachListener(ICtChangeListener* listener); virtual void setSelectedPersonId(int selectedPersonId); virtual const char* getSearchString(void); virtual bool setSearchString(char* search); virtual void getNumberSearchString(const std::shared_ptr& dataPerson, std::string &numberStr); virtual int getCheckedDataCount(); virtual int getLimitCount() { return 0;} virtual int getCurrentLinkedCount() { return 0; } void setOnLoadCompleteCb(std::function loadingCb); void resetLoadCompleteCb(); std::vector>* getCheckedDataList() const; void __getMfcPersonList(); bool __makeUsagePersonList(contacts_list_h list); void __getVcardPathFromUri(void); virtual void initialOriginalCheckedIdList(); virtual void clearOriginalCheckedIdList(); virtual bool checkIsSelectAllOnSearching(); virtual void initialOriginalPersonDataListSize(); virtual void clearOriginalPersonDataListSize(); virtual int getOriginalPersonDataListSize(); private: int __makePersonListFromVcard(); static bool __onEachContactInVcard(contacts_record_h record, void *data); private: ICtChangeListener* __listener; Ecore_Thread* __parser; bool __nQuery; std::string __vcardPath; std::vector> __personDataList; std::function __loadCompleteCb; int __loadedCount; int __totalCount; int __realTotalCount; bool __onTerminating; }; #endif