2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet MainForm class
19 *@brief: The %MainForm provides the common functionalities for the Main View of the Browser including the addressbar,
20 * loading,handling events etc.
24 #include <FGraphics.h>
29 //#include <FShellNotificationManager.h>
31 #include "IntBookmarkData.h"
32 #include "IntBookmarkPresentationModel.h"
33 #include "IntCommonLib.h"
34 #include "IntFaviconManager.h"
35 #include "IntInternetApp.h"
36 #include "IntMainForm.h"
37 #include "IntSceneRegister.h"
38 #include "IntSettingPresentationModel.h"
40 using namespace Tizen::App;
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Collection;
43 using namespace Tizen::Base::Runtime;
44 using namespace Tizen::Base::Utility;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
47 using namespace Tizen::Locales;
48 using namespace Tizen::Media;
49 using namespace Tizen::Shell;
50 using namespace Tizen::Ui;
51 using namespace Tizen::Ui::Controls;
52 using namespace Tizen::Content;
53 using namespace Tizen::Ui::Scenes;
54 using namespace Tizen::System;
55 using namespace Tizen::Web;
56 using namespace Tizen::Web::Controls;
58 static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
59 static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
60 static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
61 static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
62 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
63 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK_PRESS = L"I01_search_list_icon_favorite_press.png";
64 static const wchar_t* IDB_CONTRLBAR_ICON_MORE = L"I01_icon_more.png";
65 static const wchar_t* IDB_CONTRLBAR_ICON_MORE_PRESS = L"I01_icon_more_press.png";
66 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW = L"I01_icon_plus.png";
67 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_press.png";
68 static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
69 static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
70 static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
71 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
72 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
73 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
74 static const wchar_t* IDS_APPID = L"AppID";
75 static const wchar_t* IDS_KEY = L"key";
76 static const wchar_t* IDS_VALUE = L"value";
77 static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
78 static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
79 //static const wchar_t* IDB_ADDRESS_BAR_BACKGROUND = L"I01_toolbar_bg_02.9.png";
81 const int IDA_BACKBTN_CLICKED = 101;
82 const int IDA_BOOKMARKBTN_CLICKED = 102;
83 const int IDA_MOREBTN_CLICKED = 103;
84 const int IDA_MULTIWINDOWBTN_CLICKED = 104;
85 const int IDA_NEWWINDOWBTN_CLICKED = 105;
86 const int IDA_FORWARD_CLICKED = 106;
87 const int IDA_ADDTOBOOKMARK_CLICKED = 107;
88 const int IDA_SHARE_CLICKED = 108;
89 const int IDA_FINDONPAGE_CLICKED = 109;
90 const int IDA_PRIVATEON_CLICKED = 110;
91 const int IDA_SETTINGS_CLICKED = 111;
92 const int IDA_READER_CLOSE_CLICKED = 112;
93 const int IDA_SMALLFONT_BTN_CLICKED = 113;
94 const int IDA_LARGEFONT_BTN_CLICKED = 114;
95 const int IDA_BRIGHTNESS_BTN_CLICKED = 115;
96 const int IDA_HISTORY_CLICKED = 116;
97 const int IDA_ADD_TO_BOOKMARKBTN_CLICKED = 117;
98 const int IDA_ADD_TO_HOME_CLICKED = 118;
99 const int IDA_SAVED_PAGES_CLICKED = 119;
100 const int IDA_DESKTOP_VIEW_CLICKED = 120;
101 const int IDA_SAVE_CLICKED = 121;
102 const int IDA_PRINT_CLICKED = 122;
104 const int IDA_FINDWORD_SEARCH_CLICKED = 201;
105 const int IDA_FINDWORD_NEXT_CLICKED = 202;
106 const int IDA_FINDWORD_PREV_CLICKED = 203;
107 const int IDA_FINDWORD_CLEAR_CLICKED = 204;
108 const int IDA_FINDWORD_CANCEL_CLICKED = 205;
110 const int IDA_COPY_IMAGE_CLICKED = 206;
111 const int IDA_VIEW_IMAGE_CLICKED = 207;
112 const int IDA_SAVE_IMAGE_CLICKED = 208;
113 const int IDA_SHARE_IMAGE_CLICKED = 209;
115 const int IDA_COPY_TEXT_CLICKED = 210;
116 const int IDA_PASTE_TEXT_CLICKED = 211;
117 const int IDA_FIND_TEXT__CLICKED = 212;
118 const int IDA_SHARE_TEXT_CLICKED = 213;
120 const int IDA_GO_BACK = 214;
121 const int IDA_GO_FORWARD = 215;
122 const int IDA_REFRESH_BTN_CLICKED = 216;
123 const int IDA_STOP_BTN_CLICKED = 217;
124 const int IDA_CLEAR_URL = 218;
125 const int IDA_READER_BTN_CLICKED = 219;
128 const int IDA_HYPERLINK_OPEN_CLICKED = 220;
129 const int IDA_HYPERLINK_COPY_LINK_CLICKED = 221;
130 const int IDA_HYPERLINK_SAVE_IMAGE_CLICKED = 222;
131 const int IDA_HYPERLINK_SHARE_IMAGE_CLICKED = 223;
133 const int IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED = 224;
135 const int DEFAULT_PROGRESS_PERCENTAGE = 10;
137 const int MainForm::IDA_FORMAT_BITMAP = 500;
138 const int MainForm::IDA_FORMAT_DELETE_BITMAP = 501;
139 const int MainForm::IDA_FORMAT_TITLE_STRING = 502;
140 const int MainForm::IDA_FORMAT_URL_STRING = 503;
141 const int MainForm::IDA_CONTEXT_ITEM_DELETE = 504;
143 static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
144 static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
145 static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
147 static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
148 MainForm::MainForm(void)
150 __isLongPressedDone = false;
152 __pAddressbar = null;
153 // __pMostVisitedSitesPanel = null;
154 __pMostVisitedListView = null;
155 __pFooterPanel = null;
156 __pHitElementResult = null;
157 __pWindowInfo = null;
160 __pOptionMenu = null;
161 __pFindWordControl = null;
162 __pFindWordPanelLeftToRight = null;
163 __pFindWordPanelRightToLeft = null;
164 __pFindWordBgLabel = null;
165 __pFindWordBgLabelRightToLeft = null;
166 __pFindWordEditField = null;
167 __pFindWordEditFieldRightToLeft = null;
168 __pFindWordClear = null;
169 __pFindWordClearRightToLeft = null;
170 __pFindWordCountLabel = null;
171 __pFindWordClearRightToLeft = null;
172 __pFindWordNext = null;
173 __pFindWordPrev = null;
174 __previousZoomLevel = 1.0;
176 __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
179 __currentSearchStr = L"";
180 __currentSelectedStr = L"";
181 __maxOccurrances = 0;
182 __currentWordIndex = 0;
185 //__inputEventToBeSupressed = false;
186 __isLoadingData = false;
187 __isLoadingCompleted = false;
188 __progressPercentage = 0;
189 __touchPoint1 = Point(-1,-1);
190 __touchPoint2 = Point(-1,-1);
191 __longPressPoint = Point(-1,-1);
193 // __pReaderPopup = null;
194 __pReaderData = null;
196 __pReaderCloseBtn = null;
197 //__pNewWindowButton = null;
198 __pMoreButton = null;
199 __pMultiWindowButton = null;
200 __pArticleReaderPanel = null;
201 __pBlankPanel = null;
202 __pArticleReaderLabel = null;
203 __webControlHeight = 0;
204 __prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
205 __curAddressBarMode = ADDRESSBAR_MODE_INVALID;
206 __pMostVisitedSites = null;
207 __pFooterUrlField = null;
209 __pGoForwardBtn = null;
210 __pRefreshBtn = null;
211 __pProgressbarLabel = null;
212 __pFooterLabel = null;
216 __isKeypadOpened = false;
218 __pNotification = null;
221 MainForm::~MainForm(void)
223 SettingPresentationModel::GetInstance()->RemoveSettingsEventListener(*this);
227 __pAddressbar->SetAddressbarEventListener(null);
230 if(__pHistory != null)
236 if (__pReaderData != null)
238 delete __pReaderData;
239 __pReaderData = null;
242 if (__pPopUp != null)
248 if (__pHitElementResult != null)
250 delete __pHitElementResult;
251 __pHitElementResult = null;
255 delete __pOptionMenu;
256 __pOptionMenu = null;
259 String* pSelectedScene = NULL;
260 Object* pValue = NULL;
261 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
262 pSelectedScene = (String*) pValue;
264 /*if (pSelectedScene != null)
266 delete pSelectedScene;
268 MultiWindowPresentationModel::SetValue(SELECTED_SCENE_ID, null);*/
272 MainForm::Initialize(void)
274 Construct(L"IDL_FORM");
276 // SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
281 MainForm::OnInitializing(void)
283 AppLog("get client area width = %d",GetClientAreaBounds().width);
284 AppLog("get client area height = %d",GetClientAreaBounds().height);
285 const int WIDTH_CONTEXT_MENU_BUTTON = 336;
286 const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
288 __fontSize = CommonUtil::GetFontSize();
289 Panel* pFooterPanel = null;
291 __pSaveImage = new Image();
292 __pSaveImage->Construct();
294 // Setup back event listener
295 SettingPresentationModel::GetInstance()->AddSettingsEventListener(*this);
296 SceneManager::GetInstance()->AddSceneEventListener(IDSCN_MAIN_VIEW, *this);
297 AddOrientationEventListener(*this);
299 AppLogDebug(" MainForm::OnInitializing ended");
300 if (__pMostVisitedSites == null)
302 __pMostVisitedSites = new(std::nothrow) ArrayList();
303 __pMostVisitedSites->Construct();
305 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
307 __pItemContext= new(std::nothrow) ListContextItem();
308 __pItemContext->Construct();
310 __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"),true);
313 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
314 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
315 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
317 __pItemContextLandscape= new(std::nothrow) ListContextItem();
318 __pItemContextLandscape->Construct();
320 __pItemContextLandscape->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), true);
321 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
322 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
323 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
324 SetFormMenuEventListener(this);
325 AppLog("SetFormMenuEventListener result %s",GetErrorMessage(GetLastResult()));
330 MainForm::InitAddressbar(void)
332 AppLogDebug("MainForm::InitAddressbar entered");
334 result r = E_SUCCESS;
336 if (__pAddressbar != null)
340 __pAddressbar = new(std::nothrow) Addressbar();
341 AppLog("MainForm::InitAddressbar GetClientAreaBounds().width %d",GetClientAreaBounds().width);
342 r = __pAddressbar->Initialize(Tizen::Graphics::Rectangle(0, 0, GetClientAreaBounds().width, 82));
345 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
348 __pAddressbar->SetAddressbarEventListener(this);
349 AddControl(__pAddressbar);
350 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
351 SetControlAlwaysOnTop(*__pAddressbar, true);
352 __adressPanelPosition = __pAddressbar->GetPosition();
354 AppLogDebug("MainForm::InitAddressbar exit");
360 MainForm::CreateReaderPanel(void)
362 AppLogDebug("CreateReaderPanel() width %d",GetClientAreaBounds().width);
363 result r = E_FAILURE;
365 Button *pSmallFontBtn = null;
366 Button *pLargeFontBtn = null;
368 __pBlankPanel = new (std::nothrow) Panel();
369 __pBlankPanel->Construct(L"IDL_BLANK_PANEL");
371 __pArticleReaderPanel = new (std::nothrow) Panel();
372 __pArticleReaderPanel->Construct(L"IDL_ARTICLE_READER");
374 __pReaderCloseBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_CLOSE_READER",true));
375 if (__pReaderCloseBtn)
377 AppLogDebug("CreateReaderPanel() 6");
378 __pReaderCloseBtn->AddActionEventListener(*this);
379 __pReaderCloseBtn->SetActionId(IDA_READER_CLOSE_CLICKED);
382 __pWebReader = new (std::nothrow) Web();
383 __pWebReader->Construct(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
385 settings.SetInputStyle(INPUT_STYLE_OVERLAY);
386 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
388 r = __pWebReader->SetSetting(settings);
390 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
393 __pArticleReaderLabel = new Label();
394 __pArticleReaderLabel->Construct(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()),L"");
396 __pBlankPanel->AddControl(__pArticleReaderLabel);
397 __pBlankPanel->AddControl(__pArticleReaderPanel);
398 AddControl(__pBlankPanel);
400 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
401 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
402 __pArticleReaderLabel->SetBounds(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
404 __pArticleReaderPanel->AddControl(__pWebReader);
405 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
406 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
407 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
409 if (pBitmap != null && pSrcBitmap != null)
411 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
413 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
415 pSmallFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_SMALL_FONT",true));
418 pSmallFontBtn->AddActionEventListener(*this);
419 pSmallFontBtn->SetActionId(IDA_SMALLFONT_BTN_CLICKED);
422 pLargeFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_LARGE_FONT",true));
425 pLargeFontBtn->AddActionEventListener(*this);
426 pLargeFontBtn->SetActionId(IDA_LARGEFONT_BTN_CLICKED);
435 if (pSrcBitmap != null)
441 SetControlAlwaysOnTop(*__pBlankPanel, true);
442 //__pBlankPanel->SetControlAlwaysAtBottom(*__pArticleReaderPanel, true);
449 MainForm::InitWebControl()
451 AppLogDebug("MainForm::InitWebControl enter");
452 result r = E_SUCCESS;
453 AppLogDebug("InitWebControl");
455 if (__pAddressbar == null || __pFooterPanel == null)
458 const int Y_WEBCONTROL_POSITION = 0;
460 __webControlHeight = GetHeight() - __pFooterPanel->GetHeight();
462 if (__pMostVisitedListView)
464 __pMostVisitedListView->SetShowState(false);
466 if (__pWebViewer != null)
468 AppLogDebug("Already initialized");
471 __pWebViewer = new(std::nothrow) Web();
472 if(__pWebViewer == NULL)
474 AppLogDebug("Initialization failed");
477 r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight + 12));
481 AppLogDebug("Web construct failed with %s", GetErrorMessage(r));
488 r = AddControl(__pWebViewer);
491 __pWebViewer->Destroy();
493 AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
496 __webControlPosition = __pWebViewer->GetPosition();
497 r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
500 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
504 __pWebViewer->SetLoadingListener(this);
505 __pWebViewer->SetWebUiEventListenerF(this);
506 __pWebViewer->SetWebKeypadEventListener(this);
507 __pWebViewer->SetFocus();
508 __pWebViewer->AddTouchEventListener(*this);
510 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
511 __pWebViewer->SetTextSearchListener(this);
514 AppLogDebug("MainForm :before return");
516 AppLogDebug("MainForm::InitWebControl Exit");
522 MainForm::SetJavascriptEnabled()
524 WebSetting settings = __pWebViewer->GetSetting();
525 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
526 __pWebViewer->SetSetting(settings);
530 MainForm::SetImageLoadEnabled()
532 WebSetting settings = __pWebViewer->GetSetting();
533 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
534 __pWebViewer->SetSetting(settings);
538 MainForm::InitFooter(void)
540 AppLogDebug("MainForm::InitFooter entered");
541 Button* pBackButton = null;
542 Button* pBookmarkButton = null;
543 Button* pMultiWindowButton = null;
544 Bitmap *pIconBitmap = null;
545 Bitmap *pBGBitmap = null;
546 Label *pBGLabel = null;
548 if (__pFooterPanel == null)
550 __pFooterPanel = static_cast< Panel* >(GetControl(L"IDC_FOOTER_PANEL", true));
553 if (__pFooterPanel == null)
558 SetControlAlwaysOnTop(*__pFooterPanel, true);
560 __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
561 if ( __pFooterLabel == NULL )
565 //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
566 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
569 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
573 __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
575 if ( __pMultiWindowButton == NULL )
581 SetFormBackEventListener(this);
582 AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
583 if (__pMultiWindowButton != null)
585 Bitmap* pBitmap = null;
586 Bitmap* pPressedBitmap = null;
587 String imagePath = "I01_toolbar_icon_windows_manager_0";
588 String pressedImagePath = "I01_toolbar_icon_windows_manager_0";
589 int totalCount = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount();
590 imagePath.Append(totalCount);
591 imagePath.Append(".png");
593 pressedImagePath.Append(totalCount);
594 pressedImagePath.Append("_press.png");
596 pBitmap = AppResource::GetInstance()->GetBitmapN(imagePath);
597 pPressedBitmap = AppResource::GetInstance()->GetBitmapN(pressedImagePath);
598 if ( pBitmap == null )
603 Point startPoint = Point((__pMultiWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pMultiWindowButton->GetHeight() - pBitmap->GetHeight())/2);
606 __pMultiWindowButton->SetNormalBitmap(startPoint, *pBitmap);
607 __pMultiWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
612 __pMultiWindowButton->AddActionEventListener(*this);
613 __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
616 delete pPressedBitmap;
617 pPressedBitmap = null;
623 Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
624 Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE_PRESS);
627 Point startPoint((__pMoreButton->GetWidth() - pBitmap->GetWidth())/2,(__pMoreButton->GetHeight() - pBitmap->GetHeight())/2 );
628 __pMoreButton->SetNormalBitmap(startPoint, *pBitmap);
629 __pMoreButton->SetPressedBitmap(startPoint, *pPressedBitmap);
633 __pMoreButton->AddActionEventListener(*this);
634 __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
637 //Add the editfield for url
638 __pFooterUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
639 if (__pFooterUrlField == NULL)
641 return E_INVALID_KEY;
644 __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
645 __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
646 __pFooterUrlField->AddKeypadEventListener(*this);
647 __pFooterUrlField->SetPropagatedTouchEventListener(this);
648 __pFooterUrlField->AddFocusEventListener(*this);
650 if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
652 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
654 else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
656 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
660 //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
661 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
665 //Add the go Back Button
666 __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
667 if (__pGoBackBtn == NULL)
669 AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
670 return E_INVALID_KEY;
672 __pGoBackBtn->SetActionId(IDA_GO_BACK);
673 __pGoBackBtn->AddActionEventListener(*this);
675 //Add the go forward Button
676 __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
677 if (__pGoForwardBtn == NULL)
679 AppLogDebug("Control not found returning E_INVALID_KEY");
680 return E_INVALID_KEY;
682 __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
683 __pGoForwardBtn->AddActionEventListener(*this);
684 if (__pWebViewer && __pWebViewer->CanGoForward())
686 SetForwardButtonEnabled(true);
690 SetForwardButtonEnabled(false);
693 __pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
694 if (__pRefreshBtn == NULL)
696 AppLogDebug("Control not found returning E_INVALID_KEY");
697 return E_INVALID_KEY;
700 __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
701 __pRefreshBtn->AddActionEventListener(*this);
702 __pRefreshBtn->SetShowState(true);
704 //Add the backround label for displaying progressbar
705 __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
706 if (__pProgressbarLabel == NULL)
708 AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
709 return E_INVALID_KEY;
711 __pProgressbarLabel->SetShowState(false);
713 __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
714 if (__pStopBtn == NULL)
716 AppLogDebug("Control not found returning E_INVALID_KEY");
717 return E_INVALID_KEY;
719 __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
720 __pStopBtn->AddActionEventListener(*this);
721 __pStopBtn->SetShowState(false);
723 __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
724 if (__pClearBtn == NULL)
726 AppLogDebug("Control not found returning E_INVALID_KEY");
727 return E_INVALID_KEY;
729 __pClearBtn->SetActionId(IDA_CLEAR_URL);
730 __pClearBtn->AddActionEventListener(*this);
731 __pClearBtn->SetShowState(false);
733 __pReaderBtn = static_cast<Button*> (GetControl(L"IDC_READER_BUTTON",true));
734 if (__pReaderBtn == NULL)
736 AppLogDebug("Control not found returning E_INVALID_KEY");
737 return E_INVALID_KEY;
739 __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED);
740 __pReaderBtn->AddActionEventListener(*this);
741 __pReaderBtn->SetShowState(false);
743 // __pFooterPanel->Invalidate(true);
744 if(__isKeypadOpened == false && __pAddressbar && __pAddressbar->GetShowState() == false)
746 // AppLog("asdasdasdasda");
747 __pFooterPanel->SetShowState(true);
749 else if(__pAddressbar == null)
751 __pFooterPanel->SetShowState(true);
754 __pFooterPanel->SetShowState(false);
756 SetAddressbarMode(GetAddressbarMode());
757 AppLogDebug("MainForm::InitFooter exit");
762 MainForm::InitOptionMenu()
764 result r = E_SUCCESS;
765 bool isPrivateBrowsing = false;
766 Bitmap* pBitmap = null;
768 if (__pOptionMenu != null)
770 __pOptionMenu->SetFocusable(true);
771 __pOptionMenu->Invalidate(true);
775 __pOptionMenu = new(std::nothrow) OptionMenu();
776 r = __pOptionMenu->Construct();
777 TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
779 __pOptionMenu->SetFocusable(true);
780 isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
783 if (isPrivateBrowsing == true)
785 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
789 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
792 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
794 if ( pBitmap != NULL)
796 __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"), IDA_PRIVATEON_CLICKED,*pBitmap);
799 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_TAB_HISTORY"), IDA_HISTORY_CLICKED);
800 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
801 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
804 __pOptionMenu->SetMaxVisibleItemsCount(6);
805 __pOptionMenu->SetShowState(false);
806 __pOptionMenu->AddActionEventListener(*this);
807 SetControlAlwaysOnTop(*__pOptionMenu, true);
813 result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
815 result r = E_SUCCESS;
816 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
818 AppLog("MainForm::InitImageContextMenu clicked on image");
819 if (__pImageMenu != null)
824 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
829 __pImageMenu = new (std::nothrow) ContextMenu();
830 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
831 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
833 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
834 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
835 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED);
836 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_IMAGE_CLICKED);
837 __pImageMenu->SetMaxVisibleItemsCount(4);
838 __pImageMenu->AddActionEventListener(*this);
839 SetControlAlwaysOnTop(*__pImageMenu, true);
840 __pImageMenu->SetFocusable(true);
846 MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
848 result r = E_SUCCESS;
849 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
851 AppLog("MainForm::InitImageContextMenu clicked on image");
852 if (__pImageMenu != null)
858 // if(__pAddressbar->GetShowState() == true)
859 // p.y = p.y + __pAddressbar->GetHeight();
860 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
865 __pImageMenu = new (std::nothrow) ContextMenu();
866 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
867 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
869 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
870 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
871 //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
872 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
874 __pImageMenu->SetMaxVisibleItemsCount(3);
875 __pImageMenu->AddActionEventListener(*this);
876 SetControlAlwaysOnTop(*__pImageMenu, true);
877 __pImageMenu->SetFocusable(true);
884 MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOption = false)
886 result r = E_SUCCESS;
887 bool clipboardAvailable = true;
888 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
890 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
891 if (__pImageMenu != null)
897 // __pWebViewer->GetBlockRange(p,q);
902 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
906 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
910 Clipboard* pClipboard = Clipboard::GetInstance();
912 if(pClipboard == null)
914 clipboardAvailable = false;
918 // Retrieves a latest item
919 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
923 clipboardAvailable = false;
927 //Gets data from the clipboard item
928 String* pString = dynamic_cast<String*>(pItem->GetData());
932 clipboardAvailable = false;
936 if(clipboardAvailable == false && onlyPasteOption == true)
941 __pImageMenu = new (std::nothrow) ContextMenu();
942 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
943 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
945 if(onlyPasteOption == false)
947 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
949 if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
951 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
953 if(onlyPasteOption == false)
955 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
956 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
959 __pImageMenu->SetMaxVisibleItemsCount(3);
960 __pImageMenu->AddActionEventListener(*this);
961 SetControlAlwaysOnTop(*__pImageMenu, true);
962 __pImageMenu->SetFocusable(true);
969 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
971 result r = E_SUCCESS;
972 bool clipboardAvailable = true;
973 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
975 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
976 if (__pImageMenu != null)
981 // FloatPoint q(0.0,0.0);
982 // __pWebViewer->GetBlockRange(p,q);
986 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
990 if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
992 AppLog("asdasdafdsfdgfd");
995 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
999 Clipboard* pClipboard = Clipboard::GetInstance();
1001 if(pClipboard == null)
1003 clipboardAvailable = false;
1007 // Retrieves a latest item
1008 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
1012 clipboardAvailable = false;
1016 //Gets data from the clipboard item
1017 String* pString = dynamic_cast<String*>(pItem->GetData());
1021 clipboardAvailable = false;
1025 if(clipboardAvailable == false && onlyPasteOption == true)
1029 __pImageMenu = new (std::nothrow) ContextMenu();
1030 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
1031 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
1037 if(onlyPasteOption == false)
1039 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
1041 if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
1043 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
1045 if(onlyPasteOption == false)
1047 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
1048 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
1051 __pImageMenu->SetMaxVisibleItemsCount(3);
1052 __pImageMenu->AddActionEventListener(*this);
1053 SetControlAlwaysOnTop(*__pImageMenu, true);
1054 __pImageMenu->SetFocusable(true);
1061 MainForm::InitFindWordPanel(void)
1063 result r = E_SUCCESS;
1064 Bitmap *pIconBitmap = null;
1066 if (__pFindWordControl != null)
1068 AppLogDebug("Findword panel already initialized");
1069 if (__pFindWordBgLabel != null)
1071 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1072 if (pBitmap != null)
1074 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1078 if (__pFindWordBgLabelRightToLeft != null)
1080 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
1081 if (pBitmap != null)
1083 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1088 __pAddressbar->SetShowState(false);
1090 if(__isKeypadOpened == false)
1091 __pFooterPanel->SetShowState(true);
1095 __pFindWordControl = new (std::nothrow) Panel();
1096 r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE");
1099 AppLogException("There is some problem in the xml file. Please check.");
1102 AddControl(__pFindWordControl);
1103 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
1104 SetControlAlwaysOnTop(*__pFindWordControl,true);
1105 __pFindWordControl->SetShowState(false);
1106 __pFindWordControl->Invalidate(false);
1108 __pFindWordPanelLeftToRight = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1109 __pFindWordPanelLeftToRight->SetShowState(true);
1111 __pFindWordPanelRightToLeft = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL2", true));
1112 __pFindWordPanelRightToLeft->SetShowState(false);
1114 __pFindWordBgLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL1", true));
1115 if (__pFindWordBgLabel != null)
1117 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1118 Rectangle pRect = pPanel1->GetBounds();
1119 pRect.x = pRect.y = 0;
1120 __pFindWordBgLabel->SetBounds(pRect);
1121 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1122 if (pBitmap != null)
1124 AppLogDebug("InitFindWordPanel: Coming here");
1125 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1130 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1134 __pFindWordBgLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL2", true));
1135 if (__pFindWordBgLabelRightToLeft != null)
1137 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1138 Rectangle pRect = pPanel1->GetBounds();
1139 pRect.x = pRect.y = 0;
1140 __pFindWordBgLabelRightToLeft->SetBounds(pRect);
1141 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1142 if (pBitmap != null)
1144 AppLogDebug("InitFindWordPanel: Coming here");
1145 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1150 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1154 Button* pfindWordCancel = null;
1155 pfindWordCancel = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true));
1156 if (pfindWordCancel == null)
1158 AppLogException("There is some problem in the xml file. Please check.");
1161 pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED);
1162 pfindWordCancel->AddActionEventListener(*this);
1164 __pFindWordClear = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true));
1165 if (__pFindWordClear == null)
1167 AppLogException("There is some problem in the xml file. Please check.");
1171 __pFindWordClearRightToLeft = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR2", true));
1172 if (__pFindWordClearRightToLeft == null)
1174 AppLogException("There is some problem in the xml file. Please check.");
1178 __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED);
1179 __pFindWordClear->AddActionEventListener(*this);
1181 __pFindWordClearRightToLeft->SetActionId(IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED);
1182 __pFindWordClearRightToLeft->AddActionEventListener(*this);
1184 __pFindWordNext = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true));
1185 if (__pFindWordNext == null)
1187 AppLogException("There is some problem in the xml file. Please check.");
1191 __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED);
1192 __pFindWordNext->AddActionEventListener(*this);
1194 __pFindWordPrev = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true));
1195 if (__pFindWordPrev == null)
1197 AppLogException("There is some problem in the xml file. Please check.");
1201 __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED);
1202 __pFindWordPrev->AddActionEventListener(*this);
1204 __pFindWordNext->SetEnabled(false);
1205 __pFindWordPrev->SetEnabled(false);
1207 __pFindWordCountLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true));
1208 if (__pFindWordCountLabel == null)
1210 AppLogException("There is some problem in the xml file. Please check.");
1214 __pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
1215 if (__pFindWordCountLabelRightToLeft == null)
1217 AppLogException("There is some problem in the xml file. Please check.");
1221 __pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
1222 if (__pFindWordEditField == null)
1224 AppLogException("There is some problem in the xml file. Please check.");
1227 __pFindWordEditField->AddTextEventListener(*this);
1228 __pFindWordEditField->AddKeypadEventListener(*this);
1229 __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
1230 __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1232 __pFindWordEditFieldRightToLeft = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true));
1233 if (__pFindWordEditFieldRightToLeft == null)
1235 AppLogException("There is some problem in the xml file. Please check.");
1238 __pFindWordEditFieldRightToLeft->AddTextEventListener(*this);
1239 __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
1240 __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
1241 __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1244 __pAddressbar->SetShowState(false);
1246 if(__isKeypadOpened == false)
1247 __pFooterPanel->SetShowState(true);
1252 MainForm::CreateItem (int index, int itemWidth)
1254 Rectangle listImageRect;
1255 Rectangle pagetTitleRect;
1256 Rectangle pageURLRect;
1257 Rectangle deleteImageRect;
1258 String pageTitle(L"");
1259 String pageURL(L"");
1260 result r = E_SUCCESS;
1261 Bitmap* pListIconImage = null;
1264 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1265 if(pHistory == null)
1269 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
1270 if ( pAppResource == NULL )
1274 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
1276 CustomItem* pItem = new(std::nothrow) CustomItem();
1277 pageTitle = pHistory->GetHistoryTitle();
1278 pageURL = pHistory->GetHistoryUrl();
1280 if (pageURL.GetLength() == 0)
1283 pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
1284 pageURL = L"<"+ nourl +">";
1288 Rectangle screenBounds = GetBounds();
1291 r = pItem->Construct(Dimension(itemWidth, 128 + (__fontSize - 44)), style);
1300 Bitmap* pBitmap = pHistory->GetFavIconBitmap();
1302 if ( pBitmap != NULL)
1304 pListIconImage = new Bitmap();
1305 pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
1309 if(pListIconImage == null)
1311 pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png");
1314 if ( pListIconImage != NULL)
1316 listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28 + (__fontSize - 44)/2 , 72, 72);
1317 pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72 + (__fontSize - 44));
1318 pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
1321 if (pItem != null && pListIconImage != NULL)
1323 pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *pListIconImage, null, null);
1327 if (pageTitle.CompareTo(L"") != 0)
1331 pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, __fontSize, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true);
1335 if (pageURL.CompareTo(L"") != 0)
1339 pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
1344 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1346 if ( __pItemContext!= NULL)
1350 pItem->SetContextItem(__pItemContext);
1356 if ( __pItemContextLandscape!= NULL)
1360 pItem->SetContextItem(__pItemContextLandscape);
1364 if( pListIconImage != NULL)
1366 delete pListIconImage;
1367 pListIconImage = null;
1374 MainForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
1381 MainForm::GetItemCount (void)
1383 if(__pMostVisitedSites != null)
1385 __pMostVisitedSites->RemoveAll(true);
1387 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
1388 if(__pMostVisitedSites != null)
1390 return __pMostVisitedSites->GetCount();
1397 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
1399 AppLog("MainForm::OnListViewContextItemStateChanged called");
1400 if(__pMostVisitedSites != null)
1402 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1403 if (pHistory != null)
1405 String url = pHistory->GetHistoryUrl();
1407 HistoryPresentationModel::GetInstance()->DeleteHistory(url);
1408 __pMostVisitedListView->UpdateList();
1414 MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1416 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1417 String url = pHistory->GetHistoryUrl();
1425 MainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1431 MainForm::OnTerminating(void)
1433 result r = E_SUCCESS;
1435 RemoveOrientationEventListener(*this);
1439 __pAddressbar->SetAddressbarEventListener(null);
1444 __pWebViewer->RemoveTouchEventListener(*this);
1445 __pWebViewer->SetWebUiEventListenerF(null);
1446 __pWebViewer->SetWebKeypadEventListener(null);
1447 __pWebViewer->SetTextSearchListener(null);
1453 delete __pItemContext;
1455 if (__pItemContextLandscape)
1457 delete __pItemContextLandscape;
1461 delete __pSaveImage;
1463 if (__pMostVisitedSites)
1465 __pMostVisitedSites->RemoveAll(true);
1466 delete __pMostVisitedSites;
1472 MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1474 result r = E_SUCCESS;
1476 AppLogDebug("Clicked : %d", actionId);
1479 case IDA_BACKBTN_CLICKED:
1481 if(__pImageMenu && __pImageMenu->GetShowState() == true)
1483 AppLog("Hiding the menu");
1484 __pImageMenu->SetShowState(false);
1486 if (__pWebViewer && __pWebViewer->CanGoBack())
1488 __pWebViewer->GoBack();
1490 else if(__pWindowInfo->isJavascriptInitiated == false)
1493 pApp = UiApp::GetInstance();
1496 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1499 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1507 WindowInfo* pWindowInfo = null;
1509 SceneManager* pSceneManager = SceneManager::GetInstance();
1510 if (pSceneManager == null)
1514 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
1515 if (pAllWindowList == NULL)
1517 pApp = UiApp::GetInstance();
1520 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1523 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1528 if (pAllWindowList != null)
1530 totalCount = pAllWindowList->GetCount();
1532 for (int count = 0; count < totalCount; count++)
1534 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
1535 if (pWindowInfo == null)
1537 pApp = UiApp::GetInstance();
1540 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1543 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1550 if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
1552 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
1555 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1558 r = pAllWindowList->RemoveAt(count, true);
1559 __pWindowInfo = null;
1562 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1567 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
1571 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
1573 if (pWindowInfo == null)
1575 pApp = UiApp::GetInstance();
1578 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1584 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
1585 // r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1588 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1600 case IDA_FORWARD_CLICKED:
1601 if (__pWebViewer == null)
1604 if (__pWebViewer->CanGoForward())
1606 __pWebViewer->GoForward();
1608 __pOptionMenu->SetShowState(false);
1609 __pOptionMenu->Invalidate(false);
1612 case IDA_FINDONPAGE_CLICKED:
1614 AppLogDebug("MainForm::OnActionPerformed findword clicked");
1615 __currentSearchStr.Clear();
1617 InitFindWordPanel();
1618 __pOptionMenu->SetShowState(false);
1619 __pOptionMenu->Invalidate(false);
1621 ShowFindWordPanel(true);
1623 if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
1625 __pFindWordEditField->SetFocus();
1626 // __pFindWordCountLabel->SetShowState(false);
1630 __pFindWordEditFieldRightToLeft->SetFocus();
1631 __pFindWordCountLabelRightToLeft->SetShowState(false);
1635 case IDA_PRIVATEON_CLICKED:
1637 result r = E_SUCCESS;
1639 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
1640 Bitmap* pBitmap = null;
1641 if (isPrivateBrowsing == true)
1643 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
1646 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1650 if (__pWebViewer != NULL)
1652 __pWebViewer->SetPrivateBrowsingEnabled(false);
1655 SettingPresentationModel::GetInstance()->SetPrivateOn(false);
1657 if (__pAddressbar != null)
1659 __pAddressbar->UpdateFaviconBitmap(false);
1665 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
1668 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1672 if (__pWebViewer != NULL)
1674 __pWebViewer->SetPrivateBrowsingEnabled(true);
1677 SettingPresentationModel::GetInstance()->SetPrivateOn(true);
1679 if (__pAddressbar != null)
1681 __pAddressbar->UpdateFaviconBitmap(true);
1685 itemIndex = __pOptionMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED);
1686 r = __pOptionMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
1687 AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex);
1688 __pOptionMenu->Invalidate(true);
1689 if ( pBitmap != NULL )
1696 case IDA_SETTINGS_CLICKED:
1699 ArrayList* pArgList = new(std::nothrow) ArrayList();
1702 pArgList->Construct();
1703 pArgList->Add(*__pWindowInfo);
1704 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList);
1706 __pOptionMenu->SetShowState(false);
1707 __pOptionMenu->Invalidate(false);
1709 if (pArgList != null)
1718 case IDA_ADDTOBOOKMARK_CLICKED:
1721 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
1723 int bookmarkCount=0;
1726 url=__pWindowInfo->pageUrl;
1727 result r = E_SUCCESS;
1728 Bitmap* pBitmap = null;
1729 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1737 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_REMOVED");
1738 BookmarkPresentationModel::GetInstance()->DeleteBookmark(url);
1739 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1741 if(__pNotification != null)
1743 RemoveControl(__pNotification);
1744 __pNotification = null;
1746 __pNotification = new (std::nothrow) NotificationPanel(*this);
1747 if (__pNotification != null)
1749 __pNotification->SetText(message);
1750 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1751 __pNotification->ShowNotification();
1756 String title=__pWindowInfo->pageTitle;
1757 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ADDED");
1758 BookmarkData* pBookmark=new (std::nothrow) BookmarkData();
1760 pBookmark->SetBookmarkTitle(title);
1761 pBookmark->SetUrl(url);
1762 if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
1764 pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
1766 String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
1767 pBookmark->SetFaviconId(id);
1768 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
1769 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
1771 if(__pNotification != null)
1773 RemoveControl(__pNotification);
1774 __pNotification = null;
1776 __pNotification = new (std::nothrow) NotificationPanel(*this);
1777 if (__pNotification != null)
1779 __pNotification->SetText(message);
1780 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1781 __pNotification->ShowNotification();
1782 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1785 if (pBitmap != null)
1787 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1792 __pOptionMenu->Invalidate(true);
1797 case IDA_PRINT_CLICKED:
1799 r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//shared//data//test.pdf");
1800 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
1802 AppLog("RequestPrint called!");
1803 AppControl* pAc = Tizen::App::AppManager::FindAppControlN(L"org.tizen.mobileprint", L"http://tizen.org/appcontrol/operation/print");
1804 result nResult = E_FAILURE;
1807 AppLog("TestPrint if (pAc) == true");
1812 String fileType = L"service_print_files_type";
1813 String typeVal = L"DOC";
1815 String fileCount = L"service_print_files_count";
1816 String countVal = L"1";
1817 String fileFolder= L"service_print_files_folder_name";
1818 String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//shared//data";
1820 map.Add(&fileCount, &countVal);
1821 map.Add(&fileFolder, &folderVal);
1822 map.Add(&fileType, &typeVal);
1824 String fileName = L"service_print_files_files_name";
1826 ArrayList fileNameList;
1827 fileNameList.Construct();
1828 String file1 = L"test.pdf";
1830 fileNameList.Add(&file1);
1831 map.Add(&fileName, &fileNameList);
1833 nResult = pAc->Start(NULL, NULL, &map, NULL);
1835 if (nResult == E_SUCCESS) AppLog("TestPrint ret == E_SUCCESS");
1836 else if (nResult == E_MAX_EXCEEDED)
1837 AppLog("TestPrint ret == E_MAX_EXCEEDED");
1838 else if (nResult == E_OBJ_NOT_FOUND)
1839 AppLog("TestPrint ret == E_OBJ_NOT_FOUND");
1840 else if (nResult == E_IN_PROGRESS)
1841 AppLog("TestPrint ret == E_IN_PROGRESS");
1842 else if (nResult == E_PRIVILEGE_DENIED)
1843 AppLog("TestPrint ret == E_PRIVILEGE_DENIED");
1844 else if(nResult == E_SYSTEM)
1845 AppLog("TestPrint ret == E_SYSTEM");
1851 int __modalMsgBoxResult;
1852 MessageBox* pMsgBox = new MessageBox();
1853 pMsgBox->Construct("Not Supported","Not Supported",MSGBOX_STYLE_OK,3000);
1854 pMsgBox->ShowAndWait(__modalMsgBoxResult);
1857 __modalMsgBoxResult = 0;
1861 case IDA_SHARE_CLICKED:
1863 if(__pPopUp != null)
1870 __pAddressbar->HideKeypad();
1872 __pPopUp = new(std::nothrow) SharePopup();
1873 __pPopUp->Initialize();
1874 if (__pWindowInfo != null)
1876 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
1877 pShareInfo->SetPageTitle(__pWindowInfo->pageTitle);
1878 pShareInfo->SetPageUrl(__pWindowInfo->pageUrl);
1879 pShareInfo->SetImageAttached(false);
1880 __pPopUp->RemoveAllShareInfo();
1881 __pPopUp->AddShareInfo(pShareInfo);
1883 __pPopUp->SetShowState(true);
1887 case IDA_BOOKMARKBTN_CLICKED:
1889 AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
1890 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1893 case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
1898 case IDA_MOREBTN_CLICKED:
1900 AppLog("IDA_MOREBTN_CLICKED");
1902 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
1904 int bookmarkCount=0;
1907 url=__pWindowInfo->pageUrl;
1908 result r = E_SUCCESS;
1909 Bitmap* pBitmap = null;
1911 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1914 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
1919 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1923 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1925 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
1927 if (__pOptionMenu->GetItemCount() == 9)
1929 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1933 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1938 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
1942 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
1943 if (__pOptionMenu->GetItemCount() != 9)
1945 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
1946 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
1947 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
1948 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
1949 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
1950 __pOptionMenu->SetMaxVisibleItemsCount(6);
1952 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1954 AppLog(" Orientation landscape");
1955 __pOptionMenu->SetMaxVisibleItemsCount(5);
1959 AppLog(" Orientation potrait");
1960 __pOptionMenu->SetMaxVisibleItemsCount(6);
1963 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
1966 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
1967 __pOptionMenu->SetShowState(true);
1968 __pOptionMenu->Invalidate(true);
1969 __pOptionMenu->Show();
1973 case IDA_HISTORY_CLICKED:
1975 AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
1976 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1979 case IDA_SAVED_PAGES_CLICKED:
1984 case IDA_DESKTOP_VIEW_CLICKED:
1989 case IDA_SAVE_CLICKED:
1994 case IDA_MULTIWINDOWBTN_CLICKED:
1996 result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1997 AppLog("IDA_MULTIWINDOWBTN_CLICKED result %s",GetErrorMessage(r));
2001 case IDA_NEWWINDOWBTN_CLICKED:
2003 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
2005 if (pNewWindowInfo == null)
2009 result r = E_SUCCESS;
2010 SceneManager* pSceneManager = SceneManager::GetInstance();
2012 if (pSceneManager == NULL)
2016 ArrayList* pArgList = new(std::nothrow) ArrayList();
2017 if (pArgList == NULL)
2021 r = pArgList->Construct();
2024 pArgList->Add(*pNewWindowInfo);
2025 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2031 AppLogDebug("MainForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
2036 case IDA_SMALLFONT_BTN_CLICKED:
2038 WebSetting setting = __pWebReader->GetSetting();
2039 setting.SetFontSize(15);
2040 __pWebReader->SetSetting(setting);
2043 case IDA_LARGEFONT_BTN_CLICKED:
2045 WebSetting setting = __pWebReader->GetSetting();
2046 setting.SetFontSize(25);
2047 __pWebReader->SetSetting(setting);
2050 case IDA_READER_CLOSE_CLICKED:
2052 if (__pArticleReaderPanel != null && __pBlankPanel != null)
2054 RemoveControl(__pBlankPanel);
2055 __pArticleReaderPanel = null;
2056 __pBlankPanel = null;
2057 __pArticleReaderLabel = null;
2059 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2062 case IDA_FINDWORD_CANCEL_CLICKED:
2064 __currentSearchStr = L"";
2065 __currentWordIndex = 0;
2066 __maxOccurrances = 0;
2068 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2070 __pFindWordEditField->SetText(L"");
2071 __pFindWordCountLabel->SetText(L"0/0");
2073 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2075 __pFindWordEditFieldRightToLeft->SetText(L"");
2076 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2079 __pFindWordNext->SetEnabled(false);
2080 __pFindWordPrev->SetEnabled(false);
2081 __pFindWordCountLabel->SetText(L"0/0");
2082 __pWebViewer->SearchTextAllAsync(L"",true);
2083 AppLog("akjshdasd 1");
2084 if(__isKeypadOpened == false)
2085 __pFooterPanel->SetShowState(true);
2086 ShowFindWordPanel(false);
2089 case IDA_FINDWORD_SEARCH_CLICKED:
2091 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2093 __currentSearchStr = __pFindWordEditField->GetText();
2095 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2097 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
2100 if (__currentSearchStr.GetLength() > 0)
2106 AppLogDebug("Enter something");
2110 case IDA_FINDWORD_CLEAR_CLICKED:
2112 __pFindWordCountLabel->SetText(L"0/0");
2113 __pFindWordEditField->SetText(L"");
2114 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2116 __currentSearchStr = L"";
2117 __pFindWordNext->SetEnabled(false);
2118 __pFindWordPrev->SetEnabled(false);
2119 // __pFindWordCountLabel->SetShowState(false);
2120 __pFindWordControl->Invalidate(true);
2123 case IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED:
2125 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2126 __pFindWordEditFieldRightToLeft->SetText(L"");
2127 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2129 __currentSearchStr = L"";
2130 __pFindWordNext->SetEnabled(false);
2131 __pFindWordPrev->SetEnabled(false);
2132 // __pFindWordCountLabelRightToLeft->SetShowState(false);
2133 __pFindWordControl->Invalidate(true);
2136 case IDA_FINDWORD_NEXT_CLICKED:
2141 case IDA_FINDWORD_PREV_CLICKED:
2143 FindNextWord(false);
2146 case IDA_BRIGHTNESS_BTN_CLICKED:
2148 AppLogDebug("IDA_BRIGHTNESS_BTN_CLICKED");
2149 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BRIGHTNESS, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2152 case IDA_COPY_IMAGE_CLICKED:
2154 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2155 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2157 const Bitmap* pBitmap = null;
2158 if (__pHitElementResult != null && __pHitElementResult->HasImage())
2160 pBitmap = __pHitElementResult->GetImage();
2163 String resourcePath = App::GetInstance()->GetAppResourcePath();
2164 r = item.Construct(CLIPBOARD_DATA_TYPE_IMAGE , *pBitmap);
2165 AppLog("Platofrm construct failed result %s",GetErrorMessage(r));
2166 // copying the item to clipboard
2167 Clipboard* pClipboard = Clipboard::GetInstance();
2168 if (pClipboard != null)
2170 r = pClipboard->CopyItem(item);
2171 AppLog("Platofrm copy failed result %s",GetErrorMessage(r));
2175 case IDA_VIEW_IMAGE_CLICKED:
2177 AppLogDebug("IDA_VIEW_IMAGE_CLICKED");
2178 WindowInfo* pNewWindowInfo = null;
2179 if (__pHitElementResult != null)
2181 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2182 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2188 case IDA_SAVE_IMAGE_CLICKED:
2190 AppLogDebug("IDA_SAVE_IMAGE_CLICKED");
2191 const Bitmap* pSaveBitmap = null;
2192 String imageName = GetImagePath();
2193 AppLog("Content manager image name %ls",imageName.GetPointer());
2196 imagePath.Append(imageName);
2197 imagePath.Format(100, L"%ls/Downloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2198 AppLog("Content manager image path %ls",imagePath.GetPointer());
2199 if (__pHitElementResult != null)
2201 pSaveBitmap = __pHitElementResult->GetImage();
2203 ByteBuffer* pBuffer = __pSaveImage->EncodeToBufferN(*pSaveBitmap, IMG_FORMAT_JPG);
2207 UpdateImageContent(pBuffer, imageName);
2209 if(__pNotification != null)
2211 RemoveControl(__pNotification);
2212 __pNotification = null;
2214 __pNotification = new NotificationPanel(*this);
2216 AppResource::GetInstance()->GetString("IDS_COM_SK_SAVE", msg);
2217 msg.Append(imagePath);
2218 if (__pNotification != null)
2220 __pNotification->SetText(msg);
2221 if (__pFooterPanel->GetShowState() == true)
2223 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
2227 __pNotification->SetPositionDiff(0);
2229 __pNotification->ShowNotification();
2234 int __modalMsgBoxResult;
2235 MessageBox* pMsgBox = new MessageBox();
2236 pMsgBox->Construct(CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
2237 pMsgBox->ShowAndWait(__modalMsgBoxResult);
2240 __modalMsgBoxResult = 0;
2244 case IDA_SHARE_IMAGE_CLICKED:
2246 AppLogDebug("IDA_SHARE_IMAGE_CLICKED");
2247 if (__pPopUp != null)
2254 __pAddressbar->HideKeypad();
2256 __pPopUp = new(std::nothrow) SharePopup();
2257 __pPopUp->Initialize();
2258 if (__pHitElementResult != null)
2260 const Bitmap* pSaveBitmap = null;
2261 String imageName = GetImagePath();
2262 AppLog("Content manager image name %ls",imageName.GetPointer());
2265 imagePath.Append(imageName);
2266 imagePath.Format(100, L"%lsDownloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2267 AppLog("Content manager image path %ls",imagePath.GetPointer());
2268 if (__pHitElementResult != null)
2270 pSaveBitmap = __pHitElementResult->GetImage();
2272 __pSaveImage->EncodeToFile(*pSaveBitmap, IMG_FORMAT_JPG, imagePath, true);
2274 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2275 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2277 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2278 pShareInfo->SetPageTitle(L"");
2279 pShareInfo->SetPageUrl(srcUrl);
2280 pShareInfo->SetImageAttached(true);
2281 pShareInfo->SetImagePath(imagePath);
2282 __pPopUp->RemoveAllShareInfo();
2283 __pPopUp->AddShareInfo(pShareInfo);
2284 __pPopUp->SetShowState(true);
2289 case IDA_HYPERLINK_OPEN_CLICKED:
2291 if (__pHitElementResult != null)
2293 String srcUrl = __pHitElementResult->GetUrl();
2295 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(srcUrl);
2297 if (pNewWindowInfo == null)
2301 pNewWindowInfo->isJavascriptInitiated = true;
2302 result r = E_SUCCESS;
2303 SceneManager* pSceneManager = SceneManager::GetInstance();
2304 if (pSceneManager == NULL)
2308 ArrayList* pArgList = new(std::nothrow) ArrayList();
2309 if (pArgList == NULL)
2313 pArgList->Construct();
2315 pArgList->Add(*pNewWindowInfo);
2316 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2317 if (pArgList != null)
2324 AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
2330 case IDA_HYPERLINK_SHARE_IMAGE_CLICKED:
2332 if (__pHitElementResult == null)
2337 if(__pPopUp != null)
2344 __pAddressbar->HideKeypad();
2346 __pPopUp = new(std::nothrow) SharePopup();
2347 __pPopUp->Initialize();
2349 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2350 pShareInfo->SetPageUrl(__pHitElementResult->GetUrl());
2351 pShareInfo->SetImageAttached(false);
2352 __pPopUp->RemoveAllShareInfo();
2353 __pPopUp->AddShareInfo(pShareInfo);
2355 __pPopUp->SetShowState(true);
2359 case IDA_HYPERLINK_COPY_LINK_CLICKED:
2363 if (__pHitElementResult != null)
2365 url = __pHitElementResult->GetUrl();
2368 String resourcePath = App::GetInstance()->GetAppResourcePath();
2369 item.Construct(CLIPBOARD_DATA_TYPE_TEXT , url);
2371 // copying the item to clipboard
2372 Clipboard* pClipboard = Clipboard::GetInstance();
2373 if (pClipboard != null)
2375 pClipboard->CopyItem(item);
2379 case IDA_FIND_TEXT__CLICKED:
2381 // AddressBarCancelledClicked(*__pAddressbar);
2382 RelayoutControls(false);
2383 // __pFooterPanel->SetShowState(false);
2384 AppLogDebug("MainForm::OnActionPerformed find word clicked");
2385 __currentSearchStr.Clear();
2386 __currentSearchStr.Append(__currentSelectedStr);
2387 InitFindWordPanel();
2388 __pFindWordEditField->SetText(__currentSearchStr);
2390 if(__pOptionMenu != null)
2392 __pOptionMenu->SetShowState(false);
2393 __pOptionMenu->Invalidate(false);
2395 __adressPanelPosition.y = 0;
2397 if (__pAddressbar != null && __pWebViewer != NULL)
2399 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
2400 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
2402 if (__pFooterPanel->GetShowState() == false)
2403 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
2405 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
2406 __pWebViewer->Invalidate(true);
2409 ShowFindWordPanel(true);
2410 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2412 __pFindWordEditField->SetText(__currentSearchStr);
2413 __pFindWordEditField->SetFocus();
2415 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2417 __pFindWordEditFieldRightToLeft->SetText(__currentSearchStr);
2418 __pFindWordEditFieldRightToLeft->SetFocus();
2421 if (__currentSearchStr.GetLength() > 0)
2427 AppLogDebug("Enter something");
2430 if (__pWebViewer != null)
2432 // releasing the set block
2433 __pWebViewer->ReleaseBlock();
2438 case IDA_SHARE_TEXT_CLICKED:
2440 __pWebViewer->ReleaseBlock();
2441 AppLogDebug("IDA_SHARE_TEXT_CLICKED");
2442 if(__pPopUp != null)
2449 __pAddressbar->HideKeypad();
2451 __pPopUp = new(std::nothrow) SharePopup();
2452 __pPopUp->Initialize();
2453 if (__pHitElementResult != null)
2455 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2456 pShareInfo->SetPageTitle(L"");
2457 pShareInfo->SetPageUrl(__currentSelectedStr);
2458 pShareInfo->SetImageAttached(false);
2459 __pPopUp->RemoveAllShareInfo();
2460 __pPopUp->AddShareInfo(pShareInfo);
2461 __pPopUp->SetShowState(true);
2466 case IDA_COPY_TEXT_CLICKED:
2468 __pWebViewer->ReleaseBlock();
2469 // need to implement
2470 //__currentSelectedStr
2471 // Sets data to a clip board item
2473 String resourcePath = App::GetInstance()->GetAppResourcePath();
2474 item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __currentSelectedStr);
2476 // copying the item to clipboard
2477 Clipboard* pClipboard = Clipboard::GetInstance();
2478 if (pClipboard != null)
2480 pClipboard->CopyItem(item);
2484 case IDA_PASTE_TEXT_CLICKED:
2486 Clipboard* pClipboard = Clipboard::GetInstance();
2488 if(pClipboard == null)
2492 // Retrieves a latest item
2493 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
2499 //Gets data from the clipboard item
2500 String* pString = dynamic_cast<String*>(pItem->GetData());
2502 if (pString != null)
2504 String idElement = __pHitElementResult->GetAttributeValue(L"id");
2505 String nameElement = __pHitElementResult->GetAttributeValue(L"name");
2506 String tagElement = __pHitElementResult->GetTagName();
2507 AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
2508 String str = L"document.getElementsByName('";
2509 str.Append(nameElement);
2510 str.Append("').length");
2511 String* pCount = __pWebViewer->EvaluateJavascriptN(str);
2512 AppLog("pCount %ls",pCount->GetPointer());
2516 if(idElement.GetLength() != 0)
2518 script = L"function insertAtCursor(myField, myValue) { if (document.selection) { document.getElementById(myField).focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (document.getElementById(myField).selectionStart || document.getElementById(myField).selectionStart == '0'){ var startPos = document.getElementById(myField).selectionStart; var endPos = document.getElementById(myField).selectionEnd; document.getElementById(myField).value = document.getElementById(myField).value.substring(0, startPos)+ myValue + document.getElementById(myField).value.substring(endPos, document.getElementById(myField).value.length); } else { document.getElementById(myField).value += myValue; } } ";
2519 script.Append("insertAtCursor('");
2520 script.Append(idElement);
2521 script.Append("',");
2522 script.Append("\"");
2523 script.Append(*pString);
2524 script.Append("\");");
2528 else if (nameElement.GetLength() != 0 && pCount->Equals("1",false) == true)
2530 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; } } ";
2531 script.Append("insertAtCursor(document.getElementsByName('");
2532 script.Append(nameElement);
2533 script.Append("')[0],");
2534 script.Append("\"");
2535 script.Append(*pString);
2536 script.Append("\");");
2538 else if(tagElement.GetLength() != 0) //adding for twitter post page
2540 script = L"function insertAtCursor(myField, myValue) { if (document.selection) { document.getElementsByTagName(myField)[0].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 { document.getElementsByTagName(myField)[0].value += myValue; } } ";
2541 script.Append("insertAtCursor(document.getElementsByTagName('");
2542 script.Append(tagElement);
2543 script.Append("')[0],");
2544 script.Append("\"");
2545 script.Append(*pString);
2546 script.Append("\");");
2548 AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
2549 String* pStr = __pWebViewer->EvaluateJavascriptN(script);
2560 case IDA_GO_FORWARD:
2565 case IDA_REFRESH_BTN_CLICKED:
2567 __isLoadingCompleted = false;
2568 __isLoadingData = true;
2569 __progressPercentage = 0;
2570 __displayUrl = __pFooterUrlField->GetText();
2572 String url = __pFooterUrlField->GetText();
2573 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
2575 if (__pWebViewer != null && __pAddressbar != null)
2577 __pWebViewer->Reload();
2578 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
2582 UpdateProgressBitmap();
2585 case IDA_STOP_BTN_CLICKED:
2587 __isLoadingCompleted = false;
2588 __isLoadingData = false;
2589 __progressPercentage = 0;
2590 __pFooterUrlField->HideKeypad();
2591 __displayUrl = __pFooterUrlField->GetText();
2595 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2596 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2597 __pWebViewer->StopLoading();
2598 RequestRedraw(true);
2601 UpdateProgressBitmap();
2606 if (__pFooterUrlField->GetText().IsEmpty() == false)
2608 //__displayUrl = __pUrlField->GetText();
2609 __pFooterUrlField->Clear();
2614 case IDA_READER_BTN_CLICKED:
2625 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
2627 AppLog("MainForm::OnFormBackRequested entered");
2628 result r = E_FAILURE;
2629 if(__pImageMenu && __pImageMenu->GetShowState() == true)
2631 AppLog("Hiding the menu");
2632 __pImageMenu->SetShowState(false);
2634 if (__pWebViewer && __pWebViewer->CanGoBack())
2636 __pWebViewer->GoBack();
2638 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
2641 pApp = UiApp::GetInstance();
2644 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2647 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2655 WindowInfo* pWindowInfo = null;
2657 SceneManager* pSceneManager = SceneManager::GetInstance();
2658 if (pSceneManager == null)
2662 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
2663 if (pAllWindowList == NULL)
2665 pApp = UiApp::GetInstance();
2668 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2671 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2676 if (pAllWindowList != null)
2678 totalCount = pAllWindowList->GetCount();
2680 for (int count = 0; count < totalCount; count++)
2682 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
2683 if (pWindowInfo == null)
2685 pApp = UiApp::GetInstance();
2688 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2691 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2698 if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
2700 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
2703 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2706 r = pAllWindowList->RemoveAt(count, true);
2707 __pWindowInfo = null;
2710 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2715 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
2719 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
2721 if (pWindowInfo == null)
2723 pApp = UiApp::GetInstance();
2726 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2732 if(pWindowInfo != null)
2733 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
2736 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2742 // else if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == false)
2744 // UiApp* pApp = null;
2745 // pApp = UiApp::GetInstance();
2746 // if (pApp != null)
2748 // r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2751 // AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2759 AppLog("MainForm::OnFormBackRequested exit");
2763 MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
2764 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
2767 AppLog("MainForm::OnSceneActivatedN called");
2768 String* pSelectedScene = NULL;
2769 Object* pValue = NULL;
2770 String* pUrl = null;
2771 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
2772 pSelectedScene = (String*) pValue;
2774 if (pSelectedScene != null)
2776 delete pSelectedScene;
2778 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
2779 String* selectedSceneID = new(std::nothrow) String(currentSceneId);
2780 AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
2781 AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer());
2783 // setting the current scene ID
2784 MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId);
2786 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID);
2788 if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
2790 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2791 if(__pWindowInfo == null)
2793 // if(__pWindowInfo == null)
2795 pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
2798 else if ( pArgs != null && pArgs->GetCount() == 1)
2800 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2806 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
2808 // hiding the address bar
2809 // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
2810 __pAddressbar->SetShowState(false);
2811 // if(__pWebViewer != null)
2813 // __pWebViewer->Resume();
2816 if(pUrl != null && pUrl->GetLength() > 0)
2820 else if(__pWindowInfo != null)
2822 if(__pWindowInfo->pageUrl.GetLength() > 0 &&previousSceneId != IDSCN_BRIGHTNESS && previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId.Contains(IDSCN_MAIN_VIEW) == false)
2824 LoadUrl(__pWindowInfo->pageUrl);
2826 else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
2828 LoadUrl(__pWindowInfo->pageUrl);
2829 __pWindowInfo->isAppcontrolTriggered = false;
2831 else if (__pWindowInfo->isJavascriptInitiated == true && __pWindowInfo->isFirstLaunch == true)
2833 __pWindowInfo->isFirstLaunch = false;
2836 __pWindowInfo->pCurrentWeb = __pWebViewer;
2837 if(__pWindowInfo->pageUrl.GetLength() > 0)
2838 LoadUrl(__pWindowInfo->pageUrl);
2842 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
2843 AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
2844 if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
2846 InitMostVisitedSitesView(GetOrientationStatus());
2848 else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
2850 if(__pMostVisitedListView != null)
2852 __pMostVisitedListView->SetShowState(false);
2856 if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
2858 String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
2860 if (pBookmarkUrl == null)
2862 AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
2863 //__pAddressbar->SetUrl(*pBookmarkUrl);
2864 SetUrl(*pBookmarkUrl);
2866 if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
2867 __pWebViewer->LoadUrl(*pBookmarkUrl);
2868 delete pBookmarkUrl;
2871 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
2872 Bitmap* pBitmap = null;
2873 if (isPrivateBrowsing == true)
2875 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
2877 if (__pWebViewer != null)
2879 __pWebViewer->SetPrivateBrowsingEnabled(true);
2882 if (__pAddressbar != null)
2884 // __pAddressbar->UpdateFaviconBitmap(true);
2890 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
2892 if (__pWebViewer != null)
2894 __pWebViewer->SetPrivateBrowsingEnabled(false);
2897 if (__pAddressbar != null)
2899 // __pAddressbar->UpdateFaviconBitmap(false);
2903 if (__pOptionMenu != null && __pOptionMenu->GetItemCount() != 9)
2905 __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2907 else if (__pOptionMenu != null )
2909 __pOptionMenu->SetItemAt(5,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2912 if (pBitmap != null)
2917 RelayoutControls(false);
2918 AppLog("ABC: OnSceneActivatedN started exit");
2923 MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
2924 const Tizen::Ui::Scenes::SceneId& nextSceneId)
2926 Canvas* pWebCanvas = null;
2927 if (__pWebViewer != null)
2929 pWebCanvas = __pWebViewer->GetCanvasN();
2932 if (pWebCanvas == null)
2936 if (__pWindowInfo != null)
2938 if (__pWindowInfo->pWebCanvasBitmap != null)
2940 delete __pWindowInfo->pWebCanvasBitmap;
2942 __pWindowInfo->pWebCanvasBitmap = new(std::nothrow) Bitmap();
2943 result r = __pWindowInfo->pWebCanvasBitmap->Construct(*pWebCanvas,Rectangle(0,0,pWebCanvas->GetBounds().width,pWebCanvas->GetBounds().height));
2944 AppLog("Bitmap Construction result %s",GetErrorMessage(r));
2946 Bitmap* pBitmap = GetCapturedBitmapN();
2947 AppLog("Coming here");
2948 Canvas* pCanvas = new(std::nothrow) Canvas();
2949 pCanvas->Construct(GetClientAreaBounds());
2952 pCanvas->DrawBitmap(Point(0,0),*pBitmap);
2955 if(__pWebViewer != null && __pWindowInfo != null)
2956 pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
2958 WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
2959 WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
2963 __pAddressbar->SetShowState(false);
2964 AppLog("Coming here");
2968 MainForm::OnHttpAuthenticationRequestedN(const Tizen::Base::String& host,
2969 const Tizen::Base::String& realm,
2970 const Tizen::Web::Controls::AuthenticationChallenge& authentication)
2976 MainForm::OnHttpAuthenticationCanceled(void)
2981 MainForm::OnLoadingStarted(void)
2983 AppLogDebug("MainForm::OnLoadingStarted entered");
2985 if(__pAddressbar == NULL || __pWebViewer == null)
2990 // this is added in case if menu is opened and user load the page
2991 if(__pOptionMenu != null && __pOptionMenu->GetShowState() == true)
2993 __pOptionMenu->SetShowState(false);
2994 __pOptionMenu->Invalidate(true);
2999 if(__pImageMenu != null && __pImageMenu->GetShowState() == true)
3001 __pImageMenu->SetShowState(false);
3002 __pImageMenu->Invalidate(true);
3004 String url = __pWebViewer->GetUrl();
3005 if(url.Contains(IDS_TIZEN_SERVICE))
3008 String delim(L":;,");
3010 // Creates a StringTokenizer instance
3011 StringTokenizer strTok(url, delim);
3013 int count = strTok.GetTokenCount(); // count == 4
3015 HashMap *pMap = new HashMap();
3020 while (strTok.HasMoreTokens())
3022 AppLog("Token: %ls", token.GetPointer());
3023 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3024 if(token.Contains(IDS_APPID))
3026 token.SubString(6, appId);
3027 AppLog("AppID:%ls", appId.GetPointer());
3029 else if(token.Contains(IDS_KEY))
3031 token.SubString(4, key);
3032 AppLog("key:%ls", key.GetPointer());
3034 else if(token.Contains(IDS_VALUE))
3036 token.SubString(6, value);
3037 AppLog("value:%ls", value.GetPointer());
3040 pMap->Add(key, value);
3044 AppControl *pAppControl = null;
3045 String operationId = L"http://tizen.org/appcontrol/operation/main";
3046 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3049 AppLog("Starting AppControl");
3050 result r = pAppControl->Start(null, null, pMap, null);
3051 AppLog("Result of Start %s", GetErrorMessage(r));
3055 AppLogException("AppControl not found");
3060 if ( __pAddressbar != null && __pAddressbar->GetShowState() == true)
3062 __pAddressbar->SetShowState(false);
3063 AddressBarCancelledClicked(*__pAddressbar);
3064 __pAddressbar->Invalidate(true);
3066 Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
3069 __pAddressbar->SetFaviconBitmap(*pBitmap);
3072 if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
3074 // updating the address bar position with respect to web control
3075 __adressPanelPosition.y = 0 - __pAddressbar->GetHeight() + 12; //-12 is for the progress label
3076 __distanceMoved = 0;
3080 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3081 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3082 if (__pWebViewer != null)
3084 AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
3085 //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
3086 SetUrl(__pWebViewer->GetUrl());
3087 if (__pWindowInfo != NULL)
3089 // resetting the page title to blank, it will be received in OnPageTitleReceived()
3090 __pWindowInfo->pageTitle = L"";
3091 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3093 __pAddressbar->Invalidate(true);
3099 MainForm::OnLoadingCanceled(void)
3106 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
3108 AppLog("XYZ::MainForm::OnKeypadWillOpen");
3113 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
3115 AppLog("XYZ::MainForm::OnKeypadOpened");
3116 __isKeypadOpened = true;
3117 __pFooterPanel->SetShowState(false);
3122 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
3124 AppLog("XYZ::MainForm::OnKeypadClosed");
3125 __isKeypadOpened = false;
3126 __pFooterPanel->SetShowState(true);
3127 RelayoutControls(true);
3131 MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
3133 AppLog("XYZ::KeypadBoundsChanged");
3134 RelayoutControls(false);
3138 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
3139 const Tizen::Base::String& reason)
3141 AppLogDebug("Error: %d, %ls", error, reason.GetPointer());
3145 MainForm::OnLoadingCompleted(void)
3147 AppLog("MainForm::OnLoadingCompleted start");
3149 result r = E_SUCCESS;
3151 if (__pWebViewer == null)
3156 if (__pAddressbar == null)
3161 if(__pImageMenu && __pImageMenu->GetShowState())
3163 __pImageMenu->SetShowState(false);
3164 __pImageMenu->Invalidate(true);
3167 if (__pWebViewer->CanGoForward())
3169 //__pAddressbar->SetForwardButtonEnabled(true);
3170 SetForwardButtonEnabled(true);
3174 //__pAddressbar->SetForwardButtonEnabled(false);
3175 SetForwardButtonEnabled(false);
3178 /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3180 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3182 //__pAddressbar->UpdateProgress(0);
3186 if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3188 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3192 AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
3193 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
3194 if (isPrivateBrowsing == false)
3196 if(__pHistory != null)
3202 __pHistory = new(std::nothrow) History;
3203 HistoryPresentationModel::GetCurrentDateTime(date);
3206 __pHistory->SetHistoryTitle(__pWindowInfo->pageTitle);
3207 AppLogDebug("MainForm::OnLoadingCompleted pagetitle = %ls", __pWindowInfo->pageTitle.GetPointer());
3209 __pHistory->SetHistoryUrl(__pWindowInfo->pageUrl);
3210 AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
3212 __pHistory->SetVisitedTime(date);
3214 if (__pWebViewer != null)
3216 AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
3218 Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
3219 if (pTempBitmap != null)
3221 AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
3222 __pHistory->SetFavIconBitmap(*pTempBitmap);
3225 AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
3228 Canvas* pCanvas = __pWebViewer->GetCanvasN();
3229 Bitmap* pBitmap = new(std::nothrow) Bitmap();
3230 if ( pCanvas != null && pCanvas != null && pBitmap != null)
3232 pBitmap->Construct(*pCanvas, pCanvas->GetBounds());
3233 pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
3234 __pHistory->SetThumbnail(pBitmap);
3236 Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
3239 __pHistory->SetFavIconBitmap(*pFavIcon);
3243 HistoryPresentationModel::GetInstance()->SaveTempHistory(*__pHistory);
3250 // if (__pWindowInfo && __pWindowInfo->faviconUrl == "")
3252 // temperary fixed (webpage can be not loaded)
3256 bool isReaderEnabled = SettingPresentationModel::GetInstance()->IsRunReaderEnabled();
3257 if (isReaderEnabled == true)
3261 delete __pReaderData;
3262 __pReaderData = null;
3264 String filePath = Tizen::App::UiApp::GetInstance()->GetAppRootPath();
3265 filePath.Append(L"data/reader.js");
3271 result r = E_SUCCESS;
3272 FileAttributes attr;
3274 File::GetAttributes(filePath,attr);
3276 r = file.Construct(filePath, L"r+");
3279 AppLogDebug("File construct failed with %s", GetErrorMessage(r));
3282 char* pScript = new(std::nothrow) char[attr.GetFileSize()+1];
3285 AppLogDebug("Memory allocation for file failed %s", GetErrorMessage(r));
3288 // file.Read(pScript,attr.GetFileSize());
3290 // AppLogDebug("scipt length %d",strlen(pScript));
3291 String strScript = L"";
3292 // strScript.Append(pScript);
3293 // for(int i=0; i<25; i++)
3295 file.Read(pScript,attr.GetFileSize());
3296 // AppLog("xyzz tell %d",file.Tell());
3297 // r = strScript.Append(pScript);
3298 // AppLog("xyzz append result %s",GetErrorMessage(r));
3299 // AppLog("xyzz strScript length %d",strScript.GetLength());
3301 // AppLog("xyzz final strScript length %d",strScript.GetLength());
3303 __pReaderData = __pWebViewer->EvaluateJavascriptN(pScript);
3304 if (__pReaderData == null)
3306 AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult()));
3307 __pReaderData = new String(L"<meta name=\"viewport\" content=\"width=0, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi\"> <h1>Chinese PM Li Keqiang vows to open up markets to India</h1><div><span class=\"arttle\"><h1>Chinese PM Li Keqiang vows to open up markets to India</h1></span></div>");
3310 AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
3311 if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
3313 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3314 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3320 AppLog("MainForm::OnLoadingCompleted done");
3324 MainForm::OnEstimatedProgress(int progress)
3326 AppLogDebug("MainForm::OnEstimatedProgress entered %d",progress);
3328 if (progress < DEFAULT_PROGRESS_PERCENTAGE)
3329 progress = DEFAULT_PROGRESS_PERCENTAGE;
3331 // __pAddressbar->UpdateProgress(progress);
3332 UpdateProgress(progress);
3335 void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
3337 AppLog("MainForm::OnFaviconReceived");
3338 if (__pWebViewer != null && __pHistory != null && __pWindowInfo != null && (__pWindowInfo->pageUrl.CompareTo(__pHistory->GetHistoryUrl()) == 0))
3340 Bitmap* favIcon = __pWebViewer->GetFaviconN();
3343 HistoryPresentationModel::GetInstance()->UpdateHistoryFavIcon(*__pHistory, *favIcon);
3350 MainForm::OnUrlValueChanged(Addressbar&)
3356 MainForm::OnUrlSubmitted(Addressbar& addBar)
3358 AppLog("MainForm::OnUrlSubmitted");
3359 String url = addBar.GetUrl();
3360 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
3362 if(__pFooterUrlField)
3363 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
3364 AddressBarCancelledClicked(*__pAddressbar);
3369 MainForm::LoadUrl(String& url)
3373 // UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3374 AppLogDebug("MainForm::LoadUrl enter");
3376 if (__pWebViewer != null)
3378 __pWebViewer->SetShowState(true);
3379 __pWebViewer->Invalidate(true);
3382 if (url.CompareTo(L"") == 0)
3386 if(__pFooterPanel != null)
3388 __pFooterPanel->SetShowState(true);
3389 __pFooterPanel->Invalidate(true);
3396 String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");
3397 String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9!\+-=:#@%/;$~()_?\\\.&]{2,}$"); // URL of type abc.com (i.e without protocol in front of it)
3399 RegularExpression firstRegex;
3400 RegularExpression secondRegex;
3402 firstRegex.Construct(firstPattern, REGEX_CASELESS);
3403 secondRegex.Construct(secondPattern, REGEX_CASELESS);
3406 ret = firstRegex.Match(url, false); // This returns true value
3407 flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it)
3409 if (ret == true && __pWebViewer != null)
3412 __pWebViewer->LoadUrl(url);
3414 else if(__pWebViewer != null)
3416 String tempUrl = L"http://";
3417 tempUrl.Append(url);
3421 __pWebViewer->LoadUrl(tempUrl);
3425 UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3426 __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
3429 if (__pAddressbar != null)
3431 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3432 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3435 AppLogDebug("MainForm::LoadUrl exit");
3442 MainForm::OnFocusGained(const Tizen::Ui::Control& source)
3444 AppLog("MainForm::OnFocusGained");
3447 __pFooterPanel->SetShowState(false);
3452 __pAddressbar->SetShowState(true);
3453 __pAddressbar->SetAddressbarURLFocus();
3455 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3457 __currentSearchStr = L"";
3458 __currentWordIndex = 0;
3459 __maxOccurrances = 0;
3461 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
3463 __pFindWordEditField->SetText(L"");
3464 __pFindWordEditField->HideKeypad();
3465 __pFindWordControl->SetShowState(false);
3466 __pFindWordCountLabel->SetText(L"0/0");
3468 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
3470 __pFindWordEditFieldRightToLeft->SetText(L"");
3471 __pFindWordEditFieldRightToLeft->HideKeypad();
3472 __pFindWordControl->SetShowState(false);
3473 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
3476 __pFindWordNext->SetEnabled(false);
3477 __pFindWordPrev->SetEnabled(false);
3479 __pWebViewer->SearchTextAllAsync(L"",true);
3480 __pFindWordControl->SetShowState(false);
3482 RelayoutControls(false);
3486 MainForm::OnFocusLost(const Tizen::Ui::Control& source)
3488 AppLog("MainForm::OnFocusLost called");
3492 MainForm::OnStopClicked(Addressbar& addBar)
3494 AppLogDebug("MainForm::OnStopClicked called");
3497 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3498 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3499 __pWebViewer->StopLoading();
3500 RequestRedraw(true);
3505 MainForm::OnBackClicked(/*const Addressbar& addBar*/)
3507 // AppLog("MainForm::OnBackClicked");
3508 result r = E_FAILURE;
3509 if(__pImageMenu && __pImageMenu->GetShowState() == true)
3511 AppLog("Hiding the menu");
3512 __pImageMenu->SetShowState(false);
3515 if (__pWebViewer && __pWebViewer->CanGoBack())
3517 __pWebViewer->GoBack();
3519 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
3522 pApp = UiApp::GetInstance();
3525 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3528 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3536 WindowInfo* pWindowInfo = null;
3538 SceneManager* pSceneManager = SceneManager::GetInstance();
3539 if (pSceneManager == null)
3543 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
3544 if (pAllWindowList == NULL)
3546 pApp = UiApp::GetInstance();
3549 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3552 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3557 if (pAllWindowList != null)
3559 totalCount = pAllWindowList->GetCount();
3561 for (int count = 0; count < totalCount; count++)
3563 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
3564 if (pWindowInfo == null)
3566 pApp = UiApp::GetInstance();
3569 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3572 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3577 if (pSceneManager != null && pWindowInfo != null && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
3579 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
3582 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3585 r = pAllWindowList->RemoveAt(count, true);
3586 __pWindowInfo = null;
3589 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3594 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
3596 else if(pAllWindowList->GetCount() > 0)
3598 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
3602 pApp = UiApp::GetInstance();
3605 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3610 if (pWindowInfo == null)
3612 pApp = UiApp::GetInstance();
3615 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3621 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
3622 // r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
3625 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3639 MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
3641 AppLog("MainForm::OnForwardClicked");
3642 if (__pWebViewer == null)
3645 if (__pWebViewer->CanGoForward())
3647 __pWebViewer->GoForward();
3652 MainForm::OnAddressBarFocusGained(const Addressbar& addBar)
3654 AppLog("XYZ::MainForm::OnAddressBarFocusGained");
3655 if(__pFooterPanel != null)
3657 __pFooterPanel->SetShowState(false);
3660 if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
3662 __pAddressbar->SetShowState(true);
3663 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3666 RelayoutControls(false);
3670 MainForm::OnAddressBarFocusLost(const Addressbar& addBar, bool addressbarKeyPadState)
3672 AppLog("XYZ::MainForm::OnAddressBarFocusLost");
3674 int Height = GetClientAreaBounds().height;
3675 AppLog("MainForm::OnAddressBarFocusLost height is %d",Height);
3677 RelayoutControls(false);
3681 MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
3683 AddressBarCancelledClicked(addBar);
3687 MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
3689 __prevAddressBarMode = __curAddressBarMode;
3691 if (__pAddressbar != null)
3693 __curAddressBarMode = GetAddressbarMode();
3696 if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
3698 __adressPanelPosition.y = 0;
3699 if (__pAddressbar != null)
3701 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
3702 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3703 __pAddressbar->Invalidate(true);
3705 if (__pWebViewer != null)
3707 __pWebViewer->StopLoading();
3710 else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
3712 __adressPanelPosition.y = 0;
3713 if (__pAddressbar != null)
3715 __webControlPosition.y = 0;
3716 __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
3717 __pAddressbar->Invalidate(true);
3723 MainForm::OnClipboardClosed(const Addressbar& addBar)
3725 AppLog("XYZ::MainForm::OnClipboardClosed");
3726 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3728 AppLog("akjshdasd 3");
3729 __pFooterPanel->SetShowState(true);
3731 __isKeypadOpened = false;
3732 RelayoutControls(false);
3736 MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
3738 AppLog("XYZ::MainForm::OnAddressBarKeypadClosed");
3739 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3741 AppLog("akjshdasd 3");
3742 __pFooterPanel->SetShowState(true);
3744 __isKeypadOpened = false;
3745 if(__pNotification && __pNotification->GetShowState())
3747 __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
3750 RelayoutControls(false,footerState);
3754 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
3756 AppLog("XYZ::MainForm::OnAddressBarKeypadOpened");
3757 __isKeypadOpened = true;
3758 if(__pNotification && __pNotification->GetShowState())
3760 __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
3762 RelayoutControls(false);
3766 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
3768 __isKeypadOpened = true;
3769 __pFooterPanel->SetShowState(false);
3773 MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
3775 AppLog("XYZ::MainForm::OnAddressBarKeypadBoundsChanged");
3776 RelayoutControls(false);
3780 MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
3782 AppLog("MainForm::OnPageTitleReceived %ls",title.GetPointer());
3785 __pWindowInfo->pageTitle = title;
3786 if (__pWebViewer != null)
3788 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3789 AppLog("MainForm::OnPageTitleReceived url %ls",__pWindowInfo->pageUrl.GetPointer());
3792 if (__pAddressbar != null && __pWebViewer != null)
3794 SetUrl(__pWebViewer->GetUrl());
3795 __pAddressbar->Invalidate(true);
3800 MainForm::UpdateFavicon(void)
3802 bool urlImageType = false;
3803 String *tempPath = null;
3805 tempPath = __pWebViewer->EvaluateJavascriptN(L"var getFavicon = function() { var favicon = '/favicon.ico'; var nodeList = document.getElementsByTagName('link'); if(nodeList) { for (var i = 0; i < nodeList.length; i++) { if ((nodeList[i].getAttribute('rel') == 'icon')||(nodeList[i].getAttribute('rel') == 'shortcut icon')) { favicon = nodeList[i].getAttribute('href'); } } } return favicon; }; getFavicon();");
3806 Bitmap* pBitmap = null;
3808 if (tempPath && tempPath->GetLength() > 0 && tempPath->CompareTo(L"undefined") != 0)
3810 if (__pWindowInfo != null)
3813 url.SetUri(*tempPath);
3814 if (url.GetHost().GetLength() == 0)
3818 webUrl.SetUri(__pWebViewer->GetUrl());
3819 result r = url.SetHost(webUrl.GetHost());
3826 if (url.GetScheme().GetLength() == 0)
3830 webUrl.SetUri(__pWebViewer->GetUrl());
3831 url.SetScheme(webUrl.GetScheme());
3833 __pWindowInfo->faviconUrl = url.ToString();
3835 pBitmap = __pWebViewer->GetFaviconN();
3837 if (pBitmap != null)
3839 if (__pWindowInfo->pFavicon != NULL)
3841 __pWindowInfo->pFavicon = null;
3843 __pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
3844 __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
3846 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3848 FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
3850 else if(__pWindowInfo->pFavicon != null)
3852 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3856 Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
3857 if(pDefaultBmp != null)
3859 __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
3873 if(tempPath != null)
3877 AppLogDebug("Error occured: %s", GetErrorMessage(GetLastResult()));
3883 MainForm::OnLoadingRequested(const Tizen::Base::String& url,
3884 Tizen::Web::Controls::WebNavigationType type)
3886 AppLog("urlk %ls",url.GetPointer());
3887 // when load new page if find word panel is open its show state is false
3888 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3890 __currentSearchStr = L"";
3891 __currentWordIndex = 0;
3892 __maxOccurrances = 0;
3893 __pFindWordEditField->SetText(L"");
3894 __pFindWordNext->SetEnabled(false);
3895 __pFindWordPrev->SetEnabled(false);
3896 __pFindWordCountLabel->SetText(L"0/0");
3897 __pFindWordControl->SetShowState(false);
3898 __pFindWordEditField->HideKeypad();
3899 RelayoutControls(false);
3902 __pFooterPanel->Invalidate(true);
3905 uriInfo.SetUri(url);
3907 if(url.Contains(IDS_TIZEN_SERVICE))
3910 String delim(L":;,");
3912 // Creates a StringTokenizer instance
3913 StringTokenizer strTok(url, delim);
3915 int count = strTok.GetTokenCount(); // count == 4
3917 HashMap *pMap = new HashMap();
3923 while (strTok.HasMoreTokens())
3925 AppLog("Token: %ls", token.GetPointer());
3926 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3927 if(token.Contains(IDS_APPID))
3929 token.SubString(6, appId);
3930 AppLog("AppID:%ls", appId.GetPointer());
3932 else if(token.Contains(IDS_KEY))
3934 token.SubString(4, key);
3935 AppLog("key:%ls", key.GetPointer());
3937 else if(token.Contains(IDS_VALUE))
3939 token.SubString(6, value);
3940 AppLog("value:%ls", value.GetPointer());
3943 pMap->Add(key, value);
3947 AppControl *pAppControl = null;
3948 String operationId = L"http://tizen.org/appcontrol/operation/main";
3949 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3952 result r = pAppControl->Start(null, null, pMap, null);
3956 AppLogException("AppControl not found");
3966 MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
3967 const Tizen::Net::Http::HttpHeader& httpHeader)
3969 return Tizen::Web::Controls::WEB_DECISION_CONTINUE;
3973 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
3975 AppLog("MainForm::OnWebPageBlockSelected");
3976 // if(__isLongPressedDone == false)
3979 if (__pHitElementResult != null)
3981 delete __pHitElementResult;
3982 __pHitElementResult = null;
3985 if (__pWebViewer != null)
3987 AppLog("MainForm::OnWebPageBlockSelected web not null");
3988 __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
3990 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
3992 AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
3993 __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
3994 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
3996 __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
3998 AppLog("datafirst endpoint error %s",GetErrorMessage(GetLastResult()));
4002 if (__pHitElementResult == null)
4007 if (__pHitElementResult->HasImage() != true)
4009 String tagName = __pHitElementResult->GetTagName();
4010 String type = __pHitElementResult->GetAttributeValue("type");
4013 AppLog("TagName %ls",tagName.GetPointer());
4014 __currentSelectedStr.Clear();
4015 AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
4016 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4017 AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
4018 if(tagName.Equals(L"TEXTAREA",false) == true)
4020 AppLog("Tagnameseemstobe TEXTAREA");
4022 else if(tagName.Equals(L"INPUT",false) == true)
4024 AppLog("Tagnameseemstobe INPUT");
4027 if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
4029 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4031 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
4034 __pImageMenu->SetShowState(true);
4035 __pImageMenu->Show();
4036 __pImageMenu->Invalidate(true);
4039 else /*if(__isLongPressedDone == true)*/
4041 AppLog("MainForm::OnWebPageBlockSelected no paste option");
4043 if(__pHitElementResult->GetUrl().GetLength() > 0)
4045 __currentSelectedStr.Clear();
4046 __currentSelectedStr = __pHitElementResult->GetUrl();
4048 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
4051 __pImageMenu->SetShowState(true);
4052 __pImageMenu->Show();
4053 __pImageMenu->Invalidate(true);
4057 AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
4058 AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
4059 AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
4065 MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source)
4071 MainForm::OnWebWindowCreateRequested(void)
4073 AppLog("MainForm::OnWebWindowCreateRequested entered");
4074 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
4076 if (pNewWindowInfo == null)
4080 result r = E_SUCCESS;
4081 SceneManager* pSceneManager = SceneManager::GetInstance();
4082 if (pSceneManager == NULL)
4086 ArrayList* pArgList = new(std::nothrow) ArrayList();
4087 if (pArgList == NULL)
4091 r = pArgList->Construct();
4094 pNewWindowInfo->isJavascriptInitiated = true;
4095 pArgList->Add(*pNewWindowInfo);
4096 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
4100 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
4107 return pNewWindowInfo->pCurrentWeb;
4111 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
4113 AppLog("xyz:: MainForm::RelayoutControls called");
4114 __webControlPosition.y = 0;
4115 __webControlHeight = GetClientAreaBounds().height;
4116 AppLog("Client area height: %d", __webControlHeight);
4118 AppLog("Client area height: %d", __webControlHeight);
4119 if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
4121 __webControlPosition.y += __pAddressbar->GetHeight();
4122 __webControlHeight -= __pAddressbar->GetHeight();
4123 __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
4125 else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
4127 __webControlPosition.y += __pFindWordControl->GetHeight();
4128 __webControlHeight -= __pFindWordControl->GetHeight();
4129 __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
4132 if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true && relayoutFooter == true)
4134 __webControlHeight -= __pFooterPanel->GetHeight();
4136 __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
4137 __webControlHeight = __webControlHeight + 12;
4139 if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
4141 if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight )
4146 __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight );
4147 AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
4148 __pWebViewer->Invalidate(false);
4151 if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
4153 __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
4160 MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
4162 if (__pFindWordControl == null)
4167 Tizen::Locales::LocaleManager localeManager;
4168 Tizen::Locales::Locale local = localeManager.GetSystemLocale();
4170 String languageCode;
4171 result r = SettingInfo::GetValue(L"Language", languageCode);
4172 // int languagecode = local.GetLanguageCode();
4173 AppLog("rahul language is %S", languageCode.GetPointer());
4177 InitFindWordPanel();
4179 if (languageCode.CompareTo("ara") == 0)
4181 AppLog("rahul language is arabic");
4183 __pFindWordPanelLeftToRight->SetShowState(false);
4184 __pFindWordPanelRightToLeft->SetShowState(true);
4186 __pFindWordClear->SetShowState(false);
4187 __pFindWordCountLabel->SetShowState(false);
4188 __pFindWordEditField->SetShowState(false);
4190 __pFindWordClearRightToLeft->SetShowState(true);
4191 __pFindWordCountLabelRightToLeft->SetShowState(true);
4192 __pFindWordEditFieldRightToLeft->SetShowState(true);
4196 AppLog("rahul language is not arabic");
4199 __pFindWordPanelLeftToRight->SetShowState(true);
4200 __pFindWordPanelRightToLeft->SetShowState(false);
4202 __pFindWordClear->SetShowState(true);
4203 __pFindWordCountLabel->SetShowState(true);
4204 __pFindWordEditField->SetShowState(true);
4206 __pFindWordClearRightToLeft->SetShowState(false);
4207 __pFindWordCountLabelRightToLeft->SetShowState(false);
4208 __pFindWordEditFieldRightToLeft->SetShowState(false);
4210 __pFindWordControl->SetShowState(true);
4214 if(__pFindWordControl != null)
4216 __pFindWordControl->SetShowState(false);
4220 AppLog("MainForm::ShowFindWordPanel %d",show);
4221 if (show && !isTouchPressed)
4223 if (languageCode.CompareTo("ara") == 0)
4225 if (__pFindWordEditFieldRightToLeft)
4227 __pFindWordEditFieldRightToLeft->SetFocus();
4228 __pFindWordEditFieldRightToLeft->ShowKeypad();
4233 if (__pFindWordEditField)
4235 __pFindWordEditField->SetFocus();
4236 __pFindWordEditField->ShowKeypad();
4242 if (languageCode.CompareTo("ara") == 0)
4244 if (__pFindWordEditFieldRightToLeft)
4245 __pFindWordEditFieldRightToLeft->HideKeypad();
4249 if (__pFindWordEditField)
4250 __pFindWordEditField->HideKeypad();
4254 RelayoutControls(false);
4258 MainForm::StartWordSearch()
4260 //Get the count of occurances of the word in the current page
4261 __maxOccurrances = 0;
4262 __currentWordIndex = 0;
4264 __pFindWordPrev->SetEnabled(false);
4265 String *pCountStr = null;
4266 result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
4267 AppLog("Search Result %s",GetErrorMessage(r));
4268 /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;");
4269 if (pCountStr != null)
4271 Integer::Parse(*pCountStr, 10, __maxOccurrances);
4275 AppLogDebug("'%ls' is found %d times", __currentSearchStr.GetPointer(), __maxOccurrances);
4280 void MainForm::OnTextFound(int totalCount, int currentOrdinal)
4282 AppLog("MainForm::OnTextFound totalCount %d",totalCount);
4283 AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
4285 if(totalCount == -1 || totalCount == 0)
4287 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
4288 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
4291 else if(totalCount > 100)
4293 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4294 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4298 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4299 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4302 __maxOccurrances = totalCount;
4303 __currentWordIndex = currentOrdinal;
4305 //Reset the UI controls as per the maxOccurrance value
4306 if (totalCount <= 0)
4308 AppLog("Word not found");
4309 //Show error notification to user
4310 __pFindWordNext->SetEnabled(false);
4311 if(__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4313 __pFindWordCountLabel->SetText(L"0/0");
4314 __pFindWordCountLabel->Invalidate(false);
4316 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4318 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4319 __pFindWordCountLabelRightToLeft->Invalidate(false);
4321 __pFindWordNext->Invalidate(false);
4322 __pFindWordPrev->Invalidate(false);
4327 if (totalCount == 1 || totalCount == currentOrdinal)
4329 __pFindWordNext->SetEnabled(false);
4333 __pFindWordNext->SetEnabled(true);
4336 String countStr = L"";
4337 countStr.Append(__currentWordIndex);
4338 countStr.Append(L"/");
4339 countStr.Append(__maxOccurrances);
4340 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4342 __pFindWordCountLabel->SetText(countStr);
4343 __pFindWordCountLabel->Invalidate(false);
4344 __pFindWordCountLabel->Invalidate(false);
4346 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4348 __pFindWordCountLabelRightToLeft->SetText(countStr);
4349 __pFindWordCountLabelRightToLeft->Invalidate(false);
4350 __pFindWordCountLabelRightToLeft->Invalidate(false);
4352 //FindNextWord(true);
4353 //Update the controls
4354 __pFindWordNext->Invalidate(false);
4355 __pFindWordPrev->Invalidate(false);
4360 MainForm::FindNextWord(bool next)
4364 //if (__pWebViewer->SearchText(__currentSearchStr, true) == true)
4365 if (__pWebViewer->SearchNextAsync(true) == E_SUCCESS)
4367 if (__currentWordIndex < __maxOccurrances)
4369 __currentWordIndex++;
4375 //if (__pWebViewer->SearchText(__currentSearchStr, false) == true)
4376 if (__pWebViewer->SearchNextAsync(false) == E_SUCCESS)
4378 if(__currentWordIndex > 1)
4380 __currentWordIndex--;
4385 String countStr = L"";
4386 countStr.Append(__currentWordIndex);
4387 countStr.Append(L"/");
4388 countStr.Append(__maxOccurrances);
4390 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4392 __pFindWordCountLabel->SetText(countStr);
4393 __pFindWordCountLabel->Invalidate(false);
4395 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4397 __pFindWordCountLabelRightToLeft->SetText(countStr);
4398 __pFindWordCountLabelRightToLeft->Invalidate(false);
4401 if (__currentWordIndex >= __maxOccurrances)
4403 __pFindWordNext->SetEnabled(false);
4407 __pFindWordNext->SetEnabled(true);
4409 if (__currentWordIndex <= 1)
4411 __pFindWordPrev->SetEnabled(false);
4415 __pFindWordPrev->SetEnabled(true);
4417 __pFindWordPrev->Invalidate(false);
4418 __pFindWordNext->Invalidate(false);
4420 __pFindWordControl->Invalidate(true);
4424 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
4426 AppLog("xyz::MainForm::OnWebKeypadWillOpen");
4427 __isKeypadOpened = true;
4428 __pFooterPanel->SetShowState(false);
4429 // OnAddressBarKeypadOpened(*__pAddressbar);
4433 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
4435 __isKeypadOpened = true;
4436 AppLog("xyz::MainForm::OnWebKeypadOpened");
4438 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4440 __currentSearchStr = L"";
4441 __currentWordIndex = 0;
4442 __maxOccurrances = 0;
4443 __pFindWordEditField->SetText(L"");
4444 __pFindWordNext->SetEnabled(false);
4445 __pFindWordPrev->SetEnabled(false);
4446 __pFindWordCountLabel->SetText(L"0/0");
4447 __pWebViewer->SearchTextAllAsync(L"",false);
4448 __pFindWordControl->SetShowState(false);
4449 __pFindWordEditField->HideKeypad();
4453 if (__pWebViewer != null && __pFooterPanel != null)
4455 AppLog("MainForm::OnWebKeypadOpened GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
4456 if(__pAddressbar != null)
4458 __pAddressbar->SetShowState(false);
4460 if(__pFindWordControl != null)
4462 __pFindWordControl->SetShowState(false);
4464 __pFooterPanel->SetShowState(false);
4465 __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
4467 // if(__pImageMenu && __pImageMenu->GetShowState() == true)
4469 // __pImageMenu->SetAnchorPosition(Point(__pImageMenu->GetAnchorPosition().x/2,__pImageMenu->GetAnchorPosition().y/2));
4470 // AppLog("omgomgomg");
4476 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
4478 AppLog("abcde::MainForm::OnWebKeypadClosed");
4479 AppLog("xyz::MainForm::OnWebKeypadClosed");
4480 AppLog("akjshdasd 4");
4481 __pFooterPanel->SetShowState(true);
4482 // OnAddressBarKeypadClosed(*__pAddressbar);
4483 RelayoutControls(false);
4484 __isKeypadOpened = false;
4487 if(__pImageMenu && __pImageMenu->GetShowState() == true)
4489 AppLog("abcde: imagemenu visible.");
4492 __pWebViewer->GetBlockRange(p,q);
4493 __pImageMenu->SetAnchorPosition(p);
4494 __pImageMenu->Show();
4500 MainForm::OnWebKeypadBoundsChanged(Tizen::Web::Controls::Web& source)
4502 // RelativeLayout(false);
4503 if(__pWebViewer != null)
4505 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,GetClientAreaBounds().height));
4510 MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
4512 Control* temp = const_cast< Control* >(&source);
4513 Header* pHeader = dynamic_cast< Header* >(temp);
4514 if (pHeader != null)
4516 //Header double - clicked
4517 AppLog("Header double clicked");
4519 if(__pFindWordControl)
4521 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
4522 ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
4526 AppLog("MainScene::OnTouchDoublePressed");
4530 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4532 AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
4533 if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
4535 AppLog("Returning because of more than one touch point.");
4538 __longPressPoint = currentPosition;
4540 if (__pHitElementResult != null)
4542 delete __pHitElementResult;
4543 __pHitElementResult = null;
4546 if (__pWebViewer != null)
4548 AppLog("MainForm::OnTouchLongPressed web not null");
4549 __pHitElementResult = __pWebViewer->GetElementByPointN(currentPosition);
4552 if (__pHitElementResult == null)
4557 if (__pHitElementResult->HasImage() == true)
4559 if(__pWebViewer != null)
4560 InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4561 __pImageMenu->SetShowState(true);
4562 __pImageMenu->Show();
4563 __pImageMenu->Invalidate(true);
4565 else if(__pHitElementResult->HasUrl() == true)
4567 String tempURl = __pHitElementResult->GetUrl();
4568 AppLog("tempURl is %ls", tempURl.GetPointer());
4569 const Bitmap* pBitmap = __pHitElementResult->GetImage();
4570 if (pBitmap != null)
4578 InitImageLinkContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4579 __pImageMenu->SetShowState(true);
4580 __pImageMenu->Show();
4581 __pImageMenu->Invalidate(true);
4585 String tagName = __pHitElementResult->GetTagName();
4586 String type = __pHitElementResult->GetAttributeValue("type");
4587 String value = __pHitElementResult->GetAttributeValue(L"value");
4588 String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
4590 __currentSelectedStr.Clear();
4591 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4593 AppLog("tag name is %ls", tagName.GetPointer());
4594 AppLog("type is %ls", type.GetPointer());
4598 __isLongPressedDone = true;
4599 result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
4600 if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) && innerHtml.GetLength() == 0 && type.Equals(L"submit",false) !=true && type.Equals(L"range",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
4602 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4604 InitSelectTextContextMenu(Point(currentPosition.x , currentPosition.y + __pWebViewer->GetY()),true, true);
4607 __pImageMenu->SetShowState(true);
4608 __pImageMenu->Show();
4609 __pImageMenu->Invalidate(true);
4612 AppLog("setselectionselectedornot %s",GetErrorMessage(r));
4615 // __inputEventToBeSupressed = true;
4619 MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4621 AppLog("xyz:: MainForm::OnTouchReleased called");
4623 if (__pAddressbar && __pAddressbar->GetShowState() == true)
4625 __pAddressbar->SetShowState(false);
4627 if(__pFooterPanel && __isKeypadOpened == false)
4629 __pFooterPanel->SetShowState(true);
4633 /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
4634 if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true)
4636 __pWebViewer->ConsumeInputEvent();
4638 if(pHitElement != null)
4642 __inputEventToBeSupressed = false;*/
4646 MainForm::OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4653 MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4655 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4657 __currentSearchStr = L"";
4658 __currentWordIndex = 0;
4659 __maxOccurrances = 0;
4661 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
4663 __pFindWordEditField->SetText(L"");
4664 __pFindWordEditField->HideKeypad();
4665 __pFindWordControl->SetShowState(false);
4666 __pFindWordCountLabel->SetText(L"0/0");
4668 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
4670 __pFindWordEditFieldRightToLeft->SetText(L"");
4671 __pFindWordEditFieldRightToLeft->HideKeypad();
4672 __pFindWordControl->SetShowState(false);
4673 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4676 __pFindWordNext->SetEnabled(false);
4677 __pFindWordPrev->SetEnabled(false);
4679 __pWebViewer->SearchTextAllAsync(L"",true);
4680 __pFindWordControl->SetShowState(false);
4682 AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
4683 if(__pAddressbar->GetShowState() == false)
4685 __pAddressbar->SetAddressbarURLFocus();
4686 __pFooterPanel->SetShowState(false);
4693 MainForm::OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4699 MainForm::OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4705 MainForm::OnPreviewTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4711 MainForm::OnPreviewTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4717 MainForm::OnPreviewTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4723 MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
4725 AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
4726 int widthContextItem = 0;
4727 if(__pFindWordCountLabel)
4728 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4729 // As per the platform engineer comment removed this line
4730 /*if(__pWebViewer != null)
4732 // this is added because if any text is selected on long press followed by on rotation we are hiding the context menu therefore we should release the text block also
4733 __pWebViewer->ReleaseBlock();
4736 // if(__pFindWordControl != null)
4737 // ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
4739 if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
4741 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4743 AppLog(" Orientation landscape");
4744 __pOptionMenu->SetMaxVisibleItemsCount(5);
4748 AppLog(" Orientation potrait");
4749 __pOptionMenu->SetMaxVisibleItemsCount(6);
4752 if(__pNotification && __pNotification->GetShowState() == true)
4754 __pNotification->SetShowState(false);
4755 __pNotification->Invalidate(false);
4757 if ( __pFooterLabel != null)
4759 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
4762 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
4768 if (__pFindWordBgLabel != null)
4770 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
4771 if (pBitmap != null)
4773 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
4778 if (__pFindWordBgLabelRightToLeft != null)
4780 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
4781 if (pBitmap != null)
4783 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
4789 // if(__pOptionMenu != null)
4790 // __pOptionMenu->SetShowState(false);
4792 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4794 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
4798 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
4803 AppLog("__pFooterPanel->GetShowState() is true");
4805 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
4806 __pFooterPanel->Invalidate(true);
4810 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
4811 if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
4813 InitMostVisitedSitesView(orientationStatus);
4816 RelayoutControls(false);
4817 if (__pArticleReaderPanel != null)
4819 if (__pArticleReaderPanel->GetShowState() == true)
4821 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
4823 if (__pBlankPanel != null)
4824 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
4826 if (__pWebReader != null)
4828 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight() - 96));
4830 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4831 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4833 if ( pBitmap != null && pSrcBitmap != null)
4835 AppLog("CreateReaderPanel ninepatchbitmap found");
4836 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
4839 __pArticleReaderLabel->SetBounds(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()));
4840 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
4841 if (pBitmap != null)
4846 if (pSrcBitmap != null)
4855 if (__pAddressbar != null)
4857 int width = GetClientAreaBounds().width;
4858 __pAddressbar->OrientationChanged(width);
4863 MainForm::OnSettingsChange(int settingvalue)
4865 AppLogDebug("MainForm::OnSettingsChange entered");
4867 if(settingvalue == (int)REGISTRY_SETTING_HOMEPAGE)
4869 __pAddressbar->ResetGuideText();
4871 if (__pWebViewer == null)
4873 AppLogDebug("Webviewer is not initialized yet.");
4877 if (settingvalue == (int) REGISTRY_SETTING_DEFAULT_VIEW)
4879 WebSetting settings = __pWebViewer->GetSetting();
4880 if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
4882 settings.SetAutoFittingEnabled(true);
4884 else if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_READABLE")) == 0)
4886 settings.SetAutoFittingEnabled(false);
4888 __pWebViewer->SetSetting(settings);
4890 else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
4892 WebSetting settings = __pWebViewer->GetSetting();
4893 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
4894 __pWebViewer->SetSetting(settings);
4896 else if (settingvalue == (int) REGISTRY_SETTING_DISPLAY_IMAGES)
4898 WebSetting settings = __pWebViewer->GetSetting();
4899 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
4900 __pWebViewer->SetSetting(settings);
4901 __pWebViewer->Reload();
4903 else if (settingvalue == (int) REGISTRY_SETTING_BLOCK_POPUP)
4905 WebSetting settings = __pWebViewer->GetSetting();
4906 settings.SetJavaScriptPopupEnabled(SettingPresentationModel::GetInstance()->IsBlockPopUp());
4907 __pWebViewer->SetSetting(settings);
4909 else if (settingvalue == (int) REGISTRY_SETTING_ACCEPT_COOKIES)
4913 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4916 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_FORM_DATA)
4920 WebSetting settings = __pWebViewer->GetSetting();
4921 settings.SetAutoFormDataShowEnabled(SettingPresentationModel::GetInstance()->IsRememberFormData());
4922 __pWebViewer->SetSetting(settings);
4925 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_PASSWORD)
4929 WebSetting settings = __pWebViewer->GetSetting();
4930 settings.SetAutoLoginFormFillEnabled(SettingPresentationModel::GetInstance()->IsRememberPassword());
4931 __pWebViewer->SetSetting(settings);
4934 else if (settingvalue == (int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS)
4936 WebSetting settings = __pWebViewer->GetSetting();
4937 if (SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled() == true)
4939 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
4943 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
4945 __pWebViewer->SetSetting(settings);
4947 else if (settingvalue == (int) REGISTRY_SETTING_READER_FONT_SIZE)
4951 AppLogDebug("IntMainForm fontsize Changed to %d",SettingPresentationModel::GetInstance()->GetReaderFontSize());
4952 WebSetting settings = __pWebReader->GetSetting();
4953 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
4954 __pWebReader->SetSetting(settings);
4960 MainForm::OnSettingsReset()
4964 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4965 __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
4970 MainForm::OnClearCache()
4972 result r = E_SUCCESS;
4974 if (__pWebViewer != NULL)
4976 r = __pWebViewer->ClearCache();
4979 AppLogDebug("Cache cleared success");
4983 AppLogDebug("Cache cleared fail");
4989 MainForm::OnClearCookie()
4991 result r = E_SUCCESS;
4993 if (__pWebViewer != NULL)
4995 __pWebViewer->ClearCookie();
4999 AppLogDebug("Cookie cleared success");
5003 AppLogDebug("Cache cleared fail");
5008 MainForm::OnClearFormData()
5010 result r = E_SUCCESS;
5012 if (__pWebViewer != NULL)
5014 __pWebViewer->ClearFormData();
5018 AppLogDebug("Cookie cleared success");
5022 AppLogDebug("Cache cleared fail");
5027 MainForm::OnClearPasswords()
5029 result r = E_SUCCESS;
5031 if (__pWebViewer != NULL)
5033 __pWebViewer->ClearLoginFormData();
5037 AppLogDebug("Cookie cleared success");
5041 AppLogDebug("Cache cleared fail");
5047 MainForm::findDistance(int x1,int y1,int x2, int y2)
5049 int deltaX = Math::Abs(x2 - x1);
5050 int deltaY = Math::Abs(y2 - y1);
5051 double num = deltaX*deltaX + deltaY*deltaY;
5057 for (i = 0; i < 20; i++)
5059 x = (((x*x)+ num)/(2*x));
5070 MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5072 AppLog("xyz:: MainForm::OnTouchPressed called");
5073 if(__pFindWordControl)
5075 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
5076 // ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
5078 __isLongPressedDone = false;
5083 IList* pList = null;
5084 pList = touch.GetTouchInfoListN(source);
5088 int count = pList->GetCount();
5091 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5092 __touchPoint1 = pTouchInfo->position;
5094 /*if (__pAddressbar != null)
5096 if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5098 if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5100 __pAddressbar->SaveAddressbarEditText();
5102 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5105 __pAddressbar->Invalidate(true);
5107 if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5109 if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5111 //__pAddressbar->SaveAddressbarEditText();
5113 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5116 else if (count == 2)
5118 AppLogDebug("MainForm::OnTouchPressed count is two");
5119 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5120 __touchPoint1 = pTouchInfo->position;
5122 pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
5123 __touchPoint2 = pTouchInfo->position;
5128 pList->RemoveAll(true);
5133 __pAddressbar->SetShowState(false);
5135 if(__pFooterPanel && __isKeypadOpened == false)
5137 __pFooterPanel->SetShowState(true);
5139 RelayoutControls(false);
5144 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5146 // __currentWordIndex = 0;
5147 __isLongPressedDone = false;
5152 MainForm::MoveUiControls()
5157 MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
5159 if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
5161 if(__pFooterUrlField->GetTextLength() == 0)
5163 __pFooterUrlField->SetKeypadActionEnabled(false);
5167 __pFooterUrlField->SetKeypadActionEnabled(true);
5170 if (__pFindWordEditField != null && __pFindWordEditField->GetShowState() == true)
5172 __currentSearchStr = __pFindWordEditField->GetText();
5173 if (__currentSearchStr.GetLength() > 0)
5175 __pFindWordCountLabel->SetShowState(true);
5179 // __pFindWordCountLabel->SetShowState(false);
5180 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
5181 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
5184 __pFindWordNext->SetEnabled(false);
5185 __pFindWordPrev->SetEnabled(false);
5186 __pFindWordNext->Invalidate(true);
5187 __pFindWordPrev->Invalidate(true);
5188 __pFindWordCountLabel->SetText(L"0/0");
5189 __pFindWordCountLabel->Invalidate(true);
5191 else if (__pFindWordEditFieldRightToLeft != null && __pFindWordEditFieldRightToLeft->GetShowState() == true)
5193 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
5194 if (__currentSearchStr.GetLength() > 0)
5196 __pFindWordCountLabelRightToLeft->SetShowState(true);
5200 __pFindWordCountLabelRightToLeft->SetShowState(false);
5203 __pFindWordNext->SetEnabled(false);
5204 __pFindWordPrev->SetEnabled(false);
5205 __pFindWordNext->Invalidate(true);
5206 __pFindWordPrev->Invalidate(true);
5207 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
5208 __pFindWordCountLabelRightToLeft->Invalidate(true);
5210 AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer());
5211 if (__currentSearchStr.GetLength() > 0)
5217 __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
5219 __currentSearchStr = L"";
5220 AppLogDebug("Enter something");
5225 MainForm::InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus)
5232 MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus)
5234 if(__pWebViewer != null)
5237 AppLog("MainForm::InitMostVisitedSitesView");
5238 result r = E_SUCCESS;
5241 if (__pWebViewer != null && __pMostVisitedListView != null)
5246 if (__pMostVisitedListView != null)
5248 RemoveControl(__pMostVisitedListView);
5250 if(__pMostVisitedSites != null)
5252 __pMostVisitedSites->RemoveAll(true);
5255 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
5257 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
5258 __pMostVisitedListView = new(std::nothrow) ListView();
5260 int height = GetClientAreaBounds().height;
5262 if(__pFooterPanel->GetShowState() == true)
5264 height = height - __pFooterPanel->GetHeight();
5266 if(__pAddressbar->GetShowState() == true)
5268 height -= __pAddressbar->GetHeight();
5271 r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
5275 delete __pMostVisitedListView;
5276 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
5279 __pMostVisitedListView->SetItemProvider(*this);
5280 __pMostVisitedListView->AddListViewItemEventListener(*this);
5281 __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_VISITED_SITES"));
5282 AddControl(__pMostVisitedListView);
5283 __pMostVisitedListView->UpdateList();
5290 MainForm::GetImagePath(void)
5294 String formattedTime;
5295 DateTime currentTime;
5296 LocaleManager localManager;
5297 SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
5299 localManager.Construct();
5300 Locale locale = localManager.GetSystemLocale();
5301 //Locale locale(LANGUAGE_ENG, COUNTRY_US);
5303 // Get date formatter
5304 DateTimeFormatter* pTimeFormatter = DateTimeFormatter::CreateDateTimeFormatterN(locale, DATE_TIME_STYLE_DEFAULT);
5308 pTimeFormatter->Format(currentTime, formattedTime);
5311 AppLog("current time stamp is %ls", formattedTime.GetPointer());
5312 String delim(L" :");
5313 StringTokenizer strTok(formattedTime, delim);
5316 String str1("GMT+00");
5317 while (strTok.HasMoreTokens())
5319 strTok.GetNextToken(token); // Osp, StringTokenizer, Sample, code
5320 if(token.Equals(str1))
5322 AppLog("token is %ls", token.GetPointer());
5323 imageName.Append(token);
5329 void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
5331 result r = E_FAILURE;
5332 AppLog("Content manager 1");
5333 ContentId contentId;
5334 ContentManager contentManager;
5335 r = contentManager.Construct();
5338 AppLog("Content manager update content result %s" ,GetErrorMessage(r));
5341 Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Downloads/";
5342 Tizen::Io::Directory::Create(contentPath,true);
5343 if(GetLastResult() == E_FILE_ALREADY_EXIST)
5345 AppLog("Already exists");
5347 else if(GetLastResult() == E_SUCCESS)
5349 AppLog("created success");
5351 contentPath.Append(imageName);
5352 contentPath.Append(".jpg");
5353 contentId = contentManager.CreateContent(*aBuffer, contentPath);
5354 ShowIndicatorNotification(L"Download Complete",contentPath);
5355 AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
5359 MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
5361 AppLogDebug("ENTER");
5363 NotificationRequest request;
5364 request.SetAlertText(messageText);
5365 request.SetTitleText(L"");
5366 request.SetAppMessage(contentPath);
5367 request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
5368 request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
5369 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
5370 String homePath = pApp->GetAppRootPath();
5371 String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
5372 AppLog("The iconPath is : %ls", homePath.GetPointer());
5373 request.SetIconFilePath(iconPath);
5375 Tizen::Shell::NotificationManager notiMgr;
5376 notiMgr.Construct();
5377 notiMgr.NotifyOngoingActivity(request);
5378 AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
5383 MainForm::SetForwardButtonEnabled(bool isEnabled)
5385 __pGoForwardBtn->SetEnabled(isEnabled);
5386 __pGoForwardBtn->Invalidate(true);
5390 MainForm::SetBackButtonEnabled(bool isEnabled)
5392 __pGoBackBtn->SetEnabled(isEnabled);
5393 __pGoBackBtn->Invalidate(true);
5397 MainForm::UpdateProgress(int percentage)
5399 __progressPercentage = percentage;
5400 if (percentage == 0 || percentage == 100)
5402 __isLoadingData = false;
5403 if (percentage == 100)
5405 __isLoadingCompleted = true;
5406 __progressPercentage = 0;
5410 __isLoadingCompleted = false;
5415 __isLoadingData = true;
5417 UpdateProgressBitmap();
5421 MainForm::GetProgress(void)
5423 return __progressPercentage;
5427 MainForm::UpdateProgressBitmap(void)
5429 result r = E_SUCCESS;
5430 if (__pProgressbarLabel == null)
5432 int w = __pProgressbarLabel->GetWidth();
5433 int h = __pProgressbarLabel->GetHeight();
5435 int progressWidth = 0;
5436 Bitmap* pRetBitmap = null;
5438 if (__progressPercentage == 0 || __progressPercentage == 100)
5440 __pProgressbarLabel->SetShowState(false);
5441 __pProgressbarLabel->Invalidate(false);
5446 __pProgressbarLabel->SetShowState(true);
5447 __pProgressbarLabel->Invalidate(false);
5450 r = canvas.Construct(Rectangle(0, 0, w, h));
5454 AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
5459 Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
5463 pBgBmp->Scale(Dimension(w, h));
5464 canvas.DrawBitmap(Point(0,0), *pBgBmp);
5468 progressWidth = (double) (w) * __progressPercentage / 100;
5469 AppLogDebug("progressWidth: %d", progressWidth);
5470 Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
5472 if (pProgressBmp != null)
5474 pProgressBmp->Scale(Dimension(progressWidth, h));
5475 canvas.DrawBitmap(Point(0,0), *pProgressBmp);
5476 delete pProgressBmp;
5479 pRetBitmap = new (std::nothrow) Bitmap();
5481 if (pRetBitmap == null)
5483 AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
5487 pRetBitmap->Construct(canvas, canvas.GetBounds());
5489 if (__pProgressbarLabel != null && pRetBitmap != null)
5491 __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
5492 __pProgressbarLabel->Invalidate(false);
5495 if (pRetBitmap != null)
5504 MainForm::ReaderClicked()
5506 result r = E_SUCCESS;
5507 ArrayList* pArgList = new(std::nothrow) ArrayList();
5508 if (pArgList != null)
5510 r = pArgList->Construct();
5517 r = pArgList->Add(*new(std::nothrow) String(*__pReaderData));
5524 r = pArgList->Add(*new(std::nothrow) String(__pWebViewer->GetUrl()));
5531 r = pArgList->Add(*new(std::nothrow) String(__pWindowInfo->pageTitle));
5539 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
5545 void MainForm::SetAddressbarMode(AddressBarMode addMode)
5547 AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
5549 __currentAddMode = addMode;
5553 case ADDRESSBAR_MODE_INVALID:
5558 case ADDRESSBAR_MODE_READER:
5560 __pStopBtn->SetShowState(false);
5561 __pRefreshBtn->SetShowState(false);
5562 __pClearBtn->SetShowState(false);
5563 __pReaderBtn->SetShowState(false);
5566 case ADDRESSBAR_MODE_LOADING:
5568 __pRefreshBtn->SetShowState(false);
5569 __pStopBtn->SetShowState(true);
5570 __pClearBtn->SetShowState(false);
5571 __pReaderBtn->SetShowState(false);
5574 case ADDRESSBAR_MODE_LOADING_COMPLETE:
5576 // SetUrl(__pAddressbar->GetUrl());
5578 __pRefreshBtn->SetShowState(true);
5579 __pStopBtn->SetShowState(false);
5580 __pClearBtn->SetShowState(false);
5581 __pReaderBtn->SetShowState(false);
5584 case ADDRESSBAR_MODE_EDIT:
5586 __pRefreshBtn->SetShowState(false);
5587 __pStopBtn->SetShowState(false);
5588 __pReaderBtn->SetShowState(false);
5589 __pClearBtn->SetShowState(true);
5596 OnAddressBarModeChanged();
5599 AddressBarMode MainForm::GetAddressbarMode(void)
5601 return __currentAddMode;
5604 void MainForm::SetUrl(const String& url)
5607 if(__displayUrl.GetLength() > 2048)
5608 __displayUrl.SubString(0,2048,__displayUrl);
5610 if (__pFooterUrlField != NULL)
5612 String removedHttpUrl = RemoveHttpTextFromDisplayURL();
5613 if (removedHttpUrl.IsEmpty() == false)
5615 __pFooterUrlField->SetText(removedHttpUrl);
5616 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5617 __pAddressbar->SetUrl(__displayUrl);
5621 __pFooterUrlField->SetText(__displayUrl);
5622 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5623 __pAddressbar->SetUrl(__displayUrl);
5625 if(__pFooterUrlField)
5626 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
5627 __pFooterUrlField->Invalidate(false);
5628 if(__pAddressbar != NULL && __pAddressbar->HasFocus())
5629 __pAddressbar->Invalidate(true);
5630 // __pFooterUrlField->SetCursorPosition(0);
5635 MainForm::RemoveHttpTextFromDisplayURL(void)
5637 AppLog("MainForm::RemoveHttpTextFromDisplayURL __displayUrl %ls",__displayUrl.GetPointer());
5639 // bool isHttpText = __displayUrl.Contains(L"http://");
5640 String updatedDisplayUrl;
5641 updatedDisplayUrl.Clear();
5642 if(__displayUrl.IndexOf(L"http://",0,index) == E_SUCCESS && index == 0)
5644 __displayUrl.SubString(7,updatedDisplayUrl);
5646 else if(__displayUrl.IndexOf(L"https://",0,index) == E_SUCCESS && index == 0)
5648 __displayUrl.SubString(8,updatedDisplayUrl);
5650 return updatedDisplayUrl;
5653 void MainForm::OnSharePopupControlStarted(void)
5655 __pWebViewer->AddTouchEventListener(*this);
5659 MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
5661 if (requestId == BACK_GROUND_APP_EVENT)
5663 if(__pWebViewer != null)
5665 __pWebViewer->Pause();
5669 __pImageMenu->SetShowState(false);
5671 if(__pAddressbar != null)
5673 __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
5676 else if(requestId == FORE_GROUND_APP_EVENT)
5678 if(__pWebViewer != null)
5680 __pWebViewer->Resume();
5682 if(__pAddressbar != null)
5684 __pAddressbar->SendUserEvent(FORE_GROUND_APP_EVENT,NULL);
5690 MainForm::AddressBarCancelledClicked(const Addressbar& addBar)
5692 AppLog("XYZ::MainForm::AddressBarCancelledClicked");
5693 result r = E_SUCCESS;
5696 __pAddressbar->SetShowState(false);
5698 AppLog("akjshdasd 5");
5699 __pFooterPanel->SetShowState(true);
5702 __pWebViewer->SetFocus();
5703 else if(__pMostVisitedListView)
5704 __pMostVisitedListView->SetFocus();
5705 else if(__pMultiWindowButton)
5706 __pMultiWindowButton->SetFocus();
5707 else if(__pMoreButton)
5708 __pMoreButton->SetFocus();
5710 __pAddressbar->SetShowState(false);
5712 RelayoutControls(false);
5716 MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
5718 AppLog("MainForm::OnFormMenuRequested called");
5720 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
5722 int bookmarkCount=0;
5725 url=__pWindowInfo->pageUrl;
5726 AppLog("MainForm::OnFormMenuRequested url %ls",url.GetPointer());
5727 result r = E_SUCCESS;
5728 Bitmap* pBitmap = null;
5729 String lastChar = L"";
5730 // if(url.SubString(url.GetLength()-1,lastChar));
5731 // if(lastChar == L"/")
5733 // bool exist1 = false;
5734 // bool exist2 = false;
5735 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist1);
5736 // url.SubString(0,url.GetLength() - 1,url);
5737 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist2);
5738 // exist = exist1 | exist2;
5742 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
5745 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
5751 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
5755 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
5757 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
5759 if (__pOptionMenu->GetItemCount() == 9)
5761 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5765 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5770 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
5774 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
5775 if (__pOptionMenu->GetItemCount() != 9)
5777 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
5778 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
5779 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
5780 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
5781 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
5782 __pOptionMenu->SetMaxVisibleItemsCount(6);
5784 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
5786 AppLog(" Orientation landscape");
5787 __pOptionMenu->SetMaxVisibleItemsCount(5);
5791 AppLog(" Orientation potrait");
5792 __pOptionMenu->SetMaxVisibleItemsCount(6);
5795 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
5798 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
5800 __pAddressbar->SetShowState(false);
5802 __pFooterPanel->SetShowState(true);
5803 result r = __pOptionMenu->SetShowState(true);
5804 AppLog("ajsghd %s",GetErrorMessage(r));
5805 RelayoutControls(false);
5806 __pOptionMenu->Invalidate(true);
5807 __pOptionMenu->Show();