diff options
Diffstat (limited to 'lib-contact/ct-list/src/CtListModelFilter.h')
-rw-r--r-- | lib-contact/ct-list/src/CtListModelFilter.h | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/lib-contact/ct-list/src/CtListModelFilter.h b/lib-contact/ct-list/src/CtListModelFilter.h new file mode 100644 index 0000000..c0c8fbd --- /dev/null +++ b/lib-contact/ct-list/src/CtListModelFilter.h @@ -0,0 +1,173 @@ +/* + * 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_DATA_FILTER_H_ +#define __CT_LIST_DATA_FILTER_H_ + +#include <vector> +#include <map> + +#include "ContactsCommon.h" +#include "ContactsDebug.h" + +#include "CtType.h" +#include "CtListModelListener.h" + +enum { // this order affects to set list_op in ct_list_create_contact_view_with_info + CT_GET_LIST_ALL_PERSON = 0, + + CT_GET_LIST_PERSON_OF_WRITABLE_EXCEPT_SIM = 4, + CT_GET_LIST_PERSON_OF_WRITABLE_ADDRBOOK_ID = 5, + CT_GET_LIST_PERSON_ASSIGNED_FAVORITE = 6, + CT_GET_LIST_PERSON_OF_BUSINESS_CARD = 7, + + CT_GET_LIST_ALL_PERSON_HAD_NUMBER = 20, + CT_GET_LIST_ALL_PERSON_HAD_EMAIL = 21, + CT_GET_LIST_ALL_PERSON_HAD_NUMBER_OR_EMAIL = 22, + CT_GET_LIST_ALL_PERSON_ADD_FAVORITE = 23, + CT_GET_LIST_ALL_PERSON_REMOVE_FAVORITE = 24, + CT_GET_LIST_ALL_PERSON_REORDER_FAVORITE = 25, + CT_GET_LIST_ALL_PERSON_HAD_NUMBER_NO_EXIST = 26, + CT_GET_LIST_VCARD = 30, +}; //list op + +enum { + CT_LIST_NORMAL = 0x00, + CT_LIST_NORMAL_CONTACT = 0x01, + CT_LIST_NORMAL_FAVORITE = 0x02, + CT_LIST_NORMAL_MEMBER = 0x03, + CT_LIST_NORMAL_SDN = 0x04, + CT_LIST_NORMAL_BUSINESS_CARDS = 0x05, + + CT_LIST_SINGLE = 0x30, + CT_LIST_SINGLE_LINK = 0x31, + CT_LIST_SINGLE_RELATION = 0x32, + + CT_LIST_SINGLE_UG = 0x50, + + CT_LIST_MULTI = 0x70, + CT_LIST_MULTI_DELETE = 0x71, + CT_LIST_MULTI_ADD_MEMBER = 0x72, + CT_LIST_MULTI_REMOVE_MEMBER = 0x73, + CT_LIST_MULTI_ADD_FAVORITE = 0x74, + CT_LIST_MULTI_REMOVE_FAVORITE = 0x75, + CT_LIST_MULTI_REORDER_FAVORITE = 0x76, + CT_LIST_MULTI_EXPORT_TO_SIM = 0x77, + CT_LIST_MULTI_EXPORT_TO_VCARD = 0x78, + CT_LIST_MULTI_IMPORT_FROM_SIM = 0x79, + CT_LIST_MULTI_IMPORT_FROM_VCARD = 0x7A, + CT_LIST_MULTI_RECIPIENT_MESSAGE_INGROUP = 0x7B, + CT_LIST_MULTI_RECIPIENT_EMAIL_INGROUP = 0x7C, + CT_LIST_MULTI_SHARE = 0x7D, + + CT_LIST_MULTI_UG = 0xA0, +}; //view id + +typedef enum { + LIST_FILTER_WRITABLE_ALL, + LIST_FILTER_WRITABLE_EXCEPT_SIM, + LIST_FILTER_WRITABLE_READ_ONLY, +}CtListWritableType; + +typedef enum { + LIST_VIEW_URI_TYPE_NONE, + LIST_VIEW_URI_TYPE_PERSON, + LIST_VIEW_URI_TYPE_PERSON_CONTACT, + LIST_VIEW_URI_TYPE_PERSON_USAGE, +// LIST_VIEW_URI_TYPE_PERSON_BUSINESS_CARD, +}CtListViewUriType; + +typedef enum { + LIST_HAS_NONE, + LIST_HAS_NUMBER, + LIST_HAS_EMAIL, + LIST_HAS_NUMBER_OR_EMAIL, +}CtListHasType; + +typedef enum { + LIST_FAVORITE_NONE, + LIST_FAVORITE_SET, + LIST_FAVORITE_UNSET, +}CtListFavoriteType; + +typedef enum { + LIST_PROJECTION_NONE, + LIST_PERSON_PROJECTION, + LIST_PERSON_SEARCH_PROJECTION, + LIST_PERSON_CONTACT_PROJECTION, + LIST_PERSON_GROUPREL_PROJECTION, + LIST_PERSON_GROUPNOTASSIGNED_PROJECTION, +}CtListProjectionType; + + +class CtListModelFilter +{ +public: + CtListModelFilter(CtListHasType filterType); + CtListModelFilter(CtListDataType dataType); + virtual ~CtListModelFilter(); + +public: + contacts_query_h getQuery(CtListQueryType queryType); + + std::map<int, CtAddressbookInfo*>& getAddressbookList(); + void setDisplayAddressbook(int addressbookId, bool display); + void setListHasType(CtListHasType hasType); + void attachListener(CtListModelListener *listener); + CtListWritableType checkConditionWritable(); + +private: + bool __getOpFromDataType(CtListDataType dataType); + void __initialize(void); + void __initHasType(); + bool __checkAddressbook() const; + + CtListHasType __getListHasType() const; + CtListFavoriteType __getListFavoriteType() const; + + void __initAddressbook(); + int __getDisplayAddressbookCount(); + void __setDisplayAddressbookAsPreference(); + void __setDisplayAddressbookAsAppcontrol(int addressbookId); + void __setDisplayAddressbookWithoutSim(); + void __setDisplayAddressbookWithoutSimAndFacebook(); + void __setDisplayAddressbookWithoutFacebook(); + void __setDisplayAddressbookAll(); + static std::vector<int>* __makeTokenizeAddressbookList(const char *originString, const char *delimiter); + + static void __onDisplayWithNumberChangedCb(const char *key, void *data); + static void __onDisplayAddressbookChangedCb(const char *key, void *data); + +private: + int __listOp; + int __selectedPersonId; + int __viewId; + int __ugRequest; + char* __ugData; + std::vector<int> excludePersonId; + std::map<int, bool> __addressbookIds; + + + CtListHasType __hasType; + bool __IsSearchQuery; + + CtListModelListener *__listener; + std::map<int, CtAddressbookInfo*> __addressbookList; +}; + +#endif + |