summaryrefslogtreecommitdiff
path: root/lib-contact/ct-detail/src/CtInputViewControl.h
blob: 6a0948b8fefd988d33ae07793a54528520f33558 (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
/*
 * 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_INPUT_VIEW_CONTROL_H_
#define _CT_INPUT_VIEW_CONTROL_H_

#include <Elementary.h>

#include <contacts.h>
#include <system_settings.h>

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

#include "ContactsCommon.h"

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


class CtInputData;
class CtInputView;

class CtInputViewControl: public WControl
{
public:
	CtInputViewControl( std::shared_ptr<CtData>& inputData, CtInputView* view );

public:
	int getAddedIndex() { return __addedIndex; }

	bool getIsCreate();
	bool getIsEmpty();
	bool getIsChanged();
	void updateNumberSaveBtn(Eina_Bool isEmpty);
	void setIsDestroy(bool isDestroy);
	Evas_Object* getViewEvasObj();
	Evas_Object* getNaviframeEvasObj();

	void showTopItem();
	void basicInfoItemShowCreateKeypad( Evas_Object* obj);

protected:
	virtual Evas_Object* onCreate(Evas_Object* parent, void* viewParam);
	virtual void onDestroy();

private:
	void __initialize();
	void __addAllItems(Evas_Object* genlist);
	static void __genlistRealizedCb(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();

	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 __galleryReplyCb(app_control_h request, app_control_h reply, app_control_result_e result, void *data);
	static void __launchGallery(CtInputViewControl *control);
	static void __cameraReplyCb(app_control_h request, app_control_h reply, app_control_result_e result, void *data);
	static void __launchCamera(CtInputViewControl *control);

	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 __messengerItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __addressItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __websiteItemDeleted(Elm_Object_Item* deleteItem, bool isChanged, contacts_record_h record);
	void __relationItemDeleted(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);

	bool __checkIsChanged();
	bool __checkIsEmpty();
	void __updateSaveBtn();
	void __updateNoteBtn(bool isNoteInput);

	void __itemChanged();
	void __basicInfoItemImageClicked(Evas_Object* obj);
	void __basicInfoItemDeleted( int deletedInfo);
	void __activateNextEntry(Evas_Object* obj, Elm_Object_Item* item);
	void __basicInfoExpandClickedCb();
	void __basicInfoUpdateImage();
	Elm_Object_Item* __getLastItem(Elm_Object_Item* deleteItem);
	void __updateEntryReturnKeyType(Elm_Object_Item* deleteItem);
	void __setEntryUnfocus();

	static void __regionFormatChangedCb(system_settings_key_e key, void *data);
	void __updateBasicInfoItem();
	void __resetTheme();
	void __createEventDataPopup();
	void __appendEventItem(int year, int month, int day);
	static void __onSipUpCb(void *data, Evas_Object *obj, void *event_info);
	static void __onSipDownCb(void *data, Evas_Object *obj, void *event_info);
	void __showMorePopup();

private:
	CtInputViewControl();
	virtual ~CtInputViewControl();

private:

	typedef enum {
		INPUT_BASIC_INFO = 0,
		INPUT_NUMBER,
		INPUT_EMAIL,
		INPUT_NOTE,
		INPUT_ADDRESS,

		INPUT_EVENT,
		INPUT_RELATIONSHIP,
		INPUT_URL,
		INPUT_MESSENGER,

		INPUT_IMPORTANT_FIELDS,
		INPUT_IMPORTANT_SUBITEM,
		INPUT_ITEMS_MAX,
	}CtInputItems;

	typedef enum {
		INPUT_IMPORTANT_NONE = 0,
		INPUT_IMPORTANT_ADDRESS,
		INPUT_IMPORTANT_EVENT,
		INPUT_IMPORTANT_NICKNAME,
		INPUT_IMPORTANT_RELATIONSHIP,
		INPUT_IMPORTANT_ORGANIZATION,
		INPUT_IMPORTANT_URL,
		INPUT_IMPORTANT_MESSENGER,
		INPUT_IMPORTANT_PHONETIC_INFO,
		INPUT_IMPORTANT_MAX,
	}CtInputSubItems;

	Evas_Object *__nameEntry;
	Evas_Object* __genlist;
	Evas_Object* __conformant;

	bool __changed;
	bool __isDestroy;
	bool __needResetTheme;
	bool __needShowMorePopup;
	bool __sipIsShown;

	int __addedIndex;

	Elm_Object_Item *__genlistItems[INPUT_ITEMS_MAX];

	//
	std::shared_ptr<bool> __birthdayEventExist;

	std::shared_ptr<CtData> __inputData;
	CtInputView* __view;

	Ecore_Timer* __keypadTimer;
};

#endif /* _CT_INPUT_VIEW_H_ */