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