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);
494 AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
497 __webControlPosition = __pWebViewer->GetPosition();
498 r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
501 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
505 __pWebViewer->SetLoadingListener(this);
506 __pWebViewer->SetWebUiEventListenerF(this);
507 __pWebViewer->SetWebKeypadEventListener(this);
508 __pWebViewer->SetFocus();
509 __pWebViewer->AddTouchEventListener(*this);
511 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
512 __pWebViewer->SetTextSearchListener(this);
515 AppLogDebug("MainForm :before return");
517 AppLogDebug("MainForm::InitWebControl Exit");
523 MainForm::SetJavascriptEnabled()
525 WebSetting settings = __pWebViewer->GetSetting();
526 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
527 __pWebViewer->SetSetting(settings);
531 MainForm::SetImageLoadEnabled()
533 WebSetting settings = __pWebViewer->GetSetting();
534 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
535 __pWebViewer->SetSetting(settings);
539 MainForm::InitFooter(void)
541 AppLogDebug("MainForm::InitFooter entered");
542 Button* pBackButton = null;
543 Button* pBookmarkButton = null;
544 Button* pMultiWindowButton = null;
545 Bitmap *pIconBitmap = null;
546 Bitmap *pBGBitmap = null;
547 Label *pBGLabel = null;
549 if (__pFooterPanel == null)
551 __pFooterPanel = static_cast< Panel* >(GetControl(L"IDC_FOOTER_PANEL", true));
554 if (__pFooterPanel == null)
559 SetControlAlwaysOnTop(*__pFooterPanel, true);
561 __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
562 if ( __pFooterLabel == NULL )
566 //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
567 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
570 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
574 __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
576 if ( __pMultiWindowButton == NULL )
582 SetFormBackEventListener(this);
583 AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
584 if (__pMultiWindowButton != null)
586 Bitmap* pBitmap = null;
587 Bitmap* pPressedBitmap = null;
588 String imagePath = "I01_toolbar_icon_windows_manager_0";
589 String pressedImagePath = "I01_toolbar_icon_windows_manager_0";
590 int totalCount = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount();
591 imagePath.Append(totalCount);
592 imagePath.Append(".png");
594 pressedImagePath.Append(totalCount);
595 pressedImagePath.Append("_press.png");
597 pBitmap = AppResource::GetInstance()->GetBitmapN(imagePath);
598 pPressedBitmap = AppResource::GetInstance()->GetBitmapN(pressedImagePath);
599 if ( pBitmap == null )
604 Point startPoint = Point((__pMultiWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pMultiWindowButton->GetHeight() - pBitmap->GetHeight())/2);
607 __pMultiWindowButton->SetNormalBitmap(startPoint, *pBitmap);
608 __pMultiWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
613 __pMultiWindowButton->AddActionEventListener(*this);
614 __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
617 delete pPressedBitmap;
618 pPressedBitmap = null;
624 Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
625 Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE_PRESS);
628 Point startPoint((__pMoreButton->GetWidth() - pBitmap->GetWidth())/2,(__pMoreButton->GetHeight() - pBitmap->GetHeight())/2 );
629 __pMoreButton->SetNormalBitmap(startPoint, *pBitmap);
630 __pMoreButton->SetPressedBitmap(startPoint, *pPressedBitmap);
634 __pMoreButton->AddActionEventListener(*this);
635 __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
638 //Add the editfield for url
639 __pFooterUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
640 if (__pFooterUrlField == NULL)
642 return E_INVALID_KEY;
645 __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
646 __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
647 __pFooterUrlField->AddKeypadEventListener(*this);
648 __pFooterUrlField->SetPropagatedTouchEventListener(this);
649 __pFooterUrlField->AddFocusEventListener(*this);
651 if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
653 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
655 else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
657 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
661 //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
662 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
666 //Add the go Back Button
667 __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
668 if (__pGoBackBtn == NULL)
670 AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
671 return E_INVALID_KEY;
673 __pGoBackBtn->SetActionId(IDA_GO_BACK);
674 __pGoBackBtn->AddActionEventListener(*this);
676 //Add the go forward Button
677 __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
678 if (__pGoForwardBtn == NULL)
680 AppLogDebug("Control not found returning E_INVALID_KEY");
681 return E_INVALID_KEY;
683 __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
684 __pGoForwardBtn->AddActionEventListener(*this);
685 if (__pWebViewer && __pWebViewer->CanGoForward())
687 SetForwardButtonEnabled(true);
691 SetForwardButtonEnabled(false);
694 __pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
695 if (__pRefreshBtn == NULL)
697 AppLogDebug("Control not found returning E_INVALID_KEY");
698 return E_INVALID_KEY;
701 __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
702 __pRefreshBtn->AddActionEventListener(*this);
703 __pRefreshBtn->SetShowState(true);
705 //Add the backround label for displaying progressbar
706 __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
707 if (__pProgressbarLabel == NULL)
709 AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
710 return E_INVALID_KEY;
712 __pProgressbarLabel->SetShowState(false);
714 __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
715 if (__pStopBtn == NULL)
717 AppLogDebug("Control not found returning E_INVALID_KEY");
718 return E_INVALID_KEY;
720 __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
721 __pStopBtn->AddActionEventListener(*this);
722 __pStopBtn->SetShowState(false);
724 __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
725 if (__pClearBtn == NULL)
727 AppLogDebug("Control not found returning E_INVALID_KEY");
728 return E_INVALID_KEY;
730 __pClearBtn->SetActionId(IDA_CLEAR_URL);
731 __pClearBtn->AddActionEventListener(*this);
732 __pClearBtn->SetShowState(false);
734 __pReaderBtn = static_cast<Button*> (GetControl(L"IDC_READER_BUTTON",true));
735 if (__pReaderBtn == NULL)
737 AppLogDebug("Control not found returning E_INVALID_KEY");
738 return E_INVALID_KEY;
740 __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED);
741 __pReaderBtn->AddActionEventListener(*this);
742 __pReaderBtn->SetShowState(false);
744 // __pFooterPanel->Invalidate(true);
745 if(__isKeypadOpened == false)
747 // AppLog("asdasdasdasda");
748 __pFooterPanel->SetShowState(true);
751 __pFooterPanel->SetShowState(false);
752 AppLogDebug("MainForm::InitFooter exit");
757 MainForm::InitOptionMenu()
759 result r = E_SUCCESS;
760 bool isPrivateBrowsing = false;
761 Bitmap* pBitmap = null;
763 if (__pOptionMenu != null)
765 __pOptionMenu->SetFocusable(true);
766 __pOptionMenu->Invalidate(true);
770 __pOptionMenu = new(std::nothrow) OptionMenu();
771 r = __pOptionMenu->Construct();
772 TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
774 __pOptionMenu->SetFocusable(true);
775 isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
778 if (isPrivateBrowsing == true)
780 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
784 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
787 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
789 if ( pBitmap != NULL)
791 __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"), IDA_PRIVATEON_CLICKED,*pBitmap);
794 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_TAB_HISTORY"), IDA_HISTORY_CLICKED);
795 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
796 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
799 __pOptionMenu->SetMaxVisibleItemsCount(6);
800 __pOptionMenu->SetShowState(false);
801 __pOptionMenu->AddActionEventListener(*this);
802 SetControlAlwaysOnTop(*__pOptionMenu, true);
808 result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
810 result r = E_SUCCESS;
811 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
813 AppLog("MainForm::InitImageContextMenu clicked on image");
814 if (__pImageMenu != null)
819 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
824 __pImageMenu = new (std::nothrow) ContextMenu();
825 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
826 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
828 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
829 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
830 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED);
831 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_IMAGE_CLICKED);
832 __pImageMenu->SetMaxVisibleItemsCount(4);
833 __pImageMenu->AddActionEventListener(*this);
834 SetControlAlwaysOnTop(*__pImageMenu, true);
835 __pImageMenu->SetFocusable(true);
841 MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
843 result r = E_SUCCESS;
844 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
846 AppLog("MainForm::InitImageContextMenu clicked on image");
847 if (__pImageMenu != null)
853 // if(__pAddressbar->GetShowState() == true)
854 // p.y = p.y + __pAddressbar->GetHeight();
855 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
860 __pImageMenu = new (std::nothrow) ContextMenu();
861 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
862 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
864 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
865 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
866 //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
867 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
869 __pImageMenu->SetMaxVisibleItemsCount(3);
870 __pImageMenu->AddActionEventListener(*this);
871 SetControlAlwaysOnTop(*__pImageMenu, true);
872 __pImageMenu->SetFocusable(true);
879 MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOption = false)
881 result r = E_SUCCESS;
882 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
884 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
885 if (__pImageMenu != null)
894 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
898 if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
900 AppLog("asdasdafdsfdgfd");
903 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
905 __pImageMenu = new (std::nothrow) ContextMenu();
906 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
907 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
909 if(onlyPasteOption == false)
911 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
913 if (pasteOption || onlyPasteOption)
915 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
917 if(onlyPasteOption == false)
919 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
920 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
923 __pImageMenu->SetMaxVisibleItemsCount(3);
924 __pImageMenu->AddActionEventListener(*this);
925 SetControlAlwaysOnTop(*__pImageMenu, true);
926 __pImageMenu->SetFocusable(true);
933 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
935 result r = E_SUCCESS;
936 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
938 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
939 if (__pImageMenu != null)
948 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
952 if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
954 AppLog("asdasdafdsfdgfd");
957 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
960 __pImageMenu = new (std::nothrow) ContextMenu();
961 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
962 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
964 if(onlyPasteOption == false)
966 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
968 if (pasteOption || onlyPasteOption)
970 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
972 if(onlyPasteOption == false)
974 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
975 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
978 __pImageMenu->SetMaxVisibleItemsCount(3);
979 __pImageMenu->AddActionEventListener(*this);
980 SetControlAlwaysOnTop(*__pImageMenu, true);
981 __pImageMenu->SetFocusable(true);
988 MainForm::InitFindWordPanel(void)
990 result r = E_SUCCESS;
991 Bitmap *pIconBitmap = null;
993 if (__pFindWordControl != null)
995 AppLogDebug("Findword panel already initialized");
996 if (__pFindWordBgLabel != null)
998 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1001 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1005 if (__pFindWordBgLabelRightToLeft != null)
1007 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
1008 if (pBitmap != null)
1010 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1015 __pAddressbar->SetShowState(false);
1017 if(__isKeypadOpened == false)
1018 __pFooterPanel->SetShowState(true);
1022 __pFindWordControl = new (std::nothrow) Panel();
1023 r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE");
1026 AppLogException("There is some problem in the xml file. Please check.");
1029 AddControl(__pFindWordControl);
1030 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
1031 SetControlAlwaysOnTop(*__pFindWordControl,true);
1032 __pFindWordControl->SetShowState(false);
1033 __pFindWordControl->Invalidate(false);
1035 __pFindWordPanelLeftToRight = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1036 __pFindWordPanelLeftToRight->SetShowState(true);
1038 __pFindWordPanelRightToLeft = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL2", true));
1039 __pFindWordPanelRightToLeft->SetShowState(false);
1041 __pFindWordBgLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL1", true));
1042 if (__pFindWordBgLabel != null)
1044 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1045 Rectangle pRect = pPanel1->GetBounds();
1046 pRect.x = pRect.y = 0;
1047 __pFindWordBgLabel->SetBounds(pRect);
1048 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1049 if (pBitmap != null)
1051 AppLogDebug("InitFindWordPanel: Coming here");
1052 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1057 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1061 __pFindWordBgLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL2", true));
1062 if (__pFindWordBgLabelRightToLeft != null)
1064 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1065 Rectangle pRect = pPanel1->GetBounds();
1066 pRect.x = pRect.y = 0;
1067 __pFindWordBgLabelRightToLeft->SetBounds(pRect);
1068 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1069 if (pBitmap != null)
1071 AppLogDebug("InitFindWordPanel: Coming here");
1072 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1077 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1081 Button* pfindWordCancel = null;
1082 pfindWordCancel = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true));
1083 if (pfindWordCancel == null)
1085 AppLogException("There is some problem in the xml file. Please check.");
1088 pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED);
1089 pfindWordCancel->AddActionEventListener(*this);
1091 __pFindWordClear = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true));
1092 if (__pFindWordClear == null)
1094 AppLogException("There is some problem in the xml file. Please check.");
1098 __pFindWordClearRightToLeft = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR2", true));
1099 if (__pFindWordClearRightToLeft == null)
1101 AppLogException("There is some problem in the xml file. Please check.");
1105 __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED);
1106 __pFindWordClear->AddActionEventListener(*this);
1108 __pFindWordClearRightToLeft->SetActionId(IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED);
1109 __pFindWordClearRightToLeft->AddActionEventListener(*this);
1111 __pFindWordNext = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true));
1112 if (__pFindWordNext == null)
1114 AppLogException("There is some problem in the xml file. Please check.");
1118 __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED);
1119 __pFindWordNext->AddActionEventListener(*this);
1121 __pFindWordPrev = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true));
1122 if (__pFindWordPrev == null)
1124 AppLogException("There is some problem in the xml file. Please check.");
1128 __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED);
1129 __pFindWordPrev->AddActionEventListener(*this);
1131 __pFindWordNext->SetEnabled(false);
1132 __pFindWordPrev->SetEnabled(false);
1134 __pFindWordCountLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true));
1135 if (__pFindWordCountLabel == null)
1137 AppLogException("There is some problem in the xml file. Please check.");
1141 __pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
1142 if (__pFindWordCountLabel == null)
1144 AppLogException("There is some problem in the xml file. Please check.");
1148 __pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
1149 if (__pFindWordEditField == null)
1151 AppLogException("There is some problem in the xml file. Please check.");
1154 __pFindWordEditField->AddTextEventListener(*this);
1155 __pFindWordEditField->AddKeypadEventListener(*this);
1156 __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
1157 __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1159 __pFindWordEditFieldRightToLeft = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true));
1160 if (__pFindWordEditFieldRightToLeft == null)
1162 AppLogException("There is some problem in the xml file. Please check.");
1165 __pFindWordEditFieldRightToLeft->AddTextEventListener(*this);
1166 __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
1167 __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
1168 __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1171 __pAddressbar->SetShowState(false);
1173 if(__isKeypadOpened == false)
1174 __pFooterPanel->SetShowState(true);
1179 MainForm::CreateItem (int index, int itemWidth)
1181 Rectangle listImageRect;
1182 Rectangle pagetTitleRect;
1183 Rectangle pageURLRect;
1184 Rectangle deleteImageRect;
1185 String pageTitle(L"");
1186 String pageURL(L"");
1187 result r = E_SUCCESS;
1188 Bitmap* pListIconImage = null;
1191 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1192 if(pHistory == null)
1196 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
1197 if ( pAppResource == NULL )
1201 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
1203 CustomItem* pItem = new(std::nothrow) CustomItem();
1204 pageTitle = pHistory->GetHistoryTitle();
1205 pageURL = pHistory->GetHistoryUrl();
1207 if (pageURL.GetLength() == 0)
1210 pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
1211 pageURL = L"<"+ nourl +">";
1215 Rectangle screenBounds = GetBounds();
1218 r = pItem->Construct(Dimension(itemWidth, 128 + (__fontSize - 44)), style);
1227 Bitmap* pBitmap = pHistory->GetFavIconBitmap();
1229 if ( pBitmap != NULL)
1231 pListIconImage = new Bitmap();
1232 pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
1236 if(pListIconImage == null)
1238 pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png");
1241 if ( pListIconImage != NULL)
1243 listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28 + (__fontSize - 44)/2 , 72, 72);
1244 pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72 + (__fontSize - 44));
1245 pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
1248 if (pItem != null && pListIconImage != NULL)
1250 pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *pListIconImage, null, null);
1254 if (pageTitle.CompareTo(L"") != 0)
1258 pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, __fontSize, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true);
1262 if (pageURL.CompareTo(L"") != 0)
1266 pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
1271 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1273 if ( __pItemContext!= NULL)
1277 pItem->SetContextItem(__pItemContext);
1283 if ( __pItemContextLandscape!= NULL)
1287 pItem->SetContextItem(__pItemContextLandscape);
1291 if( pListIconImage != NULL)
1293 delete pListIconImage;
1294 pListIconImage = null;
1301 MainForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
1308 MainForm::GetItemCount (void)
1310 if(__pMostVisitedSites != null)
1312 __pMostVisitedSites->RemoveAll(true);
1314 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
1315 if(__pMostVisitedSites != null)
1317 return __pMostVisitedSites->GetCount();
1324 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
1326 AppLog("MainForm::OnListViewContextItemStateChanged called");
1327 if(__pMostVisitedSites != null)
1329 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1330 if (pHistory != null)
1332 String url = pHistory->GetHistoryUrl();
1334 HistoryPresentationModel::GetInstance()->DeleteHistory(url);
1335 __pMostVisitedListView->UpdateList();
1341 MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1343 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1344 String url = pHistory->GetHistoryUrl();
1352 MainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1358 MainForm::OnTerminating(void)
1360 result r = E_SUCCESS;
1362 RemoveOrientationEventListener(*this);
1366 __pAddressbar->SetAddressbarEventListener(null);
1371 __pWebViewer->RemoveTouchEventListener(*this);
1372 __pWebViewer->SetWebUiEventListenerF(null);
1373 __pWebViewer->SetWebKeypadEventListener(null);
1374 __pWebViewer->SetTextSearchListener(null);
1380 delete __pItemContext;
1382 if (__pItemContextLandscape)
1384 delete __pItemContextLandscape;
1388 delete __pSaveImage;
1390 if (__pMostVisitedSites)
1392 __pMostVisitedSites->RemoveAll(true);
1393 delete __pMostVisitedSites;
1399 MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1401 result r = E_SUCCESS;
1403 AppLogDebug("Clicked : %d", actionId);
1406 case IDA_BACKBTN_CLICKED:
1408 if(__pImageMenu && __pImageMenu->GetShowState() == true)
1410 AppLog("Hiding the menu");
1411 __pImageMenu->SetShowState(false);
1413 if (__pWebViewer && __pWebViewer->CanGoBack())
1415 __pWebViewer->GoBack();
1417 else if(__pWindowInfo->isJavascriptInitiated == false)
1420 pApp = UiApp::GetInstance();
1423 RemoveOrientationEventListener(*this);
1427 __pAddressbar->SetAddressbarEventListener(null);
1432 __pWebViewer->RemoveTouchEventListener(*this);
1433 __pWebViewer->SetWebUiEventListenerF(null);
1434 __pWebViewer->SetWebKeypadEventListener(null);
1435 __pWebViewer->SetTextSearchListener(null);
1436 __pWebViewer->SetLoadingListener(null);
1438 r = pApp->Terminate();
1441 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1449 WindowInfo* pWindowInfo = null;
1451 SceneManager* pSceneManager = SceneManager::GetInstance();
1452 if (pSceneManager == null)
1456 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
1457 if (pAllWindowList == NULL)
1459 pApp = UiApp::GetInstance();
1462 RemoveOrientationEventListener(*this);
1466 __pAddressbar->SetAddressbarEventListener(null);
1471 __pWebViewer->RemoveTouchEventListener(*this);
1472 __pWebViewer->SetWebUiEventListenerF(null);
1473 __pWebViewer->SetWebKeypadEventListener(null);
1474 __pWebViewer->SetTextSearchListener(null);
1475 __pWebViewer->SetLoadingListener(null);
1477 r = pApp->Terminate();
1480 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1485 if (pAllWindowList != null)
1487 totalCount = pAllWindowList->GetCount();
1489 for (int count = 0; count < totalCount; count++)
1491 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
1492 if (pWindowInfo == null)
1494 pApp = UiApp::GetInstance();
1497 RemoveOrientationEventListener(*this);
1501 __pAddressbar->SetAddressbarEventListener(null);
1506 __pWebViewer->RemoveTouchEventListener(*this);
1507 __pWebViewer->SetWebUiEventListenerF(null);
1508 __pWebViewer->SetWebKeypadEventListener(null);
1509 __pWebViewer->SetTextSearchListener(null);
1510 __pWebViewer->SetLoadingListener(null);
1512 r = pApp->Terminate();
1515 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1522 if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
1524 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
1527 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1530 r = pAllWindowList->RemoveAt(count, true);
1531 __pWindowInfo = null;
1534 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1539 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
1543 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
1545 if (pWindowInfo == null)
1547 pApp = UiApp::GetInstance();
1551 RemoveOrientationEventListener(*this);
1555 __pAddressbar->SetAddressbarEventListener(null);
1560 __pWebViewer->RemoveTouchEventListener(*this);
1561 __pWebViewer->SetWebUiEventListenerF(null);
1562 __pWebViewer->SetWebKeypadEventListener(null);
1563 __pWebViewer->SetTextSearchListener(null);
1564 __pWebViewer->SetLoadingListener(null);
1566 r = pApp->Terminate();
1572 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1575 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1587 case IDA_FORWARD_CLICKED:
1588 if (__pWebViewer == null)
1591 if (__pWebViewer->CanGoForward())
1593 __pWebViewer->GoForward();
1595 __pOptionMenu->SetShowState(false);
1596 __pOptionMenu->Invalidate(false);
1599 case IDA_FINDONPAGE_CLICKED:
1601 AppLogDebug("MainForm::OnActionPerformed findword clicked");
1602 __currentSearchStr.Clear();
1604 InitFindWordPanel();
1605 __pOptionMenu->SetShowState(false);
1606 __pOptionMenu->Invalidate(false);
1608 ShowFindWordPanel(true);
1610 if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
1612 __pFindWordEditField->SetFocus();
1613 // __pFindWordCountLabel->SetShowState(false);
1617 __pFindWordEditFieldRightToLeft->SetFocus();
1618 __pFindWordCountLabelRightToLeft->SetShowState(false);
1622 case IDA_PRIVATEON_CLICKED:
1624 result r = E_SUCCESS;
1626 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
1627 Bitmap* pBitmap = null;
1628 if (isPrivateBrowsing == true)
1630 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
1633 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1637 if (__pWebViewer != NULL)
1639 __pWebViewer->SetPrivateBrowsingEnabled(false);
1642 SettingPresentationModel::GetInstance()->SetPrivateOn(false);
1644 if (__pAddressbar != null)
1646 __pAddressbar->UpdateFaviconBitmap(false);
1652 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
1655 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1659 if (__pWebViewer != NULL)
1661 __pWebViewer->SetPrivateBrowsingEnabled(true);
1664 SettingPresentationModel::GetInstance()->SetPrivateOn(true);
1666 if (__pAddressbar != null)
1668 __pAddressbar->UpdateFaviconBitmap(true);
1672 itemIndex = __pOptionMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED);
1673 r = __pOptionMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
1674 AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex);
1675 __pOptionMenu->Invalidate(true);
1676 if ( pBitmap != NULL )
1683 case IDA_SETTINGS_CLICKED:
1686 ArrayList* pArgList = new(std::nothrow) ArrayList();
1689 pArgList->Construct();
1690 pArgList->Add(*__pWindowInfo);
1691 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList);
1693 __pOptionMenu->SetShowState(false);
1694 __pOptionMenu->Invalidate(false);
1696 if (pArgList != null)
1705 case IDA_ADDTOBOOKMARK_CLICKED:
1708 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
1710 int bookmarkCount=0;
1713 url=__pWindowInfo->pageUrl;
1714 result r = E_SUCCESS;
1715 Bitmap* pBitmap = null;
1716 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1724 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_REMOVED");
1725 BookmarkPresentationModel::GetInstance()->DeleteBookmark(url);
1726 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1728 if(__pNotification != null)
1730 RemoveControl(__pNotification);
1731 __pNotification = null;
1733 __pNotification = new (std::nothrow) NotificationPanel(*this);
1734 if (__pNotification != null)
1736 __pNotification->SetText(message);
1737 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1738 __pNotification->ShowNotification();
1743 String title=__pWindowInfo->pageTitle;
1744 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ADDED");
1745 BookmarkData* pBookmark=new (std::nothrow) BookmarkData();
1747 pBookmark->SetBookmarkTitle(title);
1748 pBookmark->SetUrl(url);
1749 if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
1751 pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
1753 String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
1754 pBookmark->SetFaviconId(id);
1755 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
1756 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
1758 if(__pNotification != null)
1760 RemoveControl(__pNotification);
1761 __pNotification = null;
1763 __pNotification = new (std::nothrow) NotificationPanel(*this);
1764 if (__pNotification != null)
1766 __pNotification->SetText(message);
1767 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1768 __pNotification->ShowNotification();
1769 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1772 if (pBitmap != null)
1774 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1779 __pOptionMenu->Invalidate(true);
1784 case IDA_PRINT_CLICKED:
1786 r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//shared//data//test.pdf");
1787 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
1789 AppLog("RequestPrint called!");
1790 AppControl* pAc = Tizen::App::AppManager::FindAppControlN(L"org.tizen.mobileprint", L"http://tizen.org/appcontrol/operation/print");
1791 result nResult = E_FAILURE;
1794 AppLog("TestPrint if (pAc) == true");
1799 String fileType = L"service_print_files_type";
1800 String typeVal = L"DOC";
1802 String fileCount = L"service_print_files_count";
1803 String countVal = L"1";
1804 String fileFolder= L"service_print_files_folder_name";
1805 String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//shared//data";
1807 map.Add(&fileCount, &countVal);
1808 map.Add(&fileFolder, &folderVal);
1809 map.Add(&fileType, &typeVal);
1811 String fileName = L"service_print_files_files_name";
1813 ArrayList fileNameList;
1814 fileNameList.Construct();
1815 String file1 = L"test.pdf";
1817 fileNameList.Add(&file1);
1818 map.Add(&fileName, &fileNameList);
1820 nResult = pAc->Start(NULL, NULL, &map, NULL);
1822 if (nResult == E_SUCCESS) AppLog("TestPrint ret == E_SUCCESS");
1823 else if (nResult == E_MAX_EXCEEDED)
1824 AppLog("TestPrint ret == E_MAX_EXCEEDED");
1825 else if (nResult == E_OBJ_NOT_FOUND)
1826 AppLog("TestPrint ret == E_OBJ_NOT_FOUND");
1827 else if (nResult == E_IN_PROGRESS)
1828 AppLog("TestPrint ret == E_IN_PROGRESS");
1829 else if (nResult == E_PRIVILEGE_DENIED)
1830 AppLog("TestPrint ret == E_PRIVILEGE_DENIED");
1831 else if(nResult == E_SYSTEM)
1832 AppLog("TestPrint ret == E_SYSTEM");
1838 int __modalMsgBoxResult;
1839 MessageBox* pMsgBox = new MessageBox();
1840 pMsgBox->Construct("Not Supported","Not Supported",MSGBOX_STYLE_OK,3000);
1841 pMsgBox->ShowAndWait(__modalMsgBoxResult);
1844 __modalMsgBoxResult = 0;
1848 case IDA_SHARE_CLICKED:
1850 if(__pPopUp != null)
1857 __pAddressbar->HideKeypad();
1859 __pPopUp = new(std::nothrow) SharePopup();
1860 __pPopUp->Initialize();
1861 if (__pWindowInfo != null)
1863 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
1864 pShareInfo->SetPageTitle(__pWindowInfo->pageTitle);
1865 pShareInfo->SetPageUrl(__pWindowInfo->pageUrl);
1866 pShareInfo->SetImageAttached(false);
1867 __pPopUp->RemoveAllShareInfo();
1868 __pPopUp->AddShareInfo(pShareInfo);
1870 __pPopUp->SetShowState(true);
1874 case IDA_BOOKMARKBTN_CLICKED:
1876 AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
1877 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1880 case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
1885 case IDA_MOREBTN_CLICKED:
1887 AppLog("IDA_MOREBTN_CLICKED");
1889 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
1891 int bookmarkCount=0;
1894 url=__pWindowInfo->pageUrl;
1895 result r = E_SUCCESS;
1896 Bitmap* pBitmap = null;
1898 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1901 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
1906 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1910 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1912 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
1914 if (__pOptionMenu->GetItemCount() == 9)
1916 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1920 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1925 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
1929 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
1930 if (__pOptionMenu->GetItemCount() != 9)
1932 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
1933 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
1934 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
1935 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
1936 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
1937 __pOptionMenu->SetMaxVisibleItemsCount(6);
1939 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
1941 AppLog(" Orientation landscape");
1942 __pOptionMenu->SetMaxVisibleItemsCount(5);
1946 AppLog(" Orientation potrait");
1947 __pOptionMenu->SetMaxVisibleItemsCount(6);
1950 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
1953 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
1954 __pOptionMenu->SetShowState(true);
1955 __pOptionMenu->Invalidate(true);
1956 __pOptionMenu->Show();
1960 case IDA_HISTORY_CLICKED:
1962 AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
1963 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1966 case IDA_SAVED_PAGES_CLICKED:
1971 case IDA_DESKTOP_VIEW_CLICKED:
1976 case IDA_SAVE_CLICKED:
1981 case IDA_MULTIWINDOWBTN_CLICKED:
1983 result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1984 AppLog("IDA_MULTIWINDOWBTN_CLICKED result %s",GetErrorMessage(r));
1988 case IDA_NEWWINDOWBTN_CLICKED:
1990 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
1992 if (pNewWindowInfo == null)
1996 result r = E_SUCCESS;
1997 SceneManager* pSceneManager = SceneManager::GetInstance();
1999 if (pSceneManager == NULL)
2003 ArrayList* pArgList = new(std::nothrow) ArrayList();
2004 if (pArgList == NULL)
2008 r = pArgList->Construct();
2011 pArgList->Add(*pNewWindowInfo);
2012 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2018 AppLogDebug("MainForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
2023 case IDA_SMALLFONT_BTN_CLICKED:
2025 WebSetting setting = __pWebReader->GetSetting();
2026 setting.SetFontSize(15);
2027 __pWebReader->SetSetting(setting);
2030 case IDA_LARGEFONT_BTN_CLICKED:
2032 WebSetting setting = __pWebReader->GetSetting();
2033 setting.SetFontSize(25);
2034 __pWebReader->SetSetting(setting);
2037 case IDA_READER_CLOSE_CLICKED:
2039 if (__pArticleReaderPanel != null && __pBlankPanel != null)
2041 RemoveControl(__pBlankPanel);
2042 __pArticleReaderPanel = null;
2043 __pBlankPanel = null;
2044 __pArticleReaderLabel = null;
2046 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2049 case IDA_FINDWORD_CANCEL_CLICKED:
2051 __currentSearchStr = L"";
2052 __currentWordIndex = 0;
2053 __maxOccurrances = 0;
2055 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2057 __pFindWordEditField->SetText(L"");
2058 __pFindWordCountLabel->SetText(L"0/0");
2060 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2062 __pFindWordEditFieldRightToLeft->SetText(L"");
2063 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2066 __pFindWordNext->SetEnabled(false);
2067 __pFindWordPrev->SetEnabled(false);
2068 __pFindWordCountLabel->SetText(L"0/0");
2069 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
2070 AppLog("akjshdasd 1");
2071 if(__isKeypadOpened == false)
2072 __pFooterPanel->SetShowState(true);
2073 ShowFindWordPanel(false);
2076 case IDA_FINDWORD_SEARCH_CLICKED:
2078 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2080 __currentSearchStr = __pFindWordEditField->GetText();
2082 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2084 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
2087 if (__currentSearchStr.GetLength() > 0)
2093 AppLogDebug("Enter something");
2097 case IDA_FINDWORD_CLEAR_CLICKED:
2099 __pFindWordCountLabel->SetText(L"0/0");
2100 __pFindWordEditField->SetText(L"");
2101 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2103 __currentSearchStr = L"";
2104 __pFindWordNext->SetEnabled(false);
2105 __pFindWordPrev->SetEnabled(false);
2106 // __pFindWordCountLabel->SetShowState(false);
2107 __pFindWordControl->Invalidate(true);
2110 case IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED:
2112 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2113 __pFindWordEditFieldRightToLeft->SetText(L"");
2114 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2116 __currentSearchStr = L"";
2117 __pFindWordNext->SetEnabled(false);
2118 __pFindWordPrev->SetEnabled(false);
2119 // __pFindWordCountLabelRightToLeft->SetShowState(false);
2120 __pFindWordControl->Invalidate(true);
2123 case IDA_FINDWORD_NEXT_CLICKED:
2128 case IDA_FINDWORD_PREV_CLICKED:
2130 FindNextWord(false);
2133 case IDA_BRIGHTNESS_BTN_CLICKED:
2135 AppLogDebug("IDA_BRIGHTNESS_BTN_CLICKED");
2136 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BRIGHTNESS, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2139 case IDA_COPY_IMAGE_CLICKED:
2141 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2142 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2144 const Bitmap* pBitmap = null;
2145 if (__pHitElementResult != null && __pHitElementResult->HasImage())
2147 pBitmap = __pHitElementResult->GetImage();
2150 String resourcePath = App::GetInstance()->GetAppResourcePath();
2151 r = item.Construct(CLIPBOARD_DATA_TYPE_IMAGE , *pBitmap);
2152 AppLog("Platofrm construct failed result %s",GetErrorMessage(r));
2153 // copying the item to clipboard
2154 Clipboard* pClipboard = Clipboard::GetInstance();
2155 if (pClipboard != null)
2157 r = pClipboard->CopyItem(item);
2158 AppLog("Platofrm copy failed result %s",GetErrorMessage(r));
2162 case IDA_VIEW_IMAGE_CLICKED:
2164 AppLogDebug("IDA_VIEW_IMAGE_CLICKED");
2165 WindowInfo* pNewWindowInfo = null;
2166 if (__pHitElementResult != null)
2168 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2169 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2175 case IDA_SAVE_IMAGE_CLICKED:
2177 AppLogDebug("IDA_SAVE_IMAGE_CLICKED");
2178 const Bitmap* pSaveBitmap = null;
2179 String imageName = GetImagePath();
2180 AppLog("Content manager image name %ls",imageName.GetPointer());
2183 imagePath.Append(imageName);
2184 imagePath.Format(100, L"%ls/Downloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2185 AppLog("Content manager image path %ls",imagePath.GetPointer());
2186 if (__pHitElementResult != null)
2188 pSaveBitmap = __pHitElementResult->GetImage();
2190 ByteBuffer* pBuffer = __pSaveImage->EncodeToBufferN(*pSaveBitmap, IMG_FORMAT_JPG);
2194 UpdateImageContent(pBuffer, imageName);
2196 if(__pNotification != null)
2198 RemoveControl(__pNotification);
2199 __pNotification = null;
2201 __pNotification = new NotificationPanel(*this);
2203 AppResource::GetInstance()->GetString("IDS_COM_SK_SAVE", msg);
2204 msg.Append(imagePath);
2205 if (__pNotification != null)
2207 __pNotification->SetText(msg);
2208 if (__pFooterPanel->GetShowState() == true)
2210 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
2214 __pNotification->SetPositionDiff(0);
2217 __pNotification->ShowNotification();
2222 int __modalMsgBoxResult;
2223 MessageBox* pMsgBox = new MessageBox();
2224 pMsgBox->Construct(CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
2225 pMsgBox->ShowAndWait(__modalMsgBoxResult);
2228 __modalMsgBoxResult = 0;
2232 case IDA_SHARE_IMAGE_CLICKED:
2234 AppLogDebug("IDA_SHARE_IMAGE_CLICKED");
2235 if (__pPopUp != null)
2242 __pAddressbar->HideKeypad();
2244 __pPopUp = new(std::nothrow) SharePopup();
2245 __pPopUp->Initialize();
2246 if (__pHitElementResult != null)
2248 const Bitmap* pSaveBitmap = null;
2249 String imageName = GetImagePath();
2250 AppLog("Content manager image name %ls",imageName.GetPointer());
2253 imagePath.Append(imageName);
2254 imagePath.Format(100, L"%lsDownloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2255 AppLog("Content manager image path %ls",imagePath.GetPointer());
2256 if (__pHitElementResult != null)
2258 pSaveBitmap = __pHitElementResult->GetImage();
2260 __pSaveImage->EncodeToFile(*pSaveBitmap, IMG_FORMAT_JPG, imagePath, true);
2262 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2263 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2265 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2266 pShareInfo->SetPageTitle(L"");
2267 pShareInfo->SetPageUrl(srcUrl);
2268 pShareInfo->SetImageAttached(true);
2269 pShareInfo->SetImagePath(imagePath);
2270 __pPopUp->RemoveAllShareInfo();
2271 __pPopUp->AddShareInfo(pShareInfo);
2272 __pPopUp->SetShowState(true);
2277 case IDA_HYPERLINK_OPEN_CLICKED:
2279 if (__pHitElementResult != null)
2281 String srcUrl = __pHitElementResult->GetUrl();
2283 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(srcUrl);
2285 if (pNewWindowInfo == null)
2289 pNewWindowInfo->isJavascriptInitiated = true;
2290 result r = E_SUCCESS;
2291 SceneManager* pSceneManager = SceneManager::GetInstance();
2292 if (pSceneManager == NULL)
2296 ArrayList* pArgList = new(std::nothrow) ArrayList();
2297 if (pArgList == NULL)
2301 pArgList->Construct();
2303 pArgList->Add(*pNewWindowInfo);
2304 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2305 if (pArgList != null)
2312 AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
2318 case IDA_HYPERLINK_SHARE_IMAGE_CLICKED:
2320 if (__pHitElementResult == null)
2325 if(__pPopUp != null)
2332 __pAddressbar->HideKeypad();
2334 __pPopUp = new(std::nothrow) SharePopup();
2335 __pPopUp->Initialize();
2337 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2338 pShareInfo->SetPageUrl(__pHitElementResult->GetUrl());
2339 pShareInfo->SetImageAttached(false);
2340 __pPopUp->RemoveAllShareInfo();
2341 __pPopUp->AddShareInfo(pShareInfo);
2343 __pPopUp->SetShowState(true);
2347 case IDA_HYPERLINK_COPY_LINK_CLICKED:
2351 if (__pHitElementResult != null)
2353 url = __pHitElementResult->GetUrl();
2356 String resourcePath = App::GetInstance()->GetAppResourcePath();
2357 item.Construct(CLIPBOARD_DATA_TYPE_TEXT , url);
2359 // copying the item to clipboard
2360 Clipboard* pClipboard = Clipboard::GetInstance();
2361 if (pClipboard != null)
2363 pClipboard->CopyItem(item);
2367 case IDA_FIND_TEXT__CLICKED:
2369 // AddressBarCancelledClicked(*__pAddressbar);
2370 RelayoutControls(false);
2371 // __pFooterPanel->SetShowState(false);
2372 AppLogDebug("MainForm::OnActionPerformed find word clicked");
2373 __currentSearchStr.Clear();
2374 __currentSearchStr.Append(__currentSelectedStr);
2375 InitFindWordPanel();
2376 __pFindWordEditField->SetText(__currentSearchStr);
2378 if(__pOptionMenu != null)
2380 __pOptionMenu->SetShowState(false);
2381 __pOptionMenu->Invalidate(false);
2383 __adressPanelPosition.y = 0;
2385 if (__pAddressbar != null && __pWebViewer != NULL)
2387 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
2388 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
2390 if (__pFooterPanel->GetShowState() == false)
2391 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
2393 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
2394 __pWebViewer->Invalidate(true);
2397 ShowFindWordPanel(true);
2398 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2400 __pFindWordEditField->SetText(__currentSearchStr);
2401 __pFindWordEditField->SetFocus();
2403 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2405 __pFindWordEditFieldRightToLeft->SetText(__currentSearchStr);
2406 __pFindWordEditFieldRightToLeft->SetFocus();
2409 if (__currentSearchStr.GetLength() > 0)
2415 AppLogDebug("Enter something");
2418 if (__pWebViewer != null)
2420 // releasing the set block
2421 __pWebViewer->ReleaseBlock();
2426 case IDA_SHARE_TEXT_CLICKED:
2428 __pWebViewer->ReleaseBlock();
2429 AppLogDebug("IDA_SHARE_TEXT_CLICKED");
2430 if(__pPopUp != null)
2437 __pAddressbar->HideKeypad();
2439 __pPopUp = new(std::nothrow) SharePopup();
2440 __pPopUp->Initialize();
2441 if (__pHitElementResult != null)
2443 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2444 pShareInfo->SetPageTitle(L"");
2445 pShareInfo->SetPageUrl(__currentSelectedStr);
2446 pShareInfo->SetImageAttached(false);
2447 __pPopUp->RemoveAllShareInfo();
2448 __pPopUp->AddShareInfo(pShareInfo);
2449 __pPopUp->SetShowState(true);
2454 case IDA_COPY_TEXT_CLICKED:
2456 __pWebViewer->ReleaseBlock();
2457 // need to implement
2458 //__currentSelectedStr
2459 // Sets data to a clip board item
2461 String resourcePath = App::GetInstance()->GetAppResourcePath();
2462 item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __currentSelectedStr);
2464 // copying the item to clipboard
2465 Clipboard* pClipboard = Clipboard::GetInstance();
2466 if (pClipboard != null)
2468 pClipboard->CopyItem(item);
2472 case IDA_PASTE_TEXT_CLICKED:
2474 Clipboard* pClipboard = Clipboard::GetInstance();
2476 if(pClipboard == null)
2480 // Retrieves a latest item
2481 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
2487 //Gets data from the clipboard item
2488 String* pString = dynamic_cast<String*>(pItem->GetData());
2490 if (pString != null)
2492 String idElement = __pHitElementResult->GetAttributeValue(L"id");
2493 String nameElement = __pHitElementResult->GetAttributeValue(L"name");
2494 String tagElement = __pHitElementResult->GetTagName();
2495 AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
2498 if(idElement.GetLength() != 0)
2500 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; } } ";
2501 script.Append("insertAtCursor('");
2502 script.Append(idElement);
2503 script.Append("',");
2504 script.Append("\"");
2505 script.Append(*pString);
2506 script.Append("\");");
2508 else if (nameElement.GetLength() != 0)
2510 script = L"function insertAtCursor(myField, myValue) { if (document.selection) { document.getElementByName(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.getElementByName(myField)[0].value += myValue; } } ";
2511 script.Append("insertAtCursor(document.getElementsByName('");
2512 script.Append(nameElement);
2513 script.Append("')[0],");
2514 script.Append("\"");
2515 script.Append(*pString);
2516 script.Append("\");");
2518 else//adding for twitter post page
2520 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; } } ";
2521 script.Append("insertAtCursor(document.getElementsByTagName('");
2522 script.Append(tagElement);
2523 script.Append("')[0],");
2524 script.Append("\"");
2525 script.Append(*pString);
2526 script.Append("\");");
2528 AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
2529 String* pStr = __pWebViewer->EvaluateJavascriptN(script);
2540 case IDA_GO_FORWARD:
2545 case IDA_REFRESH_BTN_CLICKED:
2547 __isLoadingCompleted = false;
2548 __isLoadingData = true;
2549 __progressPercentage = 0;
2550 __displayUrl = __pFooterUrlField->GetText();
2552 String url = __pFooterUrlField->GetText();
2553 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
2555 if (__pWebViewer != null && __pAddressbar != null)
2557 __pWebViewer->Reload();
2558 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
2562 UpdateProgressBitmap();
2565 case IDA_STOP_BTN_CLICKED:
2567 __isLoadingCompleted = false;
2568 __isLoadingData = false;
2569 __progressPercentage = 0;
2570 __pFooterUrlField->HideKeypad();
2571 __displayUrl = __pFooterUrlField->GetText();
2575 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2576 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2577 __pWebViewer->StopLoading();
2578 RequestRedraw(true);
2581 UpdateProgressBitmap();
2586 if (__pFooterUrlField->GetText().IsEmpty() == false)
2588 //__displayUrl = __pUrlField->GetText();
2589 __pFooterUrlField->Clear();
2594 case IDA_READER_BTN_CLICKED:
2605 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
2607 AppLog("MainForm::OnFormBackRequested entered");
2608 result r = E_FAILURE;
2609 if(__pImageMenu && __pImageMenu->GetShowState() == true)
2611 AppLog("Hiding the menu");
2612 __pImageMenu->SetShowState(false);
2614 if (__pWebViewer && __pWebViewer->CanGoBack())
2616 __pWebViewer->GoBack();
2618 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
2621 pApp = UiApp::GetInstance();
2624 RemoveOrientationEventListener(*this);
2628 __pAddressbar->SetAddressbarEventListener(null);
2633 __pWebViewer->RemoveTouchEventListener(*this);
2634 __pWebViewer->SetWebUiEventListenerF(null);
2635 __pWebViewer->SetWebKeypadEventListener(null);
2636 __pWebViewer->SetTextSearchListener(null);
2637 __pWebViewer->SetLoadingListener(null);
2639 r = pApp->Terminate();
2642 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2650 WindowInfo* pWindowInfo = null;
2652 SceneManager* pSceneManager = SceneManager::GetInstance();
2653 if (pSceneManager == null)
2657 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
2658 if (pAllWindowList == NULL)
2660 pApp = UiApp::GetInstance();
2663 RemoveOrientationEventListener(*this);
2667 __pAddressbar->SetAddressbarEventListener(null);
2672 __pWebViewer->RemoveTouchEventListener(*this);
2673 __pWebViewer->SetWebUiEventListenerF(null);
2674 __pWebViewer->SetWebKeypadEventListener(null);
2675 __pWebViewer->SetTextSearchListener(null);
2676 __pWebViewer->SetLoadingListener(null);
2678 r = pApp->Terminate();
2681 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2686 if (pAllWindowList != null)
2688 totalCount = pAllWindowList->GetCount();
2690 for (int count = 0; count < totalCount; count++)
2692 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
2693 if (pWindowInfo == null)
2695 pApp = UiApp::GetInstance();
2698 RemoveOrientationEventListener(*this);
2702 __pAddressbar->SetAddressbarEventListener(null);
2707 __pWebViewer->RemoveTouchEventListener(*this);
2708 __pWebViewer->SetWebUiEventListenerF(null);
2709 __pWebViewer->SetWebKeypadEventListener(null);
2710 __pWebViewer->SetTextSearchListener(null);
2711 __pWebViewer->SetLoadingListener(null);
2713 r = pApp->Terminate();
2716 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2723 if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
2725 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
2728 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2731 r = pAllWindowList->RemoveAt(count, true);
2732 __pWindowInfo = null;
2735 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2740 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
2744 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
2746 if (pWindowInfo == null)
2748 pApp = UiApp::GetInstance();
2751 RemoveOrientationEventListener(*this);
2755 __pAddressbar->SetAddressbarEventListener(null);
2760 __pWebViewer->RemoveTouchEventListener(*this);
2761 __pWebViewer->SetWebUiEventListenerF(null);
2762 __pWebViewer->SetWebKeypadEventListener(null);
2763 __pWebViewer->SetTextSearchListener(null);
2764 __pWebViewer->SetLoadingListener(null);
2766 r = pApp->Terminate();
2772 if(pWindowInfo != null)
2773 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2776 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2785 AppLog("MainForm::OnFormBackRequested exit");
2789 MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
2790 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
2793 AppLog("MainForm::OnSceneActivatedN called");
2794 String* pSelectedScene = NULL;
2795 Object* pValue = NULL;
2796 String* pUrl = null;
2797 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
2798 pSelectedScene = (String*) pValue;
2800 if (pSelectedScene != null)
2802 delete pSelectedScene;
2804 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
2805 String* selectedSceneID = new(std::nothrow) String(currentSceneId);
2806 AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
2807 AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer());
2809 // setting the current scene ID
2810 MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId);
2812 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID);
2814 if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
2816 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2817 if(__pWindowInfo == null)
2819 // if(__pWindowInfo == null)
2821 pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
2824 else if ( pArgs != null && pArgs->GetCount() == 1)
2826 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2832 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
2834 // hiding the address bar
2835 // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
2836 __pAddressbar->SetShowState(false);
2837 // if(__pWebViewer != null)
2839 // __pWebViewer->Resume();
2842 if(pUrl != null && pUrl->GetLength() > 0)
2846 else if(__pWindowInfo != null)
2848 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)
2850 LoadUrl(__pWindowInfo->pageUrl);
2852 else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
2854 LoadUrl(__pWindowInfo->pageUrl);
2855 __pWindowInfo->isAppcontrolTriggered = false;
2857 else if (__pWindowInfo->isJavascriptInitiated == true)
2861 __pWindowInfo->pCurrentWeb = __pWebViewer;
2862 if(__pWindowInfo->pageUrl.GetLength() > 0)
2863 LoadUrl(__pWindowInfo->pageUrl);
2867 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
2868 AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
2869 if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
2871 InitMostVisitedSitesView(GetOrientationStatus());
2873 else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
2875 if(__pMostVisitedListView != null)
2877 __pMostVisitedListView->SetShowState(false);
2881 if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
2883 String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
2885 if (pBookmarkUrl == null)
2887 AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
2888 //__pAddressbar->SetUrl(*pBookmarkUrl);
2889 SetUrl(*pBookmarkUrl);
2891 if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
2892 __pWebViewer->LoadUrl(*pBookmarkUrl);
2893 delete pBookmarkUrl;
2896 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
2897 Bitmap* pBitmap = null;
2898 if (isPrivateBrowsing == true)
2900 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
2902 if (__pWebViewer != null)
2904 __pWebViewer->SetPrivateBrowsingEnabled(true);
2907 if (__pAddressbar != null)
2909 // __pAddressbar->UpdateFaviconBitmap(true);
2915 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
2917 if (__pWebViewer != null)
2919 __pWebViewer->SetPrivateBrowsingEnabled(false);
2922 if (__pAddressbar != null)
2924 // __pAddressbar->UpdateFaviconBitmap(false);
2928 if (__pOptionMenu != null && __pOptionMenu->GetItemCount() != 9)
2930 __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2932 else if (__pOptionMenu != null )
2934 __pOptionMenu->SetItemAt(5,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2937 if (pBitmap != null)
2942 RelayoutControls(false);
2943 AppLog("ABC: OnSceneActivatedN started exit");
2948 MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
2949 const Tizen::Ui::Scenes::SceneId& nextSceneId)
2951 Canvas* pWebCanvas = null;
2952 if (__pWebViewer != null)
2954 pWebCanvas = __pWebViewer->GetCanvasN();
2957 if (pWebCanvas == null)
2961 if (__pWindowInfo != null)
2963 if (__pWindowInfo->pWebCanvasBitmap != null)
2965 delete __pWindowInfo->pWebCanvasBitmap;
2967 __pWindowInfo->pWebCanvasBitmap = new(std::nothrow) Bitmap();
2968 result r = __pWindowInfo->pWebCanvasBitmap->Construct(*pWebCanvas,Rectangle(0,0,pWebCanvas->GetBounds().width,pWebCanvas->GetBounds().height));
2969 AppLog("Bitmap Construction result %s",GetErrorMessage(r));
2971 Bitmap* pBitmap = GetCapturedBitmapN();
2972 AppLog("Coming here");
2973 Canvas* pCanvas = new(std::nothrow) Canvas();
2974 pCanvas->Construct(GetClientAreaBounds());
2977 pCanvas->DrawBitmap(Point(0,0),*pBitmap);
2980 if(__pWebViewer != null && __pWindowInfo != null)
2981 pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
2983 WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
2984 WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
2988 __pAddressbar->SetShowState(false);
2989 AppLog("Coming here");
2993 MainForm::OnHttpAuthenticationRequestedN(const Tizen::Base::String& host,
2994 const Tizen::Base::String& realm,
2995 const Tizen::Web::Controls::AuthenticationChallenge& authentication)
3001 MainForm::OnHttpAuthenticationCanceled(void)
3006 MainForm::OnLoadingStarted(void)
3008 AppLogDebug("MainForm::OnLoadingStarted entered");
3010 if(__pAddressbar == NULL || __pWebViewer == null)
3015 // this is added in case if menu is opened and user load the page
3016 if(__pOptionMenu != null && __pOptionMenu->GetShowState() == true)
3018 __pOptionMenu->SetShowState(false);
3019 __pOptionMenu->Invalidate(true);
3024 if(__pImageMenu != null && __pImageMenu->GetShowState() == true)
3026 __pImageMenu->SetShowState(false);
3027 __pImageMenu->Invalidate(true);
3029 String url = __pWebViewer->GetUrl();
3030 if(url.Contains(IDS_TIZEN_SERVICE))
3033 String delim(L":;,");
3035 // Creates a StringTokenizer instance
3036 StringTokenizer strTok(url, delim);
3038 int count = strTok.GetTokenCount(); // count == 4
3040 HashMap *pMap = new HashMap();
3045 while (strTok.HasMoreTokens())
3047 AppLog("Token: %ls", token.GetPointer());
3048 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3049 if(token.Contains(IDS_APPID))
3051 token.SubString(6, appId);
3052 AppLog("AppID:%ls", appId.GetPointer());
3054 else if(token.Contains(IDS_KEY))
3056 token.SubString(4, key);
3057 AppLog("key:%ls", key.GetPointer());
3059 else if(token.Contains(IDS_VALUE))
3061 token.SubString(6, value);
3062 AppLog("value:%ls", value.GetPointer());
3065 pMap->Add(key, value);
3069 AppControl *pAppControl = null;
3070 String operationId = L"http://tizen.org/appcontrol/operation/main";
3071 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3074 AppLog("Starting AppControl");
3075 result r = pAppControl->Start(null, null, pMap, null);
3076 AppLog("Result of Start %s", GetErrorMessage(r));
3080 AppLogException("AppControl not found");
3085 if ( __pAddressbar != null && __pAddressbar->GetShowState() == true)
3087 __pAddressbar->SetShowState(false);
3088 AddressBarCancelledClicked(*__pAddressbar);
3089 __pAddressbar->Invalidate(true);
3091 Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
3094 __pAddressbar->SetFaviconBitmap(*pBitmap);
3097 if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
3099 // updating the address bar position with respect to web control
3100 __adressPanelPosition.y = 0 - __pAddressbar->GetHeight() + 12; //-12 is for the progress label
3101 __distanceMoved = 0;
3105 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3106 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3107 if (__pWebViewer != null)
3109 AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
3110 //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
3111 SetUrl(__pWebViewer->GetUrl());
3112 if (__pWindowInfo != NULL)
3114 // resetting the page title to blank, it will be received in OnPageTitleReceived()
3115 __pWindowInfo->pageTitle = L"";
3116 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3118 __pAddressbar->Invalidate(true);
3124 MainForm::OnLoadingCanceled(void)
3131 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
3133 AppLog("XYZ::MainForm::OnKeypadWillOpen");
3138 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
3140 AppLog("XYZ::MainForm::OnKeypadOpened");
3141 __isKeypadOpened = true;
3142 __pFooterPanel->SetShowState(false);
3147 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
3149 AppLog("XYZ::MainForm::OnKeypadClosed");
3150 __isKeypadOpened = false;
3151 __pFooterPanel->SetShowState(true);
3152 RelayoutControls(true);
3156 MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
3158 AppLog("XYZ::KeypadBoundsChanged");
3159 RelayoutControls(false);
3163 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
3164 const Tizen::Base::String& reason)
3166 AppLogDebug("Error: %d, %ls", error, reason.GetPointer());
3170 MainForm::OnLoadingCompleted(void)
3172 AppLog("MainForm::OnLoadingCompleted start");
3174 result r = E_SUCCESS;
3176 if (__pWebViewer == null)
3181 if (__pAddressbar == null)
3186 if(__pImageMenu && __pImageMenu->GetShowState())
3188 __pImageMenu->SetShowState(false);
3189 __pImageMenu->Invalidate(true);
3192 if (__pWebViewer->CanGoForward())
3194 //__pAddressbar->SetForwardButtonEnabled(true);
3195 SetForwardButtonEnabled(true);
3199 //__pAddressbar->SetForwardButtonEnabled(false);
3200 SetForwardButtonEnabled(false);
3203 /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3205 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3207 //__pAddressbar->UpdateProgress(0);
3211 if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3213 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3217 AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
3218 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
3219 if (isPrivateBrowsing == false)
3221 if(__pHistory != null)
3227 __pHistory = new(std::nothrow) History;
3228 HistoryPresentationModel::GetCurrentDateTime(date);
3231 __pHistory->SetHistoryTitle(__pWindowInfo->pageTitle);
3232 AppLogDebug("MainForm::OnLoadingCompleted pagetitle = %ls", __pWindowInfo->pageTitle.GetPointer());
3234 __pHistory->SetHistoryUrl(__pWindowInfo->pageUrl);
3235 AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
3237 __pHistory->SetVisitedTime(date);
3239 if (__pWebViewer != null)
3241 AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
3243 Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
3244 if (pTempBitmap != null)
3246 AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
3247 __pHistory->SetFavIconBitmap(*pTempBitmap);
3250 AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
3253 Canvas* pCanvas = __pWebViewer->GetCanvasN();
3254 Bitmap* pBitmap = new(std::nothrow) Bitmap();
3255 if ( pCanvas != null && pCanvas != null && pBitmap != null)
3257 pBitmap->Construct(*pCanvas, pCanvas->GetBounds());
3258 pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
3259 __pHistory->SetThumbnail(pBitmap);
3261 Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
3264 __pHistory->SetFavIconBitmap(*pFavIcon);
3268 HistoryPresentationModel::GetInstance()->SaveTempHistory(*__pHistory);
3275 // if (__pWindowInfo && __pWindowInfo->faviconUrl == "")
3277 // temperary fixed (webpage can be not loaded)
3281 bool isReaderEnabled = SettingPresentationModel::GetInstance()->IsRunReaderEnabled();
3282 if (isReaderEnabled == true)
3286 delete __pReaderData;
3287 __pReaderData = null;
3289 String filePath = Tizen::App::UiApp::GetInstance()->GetAppRootPath();
3290 filePath.Append(L"data/reader.js");
3296 result r = E_SUCCESS;
3297 FileAttributes attr;
3299 File::GetAttributes(filePath,attr);
3301 r = file.Construct(filePath, L"r+");
3304 AppLogDebug("File construct failed with %s", GetErrorMessage(r));
3307 char* pScript = new(std::nothrow) char[attr.GetFileSize()+1];
3310 AppLogDebug("Memory allocation for file failed %s", GetErrorMessage(r));
3313 // file.Read(pScript,attr.GetFileSize());
3315 // AppLogDebug("scipt length %d",strlen(pScript));
3316 String strScript = L"";
3317 // strScript.Append(pScript);
3318 // for(int i=0; i<25; i++)
3320 file.Read(pScript,attr.GetFileSize());
3321 // AppLog("xyzz tell %d",file.Tell());
3322 // r = strScript.Append(pScript);
3323 // AppLog("xyzz append result %s",GetErrorMessage(r));
3324 // AppLog("xyzz strScript length %d",strScript.GetLength());
3326 // AppLog("xyzz final strScript length %d",strScript.GetLength());
3328 __pReaderData = __pWebViewer->EvaluateJavascriptN(pScript);
3329 if (__pReaderData == null)
3331 AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult()));
3332 __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>");
3335 AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
3336 if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
3338 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3339 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3345 AppLog("MainForm::OnLoadingCompleted done");
3349 MainForm::OnEstimatedProgress(int progress)
3351 AppLogDebug("MainForm::OnEstimatedProgress entered %d",progress);
3353 if (progress < DEFAULT_PROGRESS_PERCENTAGE)
3354 progress = DEFAULT_PROGRESS_PERCENTAGE;
3356 // __pAddressbar->UpdateProgress(progress);
3357 UpdateProgress(progress);
3360 void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
3362 AppLog("MainForm::OnFaviconReceived");
3363 if (__pWebViewer != null && __pHistory != null && __pWindowInfo != null && (__pWindowInfo->pageUrl.CompareTo(__pHistory->GetHistoryUrl()) == 0))
3365 Bitmap* favIcon = __pWebViewer->GetFaviconN();
3368 HistoryPresentationModel::GetInstance()->UpdateHistoryFavIcon(*__pHistory, *favIcon);
3375 MainForm::OnUrlValueChanged(Addressbar&)
3381 MainForm::OnUrlSubmitted(Addressbar& addBar)
3383 AppLog("MainForm::OnUrlSubmitted");
3384 String url = addBar.GetUrl();
3385 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
3387 if(__pFooterUrlField)
3388 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
3389 AddressBarCancelledClicked(*__pAddressbar);
3394 MainForm::LoadUrl(String& url)
3398 // UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3399 AppLogDebug("MainForm::LoadUrl enter");
3401 if (__pWebViewer != null)
3403 __pWebViewer->SetShowState(true);
3404 __pWebViewer->Invalidate(true);
3407 if (url.CompareTo(L"") == 0)
3411 if(__pFooterPanel != null)
3413 __pFooterPanel->SetShowState(true);
3414 __pFooterPanel->Invalidate(true);
3421 String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");
3422 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)
3424 RegularExpression firstRegex;
3425 RegularExpression secondRegex;
3427 firstRegex.Construct(firstPattern, REGEX_CASELESS);
3428 secondRegex.Construct(secondPattern, REGEX_CASELESS);
3431 ret = firstRegex.Match(url, false); // This returns true value
3432 flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it)
3434 if (ret == true && __pWebViewer != null)
3437 __pWebViewer->LoadUrl(url);
3439 else if(__pWebViewer != null)
3441 String tempUrl = L"http://";
3442 tempUrl.Append(url);
3446 __pWebViewer->LoadUrl(tempUrl);
3450 UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3451 __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
3454 if (__pAddressbar != null)
3456 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3457 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3460 AppLogDebug("MainForm::LoadUrl exit");
3467 MainForm::OnFocusGained(const Tizen::Ui::Control& source)
3469 AppLog("MainForm::OnFocusGained");
3472 __pFooterPanel->SetShowState(false);
3477 __pAddressbar->SetShowState(true);
3478 __pAddressbar->SetAddressbarURLFocus();
3480 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3482 __currentSearchStr = L"";
3483 __currentWordIndex = 0;
3484 __maxOccurrances = 0;
3486 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
3488 __pFindWordEditField->SetText(L"");
3489 __pFindWordEditField->HideKeypad();
3490 __pFindWordControl->SetShowState(false);
3491 __pFindWordCountLabel->SetText(L"0/0");
3493 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
3495 __pFindWordEditFieldRightToLeft->SetText(L"");
3496 __pFindWordEditFieldRightToLeft->HideKeypad();
3497 __pFindWordControl->SetShowState(false);
3498 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
3501 __pFindWordNext->SetEnabled(false);
3502 __pFindWordPrev->SetEnabled(false);
3504 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
3505 __pFindWordControl->SetShowState(false);
3507 RelayoutControls(false);
3511 MainForm::OnFocusLost(const Tizen::Ui::Control& source)
3513 AppLog("MainForm::OnFocusLost called");
3517 MainForm::OnStopClicked(Addressbar& addBar)
3519 AppLogDebug("MainForm::OnStopClicked called");
3522 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3523 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3524 __pWebViewer->StopLoading();
3525 RequestRedraw(true);
3530 MainForm::OnBackClicked(/*const Addressbar& addBar*/)
3532 // AppLog("MainForm::OnBackClicked");
3533 result r = E_FAILURE;
3534 if(__pImageMenu && __pImageMenu->GetShowState() == true)
3536 AppLog("Hiding the menu");
3537 __pImageMenu->SetShowState(false);
3540 if (__pWebViewer && __pWebViewer->CanGoBack())
3542 __pWebViewer->GoBack();
3544 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
3547 pApp = UiApp::GetInstance();
3551 RemoveOrientationEventListener(*this);
3555 __pAddressbar->SetAddressbarEventListener(null);
3560 __pWebViewer->RemoveTouchEventListener(*this);
3561 __pWebViewer->SetWebUiEventListenerF(null);
3562 __pWebViewer->SetWebKeypadEventListener(null);
3563 __pWebViewer->SetTextSearchListener(null);
3564 __pWebViewer->SetLoadingListener(null);
3568 r = pApp->Terminate();
3571 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3579 WindowInfo* pWindowInfo = null;
3581 SceneManager* pSceneManager = SceneManager::GetInstance();
3582 if (pSceneManager == null)
3586 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
3587 if (pAllWindowList == NULL)
3589 pApp = UiApp::GetInstance();
3592 RemoveOrientationEventListener(*this);
3596 __pAddressbar->SetAddressbarEventListener(null);
3601 __pWebViewer->RemoveTouchEventListener(*this);
3602 __pWebViewer->SetWebUiEventListenerF(null);
3603 __pWebViewer->SetWebKeypadEventListener(null);
3604 __pWebViewer->SetTextSearchListener(null);
3605 __pWebViewer->SetLoadingListener(null);
3609 r = pApp->Terminate();
3612 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3617 if (pAllWindowList != null)
3619 totalCount = pAllWindowList->GetCount();
3621 for (int count = 0; count < totalCount; count++)
3623 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
3624 if (pWindowInfo == null)
3626 pApp = UiApp::GetInstance();
3629 RemoveOrientationEventListener(*this);
3633 __pAddressbar->SetAddressbarEventListener(null);
3638 __pWebViewer->RemoveTouchEventListener(*this);
3639 __pWebViewer->SetWebUiEventListenerF(null);
3640 __pWebViewer->SetWebKeypadEventListener(null);
3641 __pWebViewer->SetTextSearchListener(null);
3642 __pWebViewer->SetLoadingListener(null);
3646 r = pApp->Terminate();
3649 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3654 if (pSceneManager != null && pWindowInfo != null && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
3656 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
3659 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3662 r = pAllWindowList->RemoveAt(count, true);
3663 __pWindowInfo = null;
3666 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3671 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
3673 else if(pAllWindowList->GetCount() > 0)
3675 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
3679 pApp = UiApp::GetInstance();
3682 RemoveOrientationEventListener(*this);
3686 __pAddressbar->SetAddressbarEventListener(null);
3691 __pWebViewer->RemoveTouchEventListener(*this);
3692 __pWebViewer->SetWebUiEventListenerF(null);
3693 __pWebViewer->SetWebKeypadEventListener(null);
3694 __pWebViewer->SetTextSearchListener(null);
3695 __pWebViewer->SetLoadingListener(null);
3699 r = pApp->Terminate();
3704 if (pWindowInfo == null)
3706 pApp = UiApp::GetInstance();
3709 RemoveOrientationEventListener(*this);
3713 __pAddressbar->SetAddressbarEventListener(null);
3718 __pWebViewer->RemoveTouchEventListener(*this);
3719 __pWebViewer->SetWebUiEventListenerF(null);
3720 __pWebViewer->SetWebKeypadEventListener(null);
3721 __pWebViewer->SetTextSearchListener(null);
3722 __pWebViewer->SetLoadingListener(null);
3726 r = pApp->Terminate();
3732 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
3735 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3749 MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
3751 AppLog("MainForm::OnForwardClicked");
3752 if (__pWebViewer == null)
3755 if (__pWebViewer->CanGoForward())
3757 __pWebViewer->GoForward();
3762 MainForm::OnAddressBarFocusGained(const Addressbar& addBar)
3764 AppLog("XYZ::MainForm::OnAddressBarFocusGained");
3765 if(__pFooterPanel != null)
3767 __pFooterPanel->SetShowState(false);
3770 if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
3772 __pAddressbar->SetShowState(true);
3773 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3776 RelayoutControls(false);
3780 MainForm::OnAddressBarFocusLost(const Addressbar& addBar, bool addressbarKeyPadState)
3782 AppLog("XYZ::MainForm::OnAddressBarFocusLost");
3784 int Height = GetClientAreaBounds().height;
3785 AppLog("MainForm::OnAddressBarFocusLost height is %d",Height);
3787 RelayoutControls(false);
3791 MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
3793 AddressBarCancelledClicked(addBar);
3797 MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
3799 __prevAddressBarMode = __curAddressBarMode;
3801 if (__pAddressbar != null)
3803 __curAddressBarMode = GetAddressbarMode();
3806 if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
3808 __adressPanelPosition.y = 0;
3809 if (__pAddressbar != null)
3811 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
3812 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3813 __pAddressbar->Invalidate(true);
3815 if (__pWebViewer != null)
3817 __pWebViewer->StopLoading();
3820 else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
3822 __adressPanelPosition.y = 0;
3823 if (__pAddressbar != null)
3825 __webControlPosition.y = 0;
3826 __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
3827 __pAddressbar->Invalidate(true);
3833 MainForm::OnClipboardClosed(const Addressbar& addBar)
3835 AppLog("XYZ::MainForm::OnClipboardClosed");
3836 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3838 AppLog("akjshdasd 3");
3839 __pFooterPanel->SetShowState(true);
3841 __isKeypadOpened = false;
3842 RelayoutControls(false);
3846 MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
3848 AppLog("XYZ::MainForm::OnAddressBarKeypadClosed");
3849 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3851 AppLog("akjshdasd 3");
3852 __pFooterPanel->SetShowState(true);
3854 __isKeypadOpened = false;
3856 RelayoutControls(false,footerState);
3860 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
3862 AppLog("XYZ::MainForm::OnAddressBarKeypadOpened");
3863 __isKeypadOpened = true;
3864 RelayoutControls(false);
3868 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
3870 __isKeypadOpened = true;
3871 __pFooterPanel->SetShowState(false);
3875 MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
3877 AppLog("XYZ::MainForm::OnAddressBarKeypadBoundsChanged");
3878 RelayoutControls(false);
3882 MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
3884 AppLog("MainForm::OnPageTitleReceived %ls",title.GetPointer());
3887 __pWindowInfo->pageTitle = title;
3888 if (__pWebViewer != null)
3890 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3893 if (__pAddressbar != null && __pWebViewer != null)
3895 SetUrl(__pWebViewer->GetUrl());
3896 __pAddressbar->Invalidate(true);
3901 MainForm::UpdateFavicon(void)
3903 bool urlImageType = false;
3904 String *tempPath = null;
3906 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();");
3907 Bitmap* pBitmap = null;
3909 if (tempPath && tempPath->GetLength() > 0 && tempPath->CompareTo(L"undefined") != 0)
3911 if (__pWindowInfo != null)
3914 url.SetUri(*tempPath);
3915 if (url.GetHost().GetLength() == 0)
3918 webUrl.SetUri(__pWebViewer->GetUrl());
3919 result r = url.SetHost(webUrl.GetHost());
3926 if (url.GetScheme().GetLength() == 0)
3929 webUrl.SetUri(__pWebViewer->GetUrl());
3930 url.SetScheme(webUrl.GetScheme());
3932 __pWindowInfo->faviconUrl = url.ToString();
3934 pBitmap = __pWebViewer->GetFaviconN();
3936 if (pBitmap != null)
3938 if (__pWindowInfo->pFavicon != NULL)
3940 __pWindowInfo->pFavicon = null;
3942 __pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
3943 __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
3945 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3947 FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
3949 else if(__pWindowInfo->pFavicon != null)
3951 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3955 Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
3956 if(pDefaultBmp != null)
3958 __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
3972 if(tempPath != null)
3976 AppLogDebug("Error occured: %s", GetErrorMessage(GetLastResult()));
3982 MainForm::OnLoadingRequested(const Tizen::Base::String& url,
3983 Tizen::Web::Controls::WebNavigationType type)
3985 AppLog("urlk %ls",url.GetPointer());
3986 // when load new page if find word panel is open its show state is false
3987 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3989 __currentSearchStr = L"";
3990 __currentWordIndex = 0;
3991 __maxOccurrances = 0;
3992 __pFindWordEditField->SetText(L"");
3993 __pFindWordNext->SetEnabled(false);
3994 __pFindWordPrev->SetEnabled(false);
3995 __pFindWordCountLabel->SetText(L"0/0");
3996 __pFindWordControl->SetShowState(false);
3997 __pFindWordEditField->HideKeypad();
3998 RelayoutControls(false);
4001 __pFooterPanel->Invalidate(true);
4004 uriInfo.SetUri(url);
4006 if(url.Contains(IDS_TIZEN_SERVICE))
4009 String delim(L":;,");
4011 // Creates a StringTokenizer instance
4012 StringTokenizer strTok(url, delim);
4014 int count = strTok.GetTokenCount(); // count == 4
4016 HashMap *pMap = new HashMap();
4022 while (strTok.HasMoreTokens())
4024 AppLog("Token: %ls", token.GetPointer());
4025 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
4026 if(token.Contains(IDS_APPID))
4028 token.SubString(6, appId);
4029 AppLog("AppID:%ls", appId.GetPointer());
4031 else if(token.Contains(IDS_KEY))
4033 token.SubString(4, key);
4034 AppLog("key:%ls", key.GetPointer());
4036 else if(token.Contains(IDS_VALUE))
4038 token.SubString(6, value);
4039 AppLog("value:%ls", value.GetPointer());
4042 pMap->Add(key, value);
4046 AppControl *pAppControl = null;
4047 String operationId = L"http://tizen.org/appcontrol/operation/main";
4048 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
4051 result r = pAppControl->Start(null, null, pMap, null);
4055 AppLogException("AppControl not found");
4065 MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
4066 const Tizen::Net::Http::HttpHeader& httpHeader)
4068 return Tizen::Web::Controls::WEB_DECISION_CONTINUE;
4072 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
4074 if(__isLongPressedDone == false)
4076 AppLog("MainForm::OnWebPageBlockSelected");
4077 if (__pHitElementResult != null)
4079 delete __pHitElementResult;
4080 __pHitElementResult = null;
4083 if (__pWebViewer != null)
4085 AppLog("MainForm::OnWebPageBlockSelected web not null");
4086 __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
4088 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
4090 AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
4091 __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
4092 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
4094 __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
4096 AppLog("datafirst endpoint error %s",GetErrorMessage(GetLastResult()));
4100 if (__pHitElementResult == null)
4105 if (__pHitElementResult->HasImage() != true)
4107 String tagName = __pHitElementResult->GetTagName();
4108 String type = __pHitElementResult->GetAttributeValue("type");
4111 AppLog("TagName %ls",tagName.GetPointer());
4112 __currentSelectedStr.Clear();
4113 AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
4114 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4115 AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
4117 if (((tagName.Equals(L"INPUT",false) == 0) || tagName.Equals(L"TEXTAREA",false) == 0) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
4119 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4121 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
4122 __pImageMenu->SetShowState(true);
4123 __pImageMenu->Show();
4124 __pImageMenu->Invalidate(true);
4126 else /*if(__isLongPressedDone == true)*/
4128 AppLog("MainForm::OnWebPageBlockSelected no paste option");
4130 if(__pHitElementResult->GetUrl().GetLength() > 0)
4132 __currentSelectedStr.Clear();
4133 __currentSelectedStr = __pHitElementResult->GetUrl();
4135 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
4136 __pImageMenu->SetShowState(true);
4137 __pImageMenu->Show();
4138 __pImageMenu->Invalidate(true);
4141 AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
4142 AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
4143 AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
4149 MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source)
4155 MainForm::OnWebWindowCreateRequested(void)
4157 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
4159 if (pNewWindowInfo == null)
4163 result r = E_SUCCESS;
4164 SceneManager* pSceneManager = SceneManager::GetInstance();
4165 if (pSceneManager == NULL)
4169 ArrayList* pArgList = new(std::nothrow) ArrayList();
4170 if (pArgList == NULL)
4174 r = pArgList->Construct();
4177 pNewWindowInfo->isJavascriptInitiated = true;
4178 pArgList->Add(*pNewWindowInfo);
4179 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
4183 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
4190 return pNewWindowInfo->pCurrentWeb;
4194 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
4196 AppLog("xyz:: MainForm::RelayoutControls called");
4197 __webControlPosition.y = 0;
4198 __webControlHeight = GetClientAreaBounds().height;
4199 AppLog("Client area height: %d", __webControlHeight);
4201 AppLog("Client area height: %d", __webControlHeight);
4202 if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
4204 __webControlPosition.y += __pAddressbar->GetHeight();
4205 __webControlHeight -= __pAddressbar->GetHeight();
4206 __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
4208 else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
4210 __webControlPosition.y += __pFindWordControl->GetHeight();
4211 __webControlHeight -= __pFindWordControl->GetHeight();
4212 __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
4215 if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true && relayoutFooter == true)
4217 __webControlHeight -= __pFooterPanel->GetHeight();
4219 __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
4221 if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
4223 if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight + 12 )
4228 __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight + 12);
4229 AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
4230 __pWebViewer->Invalidate(false);
4233 if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
4235 __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
4242 MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
4244 if (__pFindWordControl == null)
4249 Tizen::Locales::LocaleManager localeManager;
4250 Tizen::Locales::Locale local = localeManager.GetSystemLocale();
4252 String languageCode;
4253 result r = SettingInfo::GetValue(L"Language", languageCode);
4254 // int languagecode = local.GetLanguageCode();
4255 AppLog("rahul language is %S", languageCode.GetPointer());
4259 InitFindWordPanel();
4261 if (languageCode.CompareTo("ara") == 0)
4263 AppLog("rahul language is arabic");
4265 __pFindWordPanelLeftToRight->SetShowState(false);
4266 __pFindWordPanelRightToLeft->SetShowState(true);
4268 __pFindWordClear->SetShowState(false);
4269 // __pFindWordCountLabel->SetShowState(false);
4270 __pFindWordEditField->SetShowState(false);
4272 __pFindWordClearRightToLeft->SetShowState(true);
4273 __pFindWordCountLabelRightToLeft->SetShowState(true);
4274 __pFindWordEditFieldRightToLeft->SetShowState(true);
4278 AppLog("rahul language is not arabic");
4281 __pFindWordPanelLeftToRight->SetShowState(true);
4282 __pFindWordPanelRightToLeft->SetShowState(false);
4284 __pFindWordClear->SetShowState(true);
4285 __pFindWordCountLabel->SetShowState(true);
4286 __pFindWordEditField->SetShowState(true);
4288 __pFindWordClearRightToLeft->SetShowState(false);
4289 __pFindWordCountLabelRightToLeft->SetShowState(false);
4290 __pFindWordEditFieldRightToLeft->SetShowState(false);
4292 __pFindWordControl->SetShowState(true);
4296 if(__pFindWordControl != null)
4298 __pFindWordControl->SetShowState(false);
4302 AppLog("MainForm::ShowFindWordPanel %d",show);
4303 if (show && !isTouchPressed)
4305 if (languageCode.CompareTo("ara") == 0)
4307 if (__pFindWordEditFieldRightToLeft)
4309 __pFindWordEditFieldRightToLeft->SetFocus();
4310 __pFindWordEditFieldRightToLeft->ShowKeypad();
4315 if (__pFindWordEditField)
4317 __pFindWordEditField->SetFocus();
4318 __pFindWordEditField->ShowKeypad();
4324 if (languageCode.CompareTo("ara") == 0)
4326 if (__pFindWordEditFieldRightToLeft)
4327 __pFindWordEditFieldRightToLeft->HideKeypad();
4331 if (__pFindWordEditField)
4332 __pFindWordEditField->HideKeypad();
4336 RelayoutControls(false);
4340 MainForm::StartWordSearch()
4342 //Get the count of occurances of the word in the current page
4343 __maxOccurrances = 0;
4344 __currentWordIndex = 0;
4346 __pFindWordPrev->SetEnabled(false);
4347 String *pCountStr = null;
4348 result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
4349 AppLog("Search Result %s",GetErrorMessage(r));
4350 /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;");
4351 if (pCountStr != null)
4353 Integer::Parse(*pCountStr, 10, __maxOccurrances);
4357 AppLogDebug("'%ls' is found %d times", __currentSearchStr.GetPointer(), __maxOccurrances);
4362 void MainForm::OnTextFound(int totalCount, int currentOrdinal)
4364 AppLog("MainForm::OnTextFound totalCount %d",totalCount);
4365 AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
4367 if(totalCount == -1 || totalCount == 0)
4369 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
4370 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
4373 else if(totalCount > 100)
4375 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4376 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4380 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4381 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4384 __maxOccurrances = totalCount;
4385 __currentWordIndex = currentOrdinal;
4387 //Reset the UI controls as per the maxOccurrance value
4388 if (totalCount <= 0)
4390 AppLog("Word not found");
4391 //Show error notification to user
4392 __pFindWordNext->SetEnabled(false);
4393 if(__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4395 __pFindWordCountLabel->SetText(L"0/0");
4396 __pFindWordCountLabel->Invalidate(false);
4398 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4400 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4401 __pFindWordCountLabelRightToLeft->Invalidate(false);
4403 __pFindWordNext->Invalidate(false);
4404 __pFindWordPrev->Invalidate(false);
4409 if (totalCount == 1)
4411 __pFindWordNext->SetEnabled(false);
4415 __pFindWordNext->SetEnabled(true);
4418 String countStr = L"";
4419 countStr.Append(__currentWordIndex);
4420 countStr.Append(L"/");
4421 countStr.Append(__maxOccurrances);
4422 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4424 __pFindWordCountLabel->SetText(countStr);
4425 __pFindWordCountLabel->Invalidate(false);
4426 __pFindWordCountLabel->Invalidate(false);
4428 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4430 __pFindWordCountLabelRightToLeft->SetText(countStr);
4431 __pFindWordCountLabelRightToLeft->Invalidate(false);
4432 __pFindWordCountLabelRightToLeft->Invalidate(false);
4434 //FindNextWord(true);
4435 //Update the controls
4436 __pFindWordNext->Invalidate(false);
4437 __pFindWordPrev->Invalidate(false);
4442 MainForm::FindNextWord(bool next)
4446 //if (__pWebViewer->SearchText(__currentSearchStr, true) == true)
4447 if (__pWebViewer->SearchNextAsync(true) == E_SUCCESS)
4449 if (__currentWordIndex < __maxOccurrances)
4451 __currentWordIndex++;
4457 //if (__pWebViewer->SearchText(__currentSearchStr, false) == true)
4458 if (__pWebViewer->SearchNextAsync(false) == E_SUCCESS)
4460 if(__currentWordIndex > 1)
4462 __currentWordIndex--;
4467 String countStr = L"";
4468 countStr.Append(__currentWordIndex);
4469 countStr.Append(L"/");
4470 countStr.Append(__maxOccurrances);
4472 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4474 __pFindWordCountLabel->SetText(countStr);
4475 __pFindWordCountLabel->Invalidate(false);
4477 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4479 __pFindWordCountLabelRightToLeft->SetText(countStr);
4480 __pFindWordCountLabelRightToLeft->Invalidate(false);
4483 if (__currentWordIndex >= __maxOccurrances)
4485 __pFindWordNext->SetEnabled(false);
4489 __pFindWordNext->SetEnabled(true);
4491 if (__currentWordIndex <= 1)
4493 __pFindWordPrev->SetEnabled(false);
4497 __pFindWordPrev->SetEnabled(true);
4499 __pFindWordPrev->Invalidate(false);
4500 __pFindWordNext->Invalidate(false);
4502 __pFindWordControl->Invalidate(true);
4506 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
4508 AppLog("xyz::MainForm::OnWebKeypadWillOpen");
4509 __isKeypadOpened = true;
4510 __pFooterPanel->SetShowState(false);
4511 // OnAddressBarKeypadOpened(*__pAddressbar);
4515 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
4517 __isKeypadOpened = true;
4518 AppLog("xyz::MainForm::OnWebKeypadOpened");
4520 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4522 __currentSearchStr = L"";
4523 __currentWordIndex = 0;
4524 __maxOccurrances = 0;
4525 __pFindWordEditField->SetText(L"");
4526 __pFindWordNext->SetEnabled(false);
4527 __pFindWordPrev->SetEnabled(false);
4528 __pFindWordCountLabel->SetText(L"0/0");
4529 __pWebViewer->SearchTextAllAsync(L"",false);
4530 __pFindWordControl->SetShowState(false);
4531 __pFindWordEditField->HideKeypad();
4535 if (__pWebViewer != null && __pFooterPanel != null)
4537 AppLog("MainForm::OnWebKeypadOpened GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
4538 if(__pAddressbar != null)
4540 __pAddressbar->SetShowState(false);
4542 if(__pFindWordControl != null)
4544 __pFindWordControl->SetShowState(false);
4546 __pFooterPanel->SetShowState(false);
4547 __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
4549 // if(__pImageMenu && __pImageMenu->GetShowState() == true)
4551 // __pImageMenu->SetAnchorPosition(Point(__pImageMenu->GetAnchorPosition().x/2,__pImageMenu->GetAnchorPosition().y/2));
4552 // AppLog("omgomgomg");
4558 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
4560 AppLog("xyz::MainForm::OnWebKeypadClosed");
4561 AppLog("akjshdasd 4");
4562 __pFooterPanel->SetShowState(true);
4563 // OnAddressBarKeypadClosed(*__pAddressbar);
4564 RelayoutControls(false);
4565 __isKeypadOpened = false;
4569 MainForm::OnWebKeypadBoundsChanged(Tizen::Web::Controls::Web& source)
4571 // RelativeLayout(false);
4572 if(__pWebViewer != null)
4574 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,GetClientAreaBounds().height));
4579 MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
4581 Control* temp = const_cast< Control* >(&source);
4582 Header* pHeader = dynamic_cast< Header* >(temp);
4583 if (pHeader != null)
4585 //Header double - clicked
4586 AppLog("Header double clicked");
4588 if(__pFindWordControl)
4590 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
4591 ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
4595 AppLog("MainScene::OnTouchDoublePressed");
4599 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4601 AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
4602 if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
4604 AppLog("Returning because of more than one touch point.");
4607 __longPressPoint = currentPosition;
4609 if (__pHitElementResult != null)
4611 delete __pHitElementResult;
4612 __pHitElementResult = null;
4615 if (__pWebViewer != null)
4617 AppLog("MainForm::OnTouchLongPressed web not null");
4618 __pHitElementResult = __pWebViewer->GetElementByPointN(currentPosition);
4621 if (__pHitElementResult == null)
4626 if (__pHitElementResult->HasImage() == true)
4628 if(__pWebViewer != null)
4629 InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4630 __pImageMenu->SetShowState(true);
4631 __pImageMenu->Show();
4632 __pImageMenu->Invalidate(true);
4634 else if(__pHitElementResult->HasUrl() == true)
4636 String tempURl = __pHitElementResult->GetUrl();
4637 AppLog("tempURl is %ls", tempURl.GetPointer());
4638 const Bitmap* pBitmap = __pHitElementResult->GetImage();
4639 if (pBitmap != null)
4647 InitImageLinkContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4648 __pImageMenu->SetShowState(true);
4649 __pImageMenu->Show();
4650 __pImageMenu->Invalidate(true);
4654 String tagName = __pHitElementResult->GetTagName();
4655 String type = __pHitElementResult->GetAttributeValue("type");
4656 String value = __pHitElementResult->GetAttributeValue(L"value");
4657 String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
4659 __currentSelectedStr.Clear();
4660 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4662 AppLog("tag name is %ls", tagName.GetPointer());
4663 AppLog("type is %ls", type.GetPointer());
4667 __isLongPressedDone = true;
4668 result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
4669 if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) && innerHtml.GetLength() == 0 && type.CompareTo(L"submit") !=0/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.CompareTo(L"") == 0 && r == E_INVALID_ARG)
4671 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4673 InitSelectTextContextMenu(Point(currentPosition.x , currentPosition.y + __pWebViewer->GetY()),true, true);
4676 __pImageMenu->SetShowState(true);
4677 __pImageMenu->Show();
4678 __pImageMenu->Invalidate(true);
4681 AppLog("setselectionselectedornot %s",GetErrorMessage(r));
4684 // __inputEventToBeSupressed = true;
4688 MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4690 AppLog("xyz:: MainForm::OnTouchReleased called");
4692 if (__pAddressbar && __pAddressbar->GetShowState() == true)
4694 __pAddressbar->SetShowState(false);
4696 if(__pFooterPanel && __isKeypadOpened == false)
4698 __pFooterPanel->SetShowState(true);
4702 /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
4703 if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true)
4705 __pWebViewer->ConsumeInputEvent();
4707 if(pHitElement != null)
4711 __inputEventToBeSupressed = false;*/
4715 MainForm::OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4722 MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4724 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4726 __currentSearchStr = L"";
4727 __currentWordIndex = 0;
4728 __maxOccurrances = 0;
4730 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
4732 __pFindWordEditField->SetText(L"");
4733 __pFindWordEditField->HideKeypad();
4734 __pFindWordControl->SetShowState(false);
4735 __pFindWordCountLabel->SetText(L"0/0");
4737 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
4739 __pFindWordEditFieldRightToLeft->SetText(L"");
4740 __pFindWordEditFieldRightToLeft->HideKeypad();
4741 __pFindWordControl->SetShowState(false);
4742 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4745 __pFindWordNext->SetEnabled(false);
4746 __pFindWordPrev->SetEnabled(false);
4748 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
4749 __pFindWordControl->SetShowState(false);
4751 AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
4752 if(__pAddressbar->GetShowState() == false)
4754 __pAddressbar->SetAddressbarURLFocus();
4755 __pFooterPanel->SetShowState(false);
4762 MainForm::OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4768 MainForm::OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4774 MainForm::OnPreviewTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4780 MainForm::OnPreviewTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4786 MainForm::OnPreviewTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4792 MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
4794 AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
4795 int widthContextItem = 0;
4796 if(__pFindWordCountLabel)
4797 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4798 // As per the platform engineer comment removed this line
4799 /*if(__pWebViewer != null)
4801 // 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
4802 __pWebViewer->ReleaseBlock();
4805 // if(__pFindWordControl != null)
4806 // ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
4808 if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
4810 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
4812 AppLog(" Orientation landscape");
4813 __pOptionMenu->SetMaxVisibleItemsCount(5);
4817 AppLog(" Orientation potrait");
4818 __pOptionMenu->SetMaxVisibleItemsCount(6);
4821 if(__pNotification && __pNotification->GetShowState() == true)
4823 __pNotification->SetShowState(false);
4824 __pNotification->Invalidate(false);
4826 if ( __pFooterLabel != null)
4828 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
4831 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
4837 if (__pFindWordBgLabel != null)
4839 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
4840 if (pBitmap != null)
4842 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
4847 if (__pFindWordBgLabelRightToLeft != null)
4849 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
4850 if (pBitmap != null)
4852 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
4858 // if(__pOptionMenu != null)
4859 // __pOptionMenu->SetShowState(false);
4861 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4863 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
4867 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
4872 AppLog("__pFooterPanel->GetShowState() is true");
4874 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
4875 __pFooterPanel->Invalidate(true);
4879 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
4880 if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
4882 InitMostVisitedSitesView(orientationStatus);
4885 RelayoutControls(false);
4886 if (__pArticleReaderPanel != null)
4888 if (__pArticleReaderPanel->GetShowState() == true)
4890 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
4892 if (__pBlankPanel != null)
4893 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
4895 if (__pWebReader != null)
4897 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight() - 96));
4899 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4900 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4902 if ( pBitmap != null && pSrcBitmap != null)
4904 AppLog("CreateReaderPanel ninepatchbitmap found");
4905 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
4908 __pArticleReaderLabel->SetBounds(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()));
4909 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
4910 if (pBitmap != null)
4915 if (pSrcBitmap != null)
4924 if (__pAddressbar != null)
4926 int width = GetClientAreaBounds().width;
4927 __pAddressbar->OrientationChanged(width);
4932 MainForm::OnSettingsChange(int settingvalue)
4934 AppLogDebug("MainForm::OnSettingsChange entered");
4936 if(settingvalue == (int)REGISTRY_SETTING_HOMEPAGE)
4938 __pAddressbar->ResetGuideText();
4940 if (__pWebViewer == null)
4942 AppLogDebug("Webviewer is not initialized yet.");
4946 if (settingvalue == (int) REGISTRY_SETTING_DEFAULT_VIEW)
4948 WebSetting settings = __pWebViewer->GetSetting();
4949 if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
4951 settings.SetAutoFittingEnabled(true);
4953 else if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_READABLE")) == 0)
4955 settings.SetAutoFittingEnabled(false);
4957 __pWebViewer->SetSetting(settings);
4959 else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
4961 WebSetting settings = __pWebViewer->GetSetting();
4962 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
4963 __pWebViewer->SetSetting(settings);
4965 else if (settingvalue == (int) REGISTRY_SETTING_DISPLAY_IMAGES)
4967 WebSetting settings = __pWebViewer->GetSetting();
4968 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
4969 __pWebViewer->SetSetting(settings);
4970 __pWebViewer->Reload();
4972 else if (settingvalue == (int) REGISTRY_SETTING_BLOCK_POPUP)
4974 WebSetting settings = __pWebViewer->GetSetting();
4975 settings.SetJavaScriptPopupEnabled(SettingPresentationModel::GetInstance()->IsBlockPopUp());
4976 __pWebViewer->SetSetting(settings);
4978 else if (settingvalue == (int) REGISTRY_SETTING_ACCEPT_COOKIES)
4982 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4985 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_FORM_DATA)
4989 WebSetting settings = __pWebViewer->GetSetting();
4990 settings.SetAutoFormDataShowEnabled(SettingPresentationModel::GetInstance()->IsRememberFormData());
4991 __pWebViewer->SetSetting(settings);
4994 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_PASSWORD)
4998 WebSetting settings = __pWebViewer->GetSetting();
4999 settings.SetAutoLoginFormFillEnabled(SettingPresentationModel::GetInstance()->IsRememberPassword());
5000 __pWebViewer->SetSetting(settings);
5003 else if (settingvalue == (int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS)
5005 WebSetting settings = __pWebViewer->GetSetting();
5006 if (SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled() == true)
5008 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
5012 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
5014 __pWebViewer->SetSetting(settings);
5016 else if (settingvalue == (int) REGISTRY_SETTING_READER_FONT_SIZE)
5020 AppLogDebug("IntMainForm fontsize Changed to %d",SettingPresentationModel::GetInstance()->GetReaderFontSize());
5021 WebSetting settings = __pWebReader->GetSetting();
5022 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
5023 __pWebReader->SetSetting(settings);
5029 MainForm::OnSettingsReset()
5033 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
5034 __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
5039 MainForm::OnClearCache()
5041 result r = E_SUCCESS;
5043 if (__pWebViewer != NULL)
5045 r = __pWebViewer->ClearCache();
5048 AppLogDebug("Cache cleared success");
5052 AppLogDebug("Cache cleared fail");
5058 MainForm::OnClearCookie()
5060 result r = E_SUCCESS;
5062 if (__pWebViewer != NULL)
5064 __pWebViewer->ClearCookie();
5068 AppLogDebug("Cookie cleared success");
5072 AppLogDebug("Cache cleared fail");
5077 MainForm::OnClearFormData()
5079 result r = E_SUCCESS;
5081 if (__pWebViewer != NULL)
5083 __pWebViewer->ClearFormData();
5087 AppLogDebug("Cookie cleared success");
5091 AppLogDebug("Cache cleared fail");
5096 MainForm::OnClearPasswords()
5098 result r = E_SUCCESS;
5100 if (__pWebViewer != NULL)
5102 __pWebViewer->ClearLoginFormData();
5106 AppLogDebug("Cookie cleared success");
5110 AppLogDebug("Cache cleared fail");
5116 MainForm::findDistance(int x1,int y1,int x2, int y2)
5118 int deltaX = Math::Abs(x2 - x1);
5119 int deltaY = Math::Abs(y2 - y1);
5120 double num = deltaX*deltaX + deltaY*deltaY;
5126 for (i = 0; i < 20; i++)
5128 x = (((x*x)+ num)/(2*x));
5139 MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5141 AppLog("xyz:: MainForm::OnTouchPressed called");
5142 if(__pFindWordControl)
5144 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
5145 // ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
5147 __isLongPressedDone = false;
5152 IList* pList = null;
5153 pList = touch.GetTouchInfoListN(source);
5157 int count = pList->GetCount();
5160 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5161 __touchPoint1 = pTouchInfo->position;
5163 /*if (__pAddressbar != null)
5165 if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5167 if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5169 __pAddressbar->SaveAddressbarEditText();
5171 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5174 __pAddressbar->Invalidate(true);
5176 if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5178 if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5180 //__pAddressbar->SaveAddressbarEditText();
5182 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5185 else if (count == 2)
5187 AppLogDebug("MainForm::OnTouchPressed count is two");
5188 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5189 __touchPoint1 = pTouchInfo->position;
5191 pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
5192 __touchPoint2 = pTouchInfo->position;
5197 pList->RemoveAll(true);
5202 __pAddressbar->SetShowState(false);
5204 if(__pFooterPanel && __isKeypadOpened == false)
5206 __pFooterPanel->SetShowState(true);
5208 RelayoutControls(false);
5213 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5215 // __currentWordIndex = 0;
5216 __isLongPressedDone = false;
5221 MainForm::MoveUiControls()
5226 MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
5228 if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
5230 if(__pFooterUrlField->GetTextLength() == 0)
5232 __pFooterUrlField->SetKeypadActionEnabled(false);
5236 __pFooterUrlField->SetKeypadActionEnabled(true);
5239 if (__pFindWordEditField != null && __pFindWordEditField->GetShowState() == true)
5241 __currentSearchStr = __pFindWordEditField->GetText();
5242 if (__currentSearchStr.GetLength() > 0)
5244 __pFindWordCountLabel->SetShowState(true);
5248 // __pFindWordCountLabel->SetShowState(false);
5249 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
5250 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
5253 __pFindWordNext->SetEnabled(false);
5254 __pFindWordPrev->SetEnabled(false);
5255 __pFindWordNext->Invalidate(true);
5256 __pFindWordPrev->Invalidate(true);
5257 __pFindWordCountLabel->SetText(L"0/0");
5258 __pFindWordCountLabel->Invalidate(true);
5260 else if (__pFindWordEditFieldRightToLeft != null && __pFindWordEditFieldRightToLeft->GetShowState() == true)
5262 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
5263 if (__currentSearchStr.GetLength() > 0)
5265 __pFindWordCountLabelRightToLeft->SetShowState(true);
5269 __pFindWordCountLabelRightToLeft->SetShowState(false);
5272 __pFindWordNext->SetEnabled(false);
5273 __pFindWordPrev->SetEnabled(false);
5274 __pFindWordNext->Invalidate(true);
5275 __pFindWordPrev->Invalidate(true);
5276 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
5277 __pFindWordCountLabelRightToLeft->Invalidate(true);
5279 AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer());
5280 if (__currentSearchStr.GetLength() > 0)
5286 __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
5288 __currentSearchStr = L"";
5289 AppLogDebug("Enter something");
5294 MainForm::InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus)
5301 MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus)
5303 if(__pWebViewer != null)
5306 AppLog("MainForm::InitMostVisitedSitesView");
5307 result r = E_SUCCESS;
5310 if (__pWebViewer != null && __pMostVisitedListView != null)
5315 if (__pMostVisitedListView != null)
5317 RemoveControl(__pMostVisitedListView);
5319 if(__pMostVisitedSites != null)
5321 __pMostVisitedSites->RemoveAll(true);
5324 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
5326 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
5327 __pMostVisitedListView = new(std::nothrow) ListView();
5329 int height = GetClientAreaBounds().height;
5331 if(__pFooterPanel->GetShowState() == true)
5333 height = height - __pFooterPanel->GetHeight();
5335 if(__pAddressbar->GetShowState() == true)
5337 height -= __pAddressbar->GetHeight();
5340 r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
5344 delete __pMostVisitedListView;
5345 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
5348 __pMostVisitedListView->SetItemProvider(*this);
5349 __pMostVisitedListView->AddListViewItemEventListener(*this);
5350 __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_VISITED_SITES"));
5351 AddControl(__pMostVisitedListView);
5352 __pMostVisitedListView->UpdateList();
5359 MainForm::GetImagePath(void)
5363 String formattedTime;
5364 DateTime currentTime;
5365 LocaleManager localManager;
5366 SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
5368 localManager.Construct();
5369 Locale locale = localManager.GetSystemLocale();
5370 //Locale locale(LANGUAGE_ENG, COUNTRY_US);
5372 // Get date formatter
5373 DateTimeFormatter* pTimeFormatter = DateTimeFormatter::CreateDateTimeFormatterN(locale, DATE_TIME_STYLE_DEFAULT);
5377 pTimeFormatter->Format(currentTime, formattedTime);
5380 AppLog("current time stamp is %ls", formattedTime.GetPointer());
5381 String delim(L" :");
5382 StringTokenizer strTok(formattedTime, delim);
5385 String str1("GMT+00");
5386 while (strTok.HasMoreTokens())
5388 strTok.GetNextToken(token); // Osp, StringTokenizer, Sample, code
5389 if(token.Equals(str1))
5391 AppLog("token is %ls", token.GetPointer());
5392 imageName.Append(token);
5398 void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
5400 result r = E_FAILURE;
5401 AppLog("Content manager 1");
5402 ContentId contentId;
5403 ContentManager contentManager;
5404 r = contentManager.Construct();
5407 AppLog("Content manager update content result %s" ,GetErrorMessage(r));
5410 Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Downloads/";
5411 Tizen::Io::Directory::Create(contentPath,true);
5412 if(GetLastResult() == E_FILE_ALREADY_EXIST)
5414 AppLog("Already exists");
5416 else if(GetLastResult() == E_SUCCESS)
5418 AppLog("created success");
5420 contentPath.Append(imageName);
5421 contentPath.Append(".jpg");
5422 contentId = contentManager.CreateContent(*aBuffer, contentPath);
5423 ShowIndicatorNotification(L"Download Complete",contentPath);
5424 AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
5428 MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
5430 AppLogDebug("ENTER");
5432 NotificationRequest request;
5433 request.SetAlertText(messageText);
5434 request.SetTitleText(L"");
5435 request.SetAppMessage(contentPath);
5436 request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
5437 request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
5438 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
5439 String homePath = pApp->GetAppRootPath();
5440 String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
5441 AppLog("The iconPath is : %ls", homePath.GetPointer());
5442 request.SetIconFilePath(iconPath);
5444 Tizen::Shell::NotificationManager notiMgr;
5445 notiMgr.Construct();
5446 notiMgr.Notify(request);
5447 AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
5452 MainForm::SetForwardButtonEnabled(bool isEnabled)
5454 __pGoForwardBtn->SetEnabled(isEnabled);
5455 __pGoForwardBtn->Invalidate(true);
5459 MainForm::SetBackButtonEnabled(bool isEnabled)
5461 __pGoBackBtn->SetEnabled(isEnabled);
5462 __pGoBackBtn->Invalidate(true);
5466 MainForm::UpdateProgress(int percentage)
5468 __progressPercentage = percentage;
5469 if (percentage == 0 || percentage == 100)
5471 __isLoadingData = false;
5472 if (percentage == 100)
5474 __isLoadingCompleted = true;
5475 __progressPercentage = 0;
5479 __isLoadingCompleted = false;
5484 __isLoadingData = true;
5486 UpdateProgressBitmap();
5490 MainForm::GetProgress(void)
5492 return __progressPercentage;
5496 MainForm::UpdateProgressBitmap(void)
5498 result r = E_SUCCESS;
5499 if (__pProgressbarLabel == null)
5501 int w = __pProgressbarLabel->GetWidth();
5502 int h = __pProgressbarLabel->GetHeight();
5504 int progressWidth = 0;
5505 Bitmap* pRetBitmap = null;
5507 if (__progressPercentage == 0 || __progressPercentage == 100)
5509 __pProgressbarLabel->SetShowState(false);
5510 __pProgressbarLabel->Invalidate(false);
5515 __pProgressbarLabel->SetShowState(true);
5516 __pProgressbarLabel->Invalidate(false);
5519 r = canvas.Construct(Rectangle(0, 0, w, h));
5523 AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
5528 Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
5532 pBgBmp->Scale(Dimension(w, h));
5533 canvas.DrawBitmap(Point(0,0), *pBgBmp);
5537 progressWidth = (double) (w) * __progressPercentage / 100;
5538 AppLogDebug("progressWidth: %d", progressWidth);
5539 Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
5541 if (pProgressBmp != null)
5543 pProgressBmp->Scale(Dimension(progressWidth, h));
5544 canvas.DrawBitmap(Point(0,0), *pProgressBmp);
5545 delete pProgressBmp;
5548 pRetBitmap = new (std::nothrow) Bitmap();
5550 if (pRetBitmap == null)
5552 AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
5556 pRetBitmap->Construct(canvas, canvas.GetBounds());
5558 if (__pProgressbarLabel != null && pRetBitmap != null)
5560 __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
5561 __pProgressbarLabel->Invalidate(false);
5564 if (pRetBitmap != null)
5573 MainForm::ReaderClicked()
5575 result r = E_SUCCESS;
5576 ArrayList* pArgList = new(std::nothrow) ArrayList();
5577 if (pArgList != null)
5579 r = pArgList->Construct();
5586 r = pArgList->Add(*new(std::nothrow) String(*__pReaderData));
5593 r = pArgList->Add(*new(std::nothrow) String(__pWebViewer->GetUrl()));
5600 r = pArgList->Add(*new(std::nothrow) String(__pWindowInfo->pageTitle));
5608 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
5614 void MainForm::SetAddressbarMode(AddressBarMode addMode)
5616 AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
5618 __currentAddMode = addMode;
5622 case ADDRESSBAR_MODE_INVALID:
5627 case ADDRESSBAR_MODE_READER:
5629 __pStopBtn->SetShowState(false);
5630 __pRefreshBtn->SetShowState(false);
5631 __pClearBtn->SetShowState(false);
5632 __pReaderBtn->SetShowState(false);
5635 case ADDRESSBAR_MODE_LOADING:
5637 __pRefreshBtn->SetShowState(false);
5638 __pStopBtn->SetShowState(true);
5639 __pClearBtn->SetShowState(false);
5640 __pReaderBtn->SetShowState(false);
5643 case ADDRESSBAR_MODE_LOADING_COMPLETE:
5645 // SetUrl(__pAddressbar->GetUrl());
5647 __pRefreshBtn->SetShowState(true);
5648 __pStopBtn->SetShowState(false);
5649 __pClearBtn->SetShowState(false);
5650 __pReaderBtn->SetShowState(false);
5653 case ADDRESSBAR_MODE_EDIT:
5655 __pRefreshBtn->SetShowState(false);
5656 __pStopBtn->SetShowState(false);
5657 __pReaderBtn->SetShowState(false);
5658 __pClearBtn->SetShowState(true);
5665 OnAddressBarModeChanged();
5668 AddressBarMode MainForm::GetAddressbarMode(void)
5670 return __currentAddMode;
5673 void MainForm::SetUrl(const String& url)
5676 if(__displayUrl.GetLength() > 2048)
5677 __displayUrl.SubString(0,2048,__displayUrl);
5679 if (__pFooterUrlField != NULL)
5681 String removedHttpUrl = RemoveHttpTextFromDisplayURL();
5682 if (removedHttpUrl.IsEmpty() == false)
5684 __pFooterUrlField->SetText(removedHttpUrl);
5685 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5686 __pAddressbar->SetUrl(__displayUrl);
5690 __pFooterUrlField->SetText(__displayUrl);
5691 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5692 __pAddressbar->SetUrl(__displayUrl);
5694 if(__pFooterUrlField)
5695 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
5696 __pFooterUrlField->Invalidate(false);
5697 if(__pAddressbar != NULL && __pAddressbar->HasFocus())
5698 __pAddressbar->Invalidate(true);
5699 // __pFooterUrlField->SetCursorPosition(0);
5704 MainForm::RemoveHttpTextFromDisplayURL(void)
5706 AppLog("MainForm::RemoveHttpTextFromDisplayURL __displayUrl %ls",__displayUrl.GetPointer());
5708 // bool isHttpText = __displayUrl.Contains(L"http://");
5709 String updatedDisplayUrl;
5710 updatedDisplayUrl.Clear();
5711 if(__displayUrl.IndexOf(L"http://",0,index) == E_SUCCESS && index == 0)
5713 __displayUrl.SubString(7,updatedDisplayUrl);
5715 else if(__displayUrl.IndexOf(L"https://",0,index) == E_SUCCESS && index == 0)
5717 __displayUrl.SubString(8,updatedDisplayUrl);
5719 return updatedDisplayUrl;
5722 void MainForm::OnSharePopupControlStarted(void)
5724 __pWebViewer->AddTouchEventListener(*this);
5728 MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
5730 if (requestId == BACK_GROUND_APP_EVENT)
5732 if(__pWebViewer != null)
5734 __pWebViewer->Pause();
5738 __pImageMenu->SetShowState(false);
5740 if(__pAddressbar != null)
5742 __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
5745 else if(requestId == FORE_GROUND_APP_EVENT)
5747 if(__pWebViewer != null)
5749 __pWebViewer->Resume();
5751 if(__pAddressbar != null)
5753 __pAddressbar->SendUserEvent(FORE_GROUND_APP_EVENT,NULL);
5759 MainForm::AddressBarCancelledClicked(const Addressbar& addBar)
5761 AppLog("XYZ::MainForm::AddressBarCancelledClicked");
5762 result r = E_SUCCESS;
5765 __pAddressbar->SetShowState(false);
5767 AppLog("akjshdasd 5");
5768 __pFooterPanel->SetShowState(true);
5771 __pWebViewer->SetFocus();
5772 else if(__pMostVisitedListView)
5773 __pMostVisitedListView->SetFocus();
5774 else if(__pMultiWindowButton)
5775 __pMultiWindowButton->SetFocus();
5776 else if(__pMoreButton)
5777 __pMoreButton->SetFocus();
5779 __pAddressbar->SetShowState(false);
5781 RelayoutControls(false);
5785 MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
5787 AppLog("MainForm::OnFormMenuRequested called");
5789 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
5791 int bookmarkCount=0;
5794 url=__pWindowInfo->pageUrl;
5795 AppLog("MainForm::OnFormMenuRequested url %ls",url.GetPointer());
5796 result r = E_SUCCESS;
5797 Bitmap* pBitmap = null;
5798 String lastChar = L"";
5799 // if(url.SubString(url.GetLength()-1,lastChar));
5800 // if(lastChar == L"/")
5802 // bool exist1 = false;
5803 // bool exist2 = false;
5804 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist1);
5805 // url.SubString(0,url.GetLength() - 1,url);
5806 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist2);
5807 // exist = exist1 | exist2;
5811 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
5814 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
5820 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
5824 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
5826 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
5828 if (__pOptionMenu->GetItemCount() == 9)
5830 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5834 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5839 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
5843 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
5844 if (__pOptionMenu->GetItemCount() != 9)
5846 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
5847 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
5848 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
5849 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
5850 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
5851 __pOptionMenu->SetMaxVisibleItemsCount(6);
5853 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
5855 AppLog(" Orientation landscape");
5856 __pOptionMenu->SetMaxVisibleItemsCount(5);
5860 AppLog(" Orientation potrait");
5861 __pOptionMenu->SetMaxVisibleItemsCount(6);
5864 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
5867 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
5869 __pAddressbar->SetShowState(false);
5871 __pFooterPanel->SetShowState(true);
5872 result r = __pOptionMenu->SetShowState(true);
5873 AppLog("ajsghd %s",GetErrorMessage(r));
5874 __pOptionMenu->Invalidate(true);
5875 __pOptionMenu->Show();