a65157d4ca1d85cb7c897e89bf2d2fca4e1de40e
[apps/home/smartsearch.git] / src / ps_app_interface.cpp
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18
19
20
21
22 #include "smartsearch.h"
23 #include "ps_app_interface.h"
24 #include "ps_searcher.h"
25 #include <ui-gadget.h>
26 #include <contacts-ug.h>
27 #include <aul_service.h>
28 #include <app.h>
29 #include <app_manager.h>
30 #include <bundle.h>
31
32 #define UG_NAME_LEN 50
33
34 static void __search_layout_ug_destroy(void *data)
35 {
36         SEARCH_FUNC_START;
37
38         struct appdata *ad = (struct appdata *)data;
39
40         //D. Because the ug will be able to remove the base object, unset the content from the effect layout.
41         elm_object_part_content_unset(ad->effect_layout,
42                                  (char *)ug_get_layout(ad->detail_ug));
43
44         evas_object_del(ad->effect_layout);
45
46         ug_destroy(ad->detail_ug);
47
48         ad->detail_ug = NULL;
49         ad->effect_layout = NULL;
50
51         SEARCH_FUNC_END;
52 }
53
54 static void __search_effect_layout_signal_hide_finished(void *data,
55                                                         Evas_Object * obj,
56                                                         const char *emission,
57                                                         const char *source)
58 {
59         SEARCH_FUNC_START;
60
61         __search_layout_ug_destroy(data);
62
63         SEARCH_FUNC_END;
64 }
65
66 static void __search_effect_layout_render_flush_post_cb(void *data, Evas * e,
67                                                         void *event_info)
68 {
69         SEARCH_FUNC_START;
70
71         struct appdata *ad = (struct appdata *)data;
72         if (!ad)
73                 return;
74
75         //UG Show Effect
76         edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
77                                 "elm,state,show", "");
78
79         //B.Remove the EVAS_RENDER_FLUSH_POST callback again.
80         evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST,
81                                 __search_effect_layout_render_flush_post_cb);
82
83         SEARCH_FUNC_END;
84 }
85
86 static void __search_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode,
87                                   void *priv)
88 {
89         SEARCH_FUNC_START;
90
91         Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
92
93         if (!base)
94                 return;
95
96 #ifdef ENABLE_UG_EFFECT
97         if (!ad->effect_layout)
98                 return;
99
100         elm_object_part_content_set(ad->effect_layout, "elm.swallow.content", base);
101         //B. Add the callback event for the EVAS_RENDER_FLUSH_POST
102         //B. This is one method to not skip the total effect time in creating the ug object.
103         evas_event_callback_add(evas_object_evas_get(ad->effect_layout),
104                                 EVAS_CALLBACK_RENDER_FLUSH_POST,
105                                 __search_effect_layout_render_flush_post_cb,
106                                 ad);
107 #else
108         evas_object_show(base);
109 #endif
110
111         SEARCH_FUNC_END;
112 }
113
114 static void __search_ug_closed_cb(ui_gadget_h ug, void *priv)
115 {
116         SEARCH_FUNC_START;
117
118 #ifdef ENABLE_UG_EFFECT
119         edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
120                                 "elm,state,hide", "");
121 #else
122         Evas_Object *base = (Evas_Object *) ug_get_layout(ug);
123
124         evas_object_hide(base);
125 #endif
126
127         SEARCH_FUNC_END;
128 }
129
130 static void __search_create_effect_layout(Evas_Object * parent,
131                                           struct appdata *ad)
132 {
133         SEARCH_FUNC_START;
134
135         int ret;
136
137         //Create the layout then apply the edj
138         Evas_Object *ly = elm_layout_add(ad->win_main);
139
140         if (!ly)
141                 return;
142
143         evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
144
145         elm_win_resize_object_add(ad->win_main, ly);
146
147         ret = elm_layout_file_set(ly, SEARCH_EDJ, "ug_effect");
148
149         //Add a signal callback function which will be called after terminating hide effect.
150         edje_object_signal_callback_add(elm_layout_edje_get(ly),
151                                         "elm,action,hide,finished", "",
152                                         __search_effect_layout_signal_hide_finished,
153                                         ad);
154
155         //store the layout object to refer it at hide effect
156         ad->effect_layout = ly;
157
158         evas_object_show(ly);
159
160         SEARCH_FUNC_END;
161 }
162
163 void search_launch_contact_view(void *data, void *record_info)
164 {
165         SEARCH_FUNC_START;
166
167         struct appdata *ad = (struct appdata *)data;
168         struct search_item_sel *cur_category_mem =
169             (struct search_item_sel *)record_info;
170
171         service_h service = NULL;
172         int ret = 0;
173         bool err_popup_show = true;
174
175         ui_gadget_h ug = NULL;
176         struct ug_cbs cbs = { 0, };
177
178         char buf[10] = { 0, };
179
180         if (!cur_category_mem || strlen(cur_category_mem->main_id) < 0 ) {
181                 SEARCH_DEBUG_ERROR("Selected item does not have data!");
182                 goto out_func;
183         } else {
184         if (ad->detail_ug) {
185                         SEARCH_DEBUG_WARNING("\n prev ug is exist. destroy prev ug");
186                 __search_layout_ug_destroy(ad);
187         }
188
189                 ret = service_create(&service);
190
191                 if (ret != SERVICE_ERROR_NONE) {
192                         SEARCH_DEBUG_ERROR("Fail to create service handle!");
193                         goto out_func;
194         }
195
196         snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
197                 ret = service_add_extra_data(service, CT_UG_BUNDLE_TYPE, buf);
198
199                 if (ret != SERVICE_ERROR_NONE) {
200                         SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
201                         goto out_func;
202                 }
203
204                 ret = service_add_extra_data(service, CT_UG_BUNDLE_ID,
205                                         cur_category_mem->main_id);
206
207                 if (ret != SERVICE_ERROR_NONE) {
208                         SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 2!");
209                         goto out_func;
210                 }
211
212 #ifdef ENABLE_UG_EFFECT
213         __search_create_effect_layout(ad->win_main, ad);
214 #endif
215
216         cbs.layout_cb = __search_ug_layout_cb;
217         cbs.result_cb = NULL;
218         cbs.destroy_cb = __search_ug_closed_cb;
219         cbs.priv = ad;
220
221                 ug = ug_create(NULL, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, service, &cbs);
222
223         if (!ug) {
224                 SEARCH_DEBUG_ERROR(" ...  ug_create: failed !!!");
225                         goto out_func;
226         } else {
227                 ad->detail_ug = ug;
228                         err_popup_show = false;
229         }
230         }
231
232 out_func:
233         if (err_popup_show == true)
234                 search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
235
236         if (service != NULL)
237                 service_destroy(service);
238
239         SEARCH_FUNC_END;
240 }
241
242 void search_launch_msg_view(void *data, void *record_info)
243 {
244         SEARCH_FUNC_START;
245
246         struct appdata *ad = (struct appdata *)data;
247         struct search_item_sel *cur_category_mem =
248             (struct search_item_sel *)record_info;
249
250         bundle *b;
251         int ret = 0;
252
253         b = bundle_create();
254         if (!b) {
255                 SEARCH_DEBUG_ERROR("search_launch_msg_view : bundle_create failed");
256                 return;
257         }
258
259         bundle_add(b, "type", "msg_id");
260         bundle_add(b, "msgId", cur_category_mem->main_id);
261         ret = aul_launch_app("org.tizen.message", b);
262         if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
263                 SEARCH_DEBUG_ERROR("msg aul launch app error(%d)", ret);
264                 search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
265         }
266
267         bundle_free(b);
268
269         SEARCH_FUNC_END;
270 }
271
272 void search_launch_email_view(void *data, void *record_info)
273 {
274         SEARCH_FUNC_START;
275
276         bundle *b;
277         char *token_param = NULL;
278         char *saveptr1;
279         int i = 0;
280         int ret = 0;
281         struct appdata *ad = (struct appdata *)data;
282         struct search_item_sel *cur_category_mem =
283             (struct search_item_sel *)record_info;
284
285         b = bundle_create();
286         if (!b)
287                 return;
288
289         char livemagazine[2] = { 0, };
290         char temp_path[MAX_LENGTH_PER_PATH] = { 0, };
291         livemagazine[0] = '0';
292
293         snprintf(temp_path, MAX_LENGTH_PER_PATH - 1, "%s",
294                  cur_category_mem->path);
295
296         token_param = strtok_r(temp_path, " ", &saveptr1);
297
298         while (token_param != NULL) {
299                 if (i == 0) {
300                         bundle_add(b, "ACCOUNT_ID", token_param);       //account_id
301                 } else if (i == 1) {
302                         bundle_add(b, "MAIL_ID", token_param);  //mail_id
303                 } else if (i == 2) {
304                         bundle_add(b, "MAILBOX_ID", token_param);       //mailbox
305                 } else {
306                         break;
307                 }
308
309                 i++;
310                 token_param = strtok_r(NULL, " ", &saveptr1);
311         }
312
313         bundle_add(b, "bLiveMagazine", livemagazine);
314
315         char runType[2] = { 0 };
316         snprintf(runType, sizeof(runType), "%d", 7);
317         bundle_add(b, "RUN_TYPE", runType);
318         ret = aul_launch_app("org.tizen.email", b);
319         if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
320                 SEARCH_DEBUG_ERROR("email aul launch app error(%d)", ret);
321                 search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
322         }
323
324         bundle_free(b);
325
326         SEARCH_FUNC_END;
327 }
328
329 void search_launch_image_view(void *data, void *record_info)
330 {
331         SEARCH_FUNC_START;
332
333         struct appdata *ad = (struct appdata *)data;
334         struct search_item_sel *cur_category_mem =
335             (struct search_item_sel *)record_info;
336         int ret;
337
338                 if (access(cur_category_mem->path, F_OK) != 0) {
339                         SEARCH_DEBUG_ERROR("image access error : %s",
340                                            cur_category_mem->path);
341                         search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND,
342                                                   ad);
343                 } else {
344                 SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
345                                      cur_category_mem->path);
346
347                 service_h service;
348                 ret = service_create(&service);
349
350                 if (ret == 0) {
351                         service_set_operation(service, SERVICE_OPERATION_VIEW);
352                         service_set_uri(service, cur_category_mem->path);
353                         ret = service_send_launch_request(service, NULL, NULL);
354
355                         if (ret != 0) {
356                                 SEARCH_DEBUG_ERROR("image app service launching error(%d)", ret);
357                                 search_launch_popup_error(LAUNCH_ERROR_APPSVC,
358                                                           ad);
359                         }
360                         service_destroy(service);
361                 }
362                 }
363
364         SEARCH_FUNC_END;
365 }
366
367 void search_launch_video_view(void *data, void *record_info)
368 {
369         SEARCH_FUNC_START;
370
371         struct appdata *ad = (struct appdata *)data;
372         struct search_item_sel *cur_category_mem =
373             (struct search_item_sel *)record_info;
374         int ret;
375
376         if (access(cur_category_mem->path, F_OK) != 0) {
377                 SEARCH_DEBUG_ERROR("video access error : %s",
378                                    cur_category_mem->path);
379                 search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
380         } else {
381                 SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
382                          cur_category_mem->path);
383
384                 service_h service;
385                 ret = service_create(&service);
386
387                 if (ret == 0) {
388                         service_set_operation(service, SERVICE_OPERATION_VIEW);
389                         service_set_uri(service, cur_category_mem->path);
390                         ret = service_send_launch_request(service, NULL, NULL);
391
392                         if (ret != 0) {
393                                 SEARCH_DEBUG_ERROR("video app service launching error(%d)", ret);
394                                 search_launch_popup_error(LAUNCH_ERROR_APPSVC,
395                                                           ad);
396                         }
397                         service_destroy(service);
398                 }
399         }
400
401         SEARCH_FUNC_END;
402 }
403
404 void search_launch_music_view(void *data, void *record_info)
405 {
406         SEARCH_FUNC_START;
407
408         struct appdata *ad = (struct appdata *)data;
409         struct search_item_sel *cur_category_mem =
410             (struct search_item_sel *)record_info;
411         int ret;
412
413         if (access(cur_category_mem->path, F_OK) != 0) {
414                 SEARCH_DEBUG_ERROR("music file access error : %s",
415                                    cur_category_mem->path);
416                 search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
417         } else {
418                 SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
419                                  cur_category_mem->path);
420
421                 service_h service;
422                 ret = service_create(&service);
423
424                 if (ret == 0) {
425                         service_set_operation(service, SERVICE_OPERATION_VIEW);
426                         service_set_uri(service, cur_category_mem->path);
427                         ret = service_send_launch_request(service, NULL, NULL);
428
429                         if (ret != 0) {
430                                 SEARCH_DEBUG_ERROR("music app service launching error(%d)", ret);
431                                 search_launch_popup_error(LAUNCH_ERROR_APPSVC,
432                                                                 ad);
433                         }
434                         service_destroy(service);
435                 }
436         }
437
438         SEARCH_FUNC_END;
439 }
440
441 void search_launch_calendar_view(void *data, void *record_info)
442 {
443         SEARCH_FUNC_START;
444
445         struct appdata *ad = (struct appdata *)data;
446         struct search_item_sel *cur_category_mem =
447             (struct search_item_sel *)record_info;
448         ui_gadget_h ug = NULL;
449         struct ug_cbs cbs = { 0, };
450         int ret = 0;
451         bool err_popup_show = true;
452         service_h service = NULL;
453
454         if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
455                 SEARCH_DEBUG_ERROR("Selected item does not have data!");
456                 goto out_func;
457         } else {
458                 ret = service_create(&service);
459
460                 if (ret != SERVICE_ERROR_NONE) {
461                         SEARCH_DEBUG_ERROR("Fail to create service handle!");
462                         goto out_func;
463                 }
464
465                 ret = service_add_extra_data(service, "itemType", "event");
466
467                 if (ret != SERVICE_ERROR_NONE) {
468                         SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
469                         goto out_func;
470         }
471
472                 ret = service_add_extra_data(service, "eventID", cur_category_mem->main_id);
473
474                 if (ret != SERVICE_ERROR_NONE) {
475                         SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 2!");
476                         goto out_func;
477                 }
478
479 #ifdef ENABLE_UG_EFFECT
480                 __search_create_effect_layout(ad->win_main, ad);
481 #endif
482                 cbs.destroy_cb = __search_ug_closed_cb;
483                 cbs.layout_cb = __search_ug_layout_cb;
484                 cbs.result_cb = NULL;
485                 cbs.priv = ad;
486
487                 ug = ug_create(NULL, "calendar-detail-efl", UG_MODE_FULLVIEW, service, &cbs);
488
489                 if (!ug) {
490                         SEARCH_DEBUG_ERROR("...  create_ug_calendar : failed !!!");
491                         goto out_func;
492                 }
493
494                 ad->detail_ug = ug;
495                 err_popup_show = false;
496         }
497
498 out_func:
499         if (err_popup_show == true)
500                 search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
501
502         if (service != NULL)
503                 service_destroy(service);
504
505         SEARCH_FUNC_END;
506 }
507
508 void search_launch_memo_view(void *data, void *record_info)
509 {
510         SEARCH_FUNC_START;
511
512         struct appdata *ad = (struct appdata *)data;
513         struct search_item_sel *cur_category_mem =
514             (struct search_item_sel *)record_info;
515         ui_gadget_h ug = NULL;
516         struct ug_cbs cbs = { 0, };
517
518         int ret = 0;
519         bool err_popup_show = true;
520
521         service_h service = NULL;
522
523         if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
524                 SEARCH_DEBUG_ERROR("Selected item does not have data!");
525                 goto out_func;
526         } else {
527         if (ad->detail_ug) {
528                 SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
529                         __search_layout_ug_destroy(ad);
530                 }
531
532                 ret = service_create(&service);
533
534                 if (ret != SERVICE_ERROR_NONE) {
535                         SEARCH_DEBUG_ERROR("Fail to create service handle!");
536                         goto out_func;
537         }
538
539                 ret = service_add_extra_data(service, "index", cur_category_mem->main_id);
540
541                 if (ret != SERVICE_ERROR_NONE) {
542                         SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
543                         goto out_func;
544                 }
545
546 #ifdef ENABLE_UG_EFFECT
547         __search_create_effect_layout(ad->win_main, ad);
548 #endif
549         cbs.layout_cb = __search_ug_layout_cb;
550         cbs.result_cb = NULL;
551         cbs.destroy_cb = __search_ug_closed_cb;
552         cbs.priv = ad;
553
554                 ug = ug_create(NULL, "memo-efl", UG_MODE_FULLVIEW, service, &cbs);
555
556         if (!ug) {
557                 SEARCH_DEBUG_ERROR("...  create_ug_email : failed !!!");
558                         goto out_func;
559         }
560
561         ad->detail_ug = ug;
562                 err_popup_show = false;
563         }
564
565 out_func:
566         if (err_popup_show == true)
567                 search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
568
569         if (service != NULL)
570                 service_destroy(service);
571
572         SEARCH_FUNC_END;
573 }
574
575 void search_launch_menu_view(void *data, void *record_info)
576 {
577         SEARCH_FUNC_START;
578
579         struct appdata *ad = (struct appdata *)data;
580         struct search_item_sel *cur_category_mem =
581             (struct search_item_sel *)record_info;
582         char *pkg_name = cur_category_mem->path;
583         bool is_running = false;
584         app_context_h app_h;
585
586         bool err_popup_show = true;
587         int ret;
588         service_h service = NULL;
589
590         if (pkg_name != NULL && strlen(pkg_name)) {
591                 ret = app_manager_is_running(pkg_name, &is_running);
592
593                 if (ret != APP_MANAGER_ERROR_NONE) {
594                         SEARCH_DEBUG_ERROR("Fail to get info : app_manager_is_running [%d]", ret);
595                         goto out_func;
596                 }
597
598                 if (is_running == true) {
599                         ret = app_manager_get_app_context(pkg_name, &app_h);
600                         if (ret != APP_MANAGER_ERROR_NONE) {
601                                 SEARCH_DEBUG_ERROR("Fail to get info : app_manager_get_app_context [%d]", ret);
602                                 goto out_func;
603                         }
604
605                         ret = app_manager_resume_app(app_h);
606
607                         if (ret != APP_MANAGER_ERROR_NONE) {
608                                 SEARCH_DEBUG_ERROR("Fail to get info : app_manager_resume_app [%d]", ret);
609                                 goto out_func;
610                         }
611                         err_popup_show = false;
612                 } else {
613                         ret = service_create(&service);
614
615                         if (ret != SERVICE_ERROR_NONE) {
616                                 SEARCH_DEBUG_ERROR("Fail to create service header : [%d]", ret);
617                                 goto out_func;
618                         }
619
620                         ret = service_set_operation(service, SERVICE_OPERATION_DEFAULT);
621
622                         if (ret != SERVICE_ERROR_NONE) {
623                                 SEARCH_DEBUG_ERROR("Fail to set operation : [%d]", ret);
624                                 goto out_func;
625                         }
626
627                         ret = service_set_package(service, pkg_name);
628
629                         if (ret != SERVICE_ERROR_NONE) {
630                                 SEARCH_DEBUG_ERROR("Fail to set package : [%d]", ret);
631                                 goto out_func;
632                         }
633
634                         ret = service_send_launch_request(service, NULL, NULL);
635
636                         if (ret != SERVICE_ERROR_NONE) {
637                                 SEARCH_DEBUG_ERROR("Fail to send launch request : [%d]", ret);
638                                 goto out_func;
639                         }
640                         err_popup_show = false;
641                 }
642         } else {
643                 SEARCH_DEBUG_ERROR("Pkg name is NULL!");
644         }
645
646 out_func:
647         if (err_popup_show == true)
648                 search_launch_popup_error(LAUNCH_ERROR_APPSVC, ad);
649
650         if (service != NULL) {
651                 ret = service_destroy(service);
652
653                 if (ret != SERVICE_ERROR_NONE)
654                         SEARCH_DEBUG_ERROR("Fail to destroy service header : [%d]", ret);
655         }
656
657         SEARCH_FUNC_END;
658 }
659
660 void search_launch_browser_view(void *data, void *record_info)
661 {
662         SEARCH_FUNC_START;
663
664         struct appdata *ad = (struct appdata *)data;
665         struct search_item_sel *cur_category_mem =
666             (struct search_item_sel *)record_info;
667         int ret;
668
669         SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
670                                    cur_category_mem->path);
671
672         service_h service;
673         ret = service_create(&service);
674
675         if (ret == 0 && strlen(cur_category_mem->path) > 0 ) {
676                 service_set_operation(service, SERVICE_OPERATION_VIEW);
677                 service_set_uri(service, cur_category_mem->path);
678                 ret = service_send_launch_request(service, NULL, NULL);
679
680                 if (ret != 0) {
681                         SEARCH_DEBUG_ERROR("browser app service launching error(%d)", ret);
682                         search_launch_popup_error(LAUNCH_ERROR_APPSVC,
683                                                   ad);
684                 }
685                 service_destroy(service);
686         }
687
688 }
689
690 static void __search_launch_popup_error_response_cb(void *data,
691                                                     Evas_Object * obj,
692                                                     void *event_info)
693 {
694         SEARCH_FUNC_START;
695
696         struct appdata *ad = (struct appdata *)data;
697
698         evas_object_del(ad->ctxpopup);
699         ad->ctxpopup = NULL;
700
701         SEARCH_FUNC_END;
702 }
703
704 void search_launch_popup_error(int error_type, void *data)
705 {
706         Evas_Object *popup;
707         Evas_Object *btn1;
708
709         struct appdata *ad = (struct appdata *)data;
710
711         if (error_type >= LAUNCH_ERROR_MAX) {
712                 SEARCH_DEBUG_ERROR("wrong error_type : %d", error_type);
713         }
714
715         if (ad->ctxpopup) {
716                 evas_object_del(ad->ctxpopup);
717                 ad->ctxpopup = NULL;
718         }
719
720         popup = elm_popup_add(ad->win_main);
721         evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
722                                          EVAS_HINT_EXPAND);
723
724         switch(error_type) {
725                 case LAUNCH_ERROR_FILE_NOT_FOUND:
726                         elm_object_text_set(popup,
727                                    dgettext("sys_string",
728                                             "IDS_COM_POP_FILE_NOT_FOUND"));
729                         break;
730                 case LAUNCH_ERROR_AUL_LAUNCH:
731                         /* This Message String enable to be another string in the future */
732                         elm_object_text_set(popup,
733                                            gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
734                         break;
735                 case LAUNCH_ERROR_APPSVC:
736                         elm_object_text_set(popup,
737                                            gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
738                         break;
739         }
740
741         btn1 = elm_button_add(popup);
742         elm_object_style_set(btn1, "popup_button/default");
743
744         elm_object_text_set(btn1,
745                                 dgettext("sys_string","IDS_COM_POP_CLOSE"));
746         evas_object_smart_callback_add(btn1, "clicked",
747                                        __search_launch_popup_error_response_cb,
748                                        ad);
749
750         elm_object_part_content_set(popup, "button1", btn1);
751
752         elm_popup_timeout_set(popup, 3.0);
753
754         evas_object_smart_callback_add(popup, "timeout",
755                                        __search_launch_popup_error_response_cb,
756                                        ad);
757         evas_object_smart_callback_add(popup, "block,clicked",
758                                        __search_launch_popup_error_response_cb,
759                                        ad);
760         evas_object_show(popup);
761
762         ad->ctxpopup = popup;
763 }
764