Support to delegate various MIME types to caller as like voice recording
[platform/core/uifw/inputdelegator.git] / src / w-input-stt-voice.cpp
index 10a5ec5..595d417 100755 (executable)
@@ -32,6 +32,7 @@
 #include "w-input-stt-voice.h"
 #include "w-input-stt-engine.h"
 #include "w-input-stt-ise.h"
+#include "voice-recorder.h"
 
 using namespace std;
 
@@ -473,10 +474,15 @@ static void on_confirm_button_clicked_cb(void *data, Evas_Object *obj, void *eve
 
        PRINTFUNC(DLOG_DEBUG, "result_text = %s", result_text.c_str());
 
-       reply_to_sender_by_callback(result_text.c_str(), "voice");
+       char *filePath = NULL;
+       voice_recorder *vr = _voice_recorder_get_data();
+       if (!vr)
+               filePath = vr->file_path;
+       char *path[] = {filePath, };
+       reply_to_sender_by_callback(result_text.c_str(), "voice", (const char **)path);
        destroy_voice();
        powerUnlock();
-       elm_exit();
+       ui_app_exit();
 
        return;
 }
@@ -779,6 +785,9 @@ static Eina_Bool _start_timer_cb(void* data)
                }
                voicedata->start_timer = NULL;
        }
+
+       start_voice_recorder();
+
        return ECORE_CALLBACK_CANCEL;
 }
 
@@ -920,6 +929,7 @@ char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part)
                                        strncpy(text, s, p-s);
                                } else {
                                        strncpy(text, s, strlen(s));
+                                       text[strlen(s)] = '\0';
                                }
                        } else {
                                strncpy(text, "", strlen(""));
@@ -1324,8 +1334,11 @@ void create_setting_window(Evas_Object *more_option_layout)
         */
        genlist = create_language_list(naviframe);
 
+       const char *item_style = NULL;
+       if (_WEARABLE)
+               item_style = "empty";
        //item = elm_naviframe_item_push(naviframe, "IDS_VC_HEADER_VOICE_INPUT_LANGUAGE", NULL, NULL, genlist, NULL);
-       elm_naviframe_item_push(naviframe, NULL, NULL, NULL, genlist, "empty");
+       elm_naviframe_item_push(naviframe, NULL, NULL, NULL, genlist, item_style);
        //elm_object_item_domain_text_translatable_set(item, PACKAGE, EINA_TRUE);
 
        g_setting_window = window;
@@ -1805,6 +1818,8 @@ int init_voice(Evas_Object *parent, const char *lang, VoiceData *r_voicedata)
                voicedata->textblock_timer = NULL;
        }
 
+       init_voice_recorder(NULL);
+
        return TRUE;
 }