2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://www.tizenopensource.org/license
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.
18 #ifndef __MSG_UI_COMMON_UTILITY_H__
19 #define __MSG_UI_COMMON_UTILITY_H__
21 /*==================================================================================================
23 * ==================================================================================================*/
25 #include <Elementary.h>
27 /*==================================================================================================
29 *==================================================================================================*/
31 #define MSG_COMMON_MAX_UCHAR_PATTERN_LEN 64
32 #define MSG_COMMON_MAX_CHAR_PATTERN_LEN 128
34 #define MSG_COMMON_TAG_TEXT "<wrap=char>"
35 #define MSG_COMMON_NUMBER_MAX_LEN 40
37 /* Define vconf key */
38 #define VCONFKEY_MSG_APP_FONT_SIZE "db/private/org.tizen.message/font_size"
40 #define MSG_COMMON_EDJ EDJDIR"/msg_common.edj"
41 #define MSG_CUSTOM_WINSET_EDJ EDJDIR"/msg_custom_winset.edj"
43 /*==================================================================================================
45 *==================================================================================================*/
48 MSG_APP_FONT_SIZE_TINY = 28,
49 MSG_APP_FONT_SIZE_SMALL = 36,
50 MSG_APP_FONT_SIZE_NORMAL = 44,
51 MSG_APP_FONT_SIZE_LARGE = 70,
52 MSG_APP_FONT_SIZE_HUGE = 102,
56 } MSG_APP_FONT_SIZE_E;
59 MSG_APP_FONT_SIZE_INDEX_SYSTEM_FONT,
60 MSG_APP_FONT_SIZE_INDEX_HUGE,
61 MSG_APP_FONT_SIZE_INDEX_LARGE,
62 MSG_APP_FONT_SIZE_INDEX_NORMAL,
63 MSG_APP_FONT_SIZE_INDEX_SMALL,
64 MSG_APP_FONT_SIZE_INDEX_TINY,
66 MSG_APP_FONT_SIZE_INDEX_MAX
68 } MSG_APP_FONT_SIZE_INDEX_E;
71 MSG_SYS_FONT_SIZE_INDEX_SMALL,
72 MSG_SYS_FONT_SIZE_INDEX_NORMAL,
73 MSG_SYS_FONT_SIZE_INDEX_LARGE,
74 MSG_SYS_FONT_SIZE_INDEX_HUGE,
75 MSG_SYS_FONT_SIZE_INDEX_GIANT,
76 MSG_SYS_FONT_SIZE_INDEX_MAX
77 } MSG_SYS_FONT_SIZE_INDEX_E;
80 MSG_APP_FILE_TYPE_NONE = 0,
81 MSG_APP_FILE_TYPE_IMAGE, /**< Image category */
82 MSG_APP_FILE_TYPE_VIDEO, /**< Video category */
83 MSG_APP_FILE_TYPE_MUSIC, /**< Music category */
84 MSG_APP_FILE_TYPE_SOUND, /**< Sound category */
85 MSG_APP_FILE_TYPE_PDF, /**< Pdf category */
86 MSG_APP_FILE_TYPE_DOC, /**< Word category */
87 MSG_APP_FILE_TYPE_PPT, /**< Powerpoint category */
88 MSG_APP_FILE_TYPE_EXCEL, /**< Excel category */
89 MSG_APP_FILE_TYPE_VOICE, /**< Voice category */
90 MSG_APP_FILE_TYPE_HTML, /**< Html category */
91 MSG_APP_FILE_TYPE_FLASH, /**< Flash category */
92 MSG_APP_FILE_TYPE_TXT, /**< Txt category */
93 MSG_APP_FILE_TYPE_VCONTACT, /**< Vcontact category */
94 MSG_APP_FILE_TYPE_VCALENDAR, /**< Vcalendar category */
95 MSG_APP_FILE_TYPE_VNOTE, /**< Vnote category */
96 MSG_APP_FILE_TYPE_VBOOKMARK, /**< Vbookmark category */
97 MSG_APP_FILE_TYPE_SVG, /**< Svg category */
98 MSG_APP_FILE_TYPE_RSS, /**< Rss reader file, *.opml */
99 MSG_APP_FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */
100 MSG_APP_FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */
101 MSG_APP_FILE_TYPE_DRM, /**< drm file , *.dcf */
102 MSG_APP_FILE_TYPE_ETC, /**< Other files category */
103 MSG_APP_FILE_TYPE_MAX
104 } MSG_APP_FILE_TYPE_E;
106 /*==================================================================================================
107 FUNCTION DECLARATIONS
108 *==================================================================================================*/
111 *@fn msg_common_get_default_locale();
112 *@brief This function is used to get default locale
113 *@return default locale string on success, else NULL pointer on failure
116 const char *msg_common_get_default_locale();
119 *@fn msg_common_get_date_text(const char *locale, char *skeleton, void *time);
120 *@brief This function is used to get data & time string based on both locale and skeleton.
121 * Caller must free returned string after using it, else memory will be leaked
122 *@return data and time formated string on success, else NULL pointer on failure
123 *@param[in] locale locale info. of current setting
124 *@param[in] skeleton skeleton string caller want to see
125 *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed
127 char *msg_common_get_date_text(const char *locale, char *skeleton, void *time);
130 *@fn msg_common_get_display_date(const char *locale, char *bestPattern, time_t *msg_t);
131 *@brief This function is used to get date string based on both locale and bestPattern.
132 * Caller must free returned string after using it, else memory will be leaked
133 *@return date string on success, else NULL pointer on failure
134 *@param[in] locale locale info. of current setting
135 *@param[in] bestPattern best pattern for date and time based on locale
136 *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed
138 char *msg_common_get_display_date(const char *locale, char *bestPattern, time_t *msg_t);
141 *@fn msg_common_get_markup_text(const char *src, int fontsize, char *fontcolor);
142 *@brief This function is used to get marked up string from src text.
143 * Caller must free returned string by using eina_strbuf_free(), else memory will be leaked
144 *@return Eina_Strbuf* marked up string on success, else NULL pointer on failure
145 *@param[in] src original text to be displayed
146 *@param[in] fontsize fontsize to be displayed. If 0 is passed, it is not set
147 *@param[in] fontcolor fontcolor to be displayed. It must be "#ffffff" style. If NULL is passed, it is not set
148 *@param[in] fontstyle fontstyle to be displayed. It must be passed font style like "hilight". If NULL is passed, it is not set
150 Eina_Strbuf *msg_common_get_markup_text(const char *src, int fontsize, char *fontcolor, char *fontstyle);
153 *@fn msg_common_is_valid_phone_number(const char *address);
154 *@brief This function is used to check address is valid number or not
155 *@return return TRUE if address is valide number type, else FALSE
156 *@param[in] address string pointer of address
158 MSG_BOOL msg_common_is_valid_phone_number(const char *address);
161 *@fn msg_common_is_valid_email_addr(const char *address);
162 *@brief This function is used to check address is valid email address or not
163 *@return return TRUE if address is valide email address type, else FALSE
164 *@param[in] address string pointer of address
166 MSG_BOOL msg_common_is_valid_email_addr(const char *address);
169 *@fn msg_common_is_connected_call(void);
170 *@brief This function is used to know (voice or video)call is connected or not
171 *@return return TRUE if call is connected status, else FALSE
173 MSG_BOOL msg_common_is_connected_call(void);
176 *@fn msg_common_get_date_best_pattern(const char *locale, char *skeleton);
177 *@brief This function is used to get best pattern string based on both locale and skeleton.
178 *@return best pattern based on locale for data and time on success, else NULL pointer on failure
179 *@param[in] locale locale info. of current setting
180 *@param[in] skeleton skeleton string caller want to see
182 char *msg_common_get_date_best_pattern(const char *locale, char *skeleton);
185 *@fn msg_common_get_formatted_date(const char *locale, char *bestPattern, void *time);
186 *@brief This function is used to get data & time string from best pattern based on locale.
187 *@return data and time formated string on success, else NULL pointer on failure
188 *@param[in] locale locale info. of current setting
189 *@param[in] bestPattern best pattern for date and time based on locale
190 *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed
192 char *msg_common_get_formatted_date(const char *locale, char *bestPattern, void *time);
195 *@fn msg_common_check_sim_existence(void);
196 *@brief This function is used to know whether SIM is inserted or not.
197 *@return return TRUE if SIM is inserted, else FALSE
199 MSG_BOOL msg_common_is_sim_inserted(void);
202 *@fn msg_common_get_font_size(int *index, int *font_size);
203 *@brief This function is used to get the font size.
204 *@param[in] index index of font size. It is used in message setting.
205 *@param[in] font_size font size which is used in message app.
206 *@return return TRUE if vconf API is success, else FALSE
208 MSG_BOOL msg_common_get_font_size(int *index, int *font_size);
211 *@fn msg_common_set_font_size(void);
212 *@brief This function is used to set the font size.
213 *@return return TRUE if vconf API is success, else FALSE
215 MSG_BOOL msg_common_set_font_size(int index);
218 *@fn msg_common_apply_font_size(void);
219 *@brief This function is used to change the font size.
220 *@param[in] widget_name The widget name which font size is changed.
221 *@param[in] obj The widget which font size is changed.
222 *@return return TRUE if it is success to apply font size, else FALSE
224 MSG_BOOL msg_common_apply_font_size(const char *widget_name, Evas_Object *obj);
227 *@fnmsg_common_reset_font_size(const char *widget_name);
228 *@brief This function is used to reset the font size.
229 *@param[in] widget_name The widget name which font size is changed.
231 void msg_common_reset_font_size(const char *widget_name);
234 *@fn msg_common_get_file_icon(const char *filepath);
235 *@brief This function is used to get file icon
236 *@param[in] filepath filepath
237 *@return return file icon path, else NULL
239 const char *msg_common_get_file_icon(const char *filepath);
242 *@fn msg_common_get_timeformat();
243 *@brief This function is used to get time format (format 12H, format 24H)
244 *@param[in] filepath filepath
245 *@return return enum msg_time_format
247 int msg_common_get_timeformat();