Change elm_exit to ui_app_exit
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index 92bf854..010d98b 100755 (executable)
@@ -50,38 +50,37 @@ Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
 
 tizen_profile_t _get_tizen_profile()
 {
-   static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
-   if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
-     return profile;
-
-   char *profileName;
-   system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
-   switch (*profileName)
-     {
-      case 'm':
-      case 'M':
-         profile = TIZEN_PROFILE_MOBILE;
-         break;
-      case 'w':
-      case 'W':
-         profile = TIZEN_PROFILE_WEARABLE;
-         break;
-      case 't':
-      case 'T':
-         profile = TIZEN_PROFILE_TV;
-         break;
-      case 'i':
-      case 'I':
-         profile = TIZEN_PROFILE_IVI;
-         break;
-      default: // common or unknown ==> ALL ARE COMMON.
-         profile = TIZEN_PROFILE_COMMON;
-     }
-   free(profileName);
-
-   return profile;
-}
+       static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+       if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+               return profile;
+
+       char *profileName;
+       system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+       switch (*profileName)
+       {
+               case 'm':
+               case 'M':
+                       profile = TIZEN_PROFILE_MOBILE;
+                       break;
+               case 'w':
+               case 'W':
+                       profile = TIZEN_PROFILE_WEARABLE;
+                       break;
+               case 't':
+               case 'T':
+                       profile = TIZEN_PROFILE_TV;
+                       break;
+               case 'i':
+               case 'I':
+                       profile = TIZEN_PROFILE_IVI;
+                       break;
+               default: // common or unknown ==> ALL ARE COMMON.
+                       profile = TIZEN_PROFILE_COMMON;
+       }
+       free(profileName);
 
+       return profile;
+}
 
 void _init_app_data(App_Data* app_data);
 static void _app_language_changed(app_event_info_h event_info, void *user_data);
@@ -137,7 +136,10 @@ void init_customizing_theme(void)
        if (_WEARABLE) {
                stt_edj_path = stt_edj_path + STT_EDJ_FILE_WEARABLE;
                app_edj_path = app_edj_path + APP_EDJ_FILE_WEARABLE;
-       } else if (_MOBILE) {
+       } else if (_TV) {
+               stt_edj_path = stt_edj_path + STT_EDJ_FILE_TV;
+               app_edj_path = app_edj_path + APP_EDJ_FILE_TV;
+       } else {
                stt_edj_path = stt_edj_path + STT_EDJ_FILE_MOBILE;
                app_edj_path = app_edj_path + APP_EDJ_FILE_MOBILE;
        }
@@ -150,7 +152,7 @@ void init_customizing_theme(void)
 static Eina_Bool back_cb(void *data, Elm_Object_Item *it)
 {
        reply_to_sender_by_callback_for_back();
-       elm_exit();
+       ui_app_exit();
        return EINA_FALSE;
 }
 
@@ -208,7 +210,7 @@ static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info
 
                if (index < (int)template_list.size()) {
                        reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template");
-                       elm_exit();
+                       ui_app_exit();
                }
        }
 }
@@ -262,6 +264,8 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                string path = get_resource_path();
                if (_WEARABLE)
                        path = path + "wearable/";
+               else if (_TV)
+                       path = path + "tv/";
                else
                        path = path + "mobile/";
 
@@ -346,6 +350,8 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                string path = get_resource_path();
                if (_WEARABLE)
                        path = path + "wearable/";
+               else if (_TV)
+                       path = path + "tv/";
                else
                        path = path + "mobile/";
 
@@ -521,6 +527,8 @@ void show_popup_toast(const char *text, bool check_img)
                string path = get_resource_path();
                if (_WEARABLE)
                        path = path + "wearable/";
+               else if (_TV)
+                       path = path + "tv/";
                else
                        path = path + "mobile/";
                string path_ic = path + "/images/toast_check_icon.png";
@@ -561,15 +569,15 @@ void _back_to_genlist_for_selector()
 
        if (!app_data) return;
 
-       if (app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON){
-               PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON mode, So exit here.");
-               reply_to_sender_by_callback(NULL, NULL);
-               elm_exit();
-       }
        if (_WEARABLE) {
                Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
                eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
        }
+       if (app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON || app_data->app_type == APP_TYPE_KEYBOARD){
+               PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON/KEYBOARD mode, So exit here.");
+               reply_to_sender_by_callback(NULL, NULL);
+               ui_app_exit();
+       }
 }
 
 static void _item_realized(void *data, Evas_Object *obj, void *event_info) //called when list scrolled
@@ -600,12 +608,15 @@ Evas_Object* _create_genlist(Evas_Object* navi)
 
        show_gl_focus(EINA_FALSE);
 
+       const char *item_style = NULL;
+       if (_WEARABLE)
+               item_style = "empty";
        Elm_Object_Item *nf_main_item = elm_naviframe_item_push(navi,
             NULL,
             NULL,
             NULL,
             genlist,
-            "empty");
+            item_style);
 
        elm_naviframe_item_pop_cb_set(nf_main_item, back_cb, app_data);
        evas_object_smart_callback_add(genlist, "realized", _item_realized, NULL);
@@ -907,6 +918,13 @@ void _app_service(app_control_h service, void* user_data)
        app_control_clone(&(app_data->source_app_control), service);
        app_data->reply_type = REPLY_APP_NORMAL;
 
+       if (_TV || _MOBILE) {
+               app_data->app_type = APP_TYPE_KEYBOARD;
+               input_keyboard_init(service);
+               _keyboard_clicked_cb((void *)app_data, NULL, NULL);
+               goto ACTIVATE;
+       }
+
        ret = app_control_is_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &is_extra_data_array);
        if ( is_extra_data_array == true) {
                ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len);