patch for rc20
[framework/osp/web.git] / src / controls / FWebCtrl_AuthConfirmPopup.cpp
index a0ce387..9b3108b 100755 (executable)
@@ -31,7 +31,6 @@
 #include <FUiKeyEventInfo.h>
 #include <FUiLayout.h>
 #include <FUiVerticalBoxLayout.h>
-#include <FWebCtrlAuthenticationChallenge.h>
 #include <FSys_SystemResource.h>
 #include <FSys_VibratorImpl.h>
 #include <FUi_ControlManager.h>
@@ -58,7 +57,7 @@ static const int EDIT_TEXT_SIZE = 35;
 _AuthConfirmPopup::_AuthConfirmPopup(void)
        : __pIdEditField(null)
        , __pPwdEditField(null)
-       , __pAuthHandler(null)
+       , __pImpl(null)
 {
 }
 
@@ -70,11 +69,10 @@ _AuthConfirmPopup::~_AuthConfirmPopup(void)
 
 // Authentication popup
 result
-_AuthConfirmPopup::Construct(const String& host, const String& realm, AuthenticationChallenge* pAuth)
+_AuthConfirmPopup::Construct(const String& host, const String& realm, _WebImpl* pImpl)
 {
-       SysTryReturnResult(NID_WEB_CTRL, pAuth != null, E_INVALID_ARG, "invalid argument(s) is used. The AuthenticationChallenge is null.");
-
-       __pAuthHandler = pAuth;
+       __pImpl = pImpl;
+       SysAssertf(__pImpl != null, "Failed to get _WebImpl");
 
        _SystemResource* pSysResource = _SystemResource::GetInstance();
        SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
@@ -85,11 +83,11 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
 
        Rectangle rect(0, 0, 0, 0);
        rect.width = pPopupData->popupDim.width;
-       rect.height = (2*pPopupData->spacePad) + (pPopupData->editDim.height*2) + pPopupData->btnDim.height + (2*pPopupData->labelDim.height);
+       rect.height = (2*pPopupData->spacePad) + (pPopupData->editDim.height*2) + pPopupData->panelHeight + (2*pPopupData->labelDim.height);
        r = _WebPopup::Construct(true, Dimension(rect.width, rect.height));
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_DESTINATIONS_AUTHENTICATION_REQUIRED"));
+       SetTitleText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_ENTER_CREDENTIALS_ABB"));
 
        //host realm label
        rect.height = 2*pPopupData->labelDim.height;
@@ -100,7 +98,6 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        String hostRealm(host);
        hostRealm.Append(L": \n ");
        hostRealm.Append(realm);
-       hostRealm.Append(L"\"");
        r = pLabel->Construct(rect, hostRealm);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -123,7 +120,7 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        r = pIdEditField->Construct(rect, EDIT_FIELD_STYLE_NORMAL);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       pIdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_AUTHUSERNAME"));
+       pIdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_WIFI_BODY_ENTER_YOUR_ID"));
        pIdEditField->SetGuideTextColor(Color::GetColor(COLOR_ID_GREY));
        pIdEditField->SetTextSize(EDIT_TEXT_SIZE);;
 
@@ -138,7 +135,7 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        r = pPwdEditField->Construct(rect, EDIT_FIELD_STYLE_PASSWORD);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       pPwdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_AUTHPASSWORD"));
+       pPwdEditField->SetGuideText(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_ENTER_YOUR_PASSWORD_ABB"));
        pPwdEditField->SetGuideTextColor(Color::GetColor(COLOR_ID_GREY));
        pPwdEditField->SetTextSize(EDIT_TEXT_SIZE);;
 
@@ -146,23 +143,26 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPwdEditField = pPwdEditField.release();
+
        __pIdEditField->SetFocus();
 
        Panel* pButtonPanel = CreateAndAddPanel();
        SysTryReturn(NID_WEB_CTRL, pButtonPanel, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
 
        //Add Buttons
-       ArrayList idList;
+       ArrayList idList(SingleObjectDeleter);
        r = idList.Construct();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-       idList.Add(*(new Integer(ID_BUTTON_AUTH_PROCESS)));
-       idList.Add(*(new Integer(ID_BUTTON_AUTH_CANCEL)));
 
-       ArrayList titleList;
+       idList.Add(new Integer(ID_BUTTON_AUTH_CANCEL));
+       idList.Add(new Integer(ID_BUTTON_AUTH_PROCESS));
+
+
+       ArrayList titleList(SingleObjectDeleter);
        r = titleList.Construct();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-       titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_COM_BUTTON_LOGIN"))));
-       titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_COM_SK_CANCEL"))));
+       titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CANCEL_ABB")));
+       titleList.Add(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_CONTINUE_ABB")));
 
        r = CreateAndAddButtons(idList, titleList, pButtonPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -173,7 +173,6 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        pLayout->SetHorizontalAlignment(*pHostLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
 
        pLayout->SetSpacing(*__pPwdEditField, pPopupData->spacePad);
        pLayout->SetSpacing(*pButtonPanel, pPopupData->spacePad);
@@ -189,28 +188,35 @@ _AuthConfirmPopup::OnActionPerformed(const Control& source, int actionId)
 {
        result r = E_SUCCESS;
 
+       r = HidePopup();
+       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       ArrayList* pAuthValueList = null;
+
        switch (actionId)
        {
        case ID_BUTTON_AUTH_PROCESS:
-               __pAuthHandler->Process(__pIdEditField->GetText(), __pPwdEditField->GetText());
+
+               pAuthValueList = new (std::nothrow) ArrayList();
+               pAuthValueList->Construct();
+               pAuthValueList->Add(new String(__pIdEditField->GetText()));
+               pAuthValueList->Add(new String(__pPwdEditField->GetText()));
+               __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_PROCESS, pAuthValueList);
                break;
 
        case ID_BUTTON_AUTH_CANCEL:
-               __pAuthHandler->Cancel();
+               __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null);
                break;
 
        default:
                break;
        }
-
-       r = HidePopup();
-       SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 }
 
 bool
 _AuthConfirmPopup::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
@@ -219,15 +225,16 @@ _AuthConfirmPopup::OnKeyReleased(Control& source, const KeyEventInfo& keyEventIn
        result r = E_SUCCESS;
        if ((keyEventInfo.GetKeyCode() == KEY_ESC || keyEventInfo.GetKeyCode() == KEY_BACK) && source.GetShowState() == true)
        {
-               __pAuthHandler->Cancel();
                r = HidePopup();
                if (IsFailed(r))
                {
                        SysLogException(NID_WEB_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
                }
+
+               __pImpl->SendUserEvent(ID_AUTHENTICATION_CONFIRM_POPUP_CANCEL, null);
        }
 
-       return true;
+       return false;
 }
 
 bool