popup modifications as a result of client area change
authorBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Mon, 8 Apr 2013 10:17:17 +0000 (15:47 +0530)
committerBINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
Mon, 8 Apr 2013 11:00:11 +0000 (16:30 +0530)
Change-Id: Iaf8eeb5c273c2b984113767d0c1760d92ea69f1d
Signed-off-by: BINDUCHAITANYA TUMMALA <bc.tummala@samsung.com>
src/controls/FWebCtrl_AuthConfirmPopup.cpp
src/controls/FWebCtrl_CertificateConfirmPopup.cpp
src/controls/FWebCtrl_PromptPopup.cpp
src/controls/FWebCtrl_UserConfirmPopup.cpp
src/controls/FWebCtrl_WebPopup.cpp
src/controls/FWebCtrl_WebPopup.h

index 6959353..6346eba 100755 (executable)
@@ -113,6 +113,7 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        rect.x = 0;
        rect.y = 0;
        rect.height = pPopupData->editDim.height;
+       rect.width = pPopupData->labelDim.width;
 
        std::unique_ptr<EditField> pIdEditField(new (std::nothrow) EditField());
        SysTryReturnResult(NID_WEB_CTRL, pIdEditField.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
@@ -167,11 +168,6 @@ _AuthConfirmPopup::Construct(const String& host, const String& realm, Authentica
        std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
        SysTryReturn(NID_WEB_CTRL, pLayout.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       pLayout->SetHorizontalFitPolicy(*pHostLabel, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalFitPolicy(*__pIdEditField, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalFitPolicy(*__pPwdEditField, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-
        pLayout->SetHorizontalAlignment(*pHostLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pIdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*__pPwdEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
index 60b6d3d..62a1707 100644 (file)
@@ -144,7 +144,7 @@ _CertificateConfirmPopup::Construct(_CertificatePopupMode certPopupMode, Ewk_Cer
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
                TextBox* pCertBox = pTextBox.release();
-               pLayout->SetHorizontalFitPolicy(*pCertBox, FIT_POLICY_PARENT);
+               pLayout->SetHorizontalAlignment(*pCertBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        }
        else    // CERTIFICATE_POPUP_MODE_CONFIRM
        {
index 6d3ddd4..4865827 100755 (executable)
@@ -88,7 +88,7 @@ _PromptPopup::Construct(const String& message, const String& defaultVale)
        rect.width = pPopupData->popupDim.width - 2 * pPopupData->sideMargin;
        rect.y = 0;
        rect.height = pPopupData->editDim.height + 10;
-       
+
        std::unique_ptr<TextBox> pTextBox(new (std::nothrow) TextBox());
        SysTryReturnResult(NID_WEB_CTRL, pTextBox.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
 
@@ -148,11 +148,8 @@ _PromptPopup::Construct(const String& message, const String& defaultVale)
        std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
        SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-       pLayout->SetHorizontalFitPolicy(*__pEditField, FIT_POLICY_PARENT);
-
-       pLayout->SetHorizontalAlignment(*pTmpTextBox, LAYOUT_HORIZONTAL_ALIGN_LEFT);
-       pLayout->SetHorizontalAlignment(*__pEditField, LAYOUT_HORIZONTAL_ALIGN_LEFT);
+       pLayout->SetHorizontalAlignment(*pTmpTextBox, LAYOUT_HORIZONTAL_ALIGN_CENTER);
+       pLayout->SetHorizontalAlignment(*__pEditField, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        pLayout->SetHorizontalAlignment(*pButtonPanel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
 
        pLayout->SetSpacing(*pTmpTextBox, pPopupData->spacePad);
index 9704492..6035a92 100755 (executable)
@@ -153,13 +153,6 @@ _UserConfirmPopup::Construct(_UserConfirmMode userConfirmMode, void* pEventInfo,
        std::unique_ptr<VerticalBoxLayout> pLayout(dynamic_cast< VerticalBoxLayout* >(GetLayoutN()));
        SysTryReturn(NID_WEB_CTRL, pLayout.get(), r = GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       pLayout->SetHorizontalFitPolicy(*pInfoLabel, FIT_POLICY_PARENT);
-       if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
-       {
-               pLayout->SetHorizontalFitPolicy(*__pCheckButton, FIT_POLICY_PARENT);
-       }
-       pLayout->SetHorizontalFitPolicy(*pButtonPanel, FIT_POLICY_PARENT);
-
        pLayout->SetHorizontalAlignment(*pInfoLabel, LAYOUT_HORIZONTAL_ALIGN_CENTER);
        if (__userConfirmMode == USER_CONFIRM_GEOLOCATION)
        {
@@ -245,7 +238,7 @@ _UserConfirmPopup::GetMessageFromPolicy(void)
                const Ewk_Security_Origin* pSecurityOrigin = ewk_geolocation_permission_request_origin_get(pGeoLocPermReq);
 
                message = _Utility::CreateOrigin(pSecurityOrigin);
-               message.Append("Requests your Location");
+               message.Append(" Requests your Location");
                break;
        }
        default:
@@ -332,7 +325,7 @@ _UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
        String handlerPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
        String table;
        int checkId = 0;
-       
+
        if(checkHandler == true)
        {
                table = CUSTOM_CONTENT_TABLE_NAME;
@@ -343,7 +336,7 @@ _UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
        }
        Ewk_Custom_Handlers_Data* pHandlerData = reinterpret_cast< Ewk_Custom_Handlers_Data* >(__pUserPolicyData);
        SysAssertf(pHandlerData, "Failed to request");
-                       
+
        String baseUri(ewk_custom_handlers_data_base_url_get(pHandlerData));
        String uri = ewk_custom_handlers_data_url_get(pHandlerData);
        String target = ewk_custom_handlers_data_target_get(pHandlerData);
@@ -357,7 +350,7 @@ _UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
        {
                pEnum->MoveNext();
                pEnum->GetIntAt(0, checkId);
-               
+
                std::unique_ptr<DbStatement> pUpdateStmt(db.CreateStatementN(L"Update " + table + L" Set allow = (?) Where id = (?)"));
                SysTryReturnVoidResult(NID_WEB_CTRL, pUpdateStmt.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
@@ -365,26 +358,26 @@ _UserConfirmPopup::RegisterHandler(bool checkHandler, Eina_Bool allow)
                pUpdateStmt->BindInt(1, checkId);
 
                db.BeginTransaction();
-               
+
                std::unique_ptr<DbEnumerator> pEnum(db.ExecuteStatementN(*pUpdateStmt));
-               
+
                db.CommitTransaction();
-               
+
        }
        else
        {
                std::unique_ptr<DbStatement> pStmt(db.CreateStatementN(L"Insert Into " + table + L" (baseUrl, url, mime, allow) Values (?, ?, ?, ?)"));
                SysTryReturnVoidResult(NID_WEB_CTRL, pStmt.get(),  GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-                                               
+
                pStmt->BindString(0, baseUri);
                pStmt->BindString(1, uri);
                pStmt->BindString(2, target);
                pStmt->BindInt(3, static_cast < int >(allow));
-               
+
                db.BeginTransaction();
-               
+
                std::unique_ptr<DbEnumerator> pRegisterEnum(db.ExecuteStatementN(*pStmt));
-               
+
                db.CommitTransaction();
        }
 }
index 426531b..099ac77 100644 (file)
@@ -160,8 +160,8 @@ _WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles
        int titleCount = buttonTitles.GetCount();
        SysTryReturnResult(NID_WEB_CTRL, idCount > 0 && titleCount > 0 && idCount == titleCount, E_INVALID_DATA, "[E_INVALID_DATA] mismatch in count of Ids and Ttitles.");
 
-       int buttonMargin = __pWebPopupData->spacePad;
-       int buttonWidth = (__pWebPopupData->popupDim.width - buttonMargin*(idCount)) / idCount;
+       int buttonMargin = __pWebPopupData->spacePad/2;
+       int buttonWidth = (__pWebPopupData->popupDim.width - buttonMargin*(idCount+1)) / idCount;
 
        result r = E_SUCCESS;
        for (int i = 0; i < idCount; i++)
@@ -174,7 +174,7 @@ _WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles
                std::unique_ptr<Button> pButton(new (std::nothrow) Button());
                SysTryReturnResult(NID_WEB_CTRL, pButton.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory Allocation failed.");
 
-               r = pButton->Construct(Rectangle((buttonMargin+buttonWidth)*i, 0, buttonWidth, __pWebPopupData->btnDim.height), *pButtonTitle);
+               r = pButton->Construct(Rectangle((buttonMargin*(i+1))+(buttonWidth*i), 0, buttonWidth, __pWebPopupData->btnDim.height), *pButtonTitle);
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
                pButton->SetActionId(pButtonId->ToInt());
@@ -191,6 +191,13 @@ _WebPopup::CreateAndAddButtons(const IList& buttonIds, const IList& buttonTitles
 }
 
 
+bool
+_WebPopup::IsModalPopup(void)
+{
+       return __isModal;
+}
+
+
 _WebPopupData*
 _WebPopup::GetPopupData(bool refresh)
 {
index e19fd45..0000606 100755 (executable)
@@ -92,10 +92,16 @@ public:
 
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
 
+       /**
+        * This function launches non modal (asynchronous) popup
+        */
        result ShowPopup(void);
 
        result HidePopup(int modalResult = 0);
 
+       /**
+        * This function launches modal (synchronous) popup
+        */
        result ShowAndWait(int& modalResult);
 
        Tizen::Ui::Controls::Panel* CreateAndAddPanel(void);
@@ -104,6 +110,8 @@ public:
                                        const Tizen::Base::Collection::IList& buttonTitles,
                                        Tizen::Ui::Controls::Panel* pPanel);
 
+       bool IsModalPopup(void);
+
 protected:
        static _WebPopupData* GetPopupData(bool refresh = false);