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