Fixed Nabi Issues
[apps/osp/Internet.git] / src / IntInternetApp.cpp
index 6932a3d..be34a5b 100644 (file)
@@ -40,10 +40,14 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 using namespace Tizen::Ui::Scenes;
 
+static const wchar_t* APPCONTROL_SELECT_KEY_IMAGE = L"http://tizen.org/appcontrol/data/image/crop_mode";
+static const wchar_t* APPCONTROL_SELECT_VALUE_IMAGE = L"fit_to_screen";
+static const wchar_t* APPCONTROL_PROVIDER_ID_IMAGE_VIEWER = L"tizen.imageviewer";
+static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
 const int MIN_MEMORY_NEEDED = 1048576;
 
 InternetApp::InternetApp(void)
-: __pMultiWindowManager(NULL),__pNewWindowInfo(null)
+: __pMultiWindowManager(NULL),__pNewWindowInfo(null),pSceneManagementFrame(null)
 {
 }
 
@@ -134,10 +138,11 @@ InternetApp::OnAppInitialized(void)
 
 
        // Create a Frame
-       MainFrame* pSceneManagementFrame = new(std::nothrow) MainFrame();
+       pSceneManagementFrame = new(std::nothrow) MainFrame();
        pSceneManagementFrame->Construct();
        pSceneManagementFrame->SetName(L"SceneManagement");
        AddFrame(*pSceneManagementFrame);
+       pSceneManagementFrame->Show();
        // Goto the first scene.
 
        SceneManager* pSceneManager = SceneManager::GetInstance();
@@ -186,17 +191,6 @@ InternetApp::OnAppInitialized(void)
                return false;
        }
 
-       AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry();
-       String sliderKey("SliderValue");
-
-       int sliderValue = 0;
-
-
-       r = pAppRegistry->Get(sliderKey, sliderValue);
-       r = PowerManager::SetScreenBrightness(sliderValue);
-
-       AppLog("Settingscreenbrightness to %d result %s",sliderValue , GetErrorMessage(r));
-
        delete pArgList;
        pArgList = null;
        __pNewWindowInfo = null;
@@ -224,6 +218,21 @@ InternetApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
 void
 InternetApp::OnForeground(void)
 {
+       AppLog("InternetApp::OnForeground");
+
+       AppRegistry* pAppRegistry = App::GetInstance()->GetAppRegistry();
+       String sliderKey("SliderValue");
+
+       int sliderValue = 0;
+
+
+       result r = pAppRegistry->Get(sliderKey, sliderValue);
+       r = PowerManager::SetScreenBrightness(sliderValue);
+//     r = PowerManager::RestoreScreenBrightness();
+
+       AppLog("Settingscreenbrightness to %d result %s",sliderValue , GetErrorMessage(r));
+
+
        Form* pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
        if (pCurrentForm)
        {
@@ -274,7 +283,7 @@ void
 InternetApp::OnSettingChanged(Tizen::Base::String& key)
 {
        AppLog("InternetApp::OnSettingChanged: %ls", key.GetPointer());
-       if (key == L"http://tizen.org/setting/locale.language")
+       if (key == L"http://tizen.org/setting/locale.language" || key == L"http://tizen.org/setting/font.size")
        {
                Terminate();
        }
@@ -315,6 +324,8 @@ InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operatio
                        urlData = *pUrl;
                }
                AppLog("URL received %ls", urlData.GetPointer());
+               if(pSceneManagementFrame)
+                       pSceneManagementFrame->Show();
 
                if (__pNewWindowInfo == null)
                {
@@ -324,8 +335,8 @@ InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operatio
                {
                        if (MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)
                        {
-                               String strTitle = CommonUtil::GetString(L"IDS_COM_SK_MAX_LIMIT_REACHED");
-                               String strText = CommonUtil::GetString(L"IDS_COM_SK_CREATE_WINDOWS_BNO");
+                               String strTitle = L"";//CommonUtil::GetString(L"IDS_COM_SK_MAX_LIMIT_REACHED");
+                               String strText = CommonUtil::GetString(L"IDS_BR_BODY_COULD_NOT_OPEN_NEW_WINDOW_BECAUSE_YOU_HAVE_ALREADY_OPENED_MAXIMUM_NUMBER");
                                ShowPopup(strTitle, strText);
                        }
                        return;
@@ -357,6 +368,32 @@ InternetApp::OnAppControlRequestReceived(RequestId reqId, const String &operatio
                        __pNewWindowInfo = null;
                }
        }
+       else if (operationId.CompareTo(L"http://tizen.org/appcontrol/operation/main") == 0)
+       {
+               if (pArgs)
+               {
+                       const String* pVal = (String *) pArgs->GetValue(String(L"http://tizen.org/appcontrol/data/notification"));
+                       if (pVal && pVal->GetLength() > 0)
+                       {
+                               HashMap extraData;
+                               extraData.Construct();
+                               String typeKey = APPCONTROL_SELECT_KEY_IMAGE;
+                               String typeVal = APPCONTROL_SELECT_VALUE_IMAGE;
+                               extraData.Add(&typeKey, &typeVal);
+
+                               AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_PROVIDER_ID_IMAGE_VIEWER,
+                                               APPCONTROL_OPERATION_ID_IMAGE_VIEWER);
+                               if (pAc)
+                               {
+                                       if (pAc->Start(pVal, null, null, null) == E_SUCCESS)
+                                       {
+                                               delete pAc;
+                                       }
+                               }
+                       }
+               }
+       }
+
        AppLogDebug("ABC::Internet::OnAppControlRequestReceivedN Exit");
        return;
 }
@@ -378,3 +415,4 @@ InternetApp::GetAvailableMemory(void)
    CATCH:
     return 0;
 }
+