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