Apply sip back key concept in composer
[apps/core/preloaded/message-app.git] / composer / src / ui-composer / msg-ui-composer-common.c
index f8535b1..6ac1eb0 100755 (executable)
@@ -5,7 +5,7 @@
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *    http://www.tizenopensource.org/license
+ *    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,
@@ -473,7 +473,6 @@ static void __msg_ui_composer_change_to_sms(MSG_COMPOSER_VIEW_DATA_S *cd)
 static void __msg_ui_composer_change_to_mms(MSG_COMPOSER_VIEW_DATA_S *cd)
 {
        D_ENTER;
-
        if (!cd) {
                MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
                return;
@@ -520,6 +519,11 @@ COMPOSER_RETURN_TYPE_E msg_ui_composer_change_message_type(MSG_COMPOSER_VIEW_DAT
        bool ret = msg_ui_composer_common_is_send_possible(cd);
        msg_ui_composer_body_update_send_btn_icon(cd, !ret);
 
+       if (cd->msg_type == COMPOSER_MSG_TYPE_SMS && cd->msg_ug_mode != MSG_UG_MODE_BUBBLE_COMPOSER)
+               elm_object_disabled_set(cd->more_btn, EINA_TRUE);
+       else if (cd->msg_type == COMPOSER_MSG_TYPE_MMS)
+               elm_object_disabled_set(cd->more_btn, EINA_FALSE);
+
        D_LEAVE;
        return COMPOSER_RETURN_SUCCESS;
 }
@@ -1348,7 +1352,56 @@ void msg_ui_composer_entry_imf_state_cb(void * data, Ecore_IMF_Context *ctx, int
        D_LEAVE;
 }
 
-void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd)
+int msg_ui_composer_get_font_size(int type)
+{
+       D_ENTER;
+
+       int font_size = 0;
+       int converted_size = -1;
+
+       if (type == COMPOSER_TYPE_BODY) {
+               int index = 0;
+
+               if (msg_common_get_font_size(&index) == FALSE) {
+                       D_EMSG("msg_common_get_font_size() is failed !!");
+                       return -1;
+               } else {
+                       D_MSG("selected font_size index = %d", index);
+               }
+
+               font_size = msg_common_get_font_size_from_index(index);
+
+               if (font_size == -1) {
+                       D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+                       return -1;
+               }
+
+               converted_size = (MSGC_BODY_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+       } else if (type == COMPOSER_TYPE_SUBJECT) {
+               int access_font_index = 0;
+
+               /* get accessibility font index */
+               if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &access_font_index) < 0) {
+                       D_EMSG("vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE) is failed !!");
+                       access_font_index = MSG_SYS_FONT_SIZE_INDEX_NORMAL;     /* 1 */
+               }
+
+               font_size = msg_common_get_font_size_from_index(access_font_index);
+               if (font_size == -1) {
+                       D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+                       return -1;
+               }
+
+               converted_size = (MSGC_SUBJECT_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+       } else {
+               D_EMSG("Invalid type");
+       }
+
+       D_LEAVE;
+       return converted_size;
+}
+
+void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd, bool update_subject)
 {
        D_ENTER;
        D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
@@ -1381,6 +1434,48 @@ void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd)
        msg_ui_composer_recipient_apply_font_size(cd, font_style_str);
        msg_ui_composer_body_apply_font_size(cd, font_style_str);
 
+       if (update_subject) {
+               int access_font_index = 0;
+               /* get accessibility font index */
+               if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &access_font_index) < 0) {
+                       D_EMSG("vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE) is failed !!");
+                       access_font_index = MSG_SYS_FONT_SIZE_INDEX_NORMAL;     /* 1 */
+               }
+
+               font_size = msg_common_get_font_size_from_index(access_font_index);
+               if (font_size == -1) {
+                       D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+                       return;
+               }
+
+               converted_size = (MSGC_SUBJECT_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+
+               /* apply font size */
+               memset(font_style_str, 0, sizeof(font_style_str));
+               snprintf(font_style_str, sizeof(font_style_str), "DEFAULT='font_size=%d'", converted_size);
+               D_MSG("subject font_style_str = (%s)", font_style_str);
+
+               msg_ui_composer_subject_apply_font_size(cd, font_style_str);
+       }
+
+       D_LEAVE;
+}
+
+void msg_ui_composer_naviframe_size_hints_changed(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       D_ENTER;
+       D_MSG_RETM_IF(data == NULL, "Composer Data is NULL");
+       MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+       Evas_Display_Mode dispmode;
+
+       dispmode = evas_object_size_hint_display_mode_get(obj);
+       if (dispmode == EVAS_DISPLAY_MODE_COMPRESS) {
+               D_MSG("dispmode = EVAS_DISPLAY_MODE_COMPRESS");
+               cd->is_keypad_show = true;
+       } else if (dispmode == EVAS_DISPLAY_MODE_NONE) {
+               D_MSG("dispmode = EVAS_DISPLAY_MODE_NONE");
+               cd->is_keypad_show = false;
+       }
        D_LEAVE;
 }