summaryrefslogtreecommitdiff
path: root/include/contacts-ug.h
blob: 78bd7e76836562f4467b12df5c657a423d7a8e1d (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
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
/*
* Copyright 2012 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.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://floralicense.org/license/
*
* 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 __CONTACTS_UG_H__
#define __CONTACTS_UG_H__

/**
 * @defgroup   CONTACTS_UG Contacts UI-gadget
 * @ingroup    SLP_UG
 * @addtogroup CONTACTS_UG
 * @{
 *
 * Contacts UI-gadget
 * \n This header file contains the declaration & description for Contacts UG.
 *
 * @section Header To use Them:
 * @code
 * #include <contacts-ug.h>
 * @endcode
 *
 * @section example Example:
 * @code
 #include <stdio.h>
 #include <ui-gadget.h>
 #include <contacts-ug.h>

 void contacts_detail_ug(int contact_id)
 {
    bundle *bd;
    char buf[16];

    bd = bundle_create();
    if(NULL == bd) {
       ERR("bundle_create() Failed");
       return;
    }

    snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
    bundle_add(bd, CT_UG_BUNDLE_TYPE, buf);
    snprintf(buf, sizeof(buf), "%d", contact_id);
    bundle_add(bd, CT_UG_BUNDLE_ID, buf);

    cbs.layout_cb = ug_layout_cb;
    cbs.result_cb = NULL;
    cbs.destroy_cb = ug_destroy_cb;

    ug = ug_create(NULL, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, bd, &cbs);
    if(NULL == ug)
       ERR("ug_create() Failed");

    bundle_free(bd);
 }
 * @endcode
 *
 */

/**
 * The name of details/new/edit UG
 * @see #CT_UG_DETAILS_TYPES
 */
#define UG_CONTACTS_DETAILS "contacts-details-efl"

/**
 * The name of list UG
 * @see #CT_UG_LIST_TYPES
 */
#define UG_CONTACTS_LIST "contacts-list-efl"

/**
 * The name of setting UG
 */
#define UG_CONTACTS_SETTINGS "contacts-settings-efl"

/**
 * types of #UG_CONTACTS_DETAILS
 */
enum CT_UG_DETAILS_TYPES{
	CT_UG_REQUEST_DETAIL = 0,/**< . */

	CT_UG_REQUEST_EDIT = 11,/**< . */

	CT_UG_REQUEST_ADD = 21,/**< . */
	CT_UG_REQUEST_ADD_WITH_NUM = 22,/**< . */
	CT_UG_REQUEST_ADD_WITH_EMAIL = 23,/**< . */
	CT_UG_REQUEST_ADD_WITH_WEB = 24,/**< . */
};

/**
 * types of #UG_CONTACTS_LIST
 */
enum CT_UG_LIST_TYPES{
	CT_UG_REQUEST_LIST = 0,/**< . */
	CT_UG_REQUEST_LIST_WITH_BACK = 1,/**< . */

	CT_UG_REQUEST_SELECT_PERSON = 11,/**< . */
	CT_UG_REQUEST_SELECT_NUMBER = 12,/**< . */
	CT_UG_REQUEST_SELECT_EMAIL = 13,/**< . */
	CT_UG_REQUEST_SELECT_VCARD = 14,/**< . */
	CT_UG_REQUEST_SELECT_CONTACT_ADD_TO_HOME = 15,/**< . */
	CT_UG_REQUEST_SELECT_GROUP_ADD_TO_HOME = 16,/**< . */
	CT_UG_REQUEST_SELECT_NUMBER_OR_EMAIL = 17,/**< . */
	CT_UG_REQUEST_SELECT_GROUP = 18, /**< . */

	CT_UG_REQUEST_UPDATE_CONTACT = 20,/**< . */
	CT_UG_REQUEST_UPDATE_WITH_NUM = 21,/**< . */
	CT_UG_REQUEST_UPDATE_WITH_EMAIL = 22,/**< . */
	CT_UG_REQUEST_UPDATE_WITH_WEB = 23,/**< . */

	CT_UG_REQUEST_CHECK = 31,/**< . */
	CT_UG_REQUEST_CHECK_FOR_NUMBER = 32,/**< . */
	CT_UG_REQUEST_CHECK_FOR_EMAIL = 33,/**< . */
	CT_UG_REQUEST_CHECK_FOR_NUMBER_OR_EMAIL = 34,/**< . */

	CT_UG_REQUEST_SAVE_IMG = 41,/**< . */
	CT_UG_REQUEST_SAVE_RINGTONE = 42,/**< . */

	CT_UG_REQUEST_SHARE_CONTACT_INFO = 61,/**< . */
};

#define CT_UG_BUNDLE_ACCOUNTID "account_id"
#define CT_UG_BUNDLE_PERSON_ID "ct_person_id"

/**
 * The key of request bundle for type.
 * \n Value : convert id to string by using \%d.
 */
#define CT_UG_BUNDLE_TYPE "type"

/**
 * The key of request bundle for contact index
 * \n Value : convert id to string by using \%d
 * \n Use on #CT_UG_REQUEST_DETAIL, #CT_UG_REQUEST_EDIT
 */
#define CT_UG_BUNDLE_ID "person_id"

/**
 * The key of request bundle for vcard stream.
 * \n Value : vcard stream.(It is not a filepath.)
 * \n Use only on #CT_UG_REQUEST_ADD.
 */
#define CT_UG_BUNDLE_VCARD "ct_vcard"

/**
 * The key of request bundle for number
 * \n Use on #CT_UG_REQUEST_ADD_WITH_NUM, #CT_UG_REQUEST_UPDATE_WITH_NUM
 * \n Value : (string)number
 */
#define CT_UG_BUNDLE_NUM "ct_num"

/**
 * The key of request bundle for email
 * \n Use on #CT_UG_REQUEST_ADD_WITH_EMAIL, #CT_UG_REQUEST_UPDATE_WITH_EMAIL
 * \n (string)email address
 */
#define CT_UG_BUNDLE_EMAIL "ct_email"

/**
 * The key of request bundle for web
 * \n Use on #CT_UG_REQUEST_ADD_WITH_WEB, #CT_UG_REQUEST_UPDATE_WITH_WEB
 * \n Value : (string)web address
 */
#define CT_UG_BUNDLE_WEB "ct_web"

/**
 * The key of request bundle for path(ringtone or img)
 * \n Use on #CT_UG_REQUEST_SAVE_IMG, #CT_UG_REQUEST_SAVE_RINGTONE
 * \n Value : (string)absolutely path
 */
#define CT_UG_BUNDLE_PATH "ct_path"

/**
 * The key of request bundle for maximum number to select.
 * \n Use on #CT_UG_REQUEST_CHECK
 * \n Value : convert maximum number to string by using \%d (0 is ALL)
 */
#define CT_UG_BUNDLE_MAX "ct_max"

/**
 * The key of result bundle for contact index
 * \n The contact index on #CT_UG_REQUEST_ADD , CT_UG_REQUEST_ADD_XXX
 * \n The contact index on #CT_UG_REQUEST_SELECT_PERSON
 * \n Value : convert id to integer by using atoi()
 * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
 * \n In ug_cbs.result_cb, ug_destroy() should not be called.
 */
#define CT_UG_BUNDLE_RESULT_PERSON_ID "person_id"

/**
 * The key of result bundle for the index of number value
 * \n The number value index on #CT_UG_REQUEST_SELECT_NUMBER
 * \n Value : convert id to integer by using atoi()
 * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
 * \n In ug_cbs.result_cb, ug_destroy() should not be called.
 */
#define CT_UG_BUNDLE_RESULT_NUMBER_ID "num_id"

/**
 * The key of result bundle for the index of email value
 * \n The email value index on #CT_UG_REQUEST_SELECT_EMAIL
 * \n Value : convert id to integer by using atoi()
 * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
 * \n In ug_cbs.result_cb, ug_destroy() should not be called.
 */
#define CT_UG_BUNDLE_RESULT_EMAIL_ID "email_id"

/**
 * The key of result bundle for the index of group value
 * \n The group value index on #CT_UG_REQUEST_SELECT_GROUP
 * \n Value : convert id to integer by using atoi()
 * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
 * \n In ug_cbs.result_cb, ug_destroy() should not be called.
 */
#define CT_UG_BUNDLE_RESULT_GROUP_ID "group_id"

/**
 * The key of result bundle for a list of contact index
 * \n The contact index on #CT_UG_REQUEST_CHECK
 * \n Value : convert string to a integer array by using g_base64_decode()
 * \n Recommends to destroy Contacts UG at ug_cbs.destroy_cb.(not ug_cbs.result_cb)
 * \n In ug_cbs.result_cb, ug_destroy() should not be called.
 * @par example
 * @code
 void contacts_result_cb(struct ui_gadget *ug, bundle *result, void *data)
 {
    if(NULL == ug || NULL == data)
       return;

    if(result) {
       const char *val;
       int *list, len, i;

       val = bundle_get_val(result, CT_UG_BUNDLE_RESULT_PERSON_ID_LIST);
       list = (int *)g_base64_decode(val, &len);

       for(i=0;i<len/sizeof(int);i++)
          printf("selected contact = %d", list[i]);

       g_free(list);
    }
 }
 *
 * @endcode
 */
#define CT_UG_BUNDLE_RESULT_PERSON_ID_LIST "person_id_list"
#define CT_UG_BUNDLE_RESULT_NUMBER_ID_LIST "num_id_list"
#define CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST "email_id_list"
#define CT_UG_BUNDLE_RESULT_PERSON_INFO "person_info"
/**
 * @}
 */

#endif //__CONTACTS_UG_H__