Initialize Tizen 2.3
[apps/osp/Contacts.git] / inc / CtContactPresentationModel.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file        CtContactPresentationModel.h
19  * @brief       This is the header file for the ContactPresentationModel class.
20  */
21
22 #ifndef _CT_CONTACT_PRESENTATION_MODEL_H_
23 #define _CT_CONTACT_PRESENTATION_MODEL_H_
24
25 #include <FBase.h>
26 #include <FIo.h>
27 #include <FSocial.h>
28 #include "CtTypes.h"
29
30 class IContactEventListener;
31
32 class ContactPresentationModel
33         : public Tizen::Social::IAddressbookChangeEventListener
34 {
35 public:
36         ContactPresentationModel(void);
37         virtual ~ContactPresentationModel(void);
38
39         result Construct(void);
40         result PrepareNewContact(void);
41         result SetContactId(const Tizen::Social::RecordId contactId, bool isEditing = false);
42         result SetVcfPath(const Tizen::Base::String& filePath, bool isNewContact = false);
43         Tizen::Base::String GetVcfPath(void);
44         Tizen::Social::RecordId GetContactId(void);
45         Tizen::Base::String GetValue(DetailProperty id, int index = -1);
46         result GetDisplayName(Tizen::Base::String& name);
47         result GetBirthday(Tizen::Base::DateTime& value);
48         Tizen::Base::String GetType(DetailProperty id, int index = -1);
49         Tizen::Graphics::Bitmap* GetThumbnailN(void);
50         Tizen::Graphics::Bitmap* GetAccountIconN(const Tizen::Base::String& account);
51         result SetValue(DetailProperty id, const Tizen::Base::String& value, int index = 0);
52         result SetCustomType(DetailProperty id, const Tizen::Base::String& value, int index);
53         Tizen::Base::String GetCustomType(DetailProperty id, int index);
54         result SetBirthday(const Tizen::Base::DateTime& value);
55         result RemoveBirthday(void);
56         result SetPhoneNumber(DetailPhoneNumberType type, const Tizen::Base::String& value, int index = 0);
57         result SetEmail(DetailEmailType type, const Tizen::Base::String& value, int index = 0);
58         result SetAddress(DetailAddressType type, const Tizen::Base::String& value, int index = 0, DetailProperty property = DETAIL_PROPERTY_ADDRESS_STREET);
59         result SetUrl(DetailUrlType type, const Tizen::Base::String& value, int index = 0);
60         result SetImAddress(DetailImAddressType type, const Tizen::Base::String& value, int index = 0);
61         result SetThumbnail(const Tizen::Base::String& filePath);
62         result SetOrganization(DetailProperty id, const Tizen::Base::String& value);
63         result AddAddressBook(void);
64         int GetMultiValuesCount(DetailProperty id);
65         int GetCategoryCount(void);
66         int GetDefaultNumberIndex(void);
67         Tizen::Base::Collection::IList* GetAssignedCategoryIdListN(void);
68         result AddContactToCategory(const Tizen::Social::RecordId categoryId);
69         result RemoveContactFromAllCategories(void);
70         result AddContact(void);
71         result UpdateContact(void);
72         result RemoveContact(void);
73         bool IsContactRemoved(void);
74         void AddContactChangeListener(const IContactEventListener& listener);
75         void RemoveContactChangeListener(const IContactEventListener& listener);
76
77         Tizen::Base::String GetPhoneNumberTypeString(DetailPhoneNumberType type);
78         Tizen::Base::String GetEmailTypeString(DetailEmailType type);
79         Tizen::Base::String GetAddressTypeString(DetailAddressType type);
80         Tizen::Base::String GetUrlTypeString(DetailUrlType type);
81         Tizen::Base::String GetImAddressTypeString(DetailImAddressType type);
82
83         DetailPhoneNumberType GetPhoneNumberType(int index);
84         DetailEmailType GetEmailType(int index);
85         DetailAddressType GetAddressType(DetailProperty id, int index);
86         DetailUrlType GetUrlType(int index);
87         DetailImAddressType GetImAddressType(int index);
88
89         void SetAsFavorite(bool isFavorite);
90         bool IsFavorite(void);
91
92         virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
93         virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList);
94
95 private:
96         Tizen::Base::String GetCategory(void);
97         Tizen::Base::String GetRingtone(void);
98         Tizen::Base::String GetDefaultNumber(DetailPhoneNumberType& type);
99         Tizen::Base::String GetPhoneNumber(int index, DetailPhoneNumberType& type);
100         Tizen::Base::String GetEmail(int index, DetailEmailType& type);
101         Tizen::Base::String GetImAddress(int index, DetailImAddressType& typeIndex);
102         Tizen::Base::String GetAddress(DetailProperty id, int index, DetailAddressType& typeIndex);
103         Tizen::Base::String GetUrl(int index, DetailUrlType& typeIndex);
104         Tizen::Base::String GetDateTime(DetailProperty id);
105         result SetAddress(DetailProperty id, const Tizen::Base::String& value);
106         result GetDefaultCategoryName(Tizen::Base::String& categoryName);
107
108 private:
109         Tizen::Base::Collection::ArrayList* __pAssignedCategoryList;
110         Tizen::Base::Collection::ArrayList* __pContactListenerList;
111         Tizen::Base::String __vcfPath;
112         Tizen::Social::Contact* __pContact;
113         Tizen::Social::Addressbook* __pAddressbook;
114         Tizen::Social::Address __address;
115         int __defaultNumberIndex;
116         int  __lastRemovedContactIndex;
117         int __lastRemovedEmailIndex;
118         bool __newMode;
119         bool __isEditing;
120 };
121
122
123 #endif /* _CT_CONTACT_PRESENTATION_MODEL_H_ */