NABI issues N_SE-50115, N_SE-50067, N_SE-49946, N_SE-49897, N_SE-49884, N_SE-48837...
[apps/osp/Settings.git] / src / StDisplayForm.cpp
1 //
2 // Copyright (c) 2012 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  * @file                StDisplayForm.cpp
19  * @brief               This is the implementation file for DisplayForm class.
20  */
21
22 #include <FSystem.h>
23 #include "StDisplayForm.h"
24 #include "StResourceManager.h"
25 #include "StSettingScenesList.h"
26 #include "StTypes.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::System;
31 using namespace Tizen::Ui;
32 using namespace Tizen::Ui::Controls;
33 using namespace Tizen::Ui::Scenes;
34
35 static const int W_RESIZE_LABEL_GAP = 110;
36 static const int RELATIVE_LAYOUT_ITEM_RIGHT_MARGIN = 140;
37
38 static const int BACKLIGHT_TIME_15_SECONDS = 15;
39 static const int BACKLIGHT_TIME_30_SECONDS = 30;
40 static const int BACKLIGHT_TIME_1_MINUTE = 60;
41 static const int BACKLIGHT_TIME_2_MINUTES = 120;
42 static const int BACKLIGHT_TIME_5_MINUTES = 300;
43 static const int BACKLIGHT_TIME_10_MINUTES = 600;
44
45 static const int ID_GROUP_AUTO_ROTATE_SCREEN = 0;
46 static const int ID_ITEM_AUTO_ROTATE_SCREEN = 0;
47
48 static const int ID_GROUP_BACKLIGHT_TIME = 1;
49 static const int ID_ITEM_BACKLIGHT_TIME = 0;
50
51 static const int ID_GROUP_BACKLIGHT_TIME_LIST = 2;
52 static const int ID_GROUP_BACKLIGHT_TIME_LIST_ITEM_COUNT = 6;
53 static const int ID_ITEM_BACKLIGHT_TIME_15_SECONDS = 0;
54 static const int ID_ITEM_BACKLIGHT_TIME_30_SECONDS = 1;
55 static const int ID_ITEM_BACKLIGHT_TIME_1_MINUTE = 2;
56 static const int ID_ITEM_BACKLIGHT_TIME_2_MINUTES = 3;
57 static const int ID_ITEM_BACKLIGHT_TIME_5_MINUTES = 4;
58 static const int ID_ITEM_BACKLIGHT_TIME_10_MINUTES = 5;
59
60 static const int ID_GROUP_FONT = 3;
61 static const int ID_ITEM_FONT = 0;
62
63 static const int ID_GROUP_BATTERY_PERCENTAGE = 4;
64 static const int ID_ITEM_BATTERY_PERCENTAGE = 0;
65
66 static const int ID_GROUP_BATTERY_PERCENTAGE_HELP = 5;
67 static const int ID_ITEM_BATTERY_PERCENTAGE_HELP = 0;
68
69 static const int ID_GROUP_DISPLAY_MAX_COUNT = 6;
70 static const int ID_GROUP_DEFAULT_ITEM_COUNT = 1;
71
72 static const int ID_GROUP_COUNT = 6;
73 static const int ID_GROUP_MAX_ITEM_COUNT = ID_GROUP_DISPLAY_MAX_COUNT;
74
75 DisplayForm::DisplayForm(void)
76 {
77 }
78
79 DisplayForm::~DisplayForm(void)
80 {
81 }
82
83 void
84 DisplayForm::CreateFooter(void)
85 {
86         Footer* pFooter = GetFooter();
87         AppAssert(pFooter);
88
89         pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
90         pFooter->AddActionEventListener(*this);
91
92         SetFormBackEventListener(this);
93 }
94
95 result
96 DisplayForm::OnInitializing(void)
97 {
98         CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_DISPLAY"));
99         CreateTableView();
100
101         AppLogDebug("ENTER");
102
103         return E_SUCCESS;
104 }
105
106 result
107 DisplayForm::OnTerminating(void)
108 {
109         __pTableView = null;
110
111         SetFormBackEventListener(null);
112         return E_SUCCESS;
113 }
114
115 void
116 DisplayForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
117 {
118         __pTableView->UpdateTableView();
119
120         bool autoRotation = false;
121         if (SettingInfo::GetValue(SETTING_INFO_KEY_SCREEN_ROTAION_AUTO, autoRotation) == E_SUCCESS)
122         {
123                 __pTableView->SetItemChecked(ID_GROUP_AUTO_ROTATE_SCREEN, ID_ITEM_AUTO_ROTATE_SCREEN, autoRotation);
124         }
125
126         bool batteryPercentage = false;
127         if (SettingInfo::GetValue(SETTING_INFO_KEY_BATTERY_PERCENTAGE, batteryPercentage) == E_SUCCESS)
128         {
129                 __pTableView->SetItemChecked(ID_GROUP_BATTERY_PERCENTAGE, ID_ITEM_BATTERY_PERCENTAGE, batteryPercentage);
130         }
131
132         __pTableView->SetItemChecked(ID_GROUP_BACKLIGHT_TIME_LIST, GetBackLightTimeIndex(), true);
133         __pTableView->CollapseGroup(ID_GROUP_BACKLIGHT_TIME_LIST);
134 }
135
136 void
137 DisplayForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
138 {
139 }
140
141 void
142 DisplayForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
143 {
144         SceneManager* pSceneManager = SceneManager::GetInstance();
145         AppAssert(pSceneManager);
146
147         pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
148 }
149
150 int
151 DisplayForm::GetGroupCount(void)
152 {
153         AppLogDebug("ENTER");
154         return ID_GROUP_COUNT;
155 }
156
157 int
158 DisplayForm::GetItemCount(int groupIndex)
159 {
160         int itemCount = ID_GROUP_DEFAULT_ITEM_COUNT;
161
162         if (groupIndex == ID_GROUP_BACKLIGHT_TIME_LIST)
163         {
164                 itemCount = ID_GROUP_BACKLIGHT_TIME_LIST_ITEM_COUNT;
165         }
166         else if (groupIndex == ID_GROUP_BATTERY_PERCENTAGE_HELP)
167         {
168                 itemCount = 0;
169         }
170         AppLogDebug("GetItemCount %d", itemCount);
171
172         return itemCount;
173 }
174
175 TableViewGroupItem*
176 DisplayForm::CreateGroupItem(int groupIndex, int itemWidth)
177 {
178         AppLogDebug("ENTER");
179
180         int itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
181         int yItemOffset = H_GROUP_INDEX_HELP_TEXT_TOP_GAP;
182         LabelTextStyle style = LABEL_TEXT_STYLE_BOLD;
183         Rectangle itemMainRectangle;
184         String groupText;
185         Label* pLabel = null;
186
187         TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
188
189         if (groupIndex == ID_GROUP_BATTERY_PERCENTAGE_HELP)
190         {
191                 style = LABEL_TEXT_STYLE_NORMAL;
192                 yItemOffset = H_GROUP_INDEX_HELP_TEXT_TOP_GAP;
193                 itemHeight = H_GROUP_INDEX_DEFAULT;
194                 groupText = ResourceManager::GetString(L"IDS_ST_BODY_SHOWS_BATTERY_PERCENTAGE_ON_INDICATOR");
195         }
196         else
197         {
198                 yItemOffset = 0;
199                 itemHeight = 0;
200         }
201
202         itemMainRectangle.x = X_GROUP_INDEX_DEFAULT_LABEL;
203         itemMainRectangle.y = yItemOffset;
204         itemMainRectangle.width = itemWidth;
205         itemMainRectangle.height = itemHeight;
206
207         RelativeLayout relativeLayout;
208         relativeLayout.Construct();
209
210         pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
211         pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
212
213         pLabel = new (std::nothrow) Label();
214         pLabel->Construct(itemMainRectangle, groupText);
215         pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
216         pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
217         pLabel->SetTextConfig(FONT_SIZE_GROUP_TITLE_TEXT, style);
218         pLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
219
220         pItem->AddControl(pLabel);
221         relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
222         relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
223         relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
224         pItem->SetEnabled(false);
225
226         return pItem;
227 }
228
229 TableViewItem*
230 DisplayForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
231 {
232         AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
233
234         Rectangle itemMainRectangle;
235         Rectangle itemSubRectangle;
236         TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
237         String itemMainText;
238         String subText;
239         Label* pLabel = null;
240         int fontSize = GetFontSize();
241         int leftMargin = 0;
242         int rightMargin = 0;
243         Rectangle detailArrow;
244         Bitmap* pBitmap = null;
245         int itemHeight = 0;
246         TableViewItem* pItem = new (std::nothrow) TableViewItem();
247
248         ItemTypeOneLine(itemMainRectangle);
249         itemHeight = itemMainRectangle.height;
250
251         switch (groupIndex)
252         {
253         case ID_GROUP_AUTO_ROTATE_SCREEN:
254                 {
255                         style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
256                         itemMainRectangle.width -= W_RESIZE_LABEL_GAP;
257                         itemMainText = ResourceManager::GetString(L"IDS_ST_HEADER_AUTO_ROTATE_SCREEN_ABB");
258                 }
259                 break;
260
261         case ID_GROUP_BACKLIGHT_TIME:
262                 {
263                         ItemTypeTwoLine(itemMainRectangle, itemSubRectangle,fontSize);
264                         itemHeight = (itemMainRectangle.height + itemSubRectangle.height);
265
266                         pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_CLOSED);
267
268                         itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_BACKLIGHT_TIME");
269                         int index = GetBackLightTimeIndex();
270                         subText = GetBackLightTimeIndexString(index);
271                 }
272                 break;
273
274         case ID_GROUP_BACKLIGHT_TIME_LIST:
275                 {
276                         style = TABLE_VIEW_ANNEX_STYLE_RADIO;
277                         itemMainText = GetBackLightTimeIndexString(itemIndex);
278                 }
279                 break;
280
281         case ID_GROUP_FONT:
282                 {
283                         itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_FONT");
284                 }
285                 break;
286
287         case ID_GROUP_BATTERY_PERCENTAGE:
288                 {
289                         style = TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING;
290                         itemMainRectangle.width -= W_RESIZE_LABEL_GAP;
291                         itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_BATTERY_PERCENTAGE_ABB");
292                 }
293                 break;
294
295         default:
296                 break;
297         }
298
299         RelativeLayout relativeLayout;
300         relativeLayout.Construct();
301
302         pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight), style);
303         pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
304
305         pLabel = new (std::nothrow) Label();
306         pLabel->Construct(itemMainRectangle, itemMainText);
307         pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
308         pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
309         pLabel->SetTextColor(COLOR_MAIN_TEXT);
310
311         pItem->AddControl(pLabel);
312
313         switch (style)
314         {
315         case TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING:
316                 {
317                         rightMargin = RELATIVE_LAYOUT_RIGHT_MARGIN_ONOFF_SLIDING;
318                 }
319                 break;
320
321         case TABLE_VIEW_ANNEX_STYLE_RADIO:
322                 {
323                         leftMargin = RELATIVE_LAYOUT_LEFT_MARGIN;
324                         rightMargin = RELATIVE_LAYOUT_ITEM_RIGHT_MARGIN;
325                 }
326                 break;
327
328         default:
329                 {
330                         rightMargin = RELATIVE_LAYOUT_ITEM_RIGHT_MARGIN;
331                 }
332                 break;
333         }
334         relativeLayout.SetMargin(*pLabel, leftMargin, rightMargin, 0, 0);
335         relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
336         relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
337
338         if (pBitmap)
339         {
340                 detailArrow = itemMainRectangle;
341                 detailArrow.y = itemMainRectangle.y + ((itemHeight - W_DETAIL_ARROW_BUTTON) / DIVIDE_BY_TWO);
342                 detailArrow.height = W_DETAIL_ARROW_BUTTON;
343                 detailArrow.width = W_DETAIL_ARROW_BUTTON;
344
345                 pLabel = new (std::nothrow) Label();
346                 pLabel->Construct(detailArrow, L"");
347
348                 pLabel->SetBackgroundBitmap(*pBitmap);
349
350                 pItem->AddControl(pLabel);
351                 relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN_DETAIL_ARROW_BUTTON, 0, 0);
352                 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
353
354                 pLabel = new (std::nothrow) Label();
355                 pLabel->Construct(itemSubRectangle, subText);
356                 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
357                 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
358                 pLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
359                 pLabel->SetTextColor(COLOR_SUB_TEXT);
360
361                 pItem->AddControl(pLabel);
362                 relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
363                 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
364                 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
365         }
366
367         return pItem;
368 }
369
370 bool
371 DisplayForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
372 {
373         AppLogDebug("ENTER");
374
375         delete pItem;
376         pItem = null;
377
378         return true;
379 }
380
381 bool
382 DisplayForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
383 {
384         AppLogDebug("ENTER");
385
386         delete pItem;
387         pItem = null;
388
389         return true;
390 }
391
392 void
393 DisplayForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
394 {
395         AppLogDebug("ENTER");
396         AppLogDebug("RequestFrom[%d]", requestId);
397         if (requestId == REFRESH_REQUEST_EVENT)
398         {
399                 int itemCount = __pTableView->GetItemCountAt(ID_GROUP_BACKLIGHT_TIME_LIST);
400                 bool autoRotation = false;
401                 if (SettingInfo::GetValue(SETTING_INFO_KEY_SCREEN_ROTAION_AUTO, autoRotation) == E_SUCCESS)
402                 {
403                         __pTableView->SetItemChecked(ID_GROUP_AUTO_ROTATE_SCREEN, ID_ITEM_AUTO_ROTATE_SCREEN, autoRotation);
404                 }
405
406                 bool batteryPercentage = false;
407                 if (SettingInfo::GetValue(SETTING_INFO_KEY_BATTERY_PERCENTAGE, batteryPercentage) == E_SUCCESS)
408                 {
409                         __pTableView->SetItemChecked(ID_GROUP_BATTERY_PERCENTAGE, ID_ITEM_BATTERY_PERCENTAGE, batteryPercentage);
410                 }
411
412                 for (int index = 0; index < itemCount; index++)
413                 {
414                         if (index == GetBackLightTimeIndex())
415                         {
416                                 __pTableView->SetItemChecked(ID_GROUP_BACKLIGHT_TIME_LIST, index, true);
417                         }
418                         else
419                         {
420                                 __pTableView->SetItemChecked(ID_GROUP_BACKLIGHT_TIME_LIST, index, false);
421                         }
422                 }
423                 __pTableView->RefreshItem(ID_GROUP_BACKLIGHT_TIME, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
424                 __pTableView->RefreshItem(ID_GROUP_BACKLIGHT_TIME, 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
425         }
426 }
427
428 void
429 DisplayForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
430 {
431         SceneManager* pSceneManager = SceneManager::GetInstance();
432         AppAssert(pSceneManager);
433
434         AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
435
436         switch (groupIndex)
437         {
438         case ID_GROUP_AUTO_ROTATE_SCREEN:
439                 {
440                         bool itemSelectStatus = tableView.IsItemChecked(groupIndex, itemIndex);
441
442                         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
443                         {
444                                 itemSelectStatus = !itemSelectStatus;
445                         }
446
447                         if (SettingInfo::SetValue(SETTING_INFO_KEY_SCREEN_ROTAION_AUTO, itemSelectStatus) == E_SUCCESS)
448                         {
449                                 tableView.SetItemChecked(groupIndex, itemIndex, itemSelectStatus);
450                         }
451                 }
452                 break;
453
454         case ID_GROUP_BACKLIGHT_TIME:
455                 {
456                         if (tableView.IsGroupExpanded(ID_GROUP_BACKLIGHT_TIME_LIST) == true)
457                         {
458                                 tableView.CollapseGroup(ID_GROUP_BACKLIGHT_TIME_LIST);
459                         }
460                         else
461                         {
462                                 tableView.ExpandGroup(ID_GROUP_BACKLIGHT_TIME_LIST);
463                         }
464                         tableView.RefreshItem(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
465                 }
466                 break;
467
468         case ID_GROUP_BACKLIGHT_TIME_LIST:
469                 {
470                         SetBackLightTime(itemIndex);
471
472                         int itemCount = tableView.GetItemCountAt(groupIndex);
473
474                         for (int index = 0; index < itemCount; index++)
475                         {
476                                 if (index == itemIndex)
477                                 {
478                                         tableView.SetItemChecked(groupIndex, index, true);
479                                 }
480                                 else
481                                 {
482                                         tableView.SetItemChecked(groupIndex, index, false);
483                                 }
484                         }
485                         tableView.RefreshItem(ID_GROUP_BACKLIGHT_TIME, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
486                 }
487                 break;
488
489         case ID_GROUP_FONT:
490                 {
491                         SceneManager* pSceneManager = SceneManager::GetInstance();
492                         AppAssert(pSceneManager);
493
494                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FONT, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), null);
495                 }
496                 break;
497
498         case ID_GROUP_BATTERY_PERCENTAGE:
499                 {
500                         bool itemSelectStatus = tableView.IsItemChecked(groupIndex, itemIndex);
501
502                         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
503                         {
504                                 itemSelectStatus = !itemSelectStatus;
505                         }
506
507                         if (SettingInfo::SetValue(SETTING_INFO_KEY_BATTERY_PERCENTAGE, itemSelectStatus) == E_SUCCESS)
508                         {
509                                 tableView.SetItemChecked(groupIndex, itemIndex, itemSelectStatus);
510                         }
511                 }
512                 break;
513
514         default:
515                 break;
516         }
517 }
518
519 int
520 DisplayForm::GetDefaultGroupItemHeight(void)
521 {
522         return H_GROUP_INDEX_NO_TITLE_DEFAULT;
523 }
524
525 int
526 DisplayForm::GetDefaultItemHeight(void)
527 {
528         return H_GROUP_ITEM_DEFAULT;
529 }
530
531 void
532 DisplayForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
533 {
534 }
535
536 void
537 DisplayForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
538 {
539         int index = 0;
540         String itemMainText;
541         String itemSubText;
542         Label* pSubLabel = null;
543
544         switch (groupIndex)
545         {
546         case ID_GROUP_FONT:
547                 //fall through
548         case ID_GROUP_AUTO_ROTATE_SCREEN:
549                 //fall through
550         case ID_GROUP_BATTERY_PERCENTAGE:
551                 //fall through
552         case ID_GROUP_BACKLIGHT_TIME_LIST:
553                 {
554                         int fontSize = GetFontSize();
555                         Label* pLabel = static_cast<Label*>(pItem->GetControl(0));
556
557                         pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
558                         pLabel->Invalidate(false);
559                 }
560                 break;
561
562         case ID_GROUP_BACKLIGHT_TIME:
563                 {
564                         Bitmap* pBitmap = null;
565                         Label* pLabel = static_cast<Label*>(pItem->GetControl(0));
566                         Label* pLabelBitmap = static_cast<Label*>(pItem->GetControl(1));
567                         pSubLabel = static_cast<Label*>(pItem->GetControl(2));
568
569                         int fontSize = GetFontSize();
570                         Rectangle mainRectangle;
571                         Rectangle subRectangle;
572                         Rectangle pItemRectangle;
573                         Rectangle detailArrow;
574
575                         pItemRectangle = pItem->GetBounds();
576                         ItemTypeTwoLine(mainRectangle, subRectangle, fontSize);
577
578                         pLabel->SetBounds(mainRectangle);
579                         pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
580
581                         pItemRectangle.height = (mainRectangle.height + subRectangle.height);
582                         pItem->SetBounds(pItemRectangle);
583
584                         if (__pTableView->IsGroupExpanded(ID_GROUP_BACKLIGHT_TIME_LIST))
585                         {
586                                 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_OPENED);
587                         }
588                         else
589                         {
590                                 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_CLOSED);
591                         }
592                         pLabelBitmap->SetBackgroundBitmap(*pBitmap);
593
594                         detailArrow = mainRectangle;
595                         detailArrow.y = mainRectangle.y + ((pItemRectangle.height - W_DETAIL_ARROW_BUTTON) / DIVIDE_BY_TWO);
596                         detailArrow.height = W_DETAIL_ARROW_BUTTON;
597                         detailArrow.width = W_DETAIL_ARROW_BUTTON;
598                         pLabelBitmap->SetBounds(detailArrow);
599
600                         index = GetBackLightTimeIndex();
601                         itemSubText = GetBackLightTimeIndexString(index);
602                         pSubLabel->SetBounds(subRectangle);
603                         pSubLabel->SetText(itemSubText);
604                         pSubLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
605
606                         pLabel->Invalidate(false);
607                         pLabelBitmap->Invalidate(false);
608                         pSubLabel->Invalidate(false);
609                         pItem->Invalidate(false);
610                 }
611                 break;
612         }
613
614         Invalidate(true);
615 }
616
617 void
618 DisplayForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
619 {
620 }
621
622 void
623 DisplayForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
624 {
625 }
626
627 int
628 DisplayForm::GetBackLightTime(void)
629 {
630         int backlightTime = 0;
631
632         result r = SettingInfo::GetValue(SETTING_INFO_KEY_BACKLIGHT_TIME, backlightTime);
633         if (IsFailed(r))
634         {
635                 AppLogDebug("GetValue Backlight Time fail [%s]", GetErrorMessage(r));
636         }
637         return backlightTime;
638 }
639
640 void
641 DisplayForm::SetBackLightTime(int itemIndex)
642 {
643         int backlightTime = 0;
644         switch (itemIndex)
645         {
646         case ID_ITEM_BACKLIGHT_TIME_15_SECONDS:
647                 {
648                         backlightTime = BACKLIGHT_TIME_15_SECONDS;
649                 }
650                 break;
651
652         case ID_ITEM_BACKLIGHT_TIME_30_SECONDS:
653                 {
654                         backlightTime = BACKLIGHT_TIME_30_SECONDS;
655                 }
656                 break;
657
658         case ID_ITEM_BACKLIGHT_TIME_1_MINUTE:
659                 {
660                         backlightTime = BACKLIGHT_TIME_1_MINUTE;
661                 }
662                 break;
663
664         case ID_ITEM_BACKLIGHT_TIME_2_MINUTES:
665                 {
666                         backlightTime = BACKLIGHT_TIME_2_MINUTES;
667                 }
668                 break;
669
670         case ID_ITEM_BACKLIGHT_TIME_5_MINUTES:
671                 {
672                         backlightTime = BACKLIGHT_TIME_5_MINUTES;
673                 }
674                 break;
675
676         case ID_ITEM_BACKLIGHT_TIME_10_MINUTES:
677                 {
678                         backlightTime = BACKLIGHT_TIME_10_MINUTES;
679                 }
680                 break;
681         }
682
683         result r = SettingInfo::SetValue(SETTING_INFO_KEY_BACKLIGHT_TIME, backlightTime);
684         if (IsFailed(r))
685         {
686                 AppLogDebug("SetValue Backlight Time fail [%s]", GetErrorMessage(r));
687         }
688 }
689
690 int
691 DisplayForm::GetBackLightTimeIndex(void)
692 {
693         int itemIndex = 0;
694         int backlightTime = GetBackLightTime();
695
696         switch (backlightTime)
697         {
698         case BACKLIGHT_TIME_15_SECONDS:
699                 {
700                         itemIndex = ID_ITEM_BACKLIGHT_TIME_15_SECONDS;
701                 }
702                 break;
703
704         case BACKLIGHT_TIME_30_SECONDS:
705                 {
706                         itemIndex = ID_ITEM_BACKLIGHT_TIME_30_SECONDS;
707                 }
708                 break;
709
710         case BACKLIGHT_TIME_1_MINUTE:
711                 {
712                         itemIndex = ID_ITEM_BACKLIGHT_TIME_1_MINUTE;
713                 }
714                 break;
715
716         case BACKLIGHT_TIME_2_MINUTES:
717                 {
718                         itemIndex = ID_ITEM_BACKLIGHT_TIME_2_MINUTES;
719                 }
720                 break;
721
722         case BACKLIGHT_TIME_5_MINUTES:
723                 {
724                         itemIndex = ID_ITEM_BACKLIGHT_TIME_5_MINUTES;
725                 }
726                 break;
727
728         case BACKLIGHT_TIME_10_MINUTES:
729                 {
730                         itemIndex = ID_ITEM_BACKLIGHT_TIME_10_MINUTES;
731                 }
732                 break;
733         }
734
735         return itemIndex;
736 }
737
738 Tizen::Base::String
739 DisplayForm::GetBackLightTimeIndexString(int itemIndex)
740 {
741         String itemText;
742
743         switch (itemIndex)
744         {
745         case ID_ITEM_BACKLIGHT_TIME_15_SECONDS:
746                 {
747                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_15_SECONDS");
748                 }
749                 break;
750
751         case ID_ITEM_BACKLIGHT_TIME_30_SECONDS:
752                 {
753                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_30_SECONDS");
754                 }
755                 break;
756
757         case ID_ITEM_BACKLIGHT_TIME_1_MINUTE:
758                 {
759                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_1_MINUTE");
760                 }
761                 break;
762
763         case ID_ITEM_BACKLIGHT_TIME_2_MINUTES:
764                 {
765                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_2_MINUTES");
766                 }
767                 break;
768
769         case ID_ITEM_BACKLIGHT_TIME_5_MINUTES:
770                 {
771                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_5_MINUTES");
772                 }
773                 break;
774
775         case ID_ITEM_BACKLIGHT_TIME_10_MINUTES:
776                 {
777                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_10_MINUTES");
778                 }
779                 break;
780         }
781
782         return itemText;
783 }