summaryrefslogtreecommitdiff
path: root/src/ps_app_interface.cpp
blob: 2ad8be202c5d1430a4421d3bc44c93a819fb4486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */






#include "smartsearch.h"
#include "ps_app_interface.h"
#include "ps_searcher.h"
#include <ui-gadget.h>
#include <contacts-ug.h>
#include <aul_service.h>
#include <app.h>
#include <app_manager.h>
#include <bundle.h>

#define UG_NAME_LEN 50

static void __search_layout_ug_destroy(void *data)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;

	//D. Because the ug will be able to remove the base object, unset the content from the effect layout.
	elm_object_part_content_unset(ad->effect_layout,
				 (char *)ug_get_layout(ad->detail_ug));

	evas_object_del(ad->effect_layout);

	ug_destroy(ad->detail_ug);

	ad->detail_ug = NULL;
	ad->effect_layout = NULL;

	SEARCH_FUNC_END;
}

static void __search_effect_layout_signal_hide_finished(void *data,
							Evas_Object * obj,
							const char *emission,
							const char *source)
{
	SEARCH_FUNC_START;

	__search_layout_ug_destroy(data);

	SEARCH_FUNC_END;
}

static void __search_effect_layout_render_flush_post_cb(void *data, Evas * e,
							void *event_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	if (!ad)
		return;

	//UG Show Effect
	edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
				"elm,state,show", "");

	//B.Remove the EVAS_RENDER_FLUSH_POST callback again.
	evas_event_callback_del(e, EVAS_CALLBACK_RENDER_FLUSH_POST,
				__search_effect_layout_render_flush_post_cb);

	SEARCH_FUNC_END;
}

static void __search_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode,
				  void *priv)
{
	SEARCH_FUNC_START;

	Evas_Object *base = (Evas_Object *) ug_get_layout(ug);

	if (!base)
		return;

#ifdef ENABLE_UG_EFFECT
	if (!ad->effect_layout)
		return;

	elm_object_part_content_set(ad->effect_layout, "elm.swallow.content", base);
	//B. Add the callback event for the EVAS_RENDER_FLUSH_POST
	//B. This is one method to not skip the total effect time in creating the ug object.
	evas_event_callback_add(evas_object_evas_get(ad->effect_layout),
				EVAS_CALLBACK_RENDER_FLUSH_POST,
				__search_effect_layout_render_flush_post_cb,
				ad);
#else
	evas_object_show(base);
#endif

	SEARCH_FUNC_END;
}

static void __search_ug_closed_cb(ui_gadget_h ug, void *priv)
{
	SEARCH_FUNC_START;

#ifdef ENABLE_UG_EFFECT
	edje_object_signal_emit(elm_layout_edje_get(ad->effect_layout),
				"elm,state,hide", "");
#else
	Evas_Object *base = (Evas_Object *) ug_get_layout(ug);

	evas_object_hide(base);
#endif

	SEARCH_FUNC_END;
}

static void __search_create_effect_layout(Evas_Object * parent,
					  struct appdata *ad)
{
	SEARCH_FUNC_START;

	int ret;

	//Create the layout then apply the edj
	Evas_Object *ly = elm_layout_add(ad->win_main);

	if (!ly)
		return;

	evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

	elm_win_resize_object_add(ad->win_main, ly);

	ret = elm_layout_file_set(ly, SEARCH_EDJ, "ug_effect");

	//Add a signal callback function which will be called after terminating hide effect.
	edje_object_signal_callback_add(elm_layout_edje_get(ly),
					"elm,action,hide,finished", "",
					__search_effect_layout_signal_hide_finished,
					ad);

	//store the layout object to refer it at hide effect
	ad->effect_layout = ly;

	evas_object_show(ly);

	SEARCH_FUNC_END;
}

void search_launch_contact_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;

	service_h service = NULL;
	int ret = 0;
	bool err_popup_show = true;

	ui_gadget_h ug = NULL;
	struct ug_cbs cbs = { 0, };

	char buf[10] = { 0, };

	if (!cur_category_mem || strlen(cur_category_mem->main_id) < 0 ) {
		SEARCH_DEBUG_ERROR("Selected item does not have data!");
		goto out_func;
	} else {
	if (ad->detail_ug) {
			SEARCH_DEBUG_WARNING("\n prev ug is exist. destroy prev ug");
		__search_layout_ug_destroy(ad);
	}

		ret = service_create(&service);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to create service handle!");
			goto out_func;
	}

	snprintf(buf, sizeof(buf), "%d", CT_UG_REQUEST_DETAIL);
		ret = service_add_extra_data(service, CT_UG_BUNDLE_TYPE, buf);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
			goto out_func;
		}

		ret = service_add_extra_data(service, CT_UG_BUNDLE_ID,
					cur_category_mem->main_id);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 2!");
			goto out_func;
		}

