2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file StFontForm.cpp
19 * @brief This is the implementation file for FontForm class.
24 #include "StFontForm.h"
25 #include "StResourceManager.h"
26 #include "StSettingScenesList.h"
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;
39 static const char APPCONTROL_DEFAULT = 0x00;
40 static const char APPCONTROL_REQUEST_FONT_TYPE = 0x21;
41 static const char APPCONTROL_REQUEST_FONT_SIZE = 0x22;
42 static const char APPCONTROL_TYPE = 0x01;
43 static const char APPCONTROL_SIZE = 0x02;
45 static const int W_FONT_ITEM_RIGHT_GAP = 100;
46 static const int ID_GROUP_FONT = 0;
47 static const int ID_GROUP_FONT_ITEM_COUNT = 1;
48 static const int ID_ITEM_FONT_TYPE = 0;
50 static const int ID_GROUP_FONT_LIST = 1;
52 static const int ID_GROUP_FONT_SIZE = 2;
53 static const int ID_GROUP_FONT_SIZE_ITEM_COUNT = 1;
54 static const int ID_ITEM_FONT_SIZE = 0;
56 static const int ID_GROUP_FONT_TEXT = 3;
57 static const int ID_GROUP_FONT_TEXT_ITEM_COUNT = 0;
59 static const int ID_GROUP_COUNT = 4;
60 static const int ID_GROUP_MAX_ITEM_COUNT = ID_GROUP_FONT_ITEM_COUNT;
62 static const int H_HELP_TEXT_GAP = 6;
63 static const int FONT_FORM_FIRST_CONTROL = 0;
64 static const int FONT_FORM_SECOND_CONTROL = 1;
65 static const int FONT_FORM_THIRD_CONTROL = 2;
66 static const int SECOND_CONTROL_ITEM = 1;
68 FontForm::FontForm(void)
69 : __isAppControlRequest(APPCONTROL_DEFAULT)
70 , __categoryCheck(L"")
71 , __isFontTypeExpend(false)
75 FontForm::~FontForm(void)
80 FontForm::CreateFooter(void)
82 Footer* pFooter = GetFooter();
85 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
86 pFooter->SetBackButton();
87 pFooter->AddActionEventListener(*this);
89 SetFormBackEventListener(this);
93 FontForm::OnInitializing(void)
95 CreateHeader(ResourceManager::GetString(L"IDS_ST_BODY_FONT"));
98 __fontList = new (std::nothrow) ArrayList(SingleObjectDeleter);
99 __fontList->Construct();
100 GetFontList(*__fontList);
102 __pTableView->UpdateTableView();
103 __pTableView->CollapseGroup(ID_GROUP_FONT_LIST);
104 SettingInfo::AddSettingEventListener(*this);
105 AppLogDebug("ENTER");
111 FontForm::OnTerminating(void)
117 SettingInfo::RemoveSettingEventListener(*this);
118 SetFormBackEventListener(null);
123 FontForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
127 __categoryCheck = static_cast<String*>(pArgs->GetAt(0))->GetPointer();
129 if (__categoryCheck.CompareTo(L"http://tizen.org/appcontrol/data/font/type") == 0)
131 SetAppControlRequest(APPCONTROL_REQUEST_FONT_TYPE);
132 __pTableView->SetItemEnabled(ID_GROUP_FONT_SIZE, ID_ITEM_FONT_SIZE, false);
134 else if (__categoryCheck.Equals(L"http://tizen.org/appcontrol/data/font/size", false))
136 SetAppControlRequest(APPCONTROL_REQUEST_FONT_SIZE);
137 __pTableView->SetItemEnabled(ID_GROUP_FONT, ID_ITEM_FONT_TYPE, false);
142 __pTableView->UpdateTableView();
144 String currentFontType;
146 if (SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, currentFontType) == E_SUCCESS)
148 for (int i = 0; i < __fontList->GetCount(); i++)
150 String itemMainText = static_cast<String*>(__fontList->GetAt(i))->GetPointer();
152 if (itemMainText.Equals(currentFontType, false))
154 __pTableView->SetItemChecked(ID_GROUP_FONT_LIST, i, true);
158 AppLogDebug("Get Font Type[%ls] :Result[%s]", currentFontType.GetPointer(), GetErrorMessage(GetLastResult()));
160 __pTableView->RefreshItem(ID_GROUP_FONT_SIZE, ID_ITEM_FONT_SIZE, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
161 __pTableView->RefreshItem(ID_GROUP_FONT_LIST, ID_ITEM_FONT_TYPE, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
162 __pTableView->RefreshItem(ID_GROUP_FONT, ID_ITEM_FONT_TYPE, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
166 FontForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
171 FontForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
173 SceneManager* pSceneManager = SceneManager::GetInstance();
174 AppAssert(pSceneManager);
176 __pTableView->CollapseGroup(ID_GROUP_FONT_LIST);
177 if (GetAppControlRequest() != APPCONTROL_DEFAULT)
179 UiApp* pApp = UiApp::GetInstance();
181 AppControlFontResult();
186 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), null);
191 FontForm::GetGroupCount(void)
193 AppLogDebug("ENTER");
194 return ID_GROUP_COUNT;
198 FontForm::GetItemCount(int groupIndex)
206 case ID_GROUP_FONT_SIZE:
208 itemCount = ID_GROUP_MAX_ITEM_COUNT;
212 case ID_GROUP_FONT_LIST:
214 itemCount = __fontList->GetCount();
222 AppLogDebug("GetItemCount %d", itemCount);
228 FontForm::CreateGroupItem(int groupIndex, int itemWidth)
230 AppLogDebug("ENTER");
232 int itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
233 int yItemOffset = H_GROUP_INDEX_HELP_TEXT_TOP_GAP;
234 LabelTextStyle style = LABEL_TEXT_STYLE_NORMAL;
235 Rectangle itemMainRectangle;
237 Label* pLabel = null;
238 int fontSize = GetFontSize();
240 TableViewGroupItem* pItem = new (std::nothrow) TableViewGroupItem();
246 yItemOffset = H_GROUP_INDEX_NO_HELP_TEXT_GAP;
247 itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
251 case ID_GROUP_FONT_LIST:
257 case ID_GROUP_FONT_SIZE:
259 case ID_GROUP_FONT_TEXT:
267 yItemOffset = H_GROUP_INDEX_NO_HELP_TEXT_GAP;
268 itemHeight = H_GROUP_INDEX_NO_TITLE_DEFAULT;
273 itemMainRectangle.x = X_GROUP_ITEM_DEFAULT_LABEL;
274 itemMainRectangle.y = yItemOffset;
275 itemMainRectangle.width = itemWidth;
276 itemMainRectangle.height = itemHeight;
278 RelativeLayout relativeLayout;
279 relativeLayout.Construct();
281 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight));
282 pItem->SetBackgroundColor(COLOR_BG_GROUP_INDEX_DEFAULT);
284 pLabel = new (std::nothrow) Label();
285 pLabel->Construct(itemMainRectangle, groupText);
286 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
287 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
288 pLabel->SetTextConfig(fontSize, style);
289 pLabel->SetTextColor(COLOR_HELP_TEXT_TYPE_01);
291 pItem->AddControl(pLabel);
292 relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
293 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
294 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
295 pItem->SetEnabled(false);
301 FontForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
303 AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
305 Rectangle itemMainRectangle;
306 Rectangle itemSubRectangle;
307 TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
310 String fontReturnValue;
311 Label* pLabel = null;
312 Label* pLabelArrow = null;
314 int fontSize = GetFontSize();
315 bool isItemSubText = true;
316 int itemHeight = H_GROUP_ITEM_DEFAULT;
317 Rectangle detailArrow;
318 Bitmap* pBitmap = null;
319 char appControlRequest;
321 if (groupIndex == ID_GROUP_FONT_LIST)
323 String currentFontType;
324 isItemSubText = false;
325 style = TABLE_VIEW_ANNEX_STYLE_RADIO;
328 GetTableViewItemString(groupIndex, itemIndex, itemMainText, itemSubText);
330 TableViewItem* pItem = new (std::nothrow) TableViewItem();
332 if (isItemSubText == true)
334 ItemTypeTwoLine(itemMainRectangle, itemSubRectangle, fontSize);
335 itemHeight = (itemMainRectangle.height + itemSubRectangle.height);
337 RelativeLayout relativeLayout;
338 relativeLayout.Construct();
340 pItem->Construct(relativeLayout, Dimension(itemWidth, itemHeight), style);
341 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
343 pLabel = new (std::nothrow) Label();
344 pLabel->Construct(itemMainRectangle, itemMainText);
345 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
346 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
347 pLabel->SetTextColor(COLOR_MAIN_TEXT);
349 pItem->AddControl(pLabel);
350 relativeLayout.SetMargin(*pLabel, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
351 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
353 if (groupIndex == ID_GROUP_FONT)
355 if (__pTableView->IsGroupExpanded(ID_GROUP_FONT_LIST))
357 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_OPENED);
361 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_CLOSED);
364 detailArrow = itemMainRectangle;
365 detailArrow.y = itemMainRectangle.y + ((itemHeight - W_DETAIL_ARROW_BUTTON) / DIVIDE_BY_TWO);
366 detailArrow.height = W_DETAIL_ARROW_BUTTON;
367 detailArrow.width = W_DETAIL_ARROW_BUTTON;
369 pLabelArrow = new (std::nothrow) Label();
370 pLabelArrow->Construct(detailArrow, L"");
372 pLabelArrow->SetBackgroundBitmap(*pBitmap);
374 pItem->AddControl(pLabelArrow);
375 relativeLayout.SetMargin(*pLabelArrow, itemMainRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN_DETAIL_ARROW_BUTTON, 0, 0);
376 relativeLayout.SetRelation(*pLabelArrow, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
377 relativeLayout.SetRelation(*pLabel, pLabelArrow, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
381 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
384 pLabel = new (std::nothrow) Label();
385 pLabel->Construct(itemSubRectangle, itemSubText);
386 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
387 pLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
388 pLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
389 pLabel->SetTextColor(COLOR_SUB_TEXT);
391 pItem->AddControl(pLabel);
392 relativeLayout.SetMargin(*pLabel, itemSubRectangle.x, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
393 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
394 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
398 RelativeLayout relativeLayout;
399 relativeLayout.Construct();
401 pItem->Construct(relativeLayout, Dimension(itemWidth, H_GROUP_ITEM_DEFAULT), style);
402 pItem->SetBackgroundColor(COLOR_BG_GROUP_ITEM_DEFAULT);
404 ItemTypeOneLine(itemMainRectangle);
405 pLabel = new (std::nothrow) Label();
406 pLabel->Construct(itemMainRectangle, itemMainText);
407 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
408 pLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
409 pLabel->SetTextColor(COLOR_MAIN_TEXT);
411 pItem->AddControl(pLabel);
412 relativeLayout.SetMargin(*pLabel, RELATIVE_LAYOUT_LEFT_MARGIN, RELATIVE_LAYOUT_RIGHT_MARGIN, 0, 0);
413 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
414 relativeLayout.SetRelation(*pLabel, pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
417 if ((appControlRequest = GetAppControlRequest()) != APPCONTROL_DEFAULT)
419 if (appControlRequest & APPCONTROL_TYPE)
421 if (groupIndex == ID_GROUP_FONT_SIZE)
427 else if (appControlRequest & APPCONTROL_SIZE)
429 if ((groupIndex == ID_GROUP_FONT) || (groupIndex == ID_GROUP_FONT_LIST))
441 FontForm::DeleteGroupItem(int groupIndex, TableViewGroupItem* pItem)
443 AppLogDebug("ENTER");
452 FontForm::DeleteItem(int groupIndex, int itemIndex, TableViewItem* pItem)
454 AppLogDebug("ENTER");
463 FontForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
465 AppLogDebug("group[%d] index[%d]", groupIndex, itemIndex);
467 SceneManager* pSceneManager = SceneManager::GetInstance();
468 AppAssert(pSceneManager);
469 String fontReturnValue;
475 if (__pTableView->IsGroupExpanded(ID_GROUP_FONT_LIST))
477 __pTableView->CollapseGroup(ID_GROUP_FONT_LIST);
481 __pTableView->ExpandGroup(ID_GROUP_FONT_LIST);
484 __pTableView->RefreshItem(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
488 case ID_GROUP_FONT_LIST:
490 int listCount = __fontList->GetCount();
492 fontReturnValue = static_cast<String*>(__fontList->GetAt(itemIndex))->GetPointer();
494 for (int count = 0; count < listCount; count++)
496 if (itemIndex == count)
498 tableView.SetItemChecked(groupIndex, count, true);
502 tableView.SetItemChecked(groupIndex, count, false);
505 if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, fontGetValue)) == E_SUCCESS)
507 if (fontGetValue.Equals(fontReturnValue, false))
513 if (SettingInfo::SetValue(SETTING_INFO_KEY_FONT_TYPE, fontReturnValue) != E_SUCCESS)
515 AppLogDebug("Set Font Type :Result[%s]", GetErrorMessage(GetLastResult()));
517 AppLogDebug("Set Font Type[%ls] :Result[%s]", fontReturnValue.GetPointer(), GetErrorMessage(GetLastResult()));
521 case ID_GROUP_FONT_SIZE:
523 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FONT_SIZE, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
533 FontForm::GetDefaultGroupItemHeight(void)
535 return H_GROUP_INDEX_NO_TITLE_DEFAULT;
539 FontForm::GetDefaultItemHeight(void)
541 return H_GROUP_ITEM_DEFAULT;
545 FontForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
550 FontForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
552 Rectangle itemMainRectangle;
553 Rectangle itemSubRectangle;
554 Rectangle pItemBounds = pItem->GetBounds();
555 int fontSize = GetFontSize();
561 ItemTypeTwoLine(itemMainRectangle, itemSubRectangle, fontSize);
563 pItemBounds.height = itemMainRectangle.height + itemSubRectangle.height;
564 pItem->SetBounds(pItemBounds);
565 Label* pFirstLabel = static_cast<Label*>(pItem->GetControl(FONT_FORM_FIRST_CONTROL));
566 Label* pSecondLabel = static_cast<Label*>(pItem->GetControl(FONT_FORM_SECOND_CONTROL));
567 Label* pThirdLabel = static_cast<Label*>(pItem->GetControl(FONT_FORM_THIRD_CONTROL));
568 Rectangle detailArrow = pSecondLabel->GetBounds();
569 detailArrow.y = itemMainRectangle.y + ((pItemBounds.height - W_DETAIL_ARROW_BUTTON) / DIVIDE_BY_TWO);
571 pFirstLabel->SetBounds(itemMainRectangle);
572 pFirstLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
573 pSecondLabel->SetBounds(detailArrow);
574 pThirdLabel->SetBounds(itemSubRectangle);
575 pThirdLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
577 Bitmap* pBitmap = null;
579 if (__pTableView->IsGroupExpanded(ID_GROUP_FONT_LIST))
581 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_OPENED);
585 pBitmap = ResourceManager::GetBitmapN(IDB_DETAIL_BUTTON_EXPAND_CLOSED);
587 pSecondLabel->SetBackgroundBitmap(*pBitmap);
588 pSecondLabel->Invalidate(false);
589 pFirstLabel->Invalidate(false);
590 pItem->Invalidate(false);
595 case ID_GROUP_FONT_SIZE:
597 ItemTypeTwoLine(itemMainRectangle, itemSubRectangle, fontSize);
599 pItemBounds.height = itemMainRectangle.height + itemSubRectangle.height;
600 pItem->SetBounds(pItemBounds);
601 Label* pFirstLabel = static_cast<Label*>(pItem->GetControl(FONT_FORM_FIRST_CONTROL));
602 Label* pSecondLabel = static_cast<Label*>(pItem->GetControl(FONT_FORM_SECOND_CONTROL));
604 pFirstLabel->SetBounds(itemMainRectangle);
605 pFirstLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
606 pSecondLabel->SetBounds(itemSubRectangle);
607 pSecondLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_NORMAL);
609 String itemMainText = L"";
610 String itemSubText = L"";
612 GetTableViewItemString(groupIndex, itemIndex, itemMainText, itemSubText);
613 pFirstLabel->SetText(itemMainText);
614 pSecondLabel->SetText(itemSubText);
616 pFirstLabel->Invalidate(false);
617 pSecondLabel->Invalidate(false);
618 pItem->Invalidate(false);
622 case ID_GROUP_FONT_LIST:
624 ItemTypeOneLine(itemMainRectangle);
625 Label* pFirstLabel = static_cast<Label*>(pItem->GetControl(0));
626 pFirstLabel->SetBounds(itemMainRectangle);
627 pFirstLabel->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
628 pFirstLabel->Invalidate(false);
640 FontForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
645 FontForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView& tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
650 FontForm::AppControlFontResult(void)
654 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
656 HashMap* hashMap = new (std::nothrow) HashMap();
657 hashMap->Construct();
659 if (GetAppControlRequest() == APPCONTROL_REQUEST_FONT_TYPE)
661 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, value);
662 hashMap->Add(*(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/font/type")), *(new (std::nothrow) String(value)));
664 else if (GetAppControlRequest() == APPCONTROL_REQUEST_FONT_SIZE)
666 SettingInfo::GetValue(SETTING_INFO_KEY_FONT_SIZE, value);
667 hashMap->Add(*(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/font/size")), *(new (std::nothrow) String(value)));
670 pAppManager->SendAppControlResult(reqId, APP_CTRL_RESULT_SUCCEEDED, hashMap);
672 hashMap->RemoveAll();
677 FontForm::GetFontList(Tizen::Base::Collection::IList& list)
679 const String FONT_DIR_PATH[] =
684 list.RemoveAll(true);
685 const int FONT_DIR_PATH_COUNT = sizeof(FONT_DIR_PATH) / sizeof(FONT_DIR_PATH[0]);
687 for (int i = 0; i < FONT_DIR_PATH_COUNT; i++)
690 result r = directory.Construct(FONT_DIR_PATH[i]);
693 std::auto_ptr<DirEnumerator>dirEnumerator(directory.ReadN());
695 while (dirEnumerator->MoveNext() == E_SUCCESS)
697 DirEntry entry = dirEnumerator->GetCurrentDirEntry();
698 if (entry.IsDirectory() == false && entry.IsHidden() == false)
700 Tizen::Base::Utility::StringTokenizer formatTok(entry.GetName(), ".");
702 while (formatTok.GetTokenCount())
704 formatTok.GetNextToken(token);
707 if (token.Equals("ttf", false) || token.Equals("ttc", false))
710 fullName.Append(FONT_DIR_PATH[i]);
711 fullName.Append(L"/");
712 fullName.Append(entry.GetName());
713 bool isNewFont = true;
715 String* pFamilyName = new (std::nothrow) String(Font::GetFaceName(fullName));
717 for (int idx = 0; idx < list.GetCount(); idx++)
719 String* pName = static_cast <String*>(list.GetAt(idx));
724 if (pFamilyName->Equals(*pName, true))
732 list.Add(*pFamilyName);
748 FontForm::GetTableViewItemString(int groupIndex, int itemIndex, Tizen::Base::String& itemMainText, Tizen::Base::String& itemSubText)
754 String fontReturnValue;
755 if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_TYPE, fontReturnValue)) == E_SUCCESS)
757 itemSubText = fontReturnValue;
759 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_FONT_TYPE");
763 case ID_GROUP_FONT_LIST:
765 itemMainText = static_cast<String*>(__fontList->GetAt(itemIndex))->GetPointer();
770 case ID_GROUP_FONT_SIZE:
772 String fontReturnValue;
773 if ((SettingInfo::GetValue(SETTING_INFO_KEY_FONT_SIZE, fontReturnValue)) == E_SUCCESS)
775 if (fontReturnValue.Equals(L"giant", false))
777 itemSubText = ResourceManager::GetString(L"IDS_EMAIL_POP_GIANT_M_TEXTSIZE");
779 else if (fontReturnValue.Equals(L"huge", false))
781 itemSubText = ResourceManager::GetString(L"IDS_EMAIL_OPT_HUGE_M_TEXTSIZE");
783 else if (fontReturnValue.Equals(L"large", false))
785 itemSubText = ResourceManager::GetString(L"IDS_ST_BODY_TEXTSTYLE_LARGE");
787 else if (fontReturnValue.Equals(L"medium", false))
789 itemSubText = ResourceManager::GetString(L"IDS_ST_BODY_FONTTYPE_NORMAL");
793 itemSubText = ResourceManager::GetString(L"IDS_ST_BODY_SMALL_M_TEXTSIZE");
796 itemMainText = ResourceManager::GetString(L"IDS_ST_BODY_FONT_SIZE");
806 FontForm::OnSettingChanged (Tizen::Base::String &key)
808 AppLogDebug("FontForm::key changed [%ls]", key.GetPointer());
810 int groupCount = __pTableView->GetGroupCount();
812 for (int i = 0; i < groupCount; i++)
814 int itemCount = __pTableView->GetItemCountAt(i);
816 for (int j = 0; j < itemCount; j++)
818 __pTableView->RefreshItem(i, j, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
824 FontForm::GetAppControlRequest(void)
826 return __isAppControlRequest;
830 FontForm::SetAppControlRequest(char requestStatus)
832 __isAppControlRequest = requestStatus;