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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
/*
* Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
*
* This file is part of ug-contacts-efl
*
* Written by Youngjae Shin <yj99.shin@samsung.com>
* Donghee Ye <donghee.ye@samsung.com>
* Sunggoo Kim <sung.goo.kim@samsung.com>
*
* PROPRIETARY/CONFIDENTIAL
*
* This software is the confidential and proprietary information of
* SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered
* into with SAMSUNG ELECTRONICS.
* SAMSUNG make no representations or warranties about the suitability
* of the software, either express or implied, including but not limited
* to the implied warranties of merchantability, fitness for a particular
* purpose, or non-infringement. SAMSUNG shall not be liable for any
* damages suffered by licensee as a result of using, modifying or
* distributing this software or its derivatives.
*
*/
#include <aul.h>
#include <ui-gadget-module.h>
#include "contacts.h"
#include "ct-common.h"
inline void ctui_ld_to_dd(ct_list_data *clist_d, ct_detail_data *cdetail_d)
{
cdetail_d->win = clist_d->win;
cdetail_d->navi = clist_d->navi;
cdetail_d->base_grp = clist_d->base_grp;
cdetail_d->base_ab = clist_d->base_ab;
cdetail_d->ug = clist_d->ug;
cdetail_d->prev_navi_item = clist_d->navi_item;
cdetail_d->clist_d = clist_d;
}
#define CT_UG_BUNDLE_RESULT_ID "id"
void ctui_ug_return_id(struct ui_gadget *ug, int ct_id, int num_id, int email_id)
{
bundle *bd;
char buf[16];
bd = bundle_create();
c_retm_if(NULL == bd, "bundle_create() Failed");
if (ct_id) {
snprintf(buf, sizeof(buf), "%d", ct_id);
bundle_add(bd, CT_UG_BUNDLE_RESULT_ID, buf);
bundle_add(bd, CT_UG_BUNDLE_RESULT_CONTACT_ID, buf);
}
if (num_id) {
snprintf(buf, sizeof(buf), "%d", num_id);
bundle_del(bd, CT_UG_BUNDLE_RESULT_ID);
bundle_add(bd, CT_UG_BUNDLE_RESULT_ID, buf);
bundle_add(bd, CT_UG_BUNDLE_RESULT_NUMBER_ID, buf);
}
if (email_id) {
snprintf(buf, sizeof(buf), "%d", email_id);
bundle_del(bd, CT_UG_BUNDLE_RESULT_ID);
bundle_add(bd, CT_UG_BUNDLE_RESULT_ID, buf);
bundle_add(bd, CT_UG_BUNDLE_RESULT_EMAIL_ID, buf);
}
ug_send_result(ug, bd);
bundle_free(bd);
}
int ctui_get_display_name(CTSvalue *name, char *dest, int dest_len)
{
const char *first, *last, *display;
display = contacts_svc_value_get_str(name, CTS_NAME_VAL_DISPLAY_STR);
if (display)
snprintf(dest, dest_len, "%s", display);
else {
first = contacts_svc_value_get_str(name, CTS_NAME_VAL_FIRST_STR);
last = contacts_svc_value_get_str(name, CTS_NAME_VAL_LAST_STR);
if (CTS_ORDER_NAME_FIRSTLAST == contacts_svc_get_order(CTS_ORDER_OF_DISPLAY))
snprintf(dest, dest_len, "%s%s%s", SAFE_STR(first), STR_BLANK(first, last));
else
snprintf(dest, dest_len, "%s%s%s", SAFE_STR(last), STR_BLANK(last, first));
}
return 0;
}
void ctui_get_number_type_str(int cts_num_type, char *dest, int dest_len)
{
const char* type_str;
if (cts_num_type & CTS_NUM_TYPE_CUSTOM) {
char *custom;
custom = contacts_svc_get_custom_type(CTS_TYPE_CLASS_NUM, cts_num_type);
if (NULL == custom)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_OTHER);
else {
snprintf(dest, dest_len, "%s", custom);
free(custom);
return;
}
}
else if (cts_num_type & CTS_NUM_TYPE_CELL)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_MOBILE);
else if (cts_num_type & CTS_NUM_TYPE_VOICE) {
if (cts_num_type & CTS_NUM_TYPE_HOME)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_HOME);
else if (cts_num_type & CTS_NUM_TYPE_WORK)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_WORK);
else
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_TELEPHONE);
}
else if (cts_num_type & CTS_NUM_TYPE_FAX) {
if (cts_num_type & CTS_NUM_TYPE_HOME)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX);
else if (cts_num_type & CTS_NUM_TYPE_WORK)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX);
else
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_FAX);
}
else if (cts_num_type & CTS_NUM_TYPE_PAGER)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_PAGER);
else if (cts_num_type & CTS_NUM_TYPE_CAR)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_CAR);
else if (cts_num_type & CTS_NUM_TYPE_ASSISTANT)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_ASSISTANT);
else {
if (cts_num_type == CTS_NUM_TYPE_HOME)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_HOME);
else if (cts_num_type == CTS_NUM_TYPE_WORK)
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_WORK);
else
type_str = T_(CT_GET_TEXT_NUM_TYPE, CTTEXT_TYPE_OTHER);
}
snprintf(dest, dest_len, "%s", type_str);
}
const char* ctui_get_default_contact_img(int view_type)
{
switch (view_type) {
case CT_VIEW_DETAIL:
return CTUI_IMG_DEFAULT_PHOTO_90_90;
case CT_VIEW_INPUT:
return CTUI_IMG_PHOTO_EDIT;
case CT_VIEW_ETC:
default:
return CTUI_IMG_DEFAULT_PHOTO_70_70;
}
}
Evas_Object* ctui_create_btn(Evas_Object *parent, const char *label)
{
Evas_Object *btn;
btn = elm_button_add(parent);
c_retvm_if(NULL == btn, NULL, "elm_button_add() return NULL");
elm_object_style_set(btn, "style2");
elm_object_text_set(btn, label);
evas_object_show(btn);
return btn;
}
inline void ctui_voice_call(const int id, const char* number)
{
char idx[10];
bundle *bd = bundle_create();
c_retm_if(NULL == bd, "bundle_create() Failed");
bundle_add(bd, "launch-type", "MO");// "MO" : normal call, "EMERGENCY" : emergency call
bundle_add(bd, "number", number);
snprintf(idx, sizeof(idx), "%d", id);
bundle_add(bd, "ctindex", idx);
aul_launch_app(VOICE_CALL_UI_PKG, bd);
bundle_free(bd);
}
Evas_Object* ctui_new_confirm_popup(Evas_Object *win, const char* description)
{
Evas_Object* notify = elm_popup_add(win);
evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_text_set(notify, description);
evas_object_show(notify);
return notify;
}
void ctui_msg_ug(struct ui_gadget *parent, const char *number, const int idx, const char *attach)
{
struct ug_cbs cbs = {0};
struct ui_gadget* ug;
bundle* bd = bundle_create();
c_retm_if(NULL == bd, "bundle_craete() return NULL");
if (number && idx) {
char temp[CT_TEXT_SHORT_LEN];
snprintf(temp, sizeof(temp), "%s/%d", number, idx);
bundle_add(bd, "number/index", temp);
}
else if (number) {
bundle_add(bd, "TO", number);
}
if (attach) {
bundle_add(bd, "ATTACHFILE", attach);
bundle_add(bd, "SUBJECT", "Contacts name card");
}
cbs.layout_cb = ctui_ug_layout_cb;
cbs.result_cb = NULL;
cbs.destroy_cb = ctui_ug_destroy_cb;
ug = ug_create(parent, MSG_COMPOSER_UG, UG_MODE_FULLVIEW, bd, &cbs);
c_warn_if(NULL == ug, "ug_create() Failed");
bundle_free(bd);
}
Evas_Object* ctui_naviframe_btn(Evas_Object *parent, const char *label)
{
Evas_Object *btn;
btn = elm_button_add(parent);
elm_object_style_set(btn, "naviframe/title/default");
elm_object_text_set(btn, label);
evas_object_show(btn);
return btn;
}
void ctui_cbar_item_clear(Evas_Object *cbar)
{
Elm_Object_Item *c_item, *n_item;
c_retm_if(NULL == cbar, "parameter(toolbar) is NULL");
c_item = elm_toolbar_first_item_get(cbar);
while (c_item) {
n_item = elm_toolbar_item_next_get(c_item);
elm_object_item_del(c_item);
c_item = n_item;
}
evas_object_data_del(cbar, "done_item");
evas_object_data_del(cbar, "delete_item");
evas_object_data_del(cbar, "move_item");
evas_object_data_del(cbar, "copy_item");
}
void ctui_entry_limit_size_set(Evas_Object *entry)
{
const int EDITFIELD_MAX_CHAR = 700;
static Elm_Entry_Filter_Limit_Size filter;
c_retm_if(NULL == entry, "parameter(entry) is NULL");
filter.max_char_count = EDITFIELD_MAX_CHAR;
elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &filter);
}
void ctui_genlist_append_separator_10px(Evas_Object *genlist)
{
static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/10" };
Elm_Object_Item *item;
item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
}
void ctui_genlist_append_separator_20px(Evas_Object *genlist)
{
static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/20" };
Elm_Object_Item *item;
item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
}
void ctui_cbar_btn_disabled_set(Evas_Object *cbar, Eina_Bool disabled)
{
Elm_Object_Item *done_item, *delete_item, *move_item, *copy_item;
c_retm_if(NULL == cbar, "parameter(cbar) is NULL");
done_item = evas_object_data_get(cbar, "done_item");
delete_item = evas_object_data_get(cbar, "delete_item");
move_item = evas_object_data_get(cbar, "move_item");
copy_item = evas_object_data_get(cbar, "copy_item");
if(done_item)
elm_object_item_disabled_set(done_item, disabled);
if(delete_item)
elm_object_item_disabled_set(delete_item, disabled);
if(move_item)
elm_object_item_disabled_set(move_item, disabled);
if(copy_item)
elm_object_item_disabled_set(copy_item, disabled);
}
char* ctui_entry_markup_to_utf8(const char *s)
{
int i;
char *ret;
ret = elm_entry_markup_to_utf8(s);
c_retvm_if(NULL == ret, NULL, "elm_entry_markup_to_utf8() return NULL");
for (i = 0; i < strlen(ret); i++)
if (' ' != ret[i]) return ret;
ret[0] = '\0';
return ret;
}
void ctui_entry_entry_set(Evas_Object *entry, const char *s)
{
char *s_markup;
if(NULL == s || '\0' == s[0])
return;
s_markup = elm_entry_utf8_to_markup(s);
elm_entry_entry_set(entry, s_markup);
free(s_markup);
}
void ctui_back_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win = data;
elm_win_lower(win);
}
void ctui_list_detail_genlist_append_separator_line_20px(Evas_Object *genlist)
{
static Elm_Genlist_Item_Class itc = { .item_style="dialogue/separator/21/with_line" };
Elm_Object_Item *item;
item = elm_genlist_item_append(genlist, &itc, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
}
void ctui_list_ug_hide_cb(void *data, Evas_Object *obj, void *event_info)
{
ug_destroy_me(data);
}
|