#ifdef ENABLE_UG_EFFECT
	__search_create_effect_layout(ad->win_main, ad);
#endif

	cbs.layout_cb = __search_ug_layout_cb;
	cbs.result_cb = NULL;
	cbs.destroy_cb = __search_ug_closed_cb;
	cbs.priv = ad;

		ug = ug_create(NULL, UG_CONTACTS_DETAILS, UG_MODE_FULLVIEW, service, &cbs);

	if (!ug) {
		SEARCH_DEBUG_ERROR(" ...  ug_create: failed !!!");
			goto out_func;
	} else {
		ad->detail_ug = ug;
			err_popup_show = false;
	}
	}

out_func:
	if (err_popup_show == true)
		search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);

	if (service != NULL)
		service_destroy(service);

	SEARCH_FUNC_END;
}

void search_launch_msg_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;

	bundle *b;
	int ret = 0;

	b = bundle_create();
	if (!b) {
		SEARCH_DEBUG_ERROR("search_launch_msg_view : bundle_create failed");
		return;
	}

	bundle_add(b, "type", "msg_id");
	bundle_add(b, "msgId", cur_category_mem->main_id);
	ret = aul_launch_app("org.tizen.message", b);
	if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
		SEARCH_DEBUG_ERROR("msg aul launch app error(%d)", ret);
		search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
	}

	bundle_free(b);

	SEARCH_FUNC_END;
}

void search_launch_email_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	bundle *b;
	char *token_param = NULL;
	char *saveptr1;
	int i = 0;
	int ret = 0;
	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;

	b = bundle_create();
	if (!b)
		return;

	char livemagazine[2] = { 0, };
	char temp_path[MAX_LENGTH_PER_PATH] = { 0, };
	livemagazine[0] = '0';

	snprintf(temp_path, MAX_LENGTH_PER_PATH - 1, "%s",
		 cur_category_mem->path);

	token_param = strtok_r(temp_path, " ", &saveptr1);

	while (token_param != NULL) {
		if (i == 0) {
			bundle_add(b, "ACCOUNT_ID", token_param);	//account_id
		} else if (i == 1) {
			bundle_add(b, "MAIL_ID", token_param);	//mail_id
		} else if (i == 2) {
			bundle_add(b, "MAILBOX_ID", token_param);	//mailbox
		} else {
			break;
		}

		i++;
		token_param = strtok_r(NULL, " ", &saveptr1);
	}

	bundle_add(b, "bLiveMagazine", livemagazine);

	char runType[2] = { 0 };
	snprintf(runType, sizeof(runType), "%d", 7);
	bundle_add(b, "RUN_TYPE", runType);
	ret = aul_launch_app("org.tizen.email", b);
	if( (ret <= 0) && (ret != AUL_R_ETIMEOUT) ){
		SEARCH_DEBUG_ERROR("email aul launch app error(%d)", ret);
		search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);
	}

	bundle_free(b);

	SEARCH_FUNC_END;
}

void search_launch_image_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	int ret;

		if (access(cur_category_mem->path, F_OK) != 0) {
			SEARCH_DEBUG_ERROR("image access error : %s",
					   cur_category_mem->path);
			search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND,
						  ad);
		} else {
		SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
				     cur_category_mem->path);

		service_h service;
		ret = service_create(&service);

		if (ret == 0) {
			service_set_operation(service, SERVICE_OPERATION_VIEW);
			service_set_uri(service, cur_category_mem->path);
			ret = service_send_launch_request(service, NULL, NULL);

			if (ret != 0) {
				SEARCH_DEBUG_ERROR("image app service launching error(%d)", ret);
				search_launch_popup_error(LAUNCH_ERROR_APPSVC,
							  ad);
			}
			service_destroy(service);
		}
		}

	SEARCH_FUNC_END;
}

void search_launch_video_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	int ret;

	if (access(cur_category_mem->path, F_OK) != 0) {
		SEARCH_DEBUG_ERROR("video access error : %s",
				   cur_category_mem->path);
		search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
	} else {
		SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
			 cur_category_mem->path);

		service_h service;
		ret = service_create(&service);

		if (ret == 0) {
			service_set_operation(service, SERVICE_OPERATION_VIEW);
			service_set_uri(service, cur_category_mem->path);
			ret = service_send_launch_request(service, NULL, NULL);

			if (ret != 0) {
				SEARCH_DEBUG_ERROR("video app service launching error(%d)", ret);
				search_launch_popup_error(LAUNCH_ERROR_APPSVC,
							  ad);
			}
			service_destroy(service);
		}
	}

	SEARCH_FUNC_END;
}

