change sound path of mms media
[apps/core/preloaded/message-app.git] / common / msg-ui-util.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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 #ifndef __MSG_UTIL_H__
19 #define __MSG_UTIL_H__
20
21 #include <stdio.h>
22 #include <string.h>
23 #include "dlog.h"
24 #include <vconf.h>
25 #include <heynoti.h>
26 #include "msg-ui-bundle.h"
27
28 #include <unicode/udat.h>
29 #include <unicode/utypes.h>
30 #include <unicode/ustring.h>
31
32 #ifndef MSG_BOOL
33 #define MSG_BOOL char
34 #endif
35 #ifndef TRUE
36 #define TRUE    1
37 #endif
38 #ifndef FALSE
39 #define FALSE   0
40 #endif
41
42
43 #define MESSAGE_PKGNAME "message"
44
45 #define _EDJ(o)         elm_layout_edje_get(o)
46
47 #define TAG_MSG_UI                      "MESSAGE_APP"
48
49 #define MSG_UI_LEVEL_DEBUG              0
50 #define MSG_UI_LEVEL_ERR                1
51 #define MSG_UI_LEVEL_ASSERT             2
52
53 #define DEF_BUF_LEN_D   (10)
54 #define DEF_BUF_LEN_S   (128)
55 #define DEF_BUF_LEN     (512)
56 #define DEF_BUF_LEN_L   (4096)
57
58 #define DEF_PATH_MAX    (4096)
59 #define DEF_IMG_PATH_LEN        (1024)
60 #define DEF_MAX_MSG_TEXT_LEN    (1530)
61 #define MSG_UI_URL_MAX_LEN      (1024)
62 #define DEF_MAX_EMAIL_LEN       (255)
63
64 #define DEF_THREAD_ADDR_LEN     (200)
65 #define DEF_THREAD_NAME_LEN     (200)
66
67 #define DEF_VALID_ADDRESS_LEN   (9)
68
69 #define MSG_UI_TIME_PATTERN_12H         "hma"
70 #define MSG_UI_TIME_PATTERN_24H         "Hm"
71
72 enum {
73         MSG_UI_RET_ERR = -1,
74         MSG_UI_RET_SUCCESS = 0,
75 };
76
77 #define D_PRINT(fmt, args...)       \
78         LOG(LOG_DEBUG, TAG_MSG_UI, fmt, ##args);
79
80 #define D_MSG(fmt, args...)       \
81         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[%s %s() #%d ]" fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__,  __LINE__, ##args);
82
83 #define D_EMSG(fmt, args...)       \
84         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[ERROR][%s %s() #%d ]" fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, ##args);
85
86 #define D_ENTER\
87         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[ENTER][%s %s(%p) #%d ]>>>>>\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __FUNCTION__,  __LINE__);
88
89 #define D_LEAVE\
90         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[LEAVE][%s %s() #%d]<<<<<\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__);
91
92 #define D_MSG_RETM_IF(expr, fmt, args...) do { \
93                 if (expr) { \
94                         LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return message : " fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr, ##args); \
95                         return; \
96                 } \
97         } while (0)
98
99 #define D_MSG_RETVM_IF(expr, val, fmt, args...) do { \
100                         if (expr) { \
101                                 LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return value : %d, message : " fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr, val, ##args); \
102                                 return (val); \
103                         } \
104                 } while (0)
105
106
107 #define MSG_UI_DEBUG(level, fmt, args...)       \
108         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[File: %s : %s() #%d] " fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, ##args);
109 #define MSG_UI_ENTER(level)     \
110         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[File: %s : %s() #%d] enter \n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__),  __FUNCTION__, __LINE__);
111 #define MSG_UI_LEAVE(level)     \
112         LOG(LOG_DEBUG, TAG_MSG_UI, "\n[File: %s : %s() #%d] leave \n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__);
113
114 #define MSG_UI_RET_IF(level, expr) do { \
115                 if (expr) { \
116                         LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr); \
117                         return; \
118                 } \
119         } while (0)
120 #define MSG_UI_RETV_IF(level, expr, val) do { \
121                 if (expr) { \
122                         LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return value : %d\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr, val); \
123                         return (val); \
124                 } \
125         } while (0)
126 #define MSG_UI_RETM_IF(level, expr, fmt, args...) do { \
127                 if (expr) { \
128                         LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return message : " fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr, ##args); \
129                         return; \
130                 } \
131         } while (0)
132 #define MSG_UI_RETVM_IF(level, expr, val, fmt, args...) do { \
133                 if (expr) { \
134                         LOG(LOG_ERROR, TAG_MSG_UI, "\n[File: %s : %s() #%d][(%s)] Return value : %d, message : " fmt "\n", (rindex(__FILE__, '/') ? (rindex(__FILE__, '/')+1) : __FILE__), __FUNCTION__, __LINE__, #expr, val, ##args); \
135                         return (val); \
136                 } \
137         } while (0)
138
139
140 #define MSG_THREAD_UG_NAME              "msg-thread-efl"
141 #define MSG_COMPOSER_UG_NAME            "msg-composer-efl"
142 #define MSG_SETTING_UG_NAME             "msg-setting-efl"
143 #define MSG_BUBBLE_UG_NAME              "msg-conversation-efl"
144 #define MSG_VIEWER_UG_NAME              "msg-viewer-efl"
145
146 #define PRIVACY_SETTING_UG_NAME         "setting-passwd-efl"
147 #define EMAIL_COMPOSER_UG_NAME          "email-composer-efl"
148 #define CALL_SETTING_UG_NAME            "setting-call-efl"
149
150 /* Other application's pkg name */
151 #define VIDEO_CALL_PKG_NAME             "org.tizen.vtmain"
152 #define VOICE_CALL_PKG_NAME             "org.tizen.call"
153 #define VIDEO_PLAYER_PKG_NAME           "org.tizen.video-player"
154
155 /* NOTIFY MESSAGE */
156 #define MSG_UI_NOTI_UNDER_CONTRUCT      "Under construction"
157 #define MSG_UI_NOTI_BLOCKED             "Blocked"
158 #define MSG_UI_NOTI_ALREADY_BLOCKED     "Already blocked for this address"
159
160 /* Navigation icon*/
161 #define MSG_HEADER_ICON_CANCEL                  IMGDIR"/01_header_icon_cancel.png"
162 #define MSG_HEADER_ICON_DONE                    IMGDIR"/01_header_icon_done.png"
163
164 #define MSG_TITLE_ICON_VOICECALL                IMGDIR"/M01_icon_voice_call.png"
165 #define MSG_TITLE_ICON_VIDEOCALL                IMGDIR"/M01_icon_video_call.png"
166 #define MSG_TITLE_ICON_ADD_TO_CONTACT   IMGDIR"/01_controllbar_icon_add_to_contact.png"
167 #define MSG_CONTROLBAR_ICON_VIEW_CONTACT        IMGDIR"/M01_icon_view_contact.png"
168
169 /* Controlbar Icon */
170 #define MSG_CONTROLBAR_IMG_PATH         IMGDIR"/controlbar/"
171
172 #define MSG_CONTROLBAR_ICON_COMPOSE             MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_compose.png"
173 #define MSG_CONTROLBAR_ICON_CANCEL              MSG_CONTROLBAR_IMG_PATH"01_controllbar_icon_close.png"
174 #define MSG_CONTROLBAR_ICON_DELETE              MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_delete.png"
175 #define MSG_CONTROLBAR_ICON_FORWARD             MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_forward.png"
176 #define MSG_CONTROLBAR_ICON_MORE                MSG_CONTROLBAR_IMG_PATH"M01_controlbar_icon_more.png"
177 #define MSG_CONTROLBAR_ICON_SETTINGS            MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_settings.png"
178 #define MSG_CONTROLBAR_ICON_EDIT                MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_edit.png"
179
180 /* viewer */
181 #define MSG_CONTROLBAR_ICON_PAUSE               MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_pause.png"
182 #define MSG_CONTROLBAR_ICON_PLAY                MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_Play.png"
183 #define MSG_CONTROLBAR_ICON_SAVE                MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_save.png"
184 #define MSG_CONTROLBAR_ICON_ATTACH              MSG_CONTROLBAR_IMG_PATH"M01_controlbar_icon_attach.png"
185 #define MSG_CONTROLBAR_ICON_REPLY               MSG_CONTROLBAR_IMG_PATH"M01_controlbar_icon_reply.png"
186 #define MSG_CONTROLBAR_ICON_RESEND              MSG_CONTROLBAR_IMG_PATH"M01_controlbar_icon_resend.png"
187
188 /* setting */
189 #define MSG_CONTROLBAR_ICON_CREATE              MSG_CONTROLBAR_IMG_PATH"01_controlbar_icon_create.png"
190
191
192 typedef enum {
193         MSG_TIME_FORMAT_12H = 0,
194         MSG_TIME_FORMAT_24H,
195         MSG_TIME_FORMAT_UNKNOWN
196
197 } msg_time_format;
198
199 enum {
200         CONTROLBAR_ITEM_1 = 0,
201         CONTROLBAR_ITEM_2,
202         CONTROLBAR_ITEM_3,
203         CONTROLBAR_ITEM_4,
204 };
205
206 enum {
207         MSG_UI_STATE_NONE = 0,
208         MSG_UI_STATE_RUNNING,
209         MSG_UI_STATE_PAUSE,
210         MSG_UI_STATE_DESTROY,
211         MSG_UI_STATE_MAX,
212 };
213
214 #endif /* __MSG_UTIL_H__ */