NABI issues
[apps/osp/Internet.git] / src / IntAddressbar.cpp
index 96f52d2..b7eb241 100644 (file)
@@ -144,62 +144,6 @@ Addressbar::Initialize(const Rectangle& rect)
        }
        __pProgressbarLabel->SetShowState(false);
 
-       //Add the go Back Button
-       /*__pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_BACKWARD_BUTTON",true));
-       if (__pGoBackBtn == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-       __pGoBackBtn->SetActionId(IDA_GO_BACK);
-       __pGoBackBtn->AddActionEventListener(*this);
-       __pGoBackBtn->SetEnabled(false);
-
-       //Add the go forward Button
-       __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_FORWARD_BUTTON",true));
-       if (__pGoForwardBtn == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-       __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
-       __pGoForwardBtn->AddActionEventListener(*this);
-       __pGoForwardBtn->SetEnabled(false);*/
-
-
-       //Add the favicon
-       /*__pFaviconLabel = static_cast<Label*> (GetControl(L"IDC_FAVICON_BUTTON",true));
-       if (__pFaviconLabel == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-
-       __pFaviconLabel->SetShowState(false);*/
-
-       //Add the search icon
-       /*__pSearchLabel = static_cast<Label*> (GetControl(L"IDC_SEARCH_BUTTON",true));
-       if (__pSearchLabel == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-
-       __pSearchLabel->SetShowState(true);*/
-
-       //Add the refresh button
-       /*__pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
-       if (__pRefreshBtn == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-
-       __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
-       __pRefreshBtn->AddActionEventListener(*this);
-       __pRefreshBtn->SetShowState(true);*/
-
-
        //Add the stop button
        __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
        if (__pStopBtn == NULL)
@@ -212,19 +156,6 @@ Addressbar::Initialize(const Rectangle& rect)
        __pStopBtn->SetShowState(false);
 
 
-       //Add the reader button
-       /*__pReaderBtn = static_cast<Button*> (GetControl(L"IDC_READER_BUTTON",true));
-       if (__pReaderBtn == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-
-       __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED);
-       __pReaderBtn->AddActionEventListener(*this);
-       __pReaderBtn->SetShowState(false);
-*/
-
        __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
        if (__pClearBtn == NULL)
        {
@@ -246,6 +177,15 @@ Addressbar::Initialize(const Rectangle& rect)
        __pAddressbarUrlField->SetOverlayKeypadCommandButtonVisible(false);
        __pAddressbarUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
        __pAddressbarUrlField->AddFocusEventListener(*this);
+       __pAddressbarUrlField->AddTextEventListener(*this);
+       if(__pAddressbarUrlField->GetTextLength() == 0)
+       {
+               __pAddressbarUrlField->SetKeypadActionEnabled(false);
+       }
+       else
+       {
+               __pAddressbarUrlField->SetKeypadActionEnabled(true);
+       }
 
        __pToolBarLabel = static_cast<Label*> (GetControl(L"IDC_TOOLBAR_LABEL",true));
        if (__pToolBarLabel == NULL)
@@ -274,16 +214,6 @@ Addressbar::Initialize(const Rectangle& rect)
        __pAddressBackBtn->SetShowState(true);
        //IDC_ADDRESS_BACK_BUTTON
 
-       /*//Add the Cancel Button
-       __pCancelBtn = static_cast<Button*> (GetControl(L"IDC_CANCEL_BUTTON",true));
-       if (__pCancelBtn == NULL)
-       {
-               AppLogDebug("Control not found returning E_INVALID_KEY");
-               return E_INVALID_KEY;
-       }
-       __pCancelBtn->SetActionId(IDA_CANCEL);
-       __pCancelBtn->AddActionEventListener(*this);
-       __pCancelBtn->SetShowState(false);*/
        // Added to get the favorite url if not set then address bar is about blank
 
        if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
@@ -830,7 +760,7 @@ Addressbar::OnKeypadClosed(Tizen::Ui::Control& source)
 void
 Addressbar::OnKeypadOpened(Tizen::Ui::Control& source)
 {
-//     __pListener->OnAddressBarKeypadOpened(*this);
+
        __pListener->OnAddressBarKeypadClosed(*this,false);
 }
 
@@ -896,7 +826,7 @@ Addressbar::GetLockedImageN(void)
 }
 
 void
-Addressbar::OnFocusGained(const Tizen::Ui::Control& source)
+Addressbar::OnFocusGained(const Control& source)
 {
        //SetAddressbarMode(ADDRESSBAR_MODE_EDIT);
        //      SetAddressbarMode(__prevAddMode);
@@ -908,6 +838,31 @@ Addressbar::OnFocusGained(const Tizen::Ui::Control& source)
 }
 
 void
+Addressbar::OnTextValueChanged(const Control& source)
+{
+       if(__pAddressbarUrlField != null)
+       {
+               if(__pAddressbarUrlField->GetTextLength() == 0)
+               {
+                       if(__pAddressbarUrlField->IsKeypadActionEnabled() == true)
+                       {
+                               __pAddressbarUrlField->SetKeypadActionEnabled(false);
+                               GetParent()->GetParent()->Invalidate(true);
+                       }
+               }
+               else
+               {
+                       if(__pAddressbarUrlField->IsKeypadActionEnabled() == false)
+                       {
+                               __pAddressbarUrlField->SetKeypadActionEnabled(true);
+                               GetParent()->GetParent()->Invalidate(true);
+                       }
+               }
+       }
+
+}
+
+void
 Addressbar::SetAddressbarURLFocus()
 {
        __pAddressbarUrlField->SetFocus();