void search_launch_music_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	int ret;

	if (access(cur_category_mem->path, F_OK) != 0) {
		SEARCH_DEBUG_ERROR("music file access error : %s",
				   cur_category_mem->path);
		search_launch_popup_error(LAUNCH_ERROR_FILE_NOT_FOUND, ad);
	} else {
		SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
				 cur_category_mem->path);

		service_h service;
		ret = service_create(&service);

		if (ret == 0) {
			service_set_operation(service, SERVICE_OPERATION_VIEW);
			service_set_uri(service, cur_category_mem->path);
			ret = service_send_launch_request(service, NULL, NULL);

			if (ret != 0) {
				SEARCH_DEBUG_ERROR("music app service launching error(%d)", ret);
				search_launch_popup_error(LAUNCH_ERROR_APPSVC,
							 	ad);
			}
			service_destroy(service);
		}
	}

	SEARCH_FUNC_END;
}

void search_launch_calendar_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	ui_gadget_h ug = NULL;
	struct ug_cbs cbs = { 0, };
	int ret = 0;
	bool err_popup_show = true;
	service_h service = NULL;

	if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
		SEARCH_DEBUG_ERROR("Selected item does not have data!");
		goto out_func;
	} else {
		ret = service_create(&service);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to create service handle!");
			goto out_func;
		}

		ret = service_add_extra_data(service, "itemType", "event");

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
			goto out_func;
	}

		ret = service_add_extra_data(service, "eventId", cur_category_mem->main_id);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 2!");
			goto out_func;
		}

#ifdef ENABLE_UG_EFFECT
		__search_create_effect_layout(ad->win_main, ad);
#endif
		cbs.destroy_cb = __search_ug_closed_cb;
		cbs.layout_cb = __search_ug_layout_cb;
		cbs.result_cb = NULL;
		cbs.priv = ad;

		ug = ug_create(NULL, "calendar-detail-efl", UG_MODE_FULLVIEW, service, &cbs);

		if (!ug) {
			SEARCH_DEBUG_ERROR("...  create_ug_calendar : failed !!!");
			goto out_func;
		}

		ad->detail_ug = ug;
		err_popup_show = false;
	}

out_func:
	if (err_popup_show == true)
		search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);

	if (service != NULL)
		service_destroy(service);

	SEARCH_FUNC_END;
}

void search_launch_memo_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	ui_gadget_h ug = NULL;
	struct ug_cbs cbs = { 0, };

	int ret = 0;
	bool err_popup_show = true;

	service_h service = NULL;

	if (!cur_category_mem && strlen(cur_category_mem->main_id) < 0) {
		SEARCH_DEBUG_ERROR("Selected item does not have data!");
		goto out_func;
	} else {
	if (ad->detail_ug) {
		SEARCH_DEBUG_WARNING("prev ug is exist. destroy prev ug");
			__search_layout_ug_destroy(ad);
		}

		ret = service_create(&service);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to create service handle!");
			goto out_func;
	}

		ret = service_add_extra_data(service, "index", cur_category_mem->main_id);

		if (ret != SERVICE_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to add service extra data : parameter 1!");
			goto out_func;
		}

#ifdef ENABLE_UG_EFFECT
	__search_create_effect_layout(ad->win_main, ad);
#endif
	cbs.layout_cb = __search_ug_layout_cb;
	cbs.result_cb = NULL;
	cbs.destroy_cb = __search_ug_closed_cb;
	cbs.priv = ad;

		ug = ug_create(NULL, "memo-efl", UG_MODE_FULLVIEW, service, &cbs);

	if (!ug) {
		SEARCH_DEBUG_ERROR("...  create_ug_email : failed !!!");
			goto out_func;
	}

	ad->detail_ug = ug;
		err_popup_show = false;
	}

out_func:
	if (err_popup_show == true)
		search_launch_popup_error(LAUNCH_ERROR_AUL_LAUNCH, ad);

	if (service != NULL)
		service_destroy(service);

	SEARCH_FUNC_END;
}

