Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / data / my_tools / jj / rsa / apps / osp / Settings / src / StFontForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://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                StFontForm.cpp
19  * @brief               This is the implementation file for FontForm class.
20  */
21
22 #include <memory>
23 #include <FIo.h>
24 #include "StFontForm.h"
25 #include "StResourceManager.h"
26 #include "StSettingScenesList.h"
27 #include "StTypes.h"
28
29 using namespace Tizen::App;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Io;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::System;
35 using namespace Tizen::Ui;
36 using namespace Tizen::Ui::Controls;
37 using namespace Tizen::Ui::Scenes;
38
39 #if 0
40 static const int ID_GROUP_FONT = 0;
41 static const int ID_GROUP_FONT_ITEM_COUNT = 2;
42 static const int ID_ITEM_FONT_TYPE = 0;
43 static const int ID_ITEM_FONT_SIZE = 1;
44
45 static const int ID_GROUP_FONT_TEXT = 1;
46 static const int ID_GROUP_FONT_TEXT_ITEM_COUNT = 0;
47
48 static const int ID_GROUP_COUNT = 2;
49 static const int ID_GROUP_MAX_ITEM_COUNT = ID_GROUP_FONT_ITEM_COUNT;
50 #endif
51
52 static const int ID_GROUP_FONT = 0;
53 static const int ID_GROUP_FONT_ITEM_COUNT = 1;
54 static const int ID_ITEM_FONT_TYPE = 0;
55
56 static const int ID_GROUP_FONT_LIST = 1;
57
58 static const int ID_GROUP_FONT_SIZE = 2;
59 static const int ID_GROUP_FONT_SIZE_ITEM_COUNT = 1;
60 static const int ID_ITEM_FONT_SIZE = 0;
61
62 static const int ID_GROUP_FONT_TEXT = 3;
63 static const int ID_GROUP_FONT_TEXT_ITEM_COUNT = 0;
64
65 static const int ID_GROUP_COUNT = 4;
66 static const int ID_GROUP_MAX_ITEM_COUNT = ID_GROUP_FONT_ITEM_COUNT;
67
68 static const int H_HELP_TEXT_GAP = 6;
69
70 FontForm::FontForm(void)
71         : __isAppControlRequest(false)
72         , __categoryCheck(L"")
73         , __isFontTypeExpend(false)
74 {
75 }
76
77 FontForm::~FontForm(void)
78 {
79 }
80
81 void
82 FontForm::CreateFooter(void)
83 {
84         Footer* pFooter = GetFooter();
85         AppAssert(pFooter);
86
87         pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
88         pFooter->SetBackButton();
89         pFooter->AddActionEventListener(*this);
90
91         SetFormBackEventListener(this);
92 }
93
94 result
95 FontForm::OnInitializing(void)
96 {
97         CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_FONT"));
98         CreateFooter();
99
100         __fontList = new (std::nothrow) ArrayList(SingleObjectDeleter);
101         __fontList->Construct();
102         GetFontList(*__fontList);
103
104         CreateTableView();
105
106         AppLogDebug("ENTER");
107
108         return E_SUCCESS;
109 }
110
111 result
112 FontForm::OnTerminating(void)
113 {
114         __pTableView = null;
115         delete __fontList;
116         __fontList = null;
117         SetFormBackEventListener(null);
118         return E_SUCCESS;
119 }
120
121 void
122 FontForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
123 {
124         __pTableView->UpdateTableView();
125         if (pArgs != null)
126         {
127                 __categoryCheck = static_cast<String*>(pArgs->GetAt(0))->GetPointer();
128
129                 if ((__categoryCheck == L"category:FontType") || (__categoryCheck == L"category:FontSize"))
130                 {
131                         SetAppControlRequest(true);
132
133                         if (__categoryCheck.Equals(L"category:FontType", false))
134                         {
135                                 __pTableView->SetItemEnabled(ID_GROUP_FONT_SIZE, ID_ITEM_FONT_SIZE, false);
136                         }
137                         else
138                         {
139                                 __pTableView->SetItemEnabled(ID_GROUP_FONT, ID_ITEM_FONT_TYPE, false);
140                         }
141                 }
142                 __pTableView->UpdateTableView();
143                 delete pArgs;
144         }
145
146         String currentFontType;
147
148         if (SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, currentFontType) == E_SUCCESS)
149         {
150                 for (int i = 0; i < __fontList->GetCount(); i++)
151                 {
152                         String itemText = static_cast<String*>(__fontList->GetAt(i))->GetPointer();
153
154                         if (itemText.Equals(currentFontType, false))
155                         {
156                                 __pTableView->SetItemChecked(ID_GROUP_FONT_LIST, i, true);
157                                 break;
158                         }
159                 }
160                 AppLogDebug("Get Font Type[%ls] :Result[%s]", currentFontType.GetPointer(), GetErrorMessage(GetLastResult()));
161         }
162         __pTableView->CollapseGroup(ID_GROUP_FONT_LIST);
163 }
164
165 void
166 FontForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
167 {
168 }
169
170 void
171 FontForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
172 {
173         SceneManager* pSceneManager = SceneManager::GetInstance();
174         AppAssert(pSceneManager);
175
176         if (GetAppControlRequest() == true)
177         {
178                 UiApp* pApp = UiApp::GetInstance();
179                 AppAssert(pApp);
180                 AppControlFontResult();
181                 pApp->Terminate();
182         }
183         else
184         {
185                 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
186         }
187 }
188
189 int
190 FontForm::GetGroupCount(void)
191 {
192         AppLogDebug("ENTER");
193         return ID_GROUP_COUNT;
194 }
195
196 int
197 FontForm::GetItemCount(int groupIndex)
198 {
199         int itemCount = 0;
200
201         switch (groupIndex)
202         {
203         case ID_GROUP_FONT:
204            // fall through
205         case ID_GROUP_FONT_SIZE:
206                 {
207                         itemCount = ID_GROUP_MAX_ITEM_COUNT;
208                 }
209                 break;
210
211         case ID_GROUP_FONT_LIST:
212                 {
213                         itemCount = __fontList->GetCount();
214                 }
215                 break;
216
217         default:
218                 break;
219         }
220
221         AppLogDebug("GetItemCount %d", itemCount);
222
223         return itemCount;
224 }
225
226 TableViewGroupItem*
227 FontForm::CreateGroupItem(int groupIndex, int itemWidth)
228 {
229         AppLogDebug("ENTER");
230
231         int itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
232         int yItemOffset = H_GROUP_INDEX_HELP_TEXT_TOP_GAP;
233         LabelTextStyle style = LABEL_TEXT_STYLE_NORMAL;
234         Rectangle itemRectangle;
235         String groupText;
236         Label* pLabel = null;
237         int fontSize = GetFontSize();
238
239         TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
240
241         switch (groupIndex)
242         {
243         case ID_GROUP_FONT:
244                 {
245                         yItemOffset = H_GROUP_INDEX_NO_HELP_TEXT_GAP;
246                         itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
247                 }
248                 break;
249
250         case ID_GROUP_FONT_LIST:
251                 {
252                         itemHeight = 0;
253                 }
254                 break;
255
256         case ID_GROUP_FONT_SIZE:
257                 // fall through
258         case ID_GROUP_FONT_TEXT:
259                 {
260                         itemHeight = 0;
261                 }
262                 break;
263
264         default:
265                 {
266                         yItemOffset = H_GROUP_INDEX_NO_HELP_TEXT_GAP;
267                         itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
268                 }
269                 break;
270         }
271
272         itemRectangle.x = X_GROUP_ITEM_DEFAULT_LABEL;
273         itemRectangle.y = yItemOffset;
274         itemRectangle.width = itemWidth;
275         itemRectangle.height = itemHeight;
276
277         RelativeLayout relativeLayout;
278         relativeLayout.Construct();
279
280         pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
281         pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
282
283         pLabel = new (std::nothrow) Label();
284         pLabel->Construct(itemRectangle, groupText);
285         pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
286         pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
287         pLabel->SetTextConfig(fontSize, style);
288         pLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
289
290         pItem->AddControl(*pLabel);
291         relativeLayout.SetMargin(*pLabel, itemRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
292         relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
293         relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
294         pItem->SetEnabled(false);
295
296         return pItem;
297 }
298
299 TableViewItem*
300 FontForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
301 {
302         AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
303
304         Rectangle itemRectangle;
305         Rectangle itemSecondLineTextRect;
306         TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
307         String itemText;
308         String secondLineText;
309         String fontReturnValue;
310         Label* pLabel = null;
311         int fontSize = GetFontSize();
312         bool isTwoLineText = true;
313         int itemHeight = H_GROUP_ITEM_DEFAULT;
314
315         switch (groupIndex)
316         {
317         case ID_GROUP_FONT:
318                 {
319                         style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
320                         if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, fontReturnValue)) == E_SUCCESS)
321                         {
322                                 secondLineText = fontReturnValue;
323                         }
324                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_FONT_TYPE");
325                 }
326                 break;
327
328         case ID_GROUP_FONT_LIST:
329                 {
330                         String currentFontType;
331                         isTwoLineText = false;
332                         style = TABLE_VIEW_ANNEX_STYLE_RADIO;
333                         itemText = static_cast<String*>(__fontList->GetAt(itemIndex))->GetPointer();
334
335                         if (SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, currentFontType) == E_SUCCESS)
336                         {
337                                 if (itemText.Equals(currentFontType, false))
338                                 {
339                                         __pTableView->SetItemChecked(groupIndex, itemIndex, true);
340                                 }
341                         }
342                         AppLogDebug("Get Font Type[%ls] :Result[%s]", currentFontType.GetPointer(), GetErrorMessage(GetLastResult()));
343                 }
344                 break;
345
346         case ID_GROUP_FONT_SIZE:
347                 {
348                         if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_SIZE, fontReturnValue)) == E_SUCCESS)
349                         {
350                                 if (fontReturnValue.Equals(L"giant", false))
351                                 {
352                                         secondLineText = ResourceManager::GetString(L"IDS_EMAIL_POP_GIANT_M_TEXTSIZE");
353                                 }
354                                 else if (fontReturnValue.Equals(L"huge", false))
355                                 {
356                                         secondLineText = ResourceManager::GetString(L"IDS_EMAIL_OPT_HUGE_M_TEXTSIZE");
357                                 }
358                                 else if (fontReturnValue.Equals(L"large", false))
359                                 {
360                                         secondLineText = ResourceManager::GetString(L"IDS_ST_BODY_TEXTSTYLE_LARGE");
361                                 }
362                                 else if (fontReturnValue.Equals(L"medium", false))
363                                 {
364                                         secondLineText = ResourceManager::GetString(L"IDS_ST_BODY_FONTTYPE_NORMAL");
365                                 }
366                                 else
367                                 {
368                                         secondLineText = ResourceManager::GetString(L"IDS_ST_BODY_SMALL_M_TEXTSIZE");
369                                 }
370                         }
371                         itemText = ResourceManager::GetString(L"IDS_ST_BODY_FONT_SIZE");
372                 }
373                 break;
374
375         default:
376                 break;
377         }
378
379         TableViewItem* pItem = new (std::nothrow) TableViewItem();
380
381         if (isTwoLineText == true )
382         {
383                 ItemTypeTwoLine(itemRectangle, itemSecondLineTextRect, fontSize);
384                 itemHeight = (itemRectangle.height + itemSecondLineTextRect.height);
385
386                 RelativeLayout relativeLayout;
387                 relativeLayout.Construct();
388
389                 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight), style);
390                 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
391
392                 pLabel = new (std::nothrow) Label();
393                 pLabel->Construct(itemRectangle, itemText);
394                 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
395                 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
396                 pLabel->SetTextColor(COLOR_MAIN_TEXT);
397
398                 pItem->AddControl(*pLabel);
399                 relativeLayout.SetMargin(*pLabel, itemRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
400                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
401                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
402
403                 pLabel = new (std::nothrow) Label();
404                 pLabel->Construct(itemSecondLineTextRect, secondLineText);
405                 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
406                 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
407                 pLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
408                 pLabel->SetTextColor(COLOR_SUB_TEXT);
409
410                 pItem->AddControl(*pLabel);
411                 relativeLayout.SetMargin(*pLabel, itemSecondLineTextRect.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
412                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
413                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
414         }
415         else
416         {
417                 RelativeLayout relativeLayout;
418                 relativeLayout.Construct();
419
420                 pItem->Construct(relativeLayout, Dimension(itemWidth, H_GROUP_ITEM_DEFAULT), style);
421                 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
422
423                 ItemTypeOneLine(itemRectangle);
424                 pLabel = new (std::nothrow) Label();
425                 pLabel->Construct(itemRectangle, itemText);
426                 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
427                 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
428                 pLabel->SetTextColor(COLOR_MAIN_TEXT);
429
430                 pItem->AddControl(*pLabel);
431                 relativeLayout.SetMargin(*pLabel, RELATIVE_LAYOUT_LEFT_MARGIN, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
432                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
433                 relativeLayout.SetRelation(*pLabel, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
434         }
435
436         if (GetAppControlRequest() == true)
437         {
438                 if (__categoryCheck.Equals(L"category:FontType", false))
439                 {
440                         if (groupIndex == ID_GROUP_FONT_SIZE)
441                         {
442                                 delete pItem;
443                                 pItem = null;
444                         }
445                 }
446                 else if (__categoryCheck.Equals(L"category:FontSize", false))
447                 {
448                         if ((groupIndex == ID_GROUP_FONT) || (groupIndex == ID_GROUP_FONT_LIST))
449                         {
450                                 delete pItem;
451                                 pItem = null;
452                         }
453                 }
454         }
455
456         return pItem;
457 }
458
459 bool
460 FontForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
461 {
462         AppLogDebug("ENTER");
463
464         delete pItem;
465         pItem = null;
466
467         return true;
468 }
469
470 bool
471 FontForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
472 {
473         AppLogDebug("ENTER");
474
475         delete pItem;
476         pItem = null;
477
478         return true;
479 }
480
481 void
482 FontForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
483 {
484         AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
485
486         SceneManager* pSceneManager = SceneManager::GetInstance();
487         AppAssert(pSceneManager);
488         String fontReturnValue;
489
490         switch (groupIndex)
491         {
492         case ID_GROUP_FONT:
493                 {
494                         if(__pTableView->IsGroupExpanded(ID_GROUP_FONT_LIST))
495                         {
496                                 __pTableView->CollapseGroup(ID_GROUP_FONT_LIST);
497                         }
498                         else
499                         {
500                                 __pTableView->ExpandGroup(ID_GROUP_FONT_LIST);
501                         }
502                 }
503                 break;
504
505         case ID_GROUP_FONT_LIST:
506                 {
507                         int listCount = __fontList->GetCount();
508                         String fontGetValue;
509                         fontReturnValue = static_cast<String*>(__fontList->GetAt(itemIndex))->GetPointer();
510
511                         tableView.UpdateTableView();
512
513                         for (int count = 0; count < listCount; count++)
514                         {
515                                 if (itemIndex == count)
516                                 {
517                                         tableView.SetItemChecked(groupIndex, count, true);
518                                 }
519                                 else
520                                 {
521                                         tableView.SetItemChecked(groupIndex, count, false);
522                                 }
523                         }
524                         if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, fontGetValue)) == E_SUCCESS)
525                         {
526                                 if (fontGetValue.Equals(fontReturnValue, false))
527                                 {
528                                         break;
529                                 }
530                         }
531
532                         if (SettingInfo::SetValue(SETTING_INFO_KEY_FONT_TYPE, fontReturnValue) != E_SUCCESS)
533                         {
534                                 AppLogDebug("Set Font Type :Result[%s]", GetErrorMessage(GetLastResult()));
535                         }
536                         AppLogDebug("Set Font Type[%ls] :Result[%s]", fontReturnValue.GetPointer(), GetErrorMessage(GetLastResult()));
537                 }
538                 break;
539
540         case ID_GROUP_FONT_SIZE:
541                 {
542                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FONT_SIZE, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
543                 }
544                 break;
545
546         default:
547                 break;
548         }
549 }
550
551 int
552 FontForm::GetDefaultGroupItemHeight(void)
553 {
554         return H_GROUP_INDEX_NO_TITLE_DEFAULT;
555 }
556
557 int
558 FontForm::GetDefaultItemHeight(void)
559 {
560         return H_GROUP_ITEM_DEFAULT;
561 }
562
563 void
564 FontForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
565 {
566 }
567
568 void
569 FontForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
570 {
571 }
572
573 void
574 FontForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
575 {
576 }
577
578 void
579 FontForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
580 {
581 }
582
583 void
584 FontForm::AppControlFontResult(void)
585 {
586         RequestId reqId = 0;
587         String value;
588         AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
589
590 #if 0
591         IList* pDefaultResultIList = null;
592         ArrayList* pDataList = null;
593
594         pDataList = new (std::nothrow) ArrayList();
595         pDataList->Construct();
596
597         pDataList->Add(*(new (std::nothrow) String(L"APPCONTROL_RESULT_SUCCEEDED")));
598         pDataList->Add(*(new (std::nothrow) String(__categoryCheck)));
599
600         if (__categoryCheck == L"category:FontType")
601         {
602                 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, value);
603         }
604         else if (__categoryCheck == L"category:FontSize")
605         {
606                 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_SIZE, value);
607         }
608         pDataList->Add(*(new (std::nothrow) String(value)));
609
610         pDefaultResultIList = (pDataList->GetItemsN(0, pDataList->GetCount()));
611
612         pAppManager->SendAppControlResult(reqId, pDefaultResultIList);
613
614         pDataList->RemoveAll(true);
615         delete pDataList;
616         pDefaultResultIList->RemoveAll(true);
617         delete pDefaultResultIList;
618 #else
619         HashMap* hashMap = new (std::nothrow) HashMap();
620         hashMap->Construct();
621
622         if (__categoryCheck == L"category:FontType")
623         {
624                 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, value);
625                 hashMap->Add(*(new (std::nothrow) String(L"category")), *(new (std::nothrow) String(L"FontType")));
626                 hashMap->Add(*(new (std::nothrow) String(L"type")), *(new (std::nothrow) String(value)));
627
628         }
629         else if (__categoryCheck == L"category:FontSize")
630         {
631                 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_SIZE, value);
632                 hashMap->Add(*(new (std::nothrow) String(L"category")), *(new (std::nothrow) String(L"FontSize")));
633                 hashMap->Add(*(new (std::nothrow) String(L"size")), *(new (std::nothrow) String(value)));
634         }
635
636         pAppManager->SendAppControlResult(reqId, APP_CTRL_RESULT_SUCCEEDED, hashMap);
637
638         hashMap->RemoveAll();
639         delete hashMap;
640 #endif
641 }
642
643 result
644 FontForm::GetFontList(Tizen::Base::Collection::IList& list)
645 {
646         const String FONT_DIR_PATH[] =
647         {
648                 L"/usr/share/fonts"
649         };
650
651         list.RemoveAll(true);
652         const int FONT_DIR_PATH_COUNT = sizeof(FONT_DIR_PATH) / sizeof(FONT_DIR_PATH[0]);
653
654         for (int i = 0; i < FONT_DIR_PATH_COUNT; i++)
655         {
656                 Directory directory;
657                 result r = directory.Construct(FONT_DIR_PATH[i]);
658                 if (!IsFailed(r))
659                 {
660                         std::auto_ptr<DirEnumerator>dirEnumerator(directory.ReadN());
661
662                         while (dirEnumerator->MoveNext() == E_SUCCESS)
663                         {
664                                 DirEntry entry = dirEnumerator->GetCurrentDirEntry();
665                                 if (entry.IsDirectory() == false && entry.IsHidden() == false)
666                                 {
667                                         Tizen::Base::Utility::StringTokenizer formatTok(entry.GetName(), ".");
668                                         String token;
669                                         while (formatTok.GetTokenCount())
670                                         {
671                                                 formatTok.GetNextToken(token);
672                                         }
673
674                                         if (token.Equals("ttf",false) || token.Equals("ttc",false))
675                                         {
676                                                 String fullName;
677                                                 fullName.Append(FONT_DIR_PATH[i]);
678                                                 fullName.Append(L"/");
679                                                 fullName.Append(entry.GetName());
680                                                 bool isNewFont = true;
681
682                                                 String* pFamilyName = new (std::nothrow) String(Font::GetFaceName(fullName));
683
684                                                 for (int idx = 0; idx < list.GetCount(); idx++)
685                                                 {
686                                                         String* pName = static_cast <String*>(list.GetAt(idx));
687                                                         if (pName == null)
688                                                         {
689                                                                 continue;
690                                                         }
691                                                         if (pFamilyName->Equals(*pName, true))
692                                                         {
693                                                                 isNewFont = false;
694                                                                 break;
695                                                         }
696                                                 }
697                                                 if (isNewFont)
698                                                 {
699                                                         list.Add(*pFamilyName);
700                                                 }
701                                                 else
702                                                 {
703                                                         delete pFamilyName;
704                                                         pFamilyName = null;
705                                                 }
706                                         }
707                                 }
708                         }
709                 }
710         }
711         return E_SUCCESS;
712 }
713
714 bool
715 FontForm::GetAppControlRequest(void)
716 {
717         return __isAppControlRequest;
718 }
719
720 void
721 FontForm::SetAppControlRequest(bool requestStatus)
722 {
723         __isAppControlRequest = requestStatus;
724 }