using namespace Tizen::Web;
using namespace Tizen::Web::Controls;
+static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
+static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
+static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
+static const wchar_t* IDS_APPID = L"AppID";
+static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
+static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
const int IDA_BACKBTN_CLICKED = 101;
const int IDA_BOOKMARKBTN_CLICKED = 102;
const int IDA_SMALLFONT_BTN_CLICKED = 113;
const int IDA_LARGEFONT_BTN_CLICKED = 114;
const int IDA_BRIGHTNESS_BTN_CLICKED = 115;
+const int IDA_HISTORY_CLICKED = 116;
+const int IDA_ADD_TO_BOOKMARKBTN_CLICKED = 117;
+const int IDA_ADD_TO_HOME_CLICKED = 118;
+const int IDA_SAVED_PAGES_CLICKED = 119;
+const int IDA_DESKTOP_VIEW_CLICKED = 120;
+const int IDA_SAVE_CLICKED = 121;
+
const int IDA_FINDWORD_SEARCH_CLICKED = 201;
const int IDA_FINDWORD_NEXT_CLICKED = 202;
const int IDA_FINDWORD_PREV_CLICKED = 203;
const int IDA_PASTE_TEXT_CLICKED = 211;
const int IDA_FIND_TEXT__CLICKED = 212;
const int IDA_SHARE_TEXT_CLICKED = 213;
+
+const int IDA_GO_BACK = 214;
+const int IDA_GO_FORWARD = 215;
+const int IDA_REFRESH_BTN_CLICKED = 216;
+const int IDA_STOP_BTN_CLICKED = 217;
+const int IDA_CLEAR_URL = 218;
+
const int DEFAULT_PROGRESS_PERCENTAGE = 10;
const int MainForm::IDA_FORMAT_BITMAP = 500;
const int MainForm::IDA_FORMAT_URL_STRING = 503;
const int MainForm::IDA_CONTEXT_ITEM_DELETE = 504;
+static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
+static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
+static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
+
MainForm::MainForm(void)
{
+ __isLongPressedDone = false;
__pAddressbar = null;
// __pMostVisitedSitesPanel = null;
__pMostVisitedListView = null;
__pFindWordPrev = null;
__previousZoomLevel = 1.0;
__pSaveImage = null;
+ __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
+ __displayUrl = L"";
+ __editTextUrl = L"";
__currentSearchStr = L"";
__currentSelectedStr = L"";
__maxOccurrances = 0;
__distanceMoved = 0;
__isLoaded = false;
__inputEventToBeSupressed = false;
+ __isLoadingData = false;
+ __isLoadingCompleted = false;
+ __progressPercentage = 0;
__touchPoint1 = Point(-1,-1);
__touchPoint2 = Point(-1,-1);
__pWebReader = null;
__pReaderData = null;
__pPopUp = null;
__pReaderCloseBtn = null;
- __pNewWindowButton = null;
+ //__pNewWindowButton = null;
__pMoreButton = null;
__pMultiWindowButton = null;
__pArticleReaderPanel = null;
__prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
__curAddressBarMode = ADDRESSBAR_MODE_INVALID;
__pMostVisitedSites = null;
+ __pFooterUrlField = null;
+ __pGoBackBtn = null;
+ __pGoForwardBtn = null;
+ __pRefreshBtn = null;
+ __pProgressbarLabel = null;
+ __pFooterLabel = null;
+ __pStopBtn = null;
+ __pClearBtn = null;
}
MainForm::~MainForm(void)
delete __pPopUp;
__pPopUp = null;
}
+
+ if (__pHitElementResult != null)
+ {
+ delete __pHitElementResult;
+ __pHitElementResult = null;
+ }
String* pSelectedScene = NULL;
Object* pValue = NULL;
MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
result
MainForm::OnInitializing(void)
{
+ AppLog("get client area width = %d",GetClientAreaBounds().width);
+ AppLog("get client area height = %d",GetClientAreaBounds().height);
const int WIDTH_CONTEXT_MENU_BUTTON = 336;
const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
delete pBitmapPressed;
}
+ __pItemContextLandscape= new(std::nothrow) ListContextItem();
+ __pItemContextLandscape->Construct();
+ pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE,HEIGHT_CONTEXT_MENU_BUTTON);
+ pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE, HEIGHT_CONTEXT_MENU_BUTTON);
+
+ if (pBitmapNormal != null && pBitmapPressed != null)
+ {
+ __pItemContextLandscape->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed);
+ }
+
+ if (pBitmapNormal != null)
+ {
+ delete pBitmapNormal;
+ }
+
+ if (pBitmapPressed != null)
+ {
+ delete pBitmapPressed;
+ }
+
return E_SUCCESS;
}
if (__pAddressbar == null || __pFooterPanel == null)
return E_FAILURE;
- const int Y_WEBCONTROL_POSITION = __pAddressbar->GetY() + __pAddressbar->GetHeight() - 12;
+ const int Y_WEBCONTROL_POSITION = 0;
__webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
if (__pMostVisitedListView)
{
__pWebViewer->SetTextSearchListener(this);
}
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
AppLogDebug("MainForm :before return");
Invalidate(true);
AppLogDebug("MainForm::InitWebControl Exit");
SetControlAlwaysOnTop(*__pFooterPanel, true);
- __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
-
- if ( __pMultiWindowButton == NULL )
+ __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
+ if ( __pFooterLabel == NULL )
{
return E_FAILURE;
}
-
- pBackButton = static_cast< Button* >(GetControl(L"IDC_PAGEBACK_BUTTON", true));
-
- if ( pBackButton == NULL )
+ //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
+ if (pBitmap != null)
{
- return E_FAILURE;
+ __pFooterLabel->SetBackgroundBitmap(*pBitmap);
+ delete pBitmap;
}
- pBookmarkButton = static_cast< Button* >(GetControl(L"IDC_BOOKMARK_BUTTON", true));
+ __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
- if ( pBookmarkButton == NULL )
+ if ( __pMultiWindowButton == NULL )
{
return E_FAILURE;
}
return E_FAILURE;
}
- __pNewWindowButton = static_cast< Button* >(GetControl(L"IDC_NEW_WINDOW",true));
-
- if ( __pNewWindowButton == NULL )
- {
- return E_FAILURE;
- }
-
if (__pMultiWindowButton != null)
{
Bitmap* pBitmap = null;
__pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
}
-
- if (pBackButton)
- {
- Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK);
- Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BTN_BACK_PRESS);
- if (pBitmap != null)
- {
- // pBitmap->Scale(Dimension(56,56));
-
- Point startPoint((pBackButton->GetWidth() - pBitmap->GetWidth())/2,(pBackButton->GetHeight() - pBitmap->GetHeight())/2 );
- AppLog("startPoint %d,%d pBitmap width height %d %d",startPoint.x,startPoint.y,pBitmap->GetWidth(),pBitmap->GetHeight());
- pBackButton->SetNormalBitmap(startPoint, *pBitmap);
- pBackButton->SetPressedBitmap(startPoint, *pPressedBitmap);
- delete pBitmap;
- }
- pBackButton->AddActionEventListener(*this);
- pBackButton->SetActionId(IDA_BACKBTN_CLICKED);
- }
-
- if (pBookmarkButton)
- {
- Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK);
- Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_BOOKMARK_PRESS);
- if (pBitmap != null)
- {
- Point startPoint((pBookmarkButton->GetWidth() - pBitmap->GetWidth())/2,(pBookmarkButton->GetHeight() - pBitmap->GetHeight())/2 );
- pBookmarkButton->SetNormalBitmap(startPoint, *pBitmap);
- pBookmarkButton->SetPressedBitmap(startPoint, *pPressedBitmap);
- delete pBitmap;
- }
- pBookmarkButton->AddActionEventListener(*this);
- pBookmarkButton->SetActionId(IDA_BOOKMARKBTN_CLICKED);
- }
-
if (__pMoreButton)
{
Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
}
__pMoreButton->AddActionEventListener(*this);
__pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
+ }
+ //Add the editfield for url
+ __pFooterUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
+ if (__pFooterUrlField == NULL)
+ {
+ return E_INVALID_KEY;
}
+ __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
+ __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
+ //__pFooterUrlField->AddFocusEventListener(*this);
+ __pFooterUrlField->AddKeypadEventListener(*this);
- if (__pNewWindowButton)
+ if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
{
- Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW);
- Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS);
- if (pBitmap != null)
- {
- Point startPoint((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 );
- __pNewWindowButton->SetNormalBitmap(startPoint, *pBitmap);
- __pNewWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
- delete pBitmap;
- }
- __pNewWindowButton->AddActionEventListener(*this);
- __pNewWindowButton->SetActionId(IDA_NEWWINDOWBTN_CLICKED);
- __pNewWindowButton->SetEnabled(true);
- // __pNewWindowButton->Invalidate(true);
+ __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
+ }
+ else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ {
+ __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"));
+ }
+ else
+ {
+ //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
+ __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
}
- AppLog("checkingwindow count %d",MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount());
+ //Add the go Back Button
+ __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
+ if (__pGoBackBtn == NULL)
+ {
+ AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
+ return E_INVALID_KEY;
+ }
+ __pGoBackBtn->SetActionId(IDA_GO_BACK);
+ __pGoBackBtn->AddActionEventListener(*this);
- if (__pNewWindowButton != null && MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount() >= 9)
+ //Add the go forward Button
+ __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
+ if (__pGoForwardBtn == NULL)
{
- Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTROLBAR_ICON_CREATE_DISABLE);
- if (pBitmap != null)
- {
- Point startPoint = Point((__pNewWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pNewWindowButton->GetHeight() - pBitmap->GetHeight())/2 );
- __pNewWindowButton->SetDisabledBitmap(startPoint,*pBitmap);
- delete pBitmap;
- }
- __pNewWindowButton->SetEnabled(false);
+ AppLogDebug("Control not found returning E_INVALID_KEY");
+ return E_INVALID_KEY;
+ }
+ __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
+ __pGoForwardBtn->AddActionEventListener(*this);
+ __pGoForwardBtn->SetEnabled(false);
+
+ __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 backround label for displaying progressbar
+ __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
+ if (__pProgressbarLabel == NULL)
+ {
+ AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
+ return E_INVALID_KEY;
}
+ __pProgressbarLabel->SetShowState(false);
+
+ __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
+ if (__pStopBtn == NULL)
+ {
+ AppLogDebug("Control not found returning E_INVALID_KEY");
+ return E_INVALID_KEY;
+ }
+ __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
+ __pStopBtn->AddActionEventListener(*this);
+ __pStopBtn->SetShowState(false);
+
+ __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
+ if (__pClearBtn == NULL)
+ {
+ AppLogDebug("Control not found returning E_INVALID_KEY");
+ return E_INVALID_KEY;
+ }
+ __pClearBtn->SetActionId(IDA_CLEAR_URL);
+ __pClearBtn->AddActionEventListener(*this);
+ __pClearBtn->SetShowState(false);
// __pFooterPanel->Invalidate(true);
AppLogDebug("MainForm::InitFooter exit");
pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
}
+ r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
+
if ( pBitmap != NULL)
{
__pMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY"), IDA_PRIVATEON_CLICKED,*pBitmap);
delete pBitmap;
}
+ r = __pMenu->AddItem(L"History"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_HISTORY_CLICKED);
r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
r = __pMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
- __pMenu->SetMaxVisibleItemsCount(3);
+
+
+ __pMenu->SetMaxVisibleItemsCount(6);
__pMenu->SetShowState(false);
__pMenu->AddActionEventListener(*this);
SetControlAlwaysOnTop(*__pMenu, true);
result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
{
result r = E_SUCCESS;
+ ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
AppLog("MainForm::InitImageContextMenu clicked on image");
if (__pImageMenu != null)
}
p.y = p.y + __pAddressbar->GetHeight() + 12;
+ if(p.y < 100)
+ {
+ direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
+ }
+ else
+ {
+ direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
+ }
__pImageMenu = new (std::nothrow) ContextMenu();
- r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST);
+ r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
result MainForm::InitSelectTextContextMenu(Tizen::Graphics::Point p, bool pasteOption, bool onlyPasteOption = false)
{
result r = E_SUCCESS;
+ ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
AppLog("MainForm::InitSelectTextContextMenu clicked on text");
if (__pImageMenu != null)
__pImageMenu = null;
}
p.y = p.y + __pAddressbar->GetHeight() + 12;
+ if(p.y < 100)
+ {
+ direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
+ }
+ else
+ {
+ direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
+ }
__pImageMenu = new (std::nothrow) ContextMenu();
- r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID);
+ r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
if(onlyPasteOption == false)
AppLogDebug("Findword panel already initialized");
if (__pFindWordBgLabel != null)
{
- Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
if (pBitmap != null)
{
- AppLogDebug("InitFindWordPanel: Coming here");
__pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
delete pBitmap;
}
AppLogException("There is some problem in the xml file. Please check.");
return E_FAILURE;
}
- __pFindWordPanel->AddControl(*__pFindWordControl);
+ AddControl(*__pFindWordControl);
__pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight());
- SetControlAlwaysOnTop(*__pFindWordPanel,true);
+ SetControlAlwaysOnTop(*__pFindWordControl,true);
__pFindWordPanel->SetShowState(false);
__pFindWordPanel->Invalidate(false);
return NULL;
}
- if (pHistory->GetFaviconId().GetLength() > 0)
- {
- String bitmapId = pHistory->GetFaviconId();
- Bitmap* pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId);
- if ( pBitmap != NULL)
- {
- pListIconImage = new Bitmap();
- pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
- delete pBitmap;
- }
+ Bitmap* pBitmap = pHistory->GetFavIconBitmap();
+
+ if ( pBitmap != NULL)
+ {
+ pListIconImage = new Bitmap();
+ pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
+ delete pBitmap;
}
if(pListIconImage == null)
}
- if ( __pItemContext!= NULL)
+ if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
{
- if (pItem != null)
+ if ( __pItemContext!= NULL)
+ {
+ if (pItem != null)
+ {
+ pItem->SetContextItem(__pItemContext);
+ }
+ }
+ }
+ else
+ {
+ if ( __pItemContextLandscape!= NULL)
{
- pItem->SetContextItem(__pItemContext);
+ if (pItem != null)
+ {
+ pItem->SetContextItem(__pItemContextLandscape);
+ }
}
}
if( pListIconImage != NULL)
MainForm::OnTerminating(void)
{
result r = E_SUCCESS;
+ if(__pItemContext)
+ {
+ delete __pItemContext;
+ }
+ if(__pItemContextLandscape)
+ {
+ delete __pItemContextLandscape;
+ }
return r;
}
__pMenu->SetShowState(false);
__pMenu->Invalidate(false);
- __adressPanelPosition.y = 0;
-
- if (__pAddressbar != null && __pWebViewer != NULL)
+ __pFindWordEditField->SetFocus();
+ /*
+ if (__pWebViewer != null)
{
- __webControlPosition.y = __pAddressbar->GetHeight() - 12;
- __pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
- __pAddressbar->Invalidate(true);
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
- __pWebViewer->Invalidate(true);
+ // releasing the set block
+ __pWebViewer->ReleaseBlock();
}
-
+ */
ShowFindWordPanel(true);
}
break;
pBookmark->SetBookmarkTitle(title);
pBookmark->SetUrl(url);
+ if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
+ {
+ pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
+ }
String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
pBookmark->SetFaviconId(id);
- r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
+ //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
+ r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
delete pBookmark;
NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
- if(pNotification != null)
+ if (pNotification != null)
{
pNotification->SetText(message);
pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
}
if (pBitmap != null)
{
- r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+ r = __pMenu->SetItemAt(0,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
delete pBitmap;
}
}
}
break;
case IDA_BOOKMARKBTN_CLICKED:
-
+ {
AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
- break;
+ }
+ break;
+ case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
+ {
+ }
+ break;
case IDA_MOREBTN_CLICKED:
{
AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 1");
Point p = Point(__pMoreButton->GetX() + __pMoreButton->GetWidth() / 2, GetClientAreaBounds().y + GetClientAreaBounds().height - __pMoreButton->GetHeight());
AppLog("Anchot pos: %d %d", p.x, p.y);
InitContextMenu(p);
- if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
+ if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
{
AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 2");
int bookmarkCount=0;
}
AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
- if (__pMenu->GetItemCount() == 6)
+ if (__pMenu->GetItemCount() == 9)
{
- r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+ r = __pMenu->SetItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
}
else
{
- r = __pMenu->InsertItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
+ r = __pMenu->InsertItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK")*/, IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
}
if (IsFailed(r))
return ;
}
AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
- if (__pMenu->GetItemCount() != 6)
+ if (__pMenu->GetItemCount() != 8)
{
- __pMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
- __pMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
+ __pMenu->InsertItemAt(1,L"Add to Bookmarks"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADDTOBOOKMARK_CLICKED);
+
+// __pMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
+ __pMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
+ __pMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
__pMenu->SetMaxVisibleItemsCount(6);
}
if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
__pMenu->Invalidate(true);
__pMenu->Show();
}
+ break;
+ case IDA_HISTORY_CLICKED:
+ {
+ AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
+ SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+ }
+ break;
+ case IDA_SAVED_PAGES_CLICKED:
+ {
+
+ }
+ break;
+ case IDA_DESKTOP_VIEW_CLICKED:
+ {
+ }
break;
+ case IDA_SAVE_CLICKED:
+ {
+ }
+ break;
case IDA_MULTIWINDOWBTN_CLICKED:
{
result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
__pBlankPanel = null;
__pArticleReaderLabel = null;
}
- if (__pAddressbar)
- __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ //if (__pAddressbar)
+ // __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
}
break;
case IDA_FINDWORD_CANCEL_CLICKED:
__currentSearchStr = L"";
__currentWordIndex = 0;
__maxOccurrances = 0;
- __pFindWordCountLabel->SetText(L" ");
__pFindWordEditField->SetText(L"");
__pFindWordNext->SetEnabled(false);
__pFindWordPrev->SetEnabled(false);
- __pFindWordCountLabel->SetShowState(false);
+ __pFindWordCountLabel->SetText(L"0/0");
__pWebViewer->SearchText(L"aaaabbbbcccc",true);
ShowFindWordPanel(false);
}
break;
case IDA_FINDWORD_CLEAR_CLICKED:
{
- __pFindWordCountLabel->SetText(L"");
- __pFindWordCountLabel->SetShowState(false);
+ __pFindWordCountLabel->SetText(L"0/0");
__pFindWordEditField->SetText(L"");
+ __currentSearchStr = L"aaaaaabbbbbbccccccc";
+ StartWordSearch();
+ __currentSearchStr = L"";
__pFindWordNext->SetEnabled(false);
__pFindWordPrev->SetEnabled(false);
__pFindWordPanel->Invalidate(true);
if (__pAddressbar != null && __pWebViewer != NULL)
{
__webControlPosition.y = __pAddressbar->GetHeight() - 12;
- __pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
- __pAddressbar->Invalidate(true);
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
+ //__pAddressbar->SetBounds(0,__adressPanelPosition.y,GetClientAreaBounds().width,__pAddressbar->GetHeight());
+ //__pAddressbar->Invalidate(true);
+ __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
+
+ if (__pFooterPanel->GetShowState() == false)
+ __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
+ else
+ __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
+ // __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,__webControlHeight));
__pWebViewer->Invalidate(true);
}
AppLogDebug("Enter something");
}
+ if (__pWebViewer != null)
+ {
+ // releasing the set block
+ __pWebViewer->ReleaseBlock();
+ }
+
}
break;
case IDA_SHARE_TEXT_CLICKED:
if (pString != null)
{
String idElement = __pHitElementResult->GetAttributeValue(L"id");
+ String nameElement = __pHitElementResult->GetAttributeValue(L"name");
AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
- String script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } insertAtCursor(";
- script.Append(idElement);
- script.Append(",");
- script.Append("\"");
- script.Append(*pString);
- script.Append("\");");
+ String script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
+ if(idElement.GetLength() != 0)
+ {
+ script.Append("insertAtCursor(");
+ script.Append(idElement);
+ script.Append(",");
+ script.Append("\"");
+ script.Append(*pString);
+ script.Append("\");");
+ }
+ else if (nameElement.GetLength() != 0)
+ {
+ script.Append("insertAtCursor(document.getElementsByName('");
+ script.Append(nameElement);
+ script.Append("')[0],");
+ script.Append("\"");
+ script.Append(*pString);
+ script.Append("\");");
+ }
AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
String* pStr = __pWebViewer->EvaluateJavascriptN(script);
delete pStr;
delete pItem;
}
break;
+ case IDA_GO_BACK:
+ {
+ OnBackClicked();
+ }
+ break;
+ case IDA_GO_FORWARD:
+ {
+ OnForwardClicked();
+ }
+ break;
+ case IDA_REFRESH_BTN_CLICKED:
+ {
+ __isLoadingCompleted = false;
+ __isLoadingData = true;
+ __progressPercentage = 0;
+ __displayUrl = __pFooterUrlField->GetText();
+
+ String url = __pFooterUrlField->GetText();
+ AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
+ LoadUrl(url);
+
+ //OnUrlSubmitted();
+ UpdateProgressBitmap();
+ }
+ break;
+ case IDA_STOP_BTN_CLICKED:
+ {
+ __isLoadingCompleted = false;
+ __isLoadingData = false;
+ __progressPercentage = 0;
+ __pFooterUrlField->HideKeypad();
+ __displayUrl = __pFooterUrlField->GetText();
+
+ if (__pWebViewer)
+ {
+ //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ __pWebViewer->StopLoading();
+ RequestRedraw(true);
+ }
+
+ UpdateProgressBitmap();
+ }
+ break;
+ case IDA_CLEAR_URL:
+ {
+ if (__pFooterUrlField->GetText().IsEmpty() == false)
+ {
+ //__displayUrl = __pUrlField->GetText();
+ __pFooterUrlField->Clear();
+ }
+ }
+ break;
default:
break;
}
if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
{
__pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
+ if(__pWindowInfo == null)
+ return;
// if(__pWindowInfo == null)
{
pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
InitFooter();
InitAddressbar();
+ // hiding the address bar
+ // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
+ __pAddressbar->SetShowState(false);
if(__pWebViewer != null)
{
__pWebViewer->Resume();
String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
- if(homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
{
InitMostVisitedSitesView(GetOrientationStatus());
}
if (pBookmarkUrl == null)
return;
AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
- __pAddressbar->SetUrl(*pBookmarkUrl);
+ //__pAddressbar->SetUrl(*pBookmarkUrl);
+ SetUrl(*pBookmarkUrl);
- if (__pWebViewer != null && homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE")) != 0)
+ if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
__pWebViewer->LoadUrl(*pBookmarkUrl);
delete pBookmarkUrl;
}
if (__pAddressbar != null)
{
- __pAddressbar->UpdateFaviconBitmap(true);
+ // __pAddressbar->UpdateFaviconBitmap(true);
}
}
if (__pAddressbar != null)
{
- __pAddressbar->UpdateFaviconBitmap(false);
+ // __pAddressbar->UpdateFaviconBitmap(false);
}
}
{
return;
}
+ String url = __pWebViewer->GetUrl();
+ if(url.Contains(IDS_TIZEN_SERVICE))
+ {
+ String appId;
+ String delim(L":;");
+
+ // Creates a StringTokenizer instance
+ StringTokenizer strTok(url, delim);
+
+ int count = strTok.GetTokenCount(); // count == 4
+
+ HashMap *pMap = new HashMap();
+ pMap->Construct();
+ String token;
+ String key;
+ String value;
+ while (strTok.HasMoreTokens())
+ {
+ AppLog("Token: %ls", token.GetPointer());
+ strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
+ if(token.Contains(IDS_APPID))
+ {
+ token.SubString(6, appId);
+ AppLog("AppID:%ls", appId.GetPointer());
+ }
+ else if(token.Contains("="))
+ {
+ String *pKey = new String();
+ String *pValue = new String();
+ int index = -1;
+ token.IndexOf("=", 0, index);
+ if(index != -1)
+ {
+ token.SubString(0, index, *pKey);
+ token.SubString(index + 1, *pValue);
+ pMap->Add(pKey, pValue);
+ }
+ }
+ }
+ if(appId != "")
+ {
+ AppControl *pAppControl = null;
+ String operationId = L"http://tizen.org/appcontrol/operation/main";
+ pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
+ if(pAppControl)
+ {
+ AppLog("Starting AppControl");
+ result r = pAppControl->Start(null, null, pMap, null);
+ AppLog("Result of Start %s", GetErrorMessage(r));
+ }
+ else
+ {
+ AppLogException("AppControl not found");
+ }
+ return;
+ }
+ }
Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
- __pAddressbar->SetFaviconBitmap(*pBitmap);
+ if(pBitmap != null)
+ {
+ __pAddressbar->SetFaviconBitmap(*pBitmap);
+ }
delete pBitmap;
if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
{
MoveUiControls();
}
- __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+ //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
if (__pWebViewer)
{
AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
- __pAddressbar->SetUrl(__pWebViewer->GetUrl());
+ //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
+ SetUrl(__pWebViewer->GetUrl());
if (__pWindowInfo != NULL)
{
__pWindowInfo->pageUrl = __pWebViewer->GetUrl();
void
MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
{
+ AppLog("MainForm::OnKeypadWillOpen");
+ if (__pAddressbar != null)
+ {
+ OnAddressBarKeypadWillOpen(*__pAddressbar);
+ }
+
+}
+
+void
+MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
+{
if(__pAddressbar != null)
{
OnAddressBarKeypadOpened(*__pAddressbar);
}
}
+
void
-MainForm::OnKeypadClosed(Tizen::Ui::Control& source){
- if(__pAddressbar != null)
+MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
+{
+ if (__pAddressbar != null)
{
OnAddressBarKeypadClosed(*__pAddressbar);
}
}
void
+MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
+{
+ AppLog("KeypadBoundsChanged");
+ RelayoutControls(false);
+}
+
+void
MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
const Tizen::Base::String& reason)
{
void
MainForm::OnLoadingCompleted(void)
{
+ AppLog("MainForm::OnLoadingCompleted start");
DateTime date;
result r = E_SUCCESS;
}
if (__pWebViewer->CanGoForward())
{
- __pAddressbar->SetForwardButtonEnabled(true);
+ //__pAddressbar->SetForwardButtonEnabled(true);
+ SetForwardButtonEnabled(true);
}
else
{
- __pAddressbar->SetForwardButtonEnabled(false);
+ //__pAddressbar->SetForwardButtonEnabled(false);
+ SetForwardButtonEnabled(false);
}
- if (__pWebViewer->CanGoBack())
- {
- __pAddressbar->SetBackButtonEnabled(true);
- }
- else
- {
- __pAddressbar->SetBackButtonEnabled(false);
- }
- if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
+ /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
{
__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
- __pAddressbar->UpdateProgress(0);
+ //__pAddressbar->UpdateProgress(0);
+ UpdateProgress(0);
+ }*/
+
+ if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
+ {
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ UpdateProgress(0);
}
AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
}
pHistory->SetVisitedTime(date);
- String id = "";
+ /*String id = "";
if(__pWindowInfo)
id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
- pHistory->SetFaviconId(id);
+ pHistory->SetFaviconId(id);*/
+
+ if (__pWebViewer != null)
+ {
+ AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
+
+ Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
+ if (pTempBitmap != null)
+ {
+ AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
+ pHistory->SetFavIconBitmap(*pTempBitmap);
+ }
+
+ AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
+ }
+
Canvas* pCanvas = __pWebViewer->GetCanvasN();
Bitmap* pBitmap = new(std::nothrow) Bitmap();
if ( pCanvas != null && pCanvas != null && pBitmap != null)
pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
pHistory->SetThumbnail(pBitmap);
}
- HistoryPresentationModel::GetInstance()->SaveHistory(*pHistory);
- delete pHistory;
- }
+ Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
+ if(pFavIcon)
+ {
+ pHistory->SetFavIconBitmap(*pFavIcon);
+ delete pFavIcon;
+ }
+
+ HistoryPresentationModel::GetInstance()->SaveTempHistory(*pHistory);
+ delete pHistory;
+ }
else
{
return;
// temperary fixed (webpage can be not loaded)
UpdateFavicon();
}
+ AppLog("MainForm::OnLoadingCompleted done");
}
void
AppLogDebug("MainForm::OnEstimatedProgress entered");
if (progress < DEFAULT_PROGRESS_PERCENTAGE)
progress = DEFAULT_PROGRESS_PERCENTAGE;
- if(__pAddressbar)
- __pAddressbar->UpdateProgress(progress);
+ //if(__pAddressbar)
+ // __pAddressbar->UpdateProgress(progress);
+ UpdateProgress(progress);
+}
+
+void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
+{
+ AppLog("MainForm::OnFaviconReceived");
+ Bitmap* pFavIconBitmap = __pWebViewer->GetFaviconN();
+
+ if (pFavIconBitmap != null)
+ {
+ pFavIconBitmap->GetWidth();
+ pFavIconBitmap->GetHeight();
+ }
+}
+
+void
+MainForm::OnUrlValueChanged(Addressbar&)
+{
+ Invalidate(true);
}
void
MainForm::OnUrlSubmitted(Addressbar& addBar)
{
+ AppLog("MainForm::OnUrlSubmitted");
String url = addBar.GetUrl();
- LoadUrl(url);
+ AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
+
__pFooterPanel->SetShowState(true);
- __pFooterPanel->Invalidate(true);
- RequestRedraw(true);
+// __pAddressbar->SetShowState(false);
+// RelayoutControls(false);
+ LoadUrl(url);
}
void
MainForm::LoadUrl(String& url)
{
+ String encodedUrl;
+// UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
AppLogDebug("MainForm::LoadUrl enter");
+ if (__pWebViewer != null)
+ {
+ __pWebViewer->SetShowState(true);
+ __pWebViewer->Invalidate(true);
+ }
+
if (url.CompareTo(L"") == 0)
{
return;
}
else
{
- __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(url));
+ UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+ __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
}
}
if (__pAddressbar != null)
{
- __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+ //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
}
AppLogDebug("MainForm::LoadUrl exit");
AppLogDebug("MainForm::OnStopClicked called");
if (__pWebViewer)
{
- __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
__pWebViewer->StopLoading();
RequestRedraw(true);
}
}
void
-MainForm::OnBackClicked(const Addressbar& addBar)
+MainForm::OnBackClicked(/*const Addressbar& addBar*/)
{
- if (__pWebViewer == null)
- return;
+ AppLog("MainForm::OnBackClicked");
+ result r = E_FAILURE;
- if (__pWebViewer->CanGoBack())
+ if (__pWebViewer != null && __pWebViewer->CanGoBack())
{
__pWebViewer->GoBack();
}
-
+ else
+ {
+ UiApp* pApp = null;
+ pApp = UiApp::GetInstance();
+ if(pApp != null)
+ {
+ r = pApp->Terminate();
+ if (IsFailed(r))
+ {
+ return;
+ }
+ }
+ }
}
void
-MainForm::OnForwardClicked(const Addressbar& addBar)
+MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
{
+ AppLog("MainForm::OnForwardClicked");
if (__pWebViewer == null)
return;
void
MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
{
+ result r = E_SUCCESS;
+ // hiding the address bar
+ __pAddressbar->SetShowState(false);
__pFooterPanel->SetShowState(true);
- __pFooterPanel->Invalidate(false);
+ RelayoutControls(false);
}
void
-MainForm::OnAddressBarModeChanged(const Addressbar& addBar)
+MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
{
__prevAddressBarMode = __curAddressBarMode;
if (__pAddressbar != null)
{
- __curAddressBarMode = __pAddressbar->GetAddressbarMode();
+ __curAddressBarMode = GetAddressbarMode();
}
if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
if (__pWebViewer != null)
{
__pWebViewer->StopLoading();
-
}
-
}
- if (__pWebViewer != null)
+ else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
{
- if(__pFooterPanel->GetShowState() == false)
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
- else
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
- __pWebViewer->Invalidate(true);
+ __adressPanelPosition.y = 0;
+ if (__pAddressbar != null)
+ {
+ __webControlPosition.y = 0;
+ __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
+ __pAddressbar->Invalidate(true);
+ }
}
}
void
-MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
{
+ __pFooterPanel->SetShowState(true);
+ RelayoutControls(false);
+}
- if(__pFooterPanel != null)
+void
+MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
+{
+ if (__pFindWordControl && __pFindWordControl->GetShowState() == true)
{
- String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
- if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
- {
- InitMostVisitedSitesView(GetOrientationStatus());
- }
- __pFooterPanel->SetShowState(true);
- __pFooterPanel->Invalidate(false);
+ __pAddressbar->SetShowState(false);
}
-
-
-
- //AppLogDebug("MainForm::OnAddressBarKeypadClosed enterd");
-
- if (__pWebViewer != null && __pFooterPanel != null)
+ else
{
- AppLog("MainForm::OnAddressBarKeypadClosed GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
- __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-
- if(__pFooterPanel->GetShowState() == false)
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
- else
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
- __pWebViewer->Invalidate(false);
- //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
+ if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
+ {
+ __pAddressbar->SetShowState(true);
+ __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
+ __pAddressbar->SetAddressbarURLFocus();
+ }
}
+ RelayoutControls(false);
}
void
-MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
{
__pFooterPanel->SetShowState(false);
- __pFooterPanel->Invalidate(false);
}
void
-MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
+MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
{
- __pFooterPanel->SetShowState(false);
- __pFooterPanel->Invalidate(false);
+ AppLog("KeypadBoundsChanged");
+ RelayoutControls(false);
}
void
}
if (__pAddressbar != null && __pWebViewer != null)
{
- __pAddressbar->SetUrl(__pWebViewer->GetUrl());
- __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn());
+ SetUrl(__pWebViewer->GetUrl());
__pAddressbar->Invalidate(true);
}
-
}
void
{
if (__pWindowInfo->pFavicon != NULL)
{
- // delete __pWindowInfo->pFavicon;
__pWindowInfo->pFavicon = null;
}
__pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
__pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
- //bool isPrivateBrowsing = __pWebViewer->IsPrivateBrowsingEnabled();
__pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
}
else
{
- __pAddressbar->SetFaviconBitmap(*FaviconManager::GetInstance()->GetDefaultFaviconN());
+ Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
+ if(pDefaultBmp != null)
+ {
+ __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
+ }
}
-
- AppLogDebug("Favicon download requested: url: %ls", url.ToString().GetPointer());
}
delete tempPath;
}
MainForm::OnLoadingRequested(const Tizen::Base::String& url,
Tizen::Web::Controls::WebNavigationType type)
{
+ // when load new page if find word panel is open its show state is false
+ ShowFindWordPanel(false);
+ AppLog("__pAddressbar->GetAddressbarURL() is %ls",__pAddressbar->GetAddressbarURL().GetPointer());
+
+ __pFooterPanel->Invalidate(true);
+
+ Uri uriInfo;
+ uriInfo.SetUri(url);
+
+ if(url.Contains(IDS_TIZEN_SERVICE))
+ {
+ String appId;
+ String delim(L":;");
+
+ // Creates a StringTokenizer instance
+ StringTokenizer strTok(url, delim);
+
+ int count = strTok.GetTokenCount(); // count == 4
+
+ HashMap *pMap = new HashMap();
+ pMap->Construct();
+
+ String token;
+ String key;
+ String value;
+ while (strTok.HasMoreTokens())
+ {
+ AppLog("Token: %ls", token.GetPointer());
+ strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
+ if(token.Contains(IDS_APPID))
+ {
+ token.SubString(6, appId);
+ AppLog("AppID:%ls", appId.GetPointer());
+ }
+ else if(token.Contains("="))
+ {
+ String *pKey = new String();
+ String *pValue = new String();
+ int index = -1;
+ token.IndexOf("=", 0, index);
+ if(index != -1)
+ {
+ token.SubString(0, index, *pKey);
+ token.SubString(index + 1, *pValue);
+ pMap->Add(pKey, pValue);
+ }
+ }
+ }
+ if(appId != "")
+ {
+ AppControl *pAppControl = null;
+ String operationId = L"http://tizen.org/appcontrol/operation/main";
+ pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
+ if(pAppControl)
+ {
+ result r = pAppControl->Start(null, null, pMap, null);
+ }
+ else
+ {
+ AppLogException("AppControl not found");
+ }
+ return true;
+ }
+ }
+
if (__pWebViewer && __pAddressbar)
{
- AppLog("__pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
+ __pAddressbar->SetShowState(false);
+ /*AppLog("__pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
__pAddressbar->SetUrl(__pWebViewer->GetUrl());
__pAddressbar->UpdateProgress(DEFAULT_PROGRESS_PERCENTAGE);
}
__pWindowInfo->pFavicon = FaviconManager::GetInstance()->GetDefaultFaviconN();
- }
+ }*/
__pAddressbar->Invalidate(true);
}
MainForm::OnWebPageBlockSelected(Tizen::Web::Controls::Web& source, Tizen::Graphics::Point& startPoint, Tizen::Graphics::Point& endPoint)
{
AppLog("MainForm::OnWebPageBlockSelected");
-
if (__pHitElementResult != null)
{
delete __pHitElementResult;
if (__pWebViewer != null)
{
AppLog("MainForm::OnWebPageBlockSelected web not null");
- __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
+ __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
}
if (__pHitElementResult == null)
String type = __pHitElementResult->GetAttributeValue("type");
__currentSelectedStr.Clear();
+ AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
__currentSelectedStr = __pWebViewer->GetTextFromBlock();
+ AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
- if ((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0)
+ if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) && __isLongPressedDone == true)
{
AppLog("MainForm::OnWebPageBlockSelected show paste option");
- InitSelectTextContextMenu(startPoint,true);
+ InitSelectTextContextMenu(endPoint,true);
__pImageMenu->SetShowState(true);
__pImageMenu->Show();
__pImageMenu->Invalidate(true);
}
- else if (__pHitElementResult->HasUrl() == true || __currentSelectedStr.GetLength() > 0)
+ else if(__isLongPressedDone == true)
{
AppLog("MainForm::OnWebPageBlockSelected no paste option");
__currentSelectedStr.Clear();
__currentSelectedStr = __pHitElementResult->GetUrl();
}
- InitSelectTextContextMenu(startPoint,false);
+ InitSelectTextContextMenu(endPoint,false);
__pImageMenu->SetShowState(true);
__pImageMenu->Show();
__pImageMenu->Invalidate(true);
AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
}
+
}
void
void
MainForm::RelayoutControls(bool showAddressbar)
{
- if (showAddressbar == false)
+ __webControlPosition.y = 0;
+ __webControlHeight = GetClientAreaBounds().height;
+ AppLog("Client area height: %d", __webControlHeight);
+
+ AppLog("Client area height: %d", __webControlHeight);
+ if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
{
- __pAddressbar->SetShowState(false);
- __pWebViewer->SetBounds(__pWebViewer->GetX(), 0, __pWebViewer->GetWidth(), __webControlHeight);
- __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+ __webControlPosition.y += __pAddressbar->GetHeight();
+ __webControlHeight -= __pAddressbar->GetHeight();
+ __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
}
- else
+ else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
{
- __pAddressbar->SetShowState(true);
- __pWebViewer->SetBounds(__pWebViewer->GetX(), __pWebViewer->GetY(), __pWebViewer->GetWidth(), __webControlHeight);
- __pFooterPanel->SetBounds(__pFooterPanel->GetX(), GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+ __webControlPosition.y += __pFindWordControl->GetHeight();
+ __webControlHeight -= __pFindWordControl->GetHeight();
+ __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
}
- RequestRedraw(true);
+
+ if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true)
+ {
+ __webControlHeight -= __pFooterPanel->GetHeight();
+ __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
+ }
+ if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
+ {
+ __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight);
+ __pWebViewer->Invalidate(false);
+ }
+ if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
+ {
+ __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
+ }
+
+ Invalidate(true);
}
void MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
{
- if (__pFindWordPanel == null)
+ if (__pFindWordControl == null)
{
return;
}
InitFindWordPanel();
__pFindWordEditField->SetText(__currentSearchStr);
//__pFindWordCountLabel->SetText(L"");
- __pFindWordCountLabel->SetShowState(false);
-
+ __pFindWordCountLabel->SetText(L"0/0");
+ __pFindWordPanel->SetShowState(true);
+ }
+ else
+ {
+ if(__pFindWordControl != null)
+ {
+ __pFindWordControl->SetShowState(false);
+ }
}
AppLog("MainForm::ShowFindWordPanel %d",show);
if (show && !isTouchPressed)
{
if (__pFindWordEditField)
+ {
+ __pFindWordEditField->SetFocus();
__pFindWordEditField->ShowKeypad();
+ }
}
else
{
__pFindWordEditField->HideKeypad();
}
- if (__pAddressbar != null)
- {
- __pAddressbar->SetShowState(!show);
- __pAddressbar->Invalidate(true);
- }
- if (__pFindWordPanel != null)
- {
- __pFindWordPanel->SetShowState(show);
- __pFindWordPanel->Invalidate(true);
- }
- Invalidate(true);
+ RelayoutControls(false);
}
void
if(totalCount == -1 || totalCount == 0)
{
- return;
+ __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),64,__pFindWordCountLabel->GetHeight());
+ __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
+// return;
+ }
+ else if(totalCount > 100)
+ {
+ __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+ __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
}
__maxOccurrances = totalCount;
AppLog("Word not found");
//Show error notification to user
__pFindWordNext->SetEnabled(false);
- __pFindWordCountLabel->SetText(L"");
+ __pFindWordCountLabel->SetText(L"0/0");
__pFindWordNext->Invalidate(false);
__pFindWordPrev->Invalidate(false);
__pFindWordCountLabel->Invalidate(false);
countStr.Append(L"/");
countStr.Append(__maxOccurrances);
__pFindWordCountLabel->SetText(countStr);
- __pFindWordCountLabel->SetShowState(true);
+ // __pFindWordCountLabel->SetShowState(true);
__pFindWordCountLabel->Invalidate(false);
//FindNextWord(true);
{
if (__pWebViewer->SearchText(__currentSearchStr, false) == true)
{
- if(__currentWordIndex > 0)
+ if(__currentWordIndex > 1)
{
__currentWordIndex--;
}
countStr.Append(L"/");
countStr.Append(__maxOccurrances);
__pFindWordCountLabel->SetText(countStr);
- __pFindWordCountLabel->SetShowState(true);
+ // __pFindWordCountLabel->SetShowState(true);
__pFindWordCountLabel->Invalidate(false);
if (__currentWordIndex >= __maxOccurrances)
{
{
__pFindWordNext->SetEnabled(true);
}
- if (__currentWordIndex <= 0)
+ if (__currentWordIndex <= 1)
{
__pFindWordPrev->SetEnabled(false);
}
void
MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
{
- OnAddressBarKeypadOpened(*__pAddressbar);
+ AppLog("MainForm::OnWebKeypadWillOpen");
+ // OnAddressBarKeypadOpened(*__pAddressbar);
}
void
if (__pWebViewer != null && __pFooterPanel != null)
{
AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
- __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-
- if(__pFooterPanel->GetShowState() == false)
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
- else
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-
- //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
+ if(__pAddressbar != null)
+ {
+ __pAddressbar->SetShowState(false);
+ }
+ if(__pFindWordControl != null)
+ {
+ __pFindWordControl->SetShowState(false);
+ }
+ __pFooterPanel->SetShowState(false);
+ __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
}
+ Invalidate(true);
}
void
MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
{
+ __pFooterPanel->SetShowState(true);
OnAddressBarKeypadClosed(*__pAddressbar);
}
AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
{
- __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
+ //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
}
delete[] pScript;
}
__pImageMenu->Show();
__pImageMenu->Invalidate(true);
}
+ __isLongPressedDone = true;
__pWebViewer->SetBlockSelectionPosition(currentPosition);
+
+
}
__inputEventToBeSupressed = true;
}
if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true)
{
__pWebViewer->ConsumeInputEvent();
+ }
+ if(pHitElement != null)
+ {
delete pHitElement;
}
__inputEventToBeSupressed = false;
void
MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
{
- int widthContextItem = 0;
- int heightContextItem = 72;
-
-
- if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
- {
- widthContextItem = 800;
- }
- else
- {
- widthContextItem = 336;
- }
+ AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
+ int widthContextItem = 0;
- if( __pItemContext != NULL)
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
+ if (pBitmap != null && __pFooterLabel != null)
{
- delete __pItemContext;
- __pItemContext = null;
-
- }
- __pItemContext= new(std::nothrow) ListContextItem();
- __pItemContext->Construct();
- Bitmap* pBitmapNormal = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete.9.png", widthContextItem,heightContextItem);
- Bitmap* pBitmapPressed = CommonUtil::GetNinepatchedBitmapN(L"00_button_sweep_delete_press.9.png", widthContextItem, heightContextItem);
-
- if (pBitmapNormal != null && pBitmapPressed != null)
- {
- __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), *pBitmapNormal, *pBitmapPressed, pBitmapPressed);
- }
-
- if (pBitmapNormal != null)
- {
- delete pBitmapNormal;
- }
-
- if (pBitmapPressed != null)
- {
- delete pBitmapPressed;
- }
-
-
- if (__pFindWordPanel != null && __pFindWordPanel->GetShowState() == true)
- {
- __pFindWordPanel->SetBounds(0,0,GetClientAreaBounds().width,__pFindWordPanel->GetHeight());
- __pFindWordControl->SetBounds(0,0, __pFindWordPanel->GetWidth(), __pFindWordPanel->GetHeight());
- __pFindWordControl->SetShowState(true);
- __pFindWordControl->Invalidate(true);
- __pFindWordPanel->SetShowState(true);
- __pFindWordPanel->Invalidate(true);
+ __pFooterLabel->SetBackgroundBitmap(*pBitmap);
+ delete pBitmap;
}
- if (__pWebViewer != null && __pFooterPanel != null)
- {
- AppLog("MainForm::OnOrientationChanged GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
- __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
-
- if(__pFooterPanel->GetShowState() == false)
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height));
- else
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
-
- //__pWebViewer->SetBounds(Rectangle(0, 82, GetClientAreaBounds().width,webControlHeight));
- }
- if (__pAddressbar != null)
- {
- __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
- __pAddressbar->SetAddressbarMode(__pAddressbar->GetAddressbarMode());
- __pAddressbar->UpdateFaviconBitmap(SettingPresentationModel::GetInstance()->GetPrivateOn());
- }
if (__pFindWordBgLabel != null)
{
- // __pFindWordBgLabel->SetSize(GetClientAreaBounds().width,GetClientAreaBounds().height);
- Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
if (pBitmap != null)
{
__pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
delete pBitmap;
}
}
- if (__pFooterPanel /*&& __pFooterPanel->GetShowState() == true*/)
+
+ if(__pMenu != null)
+ __pMenu->SetShowState(false);
+ if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+ {
+ widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
+ }
+ else
+ {
+ widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
+ }
+
+ if (__pFooterPanel)
{
AppLog("__pFooterPanel->GetShowState() is true");
InitFooter();
+ __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+ __pFooterPanel->Invalidate(true);
}
InitAddressbar();
__pMenu->Invalidate(true);
}
- if (__pFooterPanel)
- {
- __pFooterPanel->Invalidate(true);
- }
String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
- if (homePage.CompareTo(CommonUtil::GetString(L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
+ if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
{
InitMostVisitedSitesView(orientationStatus);
}
- AppLog("OnOrientationChanged 0");
+ RelayoutControls(false);
if (__pArticleReaderPanel != null)
{
-
if (__pArticleReaderPanel->GetShowState() == true)
{
__pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
}
}
Invalidate(true);
- if(__pAddressbar != null)
+
+ if (__pAddressbar != null)
{
- __pAddressbar->OrientationChanged();
+ int width = GetClientAreaBounds().width;
+ __pAddressbar->OrientationChanged(width);
}
}
AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState());
ShowFindWordPanel(__pFindWordPanel->GetShowState(), true);
}
-
- if (__pFindWordEditField != null)
- {
-// __pWebViewer->SearchText(L"aaaabbbbcccc",true);
-// __pFindWordEditField->HideKeypad();
- }
+ __isLongPressedDone = false;
Touch touch;
IList* pList = null;
TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
__touchPoint1 = pTouchInfo->position;
- if (__pAddressbar != null)
+ /*if (__pAddressbar != null)
{
if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
{
}
__pAddressbar->Invalidate(true);
+ }*/
+ if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
+ {
+ if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
+ {
+ //__pAddressbar->SaveAddressbarEditText();
+ }
+ SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
}
}
else if (count == 2)
void
MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
{
- AppLog("Start MainForm::OnTouchMoved MoveUiControls");
- if(__pFindWordPanel)
- {
- AppLog("MainForm::OnTouchPressed %d",__pFindWordPanel->GetShowState());
- ShowFindWordPanel(__pFindWordPanel->GetShowState(), true);
- }
-
- if (__pFindWordEditField != null)
- {
- __pFindWordEditField->HideKeypad();
- }
-
- if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
- {
- return;
- }
- static int Count=0;
- Touch touch;
- IList* pList = null;
- pList = touch.GetTouchInfoListN(source);
-
- if (pList != null)
- {
- int count = pList->GetCount();
- if (count == 1)
- {
- AppLogDebug("MainForm::OnTouchMoved count 1");
- TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
-
- if( pTouchInfo == NULL )
- {
- return;
- }
- pTouchInfo->position.y += __pWebViewer->GetY();
- AppLog("MainForm::OnTouchMoved MoveUiControls %d,%d",pTouchInfo->position.x,pTouchInfo->position.y);
-
- if (__isLoaded == false)
- return;
-
- __distanceMoved = pTouchInfo->position.y - __touchPoint1.y;
- __touchPoint1 = pTouchInfo->position;
-
- // move the address bar and web control according to distance moved
- MoveUiControls();
- }
- else if (count == 2)
- {
- AppLogDebug("MainForm::OnTouchMoved count 2");
-
- if(Count == 10)
- {
- TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
-
- if( pTouchInfo == NULL )
- {
- return;
- }
- Point firstPoint = pTouchInfo->position;
-
- pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
- if( pTouchInfo == NULL )
- {
- return;
- }
- Point secondPoint = pTouchInfo->position;
-
- if (__touchPoint1 == Point(-1,-1) || __touchPoint2 == Point(-1,-1))
- {
- __touchPoint1 = firstPoint;
- __touchPoint2 = secondPoint;
- delete pList;
- return;
- }
-
- int currX1 = firstPoint.x;
- int currY1 = firstPoint.y;
- int currX2 = secondPoint.x;
- int currY2 = secondPoint.y;
-
- double prevDist = findDistance(__touchPoint1.x,__touchPoint1.y,__touchPoint2.x,__touchPoint2.y);
- double dist = findDistance(currX1, currY1, currX2, currY2);
- __distanceMoved = prevDist - dist;
-
- __touchPoint1 = firstPoint;
- __touchPoint2 = secondPoint;
- MoveUiControls();
- Count = 0;
- }
- }
- Count++;
- delete pList;
- }
+ __currentWordIndex = 0;
+ __isLongPressedDone = false;
}
void
MainForm::MoveUiControls()
{
- __adressPanelPosition.y = __adressPanelPosition.y + __distanceMoved;
- if(__pAddressbar == NULL)
- {
- return;
- }
-
- if (__adressPanelPosition.y > 0)
- {
- __adressPanelPosition.y = 0;
- __webControlPosition.y = __pAddressbar->GetHeight() - 12;
- }
- else if (__adressPanelPosition.y < (0-(__pAddressbar->GetHeight() - 12))) // -12 is for the progress label
- {
- __adressPanelPosition.y = 0-(__pAddressbar->GetHeight() - 12);
- __webControlPosition.y = 0;
- // result r = __pWebViewer->SetScrollEnabled(true);
- // AppLog("letmetestscrollenabled true %s pos %d,%d",GetErrorMessage(r),__adressPanelPosition.x,__adressPanelPosition.y);
- }
- else
- {
- // result r = __pWebViewer->SetScrollEnabled(false);
- // __pWebViewer->Invalidate(true);
- // AppLog("letmetestscrollenabled false %s pos %d,%d",GetErrorMessage(r),__adressPanelPosition.x,__adressPanelPosition.y);
- __webControlPosition.y = __adressPanelPosition.y + (__pAddressbar->GetHeight() - 12);
- }
-
- AppLogDebug("__adressPanelPosition.y = %d, __webControlPosition.y = %d", __adressPanelPosition.y, __webControlPosition.y);
-
- __pAddressbar->SetBounds(0,__adressPanelPosition.y,__pAddressbar->GetWidth(),__pAddressbar->GetHeight());
- __pAddressbar->Invalidate(false);
-
- if (__pWebViewer != NULL)
- {
- if(__pFooterPanel->GetShowState() == true)
- __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
- else
- __webControlHeight = GetClientAreaBounds().height;
- __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
- __pWebViewer->Invalidate(false);
- }
}
void
MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
{
+ if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
+ {
+ if(__pFooterUrlField->GetTextLength() == 0)
+ {
+ __pFooterUrlField->SetKeypadActionEnabled(false);
+ }
+ else
+ {
+ __pFooterUrlField->SetKeypadActionEnabled(true);
+ }
+ }
if (__pFindWordEditField != null)
{
__currentSearchStr = __pFindWordEditField->GetText();
__pFindWordPrev->SetEnabled(false);
__pFindWordNext->Invalidate(true);
__pFindWordPrev->Invalidate(true);
- __pFindWordCountLabel->SetText("");
- __pFindWordCountLabel->SetShowState(false);
+ __pFindWordCountLabel->SetText(L"0/0");
__pFindWordCountLabel->Invalidate(true);
}
AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer());
}
else
{
+ __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
+ StartWordSearch();
AppLogDebug("Enter something");
}
}
__webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
__pMostVisitedListView = new(std::nothrow) ListView();
- if(__pFooterPanel->GetShowState() == false)
+
+ int height = GetClientAreaBounds().height;
+
+ if(__pFooterPanel->GetShowState() == true)
{
- r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , GetClientAreaBounds().width, GetClientAreaBounds().height),true,false);
+ height = height - __pFooterPanel->GetHeight();
}
- else
+ if(__pAddressbar->GetShowState() == true)
{
- r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight() , GetClientAreaBounds().width, __webControlHeight),true,false);
+ height -= __pAddressbar->GetHeight();
}
+ r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
+
if (r != E_SUCCESS)
{
delete __pMostVisitedListView;
}
__pMostVisitedListView->SetItemProvider(*this);
__pMostVisitedListView->AddListViewItemEventListener(*this);
- // __pMostVisitedListView->SetBackgroundColor(Color(0,0,0));
__pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RECENTLY_VISITED_SITES"));
AddControl(*__pMostVisitedListView);
- AppLog("__pMostVisitedSitesPanel addcontrol %s",GetErrorMessage(r));
- if(__pFooterPanel->GetShowState() == false)
- __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() + 14));
- else
- __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__pAddressbar->GetBounds().y + __pAddressbar->GetHeight()-12 , GetClientAreaBounds().width, GetClientAreaBounds().height - __pAddressbar->GetHeight() - __pFooterPanel->GetHeight() + 14));
-
__pMostVisitedListView->UpdateList();
- // __pMostVisitedSitesPanel->Invalidate(true);
- // Invalidate(true);
return E_SUCCESS;
}
contentId = contentManager.CreateContent(*aBuffer, contentPath);
AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
}
+
+void
+MainForm::SetForwardButtonEnabled(bool isEnabled)
+{
+ __pGoForwardBtn->SetEnabled(isEnabled);
+ __pGoBackBtn->Invalidate(true);
+}
+
+void
+MainForm::SetBackButtonEnabled(bool isEnabled)
+{
+ __pGoBackBtn->SetEnabled(isEnabled);
+ __pGoBackBtn->Invalidate(true);
+}
+
+void
+MainForm::UpdateProgress(int percentage)
+{
+ __progressPercentage = percentage;
+ if (percentage == 0 || percentage == 100)
+ {
+ __isLoadingData = false;
+ if (percentage == 100)
+ {
+ __isLoadingCompleted = true;
+ __progressPercentage = 0;
+ }
+ else
+ {
+ __isLoadingCompleted = false;
+ }
+ }
+ else
+ {
+ __isLoadingData = true;
+ }
+ UpdateProgressBitmap();
+}
+
+int
+MainForm::GetProgress(void)
+{
+ return __progressPercentage;
+}
+
+void
+MainForm::UpdateProgressBitmap(void)
+{
+ result r = E_SUCCESS;
+ if (__pProgressbarLabel == null)
+ return;
+ int w = __pProgressbarLabel->GetWidth();
+ int h = __pProgressbarLabel->GetHeight();
+ Canvas canvas;
+ int progressWidth = 0;
+ Bitmap* pRetBitmap = null;
+
+ if (__progressPercentage == 0 || __progressPercentage == 100)
+ {
+ __pProgressbarLabel->SetShowState(false);
+ __pProgressbarLabel->Invalidate(false);
+ return;
+ }
+ else
+ {
+ __pProgressbarLabel->SetShowState(true);
+ __pProgressbarLabel->Invalidate(false);
+ }
+
+ r = canvas.Construct(Rectangle(0, 0, w, h));
+
+ if (r != E_SUCCESS)
+ {
+ AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
+ return;
+ }
+
+ canvas.Clear();
+ Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
+
+ if (pBgBmp != null)
+ {
+ pBgBmp->Scale(Dimension(w, h));
+ canvas.DrawBitmap(Point(0,0), *pBgBmp);
+ delete pBgBmp;
+ }
+
+ progressWidth = (double) (w) * __progressPercentage / 100;
+ AppLogDebug("progressWidth: %d", progressWidth);
+ Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
+
+ if (pProgressBmp != null)
+ {
+ pProgressBmp->Scale(Dimension(progressWidth, h));
+ canvas.DrawBitmap(Point(0,0), *pProgressBmp);
+ delete pProgressBmp;
+ }
+
+ pRetBitmap = new (std::nothrow) Bitmap();
+
+ if (pRetBitmap == null)
+ {
+ AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
+ return;
+ }
+
+ pRetBitmap->Construct(canvas, canvas.GetBounds());
+
+ if (__pProgressbarLabel != null && pRetBitmap != null)
+ {
+ __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
+ __pProgressbarLabel->Invalidate(false);
+ }
+
+ if (pRetBitmap != null)
+ {
+ delete pRetBitmap;
+ pRetBitmap = null;
+ }
+ return;
+}
+
+void MainForm::SetAddressbarMode(AddressBarMode addMode)
+{
+ AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
+
+ __currentAddMode = addMode;
+
+ switch(addMode)
+ {
+ case ADDRESSBAR_MODE_INVALID:
+ {
+ // do nothing
+ }
+ break;
+ case ADDRESSBAR_MODE_READER:
+ {
+ __pStopBtn->SetShowState(false);
+ __pClearBtn->SetShowState(false);
+ }
+ break;
+ case ADDRESSBAR_MODE_LOADING:
+ {
+ __pRefreshBtn->SetShowState(false);
+ __pStopBtn->SetShowState(true);
+ __pClearBtn->SetShowState(false);
+ }
+ break;
+ case ADDRESSBAR_MODE_LOADING_COMPLETE:
+ {
+// SetUrl(__pAddressbar->GetUrl());
+
+ __pRefreshBtn->SetShowState(true);
+ __pStopBtn->SetShowState(false);
+ __pClearBtn->SetShowState(false);
+ }
+ break;
+ case ADDRESSBAR_MODE_EDIT:
+ {
+ __pRefreshBtn->SetShowState(false);
+ __pStopBtn->SetShowState(false);
+ __pClearBtn->SetShowState(true);
+ }
+ break;
+ }
+
+ Invalidate(true);
+
+ OnAddressBarModeChanged();
+}
+
+AddressBarMode MainForm::GetAddressbarMode(void)
+{
+ return __currentAddMode;
+}
+
+void MainForm::SetUrl(const String& url)
+{
+ __displayUrl = url;
+
+ if (__pFooterUrlField != NULL)
+ {
+ String removedHttpUrl = RemoveHttpTextFromDisplayURL();
+ if (removedHttpUrl.IsEmpty() == false)
+ {
+ __pFooterUrlField->SetText(removedHttpUrl);
+ __pAddressbar->SetUrl(__displayUrl);
+ }
+ else
+ {
+ __pFooterUrlField->SetText(__displayUrl);
+ __pAddressbar->SetUrl(__displayUrl);
+ }
+
+ __pFooterUrlField->Invalidate(false);
+ __pAddressbar->Invalidate(true);
+ __pFooterUrlField->SetCursorPosition(0);
+ }
+}
+
+String
+MainForm::RemoveHttpTextFromDisplayURL(void)
+{
+ bool isHttpText = __displayUrl.Contains(L"http://");
+ String updatedDisplayUrl;
+ updatedDisplayUrl.Clear();
+
+ if (isHttpText == true)
+ {
+ __displayUrl.SubString(7,updatedDisplayUrl);
+ }
+ return updatedDisplayUrl;
+}