6f0dea27e6adc6c3d68346c2e2d0addb879b8187
[profile/tv/apps/native/filebrowser.git] / src / views / FbContextView.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 #include <Elementary.h>
18 #include <Eina.h>
19 #include "i18n.h"
20 #include "dbg.h"
21
22 #include "AppCommon.h"
23 #include "InputHandler.h"
24 #include "define.h"
25 #include "common.h"
26 #include "ExtNameInfo.h"
27 #include <BaseView.h>
28 #include <ViewMgr.h>
29 #include "FbContextView.h"
30 #include "Dummy/DummyContent.h"
31
32 //#define _GET_PRIV(o) evas_object_data_get(o, "CTMDATA");
33 //#define _SET_PRIV(o, data) evas_object_data_set(o, "CTMDATA", data);
34
35 #define FBR_TEXT_SIZE N_("Size")
36 #define FBR_TEXT_FORMAT N_("Format")
37 #define FBR_TEXT_OPEN N_("OPEN")
38 #define FBR_TEXT_LINK N_("Other linkable apps")
39 #define FBR_TEXT_REL N_("Other apps for this type")
40 #define EMPTY_STR ""
41 #define TOTAL_CONTEXT_BTNS 5
42 #define TABLE_MAX_COL 2
43 #define MIN_LABEL_WIDTH 103
44 #define FBR_CTXT_BTN_WPAD 26
45 #define FBR_CTXT_TABLE_WPAD 14
46 #define FBR_CTXT_TABLE_HPAD 14
47
48
49 struct SContextView {
50         Evas_Object *eoWin;
51         Evas_Object *eoBase;
52         Evas_Object *eoBtnOpen;
53         Evas_Object *rel_first[TABLE_MAX_COL];
54         Evas_Object *rel_last[TABLE_MAX_COL];
55         Evas_Object *link_first[TABLE_MAX_COL];
56         Evas_Object *link_last[TABLE_MAX_COL];
57
58         CExtNameInfo *finfo;
59
60         CDummyContent content;
61
62         SContextView() {
63                 eoWin = NULL;
64                 eoBase = NULL;
65                 eoBtnOpen = NULL;
66                 int a;
67                 for (a = 0; a < TABLE_MAX_COL; a++) {
68                         rel_first[a] = NULL;
69                         rel_last[a] = NULL;
70                         link_first[a] = NULL;
71                         link_last[a] = NULL;
72                 }
73                 finfo = NULL;
74                 pHandlerButton = new SContextView::CHandlerButton(this);
75         }
76         ~SContextView() {
77                 delete pHandlerButton;
78         }
79
80         class CHandlerButton : public CListenerMgr, IMouseMoveListener, IMouseUpListener, IKeyUpListener {
81                 SContextView *m;
82         public:
83                 CHandlerButton(SContextView *ins) : IMouseMoveListener(this), IMouseUpListener(this), IKeyUpListener(this) { m = ins; }
84
85                 virtual void OnMouseMove(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev) {
86                         if (!elm_object_focus_get(obj))
87                                 elm_object_focus_set(obj, EINA_TRUE);
88                 }
89                 virtual void OnKeyUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) {
90                         _DBG();
91                         if (m->eoBtnOpen == obj) {
92                                 _DBG();
93                                 if (strcmp(ev->keyname, KEY_ENTER) && strcmp(ev->keyname, KEY_ENTER_REMOTE))
94                                         return;
95
96                                 CViewMgr::GetInstance()->UpdateView(FBR_BASE_VIEW, NULL);
97                         }
98                         else {
99                                 _DBG();
100                                 if (strcmp(ev->keyname, KEY_ENTER) && strcmp(ev->keyname, KEY_ENTER_REMOTE))
101                                         return;
102
103                                 elm_object_signal_emit(obj, FBR_SIGNAL_CONTENT_CLICKED, FBR_CONTEXT_VIEW);
104                         }
105                 }
106                 virtual void OnMouseUp(int id, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev) {
107                         _DBG();
108                         if (m->eoBtnOpen == obj) {
109                                 CViewMgr::GetInstance()->UpdateView(FBR_BASE_VIEW, NULL);
110                         }
111                         else {
112                                 elm_object_signal_emit(obj, FBR_SIGNAL_CONTENT_CLICKED, FBR_CONTEXT_VIEW);
113                         }
114                 }
115         } *pHandlerButton;
116 };
117
118
119 extern const char *typestr[];
120
121
122 void CContextView::_lbl_start_slide(Evas_Object *lbl)
123 {
124         elm_label_ellipsis_set(lbl, EINA_FALSE);
125         elm_label_slide_mode_set(lbl, ELM_LABEL_SLIDE_MODE_AUTO);
126         elm_label_slide_go(lbl);
127 }
128
129 void CContextView::_btn_focused(void *data, Evas_Object *obj, void *ev)
130 {
131         _DBG();
132         if (!obj)
133                 return;
134
135         elm_object_signal_emit(obj, FBR_SIGNAL_FOCUSED, FBR_CONTEXT_VIEW);
136
137 }
138
139 void CContextView::_btn_unfocused(void *data, Evas_Object *obj, void *ev)
140 {
141         _DBG();
142         if (!obj)
143                 return;
144
145         elm_object_signal_emit(obj, FBR_SIGNAL_UNFOCUSED, FBR_CONTEXT_VIEW);
146 }
147
148
149 bool CContextView::_add_btn_label(Evas_Object *btn, const char *txt)
150 {
151         Evas_Object *lbl;
152         char buf[MAX_LENGTH];
153
154         if (!btn || !txt)
155                 return false;
156
157         lbl = elm_label_add(btn);
158         if (!lbl) {
159                 _ERR("elm_label_add failed.");
160                 return false;
161         }
162
163         snprintf(buf, sizeof(buf),
164                         "<align=center><color=#FFFFFFFF>"
165                         "<font=%s>"
166                         "<font_size=21>%s</font_size>"
167                         "</font></color></align>", FONT_STYLE_MEDIUM, _(txt));
168         elm_object_text_set(lbl, buf);
169         elm_label_line_wrap_set(lbl, ELM_WRAP_WORD);
170         evas_object_size_hint_min_set(lbl, MIN_LABEL_WIDTH, 0);
171         elm_object_part_content_set(btn, FBR_PART_CTXT_BTNTEXT, lbl);
172
173         return true;
174 }
175
176 bool CContextView::_add_btn_icon(Evas_Object *btn, const char *icon)
177 {
178         Evas_Object *img;
179         char buf[MAX_LENGTH];
180
181         if (!btn || !icon)
182                 return false;
183
184         img = elm_image_add(btn);
185         if (!img) {
186                 _ERR("elm_image_add failed.");
187                 return false;
188         }
189
190         snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, icon);
191         elm_image_file_set(img, buf, NULL);
192         elm_object_part_content_set(btn, FBR_PART_CTXT_BTNICON, img);
193
194         return true;
195 }
196
197 bool CContextView::_add_btn_info(Evas_Object *btn, const char *icon, const char *txt)
198 {
199         if (!btn || !icon || !txt)
200                 return false;
201
202         if (!_add_btn_icon(btn, icon))
203                 return false;
204
205         if (!_add_btn_label(btn, txt))
206                 return false;
207
208         return true;
209 }
210
211
212 Evas_Object *CContextView::_add_btnbox(Evas_Object *eoBase)
213 {
214         Evas_Object *box;
215
216         if (!eoBase)
217                 return NULL;
218
219         box = elm_box_add(eoBase);
220         if (!box) {
221                 _ERR(" elm_box_add failed ");
222                 return NULL;
223         }
224
225         elm_box_horizontal_set(box, EINA_TRUE);
226         elm_box_padding_set(box, FBR_CTXT_BTN_WPAD, 0);
227         elm_box_align_set(box, 0, 0.5);
228         evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND,
229                         EVAS_HINT_EXPAND);
230
231         return box;
232 }
233
234 bool CContextView::_get_context_details(CExtNameInfo *pInfo, char **path, char **title, char *subtitle, char *subtitle2)
235 {
236         char buf[MAX_LENGTH];
237         TSize size;
238         double size_mb;
239         int type;
240
241         if (!pInfo)
242                 return false;
243
244         *title = pInfo->Name();
245         *path  = pInfo->ThumbnailPath();
246         size = pInfo->Size();
247
248         size_mb = (double)size / (1024 * 1024); /* Convert to MB */
249
250         snprintf(buf, sizeof(buf), "%s : %f MB", _(FBR_TEXT_SIZE), size_mb);
251         strcpy(subtitle, buf);
252
253         type = pInfo->Type();
254         snprintf(buf, sizeof(buf), "%s : %s", _(FBR_TEXT_FORMAT), _(typestr[type]));
255         strcpy(subtitle2, buf);
256
257         return true;
258 }
259
260 Evas_Object *CContextView::_add_rltv_ctnt(Evas_Object *obj, const char *name, const char *icon)
261 {
262         Evas_Object *ly, *img;
263         char buf[MAX_LENGTH];
264
265         if (!obj) {
266                 _ERR("Invalid argument.");
267                 return NULL;
268         }
269
270         ly = elm_layout_add(obj);
271         if (!ly) {
272                 _ERR("elm_layout_add failed.");
273                 return NULL;
274         }
275
276         elm_layout_file_set(ly, EDJEFILE, FBR_CONTEXT_APP);
277         evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
278
279         img = elm_image_add(ly);
280         if (!img) {
281                 _ERR("elm_image_add failed.");
282                 evas_object_del(ly);
283                 return NULL;
284         }
285
286         if (!icon || !strcmp(icon, EMPTY_STR)) {
287                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, FBR_IMAGE_DEFAULT_APP);
288                 elm_image_file_set(img, buf, NULL);
289                 elm_image_no_scale_set(img, EINA_TRUE);
290         } else {
291                 elm_image_file_set(img, icon, NULL);
292                 elm_image_aspect_fixed_set(img, EINA_FALSE);
293         }
294
295         elm_object_part_content_set(ly, FBR_PART_CTXT_RELCTNT_ICON, img);
296         elm_object_part_text_set(ly, FBR_PART_CTXT_RELCTNT_NAME, name);
297         elm_object_focus_allow_set(ly, EINA_TRUE);
298
299         return ly;
300 }
301
302
303 Evas_Object *CContextView::_add_scroller(Evas_Object *eoBase)
304 {
305         Evas_Object *scroller;
306
307         if (!eoBase) {
308                 _ERR("Invalid argument.");
309                 return NULL;
310         }
311
312         scroller = elm_scroller_add(eoBase);
313         if (!scroller) {
314                 _ERR("elm_scroller_add failed.");
315                 return NULL;
316         }
317
318         evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND,
319                         EVAS_HINT_EXPAND);
320         evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL,
321                         EVAS_HINT_FILL);
322
323         return scroller;
324 }
325
326 Evas_Object *CContextView::_add_table(Evas_Object *eoBase)
327 {
328         Evas_Object *table;
329
330         if (!eoBase) {
331                 _ERR("Invalid argument.");
332                 return NULL;
333         }
334
335         table = elm_table_add(eoBase);
336         if (!table) {
337                 _ERR("elm_table_add failed.");
338                 return NULL;
339         }
340
341         elm_table_homogeneous_set(table, EINA_TRUE);
342         elm_table_padding_set(table,
343                         FBR_CTXT_TABLE_WPAD * elm_config_scale_get(),
344                         FBR_CTXT_TABLE_HPAD * elm_config_scale_get());
345         evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
346         evas_object_show(table);
347
348         return table;
349 }
350
351
352 Evas_Object *CContextView::_get_icon(Evas_Object *obj, CExtNameInfo *finfo)
353 {
354         Evas_Object *icon;
355         char *path;
356
357         path = finfo->Path();
358         if (!path)
359                 return NULL;
360
361         icon = elm_icon_add(obj);
362         if (!icon)
363                 return NULL;
364
365         elm_need_ethumb();
366         elm_icon_thumb_set(icon, path, NULL);
367         elm_image_aspect_fixed_set(icon, EINA_FALSE);
368
369         return icon;
370 }
371
372
373 void CContextView::_set_default_thumb(Evas_Object *img, int type)
374 {
375         char buf[MAX_LENGTH];
376
377         if (!img)
378                 return;
379
380         switch (type) {
381         case E_GRP_FOLDER:
382                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
383                                 FBR_IMAGE_FOLDER);
384                 break;
385
386         case E_GRP_VIDEO:
387                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
388                                 FBR_IMAGE_DEFAULT_VIDEO);
389                 break;
390
391         case E_GRP_MUSIC:
392                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
393                                 FBR_IMAGE_DEFAULT_MUSIC);
394                 break;
395
396         default:
397                 snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR,
398                                 FBR_IMAGE_DEFAULT_OTHER);
399                 break;
400         }
401
402         elm_image_file_set(img, buf, NULL);
403         elm_image_no_scale_set(img, EINA_TRUE);
404 }
405
406
407 Evas_Object *CContextView::_create_lbl(Evas_Object *ly, char *title)
408 {
409         Evas_Object *lbl;
410         const char *s;
411         char buf[MAX_LENGTH];
412
413         if (!title)
414                 return NULL;
415
416         lbl = elm_label_add(ly);
417         if (!lbl) {
418                 return NULL;
419         }
420
421         elm_object_style_set(lbl, FBR_STYLE_LABEL);
422         elm_label_ellipsis_set(lbl, EINA_TRUE);
423         s = edje_object_data_get(elm_layout_edje_get(ly),
424                         FBR_DATA_TITLE_WIDTH);
425         if (s)
426                 elm_label_wrap_width_set(lbl, atoi(s));
427         else
428                 _ERR("No title width exist");
429
430         snprintf(buf, sizeof(buf),
431                         "<align=left><color=#FFFFFFFF>"
432                         "<font=%s>"
433                         "<font_size=36>%s</font_size>"
434                         "</font></color></align>", FONT_STYLE_BOLD, _(title));
435         elm_object_text_set(lbl, buf);
436         elm_label_slide_speed_set(lbl, FBR_TITLE_SLIDE_SPEED);
437
438         return lbl;
439 }
440
441
442
443 void CContextView::m_SetBtnDownFocus(Evas_Object *btn)
444 {
445         ASSERT(m);
446
447         if (!m->link_first[0] && !m->rel_first[0]) {
448                 elm_object_focus_next_object_set(btn, btn,
449                         ELM_FOCUS_DOWN);
450                 return;
451         }
452
453         if (m->link_first[0])
454                 elm_object_focus_next_object_set(btn, m->link_first[0],
455                 ELM_FOCUS_DOWN);
456         else
457                 elm_object_focus_next_object_set(btn, m->rel_first[0],
458                 ELM_FOCUS_DOWN);
459 }
460
461
462 void CContextView::m_SetLayoutFocusOrder(Evas_Object *btn)
463 {
464         ASSERT(btn);
465
466         int i;
467         Evas_Object *obj;
468
469         if (m->link_first[0]) {
470                 elm_object_focus_next_object_set(m->link_first[0], btn,
471                         ELM_FOCUS_UP);
472                 elm_object_focus_next_object_set(m->link_first[0],
473                         m->rel_first[0], ELM_FOCUS_DOWN);
474                 elm_object_focus_next_object_set(m->link_first[1], btn,
475                         ELM_FOCUS_UP);
476                 elm_object_focus_next_object_set(m->link_first[1],
477                         m->rel_first[0], ELM_FOCUS_DOWN);
478         }
479
480         for (i = 0; i < TABLE_MAX_COL; i++) {
481                 if (!m->rel_first[i])
482                         continue;
483
484                 obj = m->rel_first[i];
485                 if (m->link_first[0])
486                         elm_object_focus_next_object_set(obj, m->link_first[0],
487                         ELM_FOCUS_UP);
488                 else
489                         elm_object_focus_next_object_set(obj, btn,
490                         ELM_FOCUS_UP);
491         }
492 }
493
494
495 Evas_Object *CContextView::m_AddButton(Evas_Object *eoBase)
496 {
497         ASSERT(eoBase);
498
499         Evas_Object *btn;
500
501         btn = elm_layout_add(eoBase);
502         if (!btn) {
503                 _ERR("elm_layout_add failed.");
504                 return NULL;
505         }
506
507         evas_object_size_hint_weight_set(btn,
508                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
509         evas_object_size_hint_align_set(btn, 0.0, 0.5);
510
511         elm_layout_file_set(btn, EDJEFILE, FBR_CONTEXT_BTN);
512         elm_object_focus_allow_set(btn, EINA_TRUE);
513         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_UP);
514         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_LEFT);
515         elm_object_focus_next_object_set(btn, btn, ELM_FOCUS_RIGHT);
516
517         evas_object_smart_callback_add(btn, FBR_SIGNAL_FOCUSED,   _btn_focused, NULL);
518         evas_object_smart_callback_add(btn, FBR_SIGNAL_UNFOCUSED, _btn_unfocused, NULL);
519
520         evas_object_show(btn);
521         elm_object_focus_set(btn, EINA_TRUE);
522
523         return btn;
524 }
525
526
527 bool CContextView::m_AddTableContents(Evas_Object *table, Eina_List *list, enum content_app_type type)
528 {
529         ASSERT(list);
530
531         int row, col;
532         Evas_Object *ly;
533         Eina_List *l;
534         CDummyContent::SRelativeContent *rctnt;
535         void* obj;
536
537         row = 0;
538         col = 0;
539
540         EINA_LIST_FOREACH(list, l, obj) {
541                 rctnt = (CDummyContent::SRelativeContent *)obj;
542                 ly = _add_rltv_ctnt(table, rctnt->title, rctnt->imgpath);
543                 if (!ly)
544                         continue;
545                 //_SET_PRIV(ly, rctnt);
546                 elm_table_pack(table, ly, col, row, 1, 1);
547                 evas_object_show(ly);
548
549                 evas_object_smart_callback_add(ly, FBR_SIGNAL_FOCUSED,       _btn_focused, NULL);
550                 evas_object_smart_callback_add(ly, FBR_SIGNAL_UNFOCUSED,     _btn_unfocused, NULL);
551
552                 m->pHandlerButton->Connect(ly);
553
554                 if (row == 0) {
555                         if (type == APP_LINKED)
556                                 m->link_first[col] = ly;
557                         else
558                                 m->rel_first[col] = ly;
559                 }
560
561                 if (col == 0)
562                         elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_LEFT);
563                 else if (col == TABLE_MAX_COL - 1)
564                         elm_object_focus_next_object_set(ly, ly, ELM_FOCUS_RIGHT);
565
566                 if (type == APP_LINKED)
567                         m->link_last[col] = ly;
568                 else
569                         m->rel_last[col] = ly;
570
571                 col++;
572                 if (col >= TABLE_MAX_COL) {
573                         row++;
574                         col = 0;
575                 }
576         }
577
578         return true;
579 }
580
581
582 bool CContextView::m_CreateContentApps(Eina_List *list, enum content_app_type type)
583 {
584         if (!list)
585                 return false;
586
587         Evas_Object *scroller, *table;
588         int r;
589
590         scroller = _add_scroller(m->eoBase);
591         if (!scroller) {
592                 _ERR("_add_scroller failed.");
593                 return false;
594         }
595
596         table = _add_table(scroller);
597         if (!table) {
598                 _ERR("_add_table failed.");
599                 evas_object_del(scroller);
600                 return false;
601         }
602
603         r = m_AddTableContents(table, list, type);
604         if (!r) {
605                 _ERR("m_AddTableContents failed.");
606                 evas_object_del(scroller);
607                 return false;
608         }
609
610         elm_object_content_set(scroller, table);
611
612         if (type == APP_LINKED)
613                 elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_LINK_AREA,
614                 scroller);
615         else
616                 elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_REL_AREA,
617                 scroller);
618
619         return true;
620 }
621
622
623 bool CContextView::m_CreateBtnsPart(void)
624 {
625         Evas_Object *btn, *box;
626         box = _add_btnbox(m->eoBase);
627         if (!box)
628                 return false;
629
630         btn = m_AddButton(box);
631         if (!btn) {
632                 evas_object_del(box);
633                 return false;
634         }
635         if (!_add_btn_info(btn, FBR_IMAGE_CTXT_OPEN, FBR_TEXT_OPEN)) {
636                 evas_object_del(box);
637                 return false;
638         }
639
640         m_SetBtnDownFocus(btn);
641         m_SetLayoutFocusOrder(btn);
642         elm_box_pack_end(box, btn);
643         m->eoBtnOpen = btn;
644
645         m->pHandlerButton->Connect(m->eoBtnOpen);
646
647         elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_BTNAREA, box);
648
649         return true;
650 }
651
652
653 bool CContextView::m_CreateInfoPart(void)
654 {
655         Evas_Object *img = NULL;
656         char *title = NULL;
657
658         char subtitle[MAX_LENGTH];
659         char subtitle2[MAX_LENGTH];
660
661         char *path = NULL;
662         Eina_List *rltvlist = NULL;
663         Eina_List *linkapplist = NULL;
664         int type;
665         Evas_Object *lbl = NULL;
666
667         if (!_get_context_details(m->finfo, &path, &title, subtitle, subtitle2))
668                 return false;
669
670         type = m->finfo->Type();
671         if (!path) {
672                 if (type == E_GRP_PHOTO) {
673                         img = _get_icon(m->eoBase, m->finfo);
674                         if (!img)
675                                 goto finish;
676                 } else {
677                         img = elm_image_add(m->eoBase);
678                         if (!img)
679                                 goto finish;
680                         _set_default_thumb(img, type);
681                 }
682         } else {
683                 img = elm_image_add(m->eoBase);
684                 if (!img)
685                         goto finish;
686                 elm_image_file_set(img, path, NULL);
687                 elm_image_aspect_fixed_set(img, EINA_FALSE);
688         }
689
690         elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_ICON, img);
691
692         lbl = _create_lbl(m->eoBase, title);
693         if (lbl) {
694                 elm_object_part_content_set(m->eoBase, FBR_PART_CTXT_TITLE, lbl);
695                 _lbl_start_slide(lbl);
696         }
697
698         elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_SUBTITLE,  subtitle);
699         elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_SUBTITLE2, subtitle2);
700
701         elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_LINK_TEXT, _(FBR_TEXT_LINK));
702         linkapplist = CDummyContent::ListLinkApp(type);
703         if (linkapplist)
704                 m_CreateContentApps(linkapplist, APP_LINKED);
705
706         elm_object_part_text_set(m->eoBase, FBR_PART_CTXT_REL_TEXT, _(FBR_TEXT_REL));
707         rltvlist = CDummyContent::ListRelative(type);
708         if (rltvlist)
709                 m_CreateContentApps(rltvlist, APP_OTHER);
710
711 finish:
712
713         return true;
714 }
715
716
717 void CContextView::sm_CbKeyPressed(void *dt, Evas *e, Evas_Object *obj, void *ei)
718 {
719         _DBG();
720         Evas_Event_Key_Down *ev;
721
722         if (!dt || !ei)
723                 return;
724
725         ev = (Evas_Event_Key_Down *)ei;
726
727         if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE))
728         {
729                 CViewMgr::GetInstance()->PopView();
730         }
731         else if (!strcmp(ev->keyname, KEY_EXIT))
732                 elm_exit();
733 }
734
735 void CContextView::t_OnShow(void)
736 {
737         evas_object_show(m->eoBase);
738 }
739
740 void CContextView::t_OnHide(void)
741 {
742         evas_object_hide(m->eoBase);
743 }
744
745 bool CContextView::Create(void *data)
746 {
747         ASSERT(!m);
748
749         Evas_Object *eoBase = NULL;
750         Evas_Object *eoWin = CViewMgr::GetInstance()->Window();
751
752
753         _CREATE_BEGIN{
754                 _CHECK(m = new SContextView)
755                 _CHECK(eoBase = elm_layout_add(eoWin))
756                 _CHECK(elm_layout_file_set(eoBase, EDJEFILE, FBR_CONTEXT_VIEW))
757                 _COMMAND{ m->eoWin = eoWin; m->eoBase = eoBase; m->finfo = (CExtNameInfo*)data; }
758                 _CHECK(m_CreateInfoPart())
759                 _CHECK(m_CreateBtnsPart())
760
761                 _WHEN_SUCCESS{
762                         evas_object_event_callback_add(eoBase, EVAS_CALLBACK_KEY_DOWN, sm_CbKeyPressed, m);
763                 }
764
765                 _CHECK_FAIL{ /* m_CreateBtnsPart */ }
766                 _CHECK_FAIL{ /* m_CreateInfoPart */ }
767                 _CHECK_FAIL{}
768                 _CHECK_FAIL{ evas_object_del(eoBase);  }
769                 _CHECK_FAIL{ delete m; m = NULL; }
770         } _CREATE_END_AND_CATCH{ return false; }
771
772         return true;
773 }
774
775 void CContextView::Destroy(void)
776 {
777         ASSERT(m);
778
779         evas_object_del(m->eoBase);
780         delete m;
781         m = NULL;
782 }
783
784 Evas_Object* CContextView::Base(void)
785 {
786         ASSERT(m);
787
788         return m->eoBase;
789 }