summaryrefslogtreecommitdiff
path: root/lib-contact/ct-detail/inc/CtMyProfileInputView.h
blob: 83bc22e2c84bc60b1b4d5fc94ed2bf9500688722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 * 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_MYPROFILE_INPUT_VIEW_H_
#define _CT_MYPROFILE_INPUT_VIEW_H_

#include <Elementary.h>

#include <contacts.h>

#include "WNaviframe.h"
#include "WPopup.h"
#include "WView.h"

#include "ContactsCommon.h"

#include "ICtChangeListener.h"
#include "CtType.h"
#include "CtView.h"

class CtData;

class WAPP_ASSIST_EXPORT CtMyProfileInputView: public WView, public CtView, public ICtChangeListener
{
public:
	CtMyProfileInputView(contacts_record_h contactRecord);

protected:
	virtual Evas_Object* onCreate(Evas_Object* parent, void* viewParam);
	virtual void onDestroy();
	virtual void onPushed(Elm_Object_Item* naviItem);
	virtual void onEvent(int eventType);
	virtual bool onPop();

private:

	virtual void onDbChanged(const char* viewUri);
	virtual void onCompleteGetContacts(int offset);
	virtual void onConditionChagned();

protected:
	virtual void onLanguageChanged();

private:
	typedef struct {
		CtMyProfileInputView *view;
		contacts_record_h record;
		Elm_Object_Item *item;
		const char *view_uri;
		bool isChanged;
		char *oldVal;
	}CtMyProfileInputViewItem;

	void __initialize();
	void __addAllItems();
	void __addItem(int itemType);

	Evas_Object* __getWindowEvasObj(void);
	Evas_Object* __getNaviframeEvasObj(void);

	static void __onGallerySelCb(void *data, Evas_Object *obj, void *event_info);
	static void __onCameraSelCb(void *data, Evas_Object *obj, void *event_info);
	static void __onRemoveSelCb(void *data, Evas_Object *obj, void *event_info);

	static void __importantSubitemSelectedCb(void* data, Evas_Object* obj, void* event_info);
	void __addNumberClickedCb();
	void __addEmailClickedCb();
	void __addNoteClickedCb();
	void __addMoreClickedCb();
	bool __checkIsEmpty();
	bool __checkIsChanged();
	void __updateSaveBtn();
	void __updateNoteBtn(bool isNoteInput);
	void __save();


	static void __saveCb(void *data, Evas_Object *obj, void *event_info);
	static void __cancelCb(void *data, Evas_Object *obj, void *event_info);
	static void __genlistRealizedCb(void *data, Evas_Object *obj, void *event_info);

	static void __galleryReplyCb(app_control_h request, app_control_h reply, app_control_result_e result, void *data);
	static void __launchGallery(CtMyProfileInputView *view);

	static void __cameraReplyCb(app_control_h request, app_control_h reply, app_control_result_e result, void *data);
	static void __launchCamera(CtMyProfileInputView *view);

	void __itemChanged();
	void __basicInfoItemImageClicked(Evas_Object* obj);
	void __basicInfoItemDeleted( int deletedInfo);
	void __basicInfoItemShowCreateKeypad( Evas_Object* obj);
	void __basicInfoExpandClickedCb();
	void __basicInfoUpdateImage();

	Elm_Object_Item* __getLastItem(Elm_Object_Item* deleteItem);
	void __numberItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __emailItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __addressItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __messengerItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __websiteItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __eventItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __noteItemDeleted( Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __activateNextEntry(Evas_Object* obj, Elm_Object_Item* item);
	void __updateEntryReturnKeyType(Elm_Object_Item* deleteItem);
	void __updateBasicInfoItem();
	void __createEventDataPopup();
	void __appendEventItem(int year, int month, int day);

private:
	CtMyProfileInputView();
	virtual ~CtMyProfileInputView();

private:

	typedef enum {
		MYPROFILE_INPUT_BASIC_INFO = 0,
		MYPROFILE_INPUT_MSISDN,
		MYPROFILE_INPUT_NUMBER,
		MYPROFILE_INPUT_EMAIL,
		MYPROFILE_INPUT_NOTE,

		MYPROFILE_INPUT_ADDRESS,
		MYPROFILE_INPUT_EVENT,
		MYPROFILE_INPUT_URL,
		MYPROFILE_INPUT_MESSENGER,

		MYPROFILE_INPUT_IMPORTANT_FIELDS,
		MYPROFILE_INPUT_IMPORTANT_SUBITEM,
		MYPROFILE_INPUT_ITEMS_MAX,
	}CtMyProfileInputItems;

	typedef enum {
		MYPROFILE_INPUT_IMPORTANT_ADDRESS = 1,
		MYPROFILE_INPUT_IMPORTANT_EVENT,
		MYPROFILE_INPUT_IMPORTANT_NICKNAME,
		MYPROFILE_INPUT_IMPORTANT_ORGANIZATION,
		MYPROFILE_INPUT_IMPORTANT_URL,
		MYPROFILE_INPUT_IMPORTANT_MESSENGER,
		MYPROFILE_INPUT_IMPORTANT_PHONETIC_INFO,
		MYPROFILE_INPUT_IMPORTANT_MAX,
	}CtMyProfileInputSubItems;

	std::shared_ptr<bool> __birthdayEventExist;
	std::shared_ptr<CtData> __inputData;

	int __contactId;
	WPopup* __popup;
	Evas_Object *__genlist;
	Evas_Object *__ctxpopup;
	Evas_Object *__customEntry;
	int __savedAddressbookId;

	bool __saved;
	bool __discard;
	bool __changed;

	int __appendIndex;
	int __addedIndex;

	Elm_Genlist_Item_Class __inputItc[MYPROFILE_INPUT_ITEMS_MAX];
	Elm_Object_Item *__genlistItems[MYPROFILE_INPUT_ITEMS_MAX];

	Evas_Object *__nameEntry;
	char *__basicInfoFullName;
	Evas_Object* __saveBtn;

	bool __baseInfoExpanded;
	bool __isCreate;
};

#endif /* _CT_MYPROFILE_INPUT_VIEW_H_ */