Support to delegate various MIME types to caller as like voice recording
[platform/core/uifw/inputdelegator.git] / src / w-input-stt-ise.cpp
index 33efe25..da6e71f 100755 (executable)
@@ -21,6 +21,7 @@
 #include "w-input-stt-ise.h"
 #include "w-input-stt-voice.h"
 #include "w-input-stt-engine.h"
+#include "voice-recorder.h"
 
 
 VoiceData *my_voicedata = NULL;
@@ -46,37 +47,34 @@ void show_voice_input(Evas_Object *parent, const char *lang, void (*get_string)(
                my_voicedata = (VoiceData*)malloc(sizeof(VoiceData));
                if (my_voicedata == NULL) {
                        PRINTFUNC(DLOG_ERROR, "%d::::Heap Overflow, Voice Input cannot be shown!", __LINE__);
-               return;
+                       return;
                }
                memset(my_voicedata, 0, sizeof(VoiceData));
        }
 
-       init = init_voice(parent, lang, my_voicedata);
-       if (init) {
-               if (my_voicedata->naviframe) {
-                       show_voice_window(my_voicedata->naviframe, my_voicedata);
+       if (my_voicedata) {
+               init = init_voice(parent, lang, my_voicedata);
+               if (init) {
+                       if (my_voicedata->naviframe) {
+                               show_voice_window(my_voicedata->naviframe, my_voicedata);
+                       }
+               } else {
+                       destroy_voice();
+                       PRINTFUNC(DLOG_ERROR, "%d::::Fail to create Voice window!", __LINE__);
+                       return;
                }
-       } else {
-               destroy_voice();
-               PRINTFUNC(DLOG_ERROR, "%d::::Fail to create Voice window!", __LINE__);
-               return;
        }
 
        vconf_notify_key_changed(VCONFKEY_ISE_STT_LANGUAGE, _stt_lang_changed_cb, my_voicedata);
-
 }
 
-
 void  pause_voice(){
-
        PRINTFUNC(DLOG_DEBUG, "pause_voice");
 
        powerUnlock();
        if (my_voicedata) {
                on_stt_pause(my_voicedata);
        }
-
-
 }
 
  void destroy_voice()
@@ -92,6 +90,7 @@ void  pause_voice(){
                 my_voicedata = NULL;
         }
 
+       destroy_voice_recorder();
  }
 
  int is_lang_supported_by_voice_input(const char *lang)
@@ -112,7 +111,7 @@ void ise_show_stt_popup(void *data)
  {
         App_Data* ad = (App_Data*)data;
 
-        if(!ad)
+        if (!ad)
                 return;
 
         show_voice_input((Evas_Object*)ad->naviframe, NULL, NULL);
@@ -125,7 +124,6 @@ void ise_show_stt_popup(void *data)
         if (my_voicedata) {
                 my_voicedata->disclaimer = 1;
         }
-
  }