void search_launch_menu_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	char *pkg_name = cur_category_mem->path;
	bool is_running = false;
	app_context_h app_h;

	bool err_popup_show = true;
	int ret;
	service_h service = NULL;

	if (pkg_name != NULL && strlen(pkg_name)) {
		ret = app_manager_is_running(pkg_name, &is_running);

		if (ret != APP_MANAGER_ERROR_NONE) {
			SEARCH_DEBUG_ERROR("Fail to get info : app_manager_is_running [%d]", ret);
			goto out_func;
		}

		if (is_running == true) {
			ret = app_manager_get_app_context(pkg_name, &app_h);
			if (ret != APP_MANAGER_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to get info : app_manager_get_app_context [%d]", ret);
				goto out_func;
			}

			ret = app_manager_resume_app(app_h);

			if (ret != APP_MANAGER_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to get info : app_manager_resume_app [%d]", ret);
				goto out_func;
			}
			err_popup_show = false;
		} else {
			ret = service_create(&service);

			if (ret != SERVICE_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to create service header : [%d]", ret);
				goto out_func;
			}

			ret = service_set_operation(service, SERVICE_OPERATION_DEFAULT);

			if (ret != SERVICE_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to set operation : [%d]", ret);
				goto out_func;
			}

			ret = service_set_package(service, pkg_name);

			if (ret != SERVICE_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to set package : [%d]", ret);
				goto out_func;
			}

			ret = service_send_launch_request(service, NULL, NULL);

			if (ret != SERVICE_ERROR_NONE) {
				SEARCH_DEBUG_ERROR("Fail to send launch request : [%d]", ret);
				goto out_func;
			}
			err_popup_show = false;
		}
	} else {
		SEARCH_DEBUG_ERROR("Pkg name is NULL!");
	}

out_func:
	if (err_popup_show == true)
		search_launch_popup_error(LAUNCH_ERROR_APPSVC, ad);

	if (service != NULL) {
		ret = service_destroy(service);

		if (ret != SERVICE_ERROR_NONE)
			SEARCH_DEBUG_ERROR("Fail to destroy service header : [%d]", ret);
	}

	SEARCH_FUNC_END;
}

void search_launch_browser_view(void *data, void *record_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;
	struct search_item_sel *cur_category_mem =
	    (struct search_item_sel *)record_info;
	int ret;

	SEARCH_DEBUG_LOG("cur_category_mem->path : %s",
				   cur_category_mem->path);

	service_h service;
	ret = service_create(&service);

	if (ret == 0 && strlen(cur_category_mem->path) > 0 ) {
		service_set_operation(service, SERVICE_OPERATION_VIEW);
		service_set_uri(service, cur_category_mem->path);
		ret = service_send_launch_request(service, NULL, NULL);

		if (ret != 0) {
			SEARCH_DEBUG_ERROR("browser app service launching error(%d)", ret);
			search_launch_popup_error(LAUNCH_ERROR_APPSVC,
						  ad);
		}
		service_destroy(service);
	}

}

static void __search_launch_popup_error_response_cb(void *data,
						    Evas_Object * obj,
						    void *event_info)
{
	SEARCH_FUNC_START;

	struct appdata *ad = (struct appdata *)data;

	evas_object_del(ad->ctxpopup);
	ad->ctxpopup = NULL;

	SEARCH_FUNC_END;
}

void search_launch_popup_error(int error_type, void *data)
{
	Evas_Object *popup;
	Evas_Object *btn1;

	struct appdata *ad = (struct appdata *)data;

	if (error_type >= LAUNCH_ERROR_MAX) {
		SEARCH_DEBUG_ERROR("wrong error_type : %d", error_type);
	}

	if (ad->ctxpopup) {
		evas_object_del(ad->ctxpopup);
		ad->ctxpopup = NULL;
	}

	popup = elm_popup_add(ad->win_main);
	evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND,
					 EVAS_HINT_EXPAND);

	switch(error_type) {
		case LAUNCH_ERROR_FILE_NOT_FOUND:
			elm_object_text_set(popup,
				   dgettext("sys_string",
					    "IDS_COM_POP_FILE_NOT_FOUND"));
			break;
		case LAUNCH_ERROR_AUL_LAUNCH:
			/* This Message String enable to be another string in the future */
			elm_object_text_set(popup,
					   gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
			break;
		case LAUNCH_ERROR_APPSVC:
			elm_object_text_set(popup,
					   gettext("IDS_SSEARCH_POP_SELECTED_DATA_DOES_NOT_EXIST"));
			break;
	}

	btn1 = elm_button_add(popup);
	elm_object_style_set(btn1, "popup_button/default");

	elm_object_text_set(btn1,
				dgettext("sys_string","IDS_COM_POP_CLOSE"));
	evas_object_smart_callback_add(btn1, "clicked",
				       __search_launch_popup_error_response_cb,
				       ad);

	elm_object_part_content_set(popup, "button1", btn1);

	elm_popup_timeout_set(popup, 3.0);

	evas_object_smart_callback_add(popup, "timeout",
				       __search_launch_popup_error_response_cb,
				       ad);
	evas_object_smart_callback_add(popup, "block,clicked",
				       __search_launch_popup_error_response_cb,
				       ad);
	evas_object_show(popup);

	ad->ctxpopup = popup;
}