Init Tizen 2.2.1
[framework/osp/web.git] / src / controls / FWebCtrl_CertificateConfirmPopup.cpp
index 52d9ba9..0ef39ae 100755 (executable)
@@ -39,7 +39,7 @@
 #include <FUi_ControlManager.h>
 #include <FUi_ResourceManager.h>
 #include "FWebCtrl_CertificateConfirmPopup.h"
-#include "FWebCtrl_EflWebkit.h"
+#include "FWebCtrl_WebManager.h"
 #include "FWebCtrl_Utility.h"
 #include "FWebCtrl_WebImpl.h"
 
@@ -68,6 +68,7 @@ _CertificateConfirmPopup::_CertificateConfirmPopup(void)
                                                , __pCertificatePolicyData(null)
                                                , __pParent(null)
                                                , __pCertificatePopup(null)
+                                               , __reaction(false)
 {
 }
 
@@ -78,6 +79,10 @@ _CertificateConfirmPopup::~_CertificateConfirmPopup(void)
        {
                HandleUserAction(false);
        }
+       if (__pCertificatePopup.get())
+       {
+               __pCertificatePopup.reset();
+       }
 }
 
 
@@ -112,18 +117,18 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        if( __certPopupMode == CERTIFICATE_POPUP_MODE_VIEW )
        {
                titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_CERTIFICATE_ABB");
-               popupMaxHeight = 4*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
+               popupMaxHeight = 4*pPopupData->labelDim.height + pPopupData->panelHeight;
 
                rect.height = 4*pPopupData->labelDim.height;
                rect.width = pPopupData->labelDim.width;
 
                idList.Add(*(new Integer(ID_BUTTON_CERTIFICATE_CLOSE)));
-               titleList.Add(*(new String(pSysResource->GetString("sys_string", "IDS_TPLATFORM_BUTTON_OK"))));
+               titleList.Add(*(new String(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BUTTON_OK"))));
        }
        else    // CERTIFICATE_POPUP_MODE_CONFIRM
        {
                titleText = pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_HEADER_SECURITY_WARNING_ABB");
-               popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->btnDim.height + 2*pPopupData->sideMargin;
+               popupMaxHeight = 2*pPopupData->labelDim.height + pPopupData->panelHeight;
 
                rect.height = 2*pPopupData->labelDim.height;
                rect.width = pPopupData->labelDim.width;
@@ -199,11 +204,6 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
        r = CreateAndAddButtons(idList, titleList, pButtonPanel);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
-
-       pLayout->SetSpacing(*pButtonPanel, 2*pPopupData->sideMargin);
-
        SetPropagatedKeyEventListener(this);
 
        return E_SUCCESS;
@@ -218,11 +218,24 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
        switch (actionId)
        {
        case ID_BUTTON_CERTIFICATE_ALLOW:
+       {
+               if (__reaction)
+               {
+                       return;
+               }
+
                HandleUserAction(true);
                break;
+       }
 
        case ID_BUTTON_CERTIFICATE_VIEW:
        {
+               if (__reaction)
+               {
+                       return;
+               }
+
+               __reaction = true;
                std::unique_ptr<_CertificateConfirmPopup> pCertificatePopup(new (std::nothrow) _CertificateConfirmPopup());
                SysTryReturnVoidResult(NID_WEB_CTRL, pCertificatePopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
@@ -233,16 +246,29 @@ _CertificateConfirmPopup::OnActionPerformed(const Control& source, int actionId)
 
                r = __pCertificatePopup->ShowPopup();
                SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-               __pCertificatePopup.release();
                return;
        }
 
        case ID_BUTTON_CERTIFICATE_CANCEL:
+       {
+               if (__reaction)
+               {
+                       return;
+               }
+
                HandleUserAction(false);
                break;
+       }
 
        case ID_BUTTON_CERTIFICATE_CLOSE:
+       {
+               if (__reaction)
+               {
+                       return;
+               }
+
                break;
+       }
 
        default:
                SysAssert(false);
@@ -267,8 +293,16 @@ _CertificateConfirmPopup::OnUserEventReceivedN(RequestId requestId, IList* pArgs
        switch (requestId)
        {
        case ID_CERTIFICATE_CONFIRM_POPUP_CLOSE:
+       {
                __pCertificatePopup.reset();
+
+               if (__reaction)
+               {
+                       __reaction = false;
+               }
+
                break;
+       }
        default:
                break;
        }
@@ -402,7 +436,7 @@ _CertificateConfirmPopup::GenerateCertifiate(String& certString)
        certString.Append(GetStringOfToken(subject, L"/OU=") + L"\n");
 
        certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_SERIAL_NUMBER_C"));
-       certString.Append(L":\n");
+       certString.Append(L"\n");
        certString.Append(certificate.GetSerialNumber() + L"\n\n\n");
 
        //Issued by
@@ -435,7 +469,7 @@ _CertificateConfirmPopup::GenerateCertifiate(String& certString)
 
        //FingerPrints
        certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_FINGERPRINTS_C"));
-       certString.Append(L":\n\n");
+       certString.Append(L"\n\n");
        certString.Append(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_BR_BODY_SIGNATURE_ALGORITHM_VODA"));
        certString.Append(L":\n");
        certString.Append(certificate.GetSignatureAlgorithm() + L"\n\n");
@@ -445,6 +479,7 @@ _CertificateConfirmPopup::GenerateCertifiate(String& certString)
        {
                String fingerPrint;
                StringUtil::Utf8ToString((const char*)pFingerPrint->GetPointer(), fingerPrint);
+               fingerPrint.SetLength(pFingerPrint->GetLimit());
                certString.Append(fingerPrint + L"\n\n");
        }