Fixed Nabi issues N_SE-49016, N_SE-48879, N_SE-48597, N_SE-48815, N_SE-48813, N_SE...
[apps/osp/Internet.git] / src / IntFormFactory.cpp
index cdb7498..436d95a 100644 (file)
@@ -2,7 +2,7 @@
 
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
  */
 
 #include "IntAddBookmarkForm.h"
+#include "IntArticleReaderForm.h"
 #include "IntBookmarkListForm.h"
 #include "IntBrightnessForm.h"
+#include "IntCommonLib.h"
 #include "IntCreateBookmarkFolderForm.h"
 #include "IntEditBookmarkListForm.h"
 #include "IntEditHistoryListForm.h"
 #include "IntFormFactory.h"
 #include "IntSettingForm.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
@@ -55,6 +60,7 @@ const wchar_t* IDL_FORM_FONT_SIZE_SCENE = L"FontSize";
 const wchar_t* IDL_FORM_EDIT_HOME_PAGE_SCENE = L"EditHomePage";
 const wchar_t* IDL_FORM_BRIGHTNESS_SCENE = L"Brightness";
 
+
 FormFactory::FormFactory(void)
 {
 
@@ -150,7 +156,16 @@ FormFactory::CreateFormN(const String& formId, const SceneId& sceneId)
                pForm->Initialize();
                pNewForm = pForm;
        }
-
+       else if (formId == IDL_FORM_ARTICLE_READER_SCENE)
+       {
+               ArticleReaderForm* pForm = new(std::nothrow) ArticleReaderForm();
+               if (pForm == null)
+               {
+                       return null;
+               }
+               pForm->Initialize();
+               pNewForm = pForm;
+       }
        else if (formId == IDL_FORM_EDIT_BOOKMARK_LIST_SCENE)
        {
                EditBookmarkListForm* pForm = new(std::nothrow) EditBookmarkListForm();
@@ -204,5 +219,102 @@ FormFactory::CreateFormN(const String& formId, const SceneId& sceneId)
                pNewForm = pForm;
        }
        AppLogDebug("FormFactory createForm exit");
+//     pSceneManager->AddSceneEventListener(sceneId, *this);
        return pNewForm;
 }
+
+
+void
+FormFactory::SetFontSize(Container& container, int font)
+{
+       IList* pControls = container.GetControls();
+       if(pControls == null)
+       {
+               return;
+       }
+       for(int count = 0; count < pControls->GetCount(); count++)
+       {
+               //Check if the control is again an container
+               Container *pContainer = dynamic_cast<Container*>(pControls->GetAt(count));
+               if(pContainer != null)
+               {
+                       SetFontSize(*pContainer, font);
+               }
+               else //Check if it is a button
+               {
+                       Button *pButton = dynamic_cast<Button*>(pControls->GetAt(count));
+                       if(pButton != null)
+                       {
+                               pButton->SetTextSize(font);
+                       }
+                       else //Check if a label
+                       {
+                               Label *pLabel = dynamic_cast<Label*>(pControls->GetAt(count));
+                               if(pLabel != null)
+                               {
+                                       pLabel->SetTextConfig(font, pLabel->GetTextStyle());
+                               }
+                               else //Check if a EditField
+                               {
+                                       EditField *pEditField = dynamic_cast<EditField*>(pControls->GetAt(count));
+                                       if(pEditField != null)
+                                       {
+                                               pEditField->SetTextSize(font);
+                                       }
+                                       else //Check if a EditArea
+                                       {
+                                               EditArea *pEditArea = dynamic_cast<EditArea*>(pControls->GetAt(count));
+                                               if(pEditArea != null)
+                                               {
+                                                       pEditArea->SetTextSize(font);
+                                               }
+                                               else //Check if a ExpandableEditArea
+                                               {
+                                                       ExpandableEditArea *pExpandableEditArea = dynamic_cast<ExpandableEditArea*>(pControls->GetAt(count));
+                                                       if(pExpandableEditArea != null)
+                                                       {
+                                                               pExpandableEditArea->SetTextSize(font);
+                                                       }
+                                                       else //Check if a TextBox
+                                                       {
+                                                               TextBox *pTextBox = dynamic_cast<TextBox*>(pControls->GetAt(count));
+                                                               if(pTextBox != null)
+                                                               {
+                                                                       pTextBox->SetTextSize(font);
+                                                               }
+                                                               else //Check if a SearchBar
+                                                               {
+                                                                       SearchBar *pSearchBar = dynamic_cast<SearchBar*>(pControls->GetAt(count));
+                                                                       if(pSearchBar != null)
+                                                                       {
+                                                                               pSearchBar->SetSearchFieldTextSize(font);
+                                                                       }
+                                                                       else //Check if a List
+                                                                       {
+
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
+void
+FormFactory::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
+{
+       AppLog("FormFactory::OnSceneActivatedN");
+       Form *pForm = UiApp::GetInstance()->GetFrameAt(0)->GetCurrentForm();
+
+       if(pForm != null)
+       {
+               String fontSizeStr = "";
+               int fontSize = CommonUtil::GetFontSize();
+               AppLog("Font sizeStr: %ls, fontsize:%d", fontSizeStr.GetPointer(), fontSize);
+               SetFontSize(*pForm, fontSize);
+               pForm->Invalidate(true);
+       }
+}