/* * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (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 __MSG_UI_COMMON_UTILITY_H__ #define __MSG_UI_COMMON_UTILITY_H__ /*================================================================================================== INCLUDE HEADERS * ==================================================================================================*/ #include #include #include #include /*================================================================================================== DEFINITIONS *==================================================================================================*/ /* for i18n */ #define MSG_COMMON_MAX_UCHAR_PATTERN_LEN 64 #define MSG_COMMON_MAX_CHAR_PATTERN_LEN 128 #define MSG_COMMON_TAG_TEXT "" #define MSG_COMMON_NUMBER_MAX_LEN 40 /* Define vconf key */ #define VCONFKEY_MSG_APP_FONT_SIZE "db/private/org.tizen.message/font_size" #define VCONFKEY_MSG_APP_ACCESS_FONT_SIZE "db/private/org.tizen.message/accessibility_font_size" #define VCONFKEY_MSG_APP_USE_VOLUME_KEY "db/private/org.tizen.message/use_volume_key" #define MSG_COMMON_EDJ EDJDIR"/msg_common.edj" #define MSG_CUSTOM_WINSET_EDJ EDJDIR"/msg_custom_winset.edj" #define MSG_IMAGES_EDJ EDJDIR"/msg_images.edj" /*================================================================================================== ENUMERATIONS *==================================================================================================*/ typedef enum { MSG_APP_FONT_SIZE_SMALL = 36, MSG_APP_FONT_SIZE_NORMAL = 44, MSG_APP_FONT_SIZE_LARGE = 64, MSG_APP_FONT_SIZE_HUGE = 81, MSG_APP_FONT_SIZE_GIANT = 106, MSG_APP_FONT_SIZE_MAX } MSG_APP_FONT_SIZE_E; typedef enum { MSG_APP_FONT_SIZE_INDEX_SMALL, MSG_APP_FONT_SIZE_INDEX_NORMAL, MSG_APP_FONT_SIZE_INDEX_LARGE, MSG_APP_FONT_SIZE_INDEX_HUGE, MSG_APP_FONT_SIZE_INDEX_GIANT, MSG_APP_FONT_SIZE_INDEX_MAX } MSG_APP_FONT_SIZE_INDEX_E; typedef enum { MSG_SYS_FONT_SIZE_INDEX_SMALL = SYSTEM_SETTINGS_FONT_SIZE_SMALL, MSG_SYS_FONT_SIZE_INDEX_NORMAL = SYSTEM_SETTINGS_FONT_SIZE_NORMAL, MSG_SYS_FONT_SIZE_INDEX_LARGE = SYSTEM_SETTINGS_FONT_SIZE_LARGE, MSG_SYS_FONT_SIZE_INDEX_HUGE = SYSTEM_SETTINGS_FONT_SIZE_HUGE, MSG_SYS_FONT_SIZE_INDEX_GIANT = SYSTEM_SETTINGS_FONT_SIZE_GIANT, MSG_SYS_FONT_SIZE_INDEX_MAX } MSG_SYS_FONT_SIZE_INDEX_E; typedef enum { MSG_APP_FILE_TYPE_NONE = 0, MSG_APP_FILE_TYPE_IMAGE, /**< Image category */ MSG_APP_FILE_TYPE_VIDEO, /**< Video category */ MSG_APP_FILE_TYPE_MUSIC, /**< Music category */ MSG_APP_FILE_TYPE_SOUND, /**< Sound category */ MSG_APP_FILE_TYPE_PDF, /**< Pdf category */ MSG_APP_FILE_TYPE_DOC, /**< Word category */ MSG_APP_FILE_TYPE_PPT, /**< Powerpoint category */ MSG_APP_FILE_TYPE_EXCEL, /**< Excel category */ MSG_APP_FILE_TYPE_VOICE, /**< Voice category */ MSG_APP_FILE_TYPE_HTML, /**< Html category */ MSG_APP_FILE_TYPE_FLASH, /**< Flash category */ MSG_APP_FILE_TYPE_TXT, /**< Txt category */ MSG_APP_FILE_TYPE_VCONTACT, /**< Vcontact category */ MSG_APP_FILE_TYPE_VCALENDAR, /**< Vcalendar category */ MSG_APP_FILE_TYPE_VNOTE, /**< Vnote category */ MSG_APP_FILE_TYPE_VBOOKMARK, /**< Vbookmark category */ MSG_APP_FILE_TYPE_SVG, /**< Svg category */ MSG_APP_FILE_TYPE_RSS, /**< Rss reader file, *.opml */ MSG_APP_FILE_TYPE_JAVA, /**< java file, *.jad, *.jar */ MSG_APP_FILE_TYPE_WGT, /**< wrt , *.wgt, *.wgt */ MSG_APP_FILE_TYPE_DRM, /**< drm file , *.dcf */ MSG_APP_FILE_TYPE_ETC, /**< Other files category */ MSG_APP_FILE_TYPE_MAX } MSG_APP_FILE_TYPE_E; /*================================================================================================== STRUCTURES *==================================================================================================*/ /*================================================================================================== FUNCTION DECLARATIONS *==================================================================================================*/ /* *@fn msg_common_get_default_locale(); *@brief This function is used to get default locale *@return default locale string on success, else NULL pointer on failure *@param[in] None */ const char *msg_common_get_default_locale(); /* *@fn msg_common_get_date_text(const char *locale, char *skeleton, void *time); *@brief This function is used to get data & time string based on both locale and skeleton. * Caller must free returned string after using it, else memory will be leaked *@return data and time formated string on success, else NULL pointer on failure *@param[in] locale locale info. of current setting *@param[in] skeleton skeleton string caller want to see *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed */ char *msg_common_get_date_text(const char *locale, char *skeleton, void *time); /* *@fn msg_common_get_display_date(const char *locale, char *bestPattern, char* bestPattern_year, time_t *msg_t); *@brief This function is used to get date string based on both locale and bestPattern. * Caller must free returned string after using it, else memory will be leaked *@return date string on success, else NULL pointer on failure *@param[in] locale locale info. of current setting *@param[in] bestPattern best pattern for date and time based on locale *@param[in] yearPattern best pattern with year data for date and time based on locale *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed */ char *msg_common_get_display_date(const char *locale, char *bestPattern, char* yearPattern, time_t *msg_t); /* *@fn msg_common_get_markup_text(const char *src, char *fontcolor, char *fontstyle); *@brief This function is used to get marked up string from src text. * Caller must free returned string by using eina_strbuf_free(), else memory will be leaked *@return Eina_Strbuf* marked up string on success, else NULL pointer on failure *@param[in] src original text to be displayed *@param[in] fontcolor fontcolor to be displayed. It must be "#ffffff" style. If NULL is passed, it is not set *@param[in] fontstyle fontstyle to be displayed. It must be passed font style like "hilight". If NULL is passed, it is not set */ Eina_Strbuf *msg_common_get_markup_text(const char *src, char *fontcolor, char *fontstyle); /* *@fn msg_common_is_valid_phone_number(const char *address); *@brief This function is used to check address is valid number or not *@return return TRUE if address is valide number type, else FALSE *@param[in] address string pointer of address */ MSG_BOOL msg_common_is_valid_phone_number(const char *address); /* *@fn msg_common_is_valid_email_addr(const char *address); *@brief This function is used to check address is valid email address or not *@return return TRUE if address is valide email address type, else FALSE *@param[in] address string pointer of address */ MSG_BOOL msg_common_is_valid_email_addr(const char *address); /* *@fn msg_common_is_connected_call(void); *@brief This function is used to know (voice or video)call is connected or not *@return return TRUE if call is connected status, else FALSE */ MSG_BOOL msg_common_is_connected_call(void); /* *@fn msg_common_get_date_best_pattern(const char *locale, char *skeleton); *@brief This function is used to get best pattern string based on both locale and skeleton. *@return best pattern based on locale for data and time on success, else NULL pointer on failure *@param[in] locale locale info. of current setting *@param[in] skeleton skeleton string caller want to see */ char *msg_common_get_date_best_pattern(const char *locale, char *skeleton); /* *@fn msg_common_get_formatted_date(const char *locale, char *bestPattern, void *time); *@brief This function is used to get data & time string from best pattern based on locale. *@return data and time formated string on success, else NULL pointer on failure *@param[in] locale locale info. of current setting *@param[in] bestPattern best pattern for date and time based on locale *@param[in] time_t time_t pointer to be diaplayed. If NULL is passed, current time will be displayed */ char *msg_common_get_formatted_date(const char *locale, char *bestPattern, void *time); /* *@fn msg_common_check_sim_existence(void); *@brief This function is used to know whether SIM is inserted or not. *@return return TRUE if SIM is inserted, else FALSE */ MSG_BOOL msg_common_is_sim_inserted(void); /* *@fn msg_common_get_font_size(int *index); *@brief This function is used to get the index of font size. *@param[in] index index of font size. It is used in message setting. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_get_font_size(int *index); /* *@fn msg_common_set_font_size(int index); *@brief This function is used to set the index of font size. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_set_font_size(int index); /* *@fn msg_common_increase_font_size(void); *@brief This function is used to set the increased index of font size. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_increase_font_size(); /* *@fn msg_common_decrease_font_size(void); *@brief This function is used to set the decreased index of font size. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_decrease_font_size(); /* *@fn msg_common_get_index_from_font_size(int font_size); *@brief This function is used to get index from font size. *@return return font size, else -1 */ int msg_common_get_index_from_font_size(int font_size); /* *@fn msg_common_get_font_size_from_index(int index); *@brief This function is used to get font size from index. *@return return index of font size, else -1 */ int msg_common_get_font_size_from_index(int index); /* *@fn msg_common_get_access_font_size(int *index); *@brief This function is used to get the index of accessibility font size. *@param[in] index index of font size. It is used in message setting. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_get_access_font_size(int *index); /* *@fn msg_common_set_access_font_size(int index); *@brief This function is used to set the index of accessibility font size. *@return return TRUE if vconf API is success, else FALSE */ MSG_BOOL msg_common_set_access_font_size(int index); /* *@fn msg_common_apply_font_size(void); *@brief This function is used to change the font size. *@param[in] widget_name The widget name which font size is changed. *@param[in] obj The widget which font size is changed. *@return return TRUE if it is success to apply font size, else FALSE */ MSG_BOOL msg_common_apply_font_size(const char *widget_name, Evas_Object *obj); /* *@fnmsg_common_reset_font_size(const char *widget_name); *@brief This function is used to reset the font size. *@param[in] widget_name The widget name which font size is changed. */ void msg_common_reset_font_size(const char *widget_name); /* *@fn msg_common_get_file_icon(const char *filepath); *@brief This function is used to get file icon *@param[in] filepath filepath *@return return file icon path, else NULL */ const char *msg_common_get_file_icon(const char *filepath); /* *@fn msg_common_get_timeformat(); *@brief This function is used to get time format (format 12H, format 24H) *@param[in] filepath filepath *@return return enum msg_time_format */ int msg_common_get_timeformat(); /* *@fn msg_common_add_block_number(); *@brief This function is used to block address *@param[in] msgHandle *@param[in] address block address *@return return error code */ int msg_common_add_block_number(msg_handle_t msgHandle, const char *address); /* *@fn msg_common_delete_block_number(); *@brief This function is used to unblock address *@param[in] msgHandle *@param[in] address unblock address *@return return error code */ int msg_common_delete_block_number(msg_handle_t msgHandle, const char *address); /* *@fn msg_common_check_block_number(); *@brief This function is used to get address is blocked *@param[in] msgHandle *@param[in] address checking address *@param[in] result TRUE if address is blocked, else FALSE *@return return error code */ int msg_common_check_block_number(msg_handle_t msgHandle, const char *address, bool *result); char *msg_common_make_message_detail_text(msg_handle_t msgHandle, int msgId); #endif