2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet MainForm class
19 *@brief: The %MainForm provides the common functionalities for the Main View of the Browser including the addressbar,
20 * loading,handling events etc.
24 #include <FGraphics.h>
29 //#include <FShellNotificationManager.h>
31 #include "IntBookmarkData.h"
32 #include "IntBookmarkPresentationModel.h"
33 #include "IntCommonLib.h"
34 #include "IntFaviconManager.h"
35 #include "IntInternetApp.h"
36 #include "IntMainForm.h"
37 #include "IntSceneRegister.h"
38 #include "IntSettingPresentationModel.h"
40 using namespace Tizen::App;
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Collection;
43 using namespace Tizen::Base::Runtime;
44 using namespace Tizen::Base::Utility;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
47 using namespace Tizen::Locales;
48 using namespace Tizen::Media;
49 using namespace Tizen::Shell;
50 using namespace Tizen::Ui;
51 using namespace Tizen::Ui::Controls;
52 using namespace Tizen::Content;
53 using namespace Tizen::Ui::Scenes;
54 using namespace Tizen::System;
55 using namespace Tizen::Web;
56 using namespace Tizen::Web::Controls;
58 static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
59 static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
60 static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
61 static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
62 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
63 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK_PRESS = L"I01_search_list_icon_favorite_press.png";
64 static const wchar_t* IDB_CONTRLBAR_ICON_MORE = L"I01_icon_more.png";
65 static const wchar_t* IDB_CONTRLBAR_ICON_MORE_PRESS = L"I01_icon_more_press.png";
66 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW = L"I01_icon_plus.png";
67 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_press.png";
68 static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
69 static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
70 static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
71 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
72 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
73 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
74 static const wchar_t* IDS_APPID = L"AppID";
75 static const wchar_t* IDS_KEY = L"key";
76 static const wchar_t* IDS_VALUE = L"value";
77 static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
78 static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
79 //static const wchar_t* IDB_ADDRESS_BAR_BACKGROUND = L"I01_toolbar_bg_02.9.png";
81 const int IDA_BACKBTN_CLICKED = 101;
82 const int IDA_BOOKMARKBTN_CLICKED = 102;
83 const int IDA_MOREBTN_CLICKED = 103;
84 const int IDA_MULTIWINDOWBTN_CLICKED = 104;
85 const int IDA_NEWWINDOWBTN_CLICKED = 105;
86 const int IDA_FORWARD_CLICKED = 106;
87 const int IDA_ADDTOBOOKMARK_CLICKED = 107;
88 const int IDA_SHARE_CLICKED = 108;
89 const int IDA_FINDONPAGE_CLICKED = 109;
90 const int IDA_PRIVATEON_CLICKED = 110;
91 const int IDA_SETTINGS_CLICKED = 111;
92 const int IDA_READER_CLOSE_CLICKED = 112;
93 const int IDA_SMALLFONT_BTN_CLICKED = 113;
94 const int IDA_LARGEFONT_BTN_CLICKED = 114;
95 const int IDA_BRIGHTNESS_BTN_CLICKED = 115;
96 const int IDA_HISTORY_CLICKED = 116;
97 const int IDA_ADD_TO_BOOKMARKBTN_CLICKED = 117;
98 const int IDA_ADD_TO_HOME_CLICKED = 118;
99 const int IDA_SAVED_PAGES_CLICKED = 119;
100 const int IDA_DESKTOP_VIEW_CLICKED = 120;
101 const int IDA_SAVE_CLICKED = 121;
102 const int IDA_PRINT_CLICKED = 122;
104 const int IDA_FINDWORD_SEARCH_CLICKED = 201;
105 const int IDA_FINDWORD_NEXT_CLICKED = 202;
106 const int IDA_FINDWORD_PREV_CLICKED = 203;
107 const int IDA_FINDWORD_CLEAR_CLICKED = 204;
108 const int IDA_FINDWORD_CANCEL_CLICKED = 205;
110 const int IDA_COPY_IMAGE_CLICKED = 206;
111 const int IDA_VIEW_IMAGE_CLICKED = 207;
112 const int IDA_SAVE_IMAGE_CLICKED = 208;
113 const int IDA_SHARE_IMAGE_CLICKED = 209;
115 const int IDA_COPY_TEXT_CLICKED = 210;
116 const int IDA_PASTE_TEXT_CLICKED = 211;
117 const int IDA_FIND_TEXT__CLICKED = 212;
118 const int IDA_SHARE_TEXT_CLICKED = 213;
120 const int IDA_GO_BACK = 214;
121 const int IDA_GO_FORWARD = 215;
122 const int IDA_REFRESH_BTN_CLICKED = 216;
123 const int IDA_STOP_BTN_CLICKED = 217;
124 const int IDA_CLEAR_URL = 218;
125 const int IDA_READER_BTN_CLICKED = 219;
128 const int IDA_HYPERLINK_OPEN_CLICKED = 220;
129 const int IDA_HYPERLINK_COPY_LINK_CLICKED = 221;
130 const int IDA_HYPERLINK_SAVE_IMAGE_CLICKED = 222;
131 const int IDA_HYPERLINK_SHARE_IMAGE_CLICKED = 223;
133 const int IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED = 224;
135 const int DEFAULT_PROGRESS_PERCENTAGE = 10;
137 const int MainForm::IDA_FORMAT_BITMAP = 500;
138 const int MainForm::IDA_FORMAT_DELETE_BITMAP = 501;
139 const int MainForm::IDA_FORMAT_TITLE_STRING = 502;
140 const int MainForm::IDA_FORMAT_URL_STRING = 503;
141 const int MainForm::IDA_CONTEXT_ITEM_DELETE = 504;
143 static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
144 static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
145 static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
147 static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
148 MainForm::MainForm(void)
150 __isLongPressedDone = false;
152 __pAddressbar = null;
153 // __pMostVisitedSitesPanel = null;
154 __pMostVisitedListView = null;
155 __pFooterPanel = null;
156 __pHitElementResult = null;
157 __pWindowInfo = null;
160 __pOptionMenu = null;
161 __pFindWordControl = null;
162 __pFindWordPanelLeftToRight = null;
163 __pFindWordPanelRightToLeft = null;
164 __pFindWordBgLabel = null;
165 __pFindWordBgLabelRightToLeft = null;
166 __pFindWordEditField = null;
167 __pFindWordEditFieldRightToLeft = null;
168 __pFindWordClear = null;
169 __pFindWordClearRightToLeft = null;
170 __pFindWordCountLabel = null;
171 __pFindWordClearRightToLeft = null;
172 __pFindWordNext = null;
173 __pFindWordPrev = null;
174 __previousZoomLevel = 1.0;
176 __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
179 __currentSearchStr = L"";
180 __currentSelectedStr = L"";
181 __maxOccurrances = 0;
182 __currentWordIndex = 0;
185 //__inputEventToBeSupressed = false;
186 __isLoadingData = false;
187 __isLoadingCompleted = false;
188 __progressPercentage = 0;
189 __touchPoint1 = Point(-1,-1);
190 __touchPoint2 = Point(-1,-1);
191 __longPressPoint = Point(-1,-1);
193 // __pReaderPopup = null;
194 __pReaderData = null;
196 __pReaderCloseBtn = null;
197 //__pNewWindowButton = null;
198 __pMoreButton = null;
199 __pMultiWindowButton = null;
200 __pArticleReaderPanel = null;
201 __pBlankPanel = null;
202 __pArticleReaderLabel = null;
203 __webControlHeight = 0;
204 __prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
205 __curAddressBarMode = ADDRESSBAR_MODE_INVALID;
206 __pMostVisitedSites = null;
207 __pFooterUrlField = null;
209 __pGoForwardBtn = null;
210 __pRefreshBtn = null;
211 __pProgressbarLabel = null;
212 __pFooterLabel = null;
216 __isKeypadOpened = false;
218 __pNotification = null;
221 MainForm::~MainForm(void)
223 SettingPresentationModel::GetInstance()->RemoveSettingsEventListener(*this);
227 __pAddressbar->SetAddressbarEventListener(null);
230 if(__pHistory != null)
236 if (__pReaderData != null)
238 delete __pReaderData;
239 __pReaderData = null;
242 if (__pPopUp != null)
248 if (__pHitElementResult != null)
250 delete __pHitElementResult;
251 __pHitElementResult = null;
255 delete __pOptionMenu;
256 __pOptionMenu = null;
259 String* pSelectedScene = NULL;
260 Object* pValue = NULL;
261 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
262 pSelectedScene = (String*) pValue;
264 /*if (pSelectedScene != null)
266 delete pSelectedScene;
268 MultiWindowPresentationModel::SetValue(SELECTED_SCENE_ID, null);*/
272 MainForm::Initialize(void)
274 Construct(L"IDL_FORM");
276 // SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
281 MainForm::OnInitializing(void)
283 AppLog("get client area width = %d",GetClientAreaBounds().width);
284 AppLog("get client area height = %d",GetClientAreaBounds().height);
285 const int WIDTH_CONTEXT_MENU_BUTTON = 336;
286 const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
288 __fontSize = CommonUtil::GetFontSize();
289 Panel* pFooterPanel = null;
291 __pSaveImage = new Image();
292 __pSaveImage->Construct();
294 // Setup back event listener
295 SettingPresentationModel::GetInstance()->AddSettingsEventListener(*this);
296 SceneManager::GetInstance()->AddSceneEventListener(IDSCN_MAIN_VIEW, *this);
297 AddOrientationEventListener(*this);
299 AppLogDebug(" MainForm::OnInitializing ended");
300 if (__pMostVisitedSites == null)
302 __pMostVisitedSites = new(std::nothrow) ArrayList();
303 __pMostVisitedSites->Construct();
305 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
307 __pItemContext= new(std::nothrow) ListContextItem();
308 __pItemContext->Construct();
310 __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"),true);
313 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
314 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
315 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
317 __pItemContextLandscape= new(std::nothrow) ListContextItem();
318 __pItemContextLandscape->Construct();
320 __pItemContextLandscape->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), true);
321 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
322 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
323 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
324 SetFormMenuEventListener(this);
325 AppLog("SetFormMenuEventListener result %s",GetErrorMessage(GetLastResult()));
330 MainForm::InitAddressbar(void)
332 AppLogDebug("MainForm::InitAddressbar entered");
334 result r = E_SUCCESS;
336 if (__pAddressbar != null)
340 __pAddressbar = new(std::nothrow) Addressbar();
341 AppLog("MainForm::InitAddressbar GetClientAreaBounds().width %d",GetClientAreaBounds().width);
342 r = __pAddressbar->Initialize(Tizen::Graphics::Rectangle(0, 0, GetClientAreaBounds().width, 82));
345 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
348 __pAddressbar->SetAddressbarEventListener(this);
349 AddControl(__pAddressbar);
350 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
351 SetControlAlwaysOnTop(*__pAddressbar, true);
352 __adressPanelPosition = __pAddressbar->GetPosition();
354 AppLogDebug("MainForm::InitAddressbar exit");
360 MainForm::CreateReaderPanel(void)
362 AppLogDebug("CreateReaderPanel() width %d",GetClientAreaBounds().width);
363 result r = E_FAILURE;
365 Button *pSmallFontBtn = null;
366 Button *pLargeFontBtn = null;
368 __pBlankPanel = new (std::nothrow) Panel();
369 __pBlankPanel->Construct(L"IDL_BLANK_PANEL");
371 __pArticleReaderPanel = new (std::nothrow) Panel();
372 __pArticleReaderPanel->Construct(L"IDL_ARTICLE_READER");
374 __pReaderCloseBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_CLOSE_READER",true));
375 if (__pReaderCloseBtn)
377 AppLogDebug("CreateReaderPanel() 6");
378 __pReaderCloseBtn->AddActionEventListener(*this);
379 __pReaderCloseBtn->SetActionId(IDA_READER_CLOSE_CLICKED);
382 __pWebReader = new (std::nothrow) Web();
383 __pWebReader->Construct(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
385 settings.SetInputStyle(INPUT_STYLE_OVERLAY);
386 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
388 r = __pWebReader->SetSetting(settings);
390 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
393 __pArticleReaderLabel = new Label();
394 __pArticleReaderLabel->Construct(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()),L"");
396 __pBlankPanel->AddControl(__pArticleReaderLabel);
397 __pBlankPanel->AddControl(__pArticleReaderPanel);
398 AddControl(__pBlankPanel);
400 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
401 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
402 __pArticleReaderLabel->SetBounds(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
404 __pArticleReaderPanel->AddControl(__pWebReader);
405 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
406 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
407 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
409 if (pBitmap != null && pSrcBitmap != null)
411 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
413 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
415 pSmallFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_SMALL_FONT",true));
418 pSmallFontBtn->AddActionEventListener(*this);
419 pSmallFontBtn->SetActionId(IDA_SMALLFONT_BTN_CLICKED);
422 pLargeFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_LARGE_FONT",true));
425 pLargeFontBtn->AddActionEventListener(*this);
426 pLargeFontBtn->SetActionId(IDA_LARGEFONT_BTN_CLICKED);
435 if (pSrcBitmap != null)
441 SetControlAlwaysOnTop(*__pBlankPanel, true);
442 //__pBlankPanel->SetControlAlwaysAtBottom(*__pArticleReaderPanel, true);
449 MainForm::InitWebControl()
451 AppLogDebug("MainForm::InitWebControl enter");
452 result r = E_SUCCESS;
453 AppLogDebug("InitWebControl");
455 if (__pAddressbar == null || __pFooterPanel == null)
458 const int Y_WEBCONTROL_POSITION = 0;
460 __webControlHeight = GetHeight() - __pFooterPanel->GetHeight();
462 if (__pMostVisitedListView)
464 __pMostVisitedListView->SetShowState(false);
466 if (__pWebViewer != null)
468 AppLogDebug("Already initialized");
471 __pWebViewer = new(std::nothrow) Web();
472 if(__pWebViewer == NULL)
474 AppLogDebug("Initialization failed");
477 r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight + 12));
481 AppLogDebug("Web construct failed with %s", GetErrorMessage(r));
488 r = AddControl(__pWebViewer);
491 __pWebViewer->Destroy();
493 AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
496 __webControlPosition = __pWebViewer->GetPosition();
497 r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
500 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
504 __pWebViewer->SetLoadingListener(this);
505 __pWebViewer->SetWebUiEventListenerF(this);
506 __pWebViewer->SetWebKeypadEventListener(this);
507 __pWebViewer->SetFocus();
508 __pWebViewer->AddTouchEventListener(*this);
510 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
511 __pWebViewer->SetTextSearchListener(this);
514 AppLogDebug("MainForm :before return");
516 AppLogDebug("MainForm::InitWebControl Exit");
522 MainForm::SetJavascriptEnabled()
524 WebSetting settings = __pWebViewer->GetSetting();
525 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
526 __pWebViewer->SetSetting(settings);
530 MainForm::SetImageLoadEnabled()
532 WebSetting settings = __pWebViewer->GetSetting();
533 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
534 __pWebViewer->SetSetting(settings);
538 MainForm::InitFooter(void)
540 AppLogDebug("MainForm::InitFooter entered");
541 Button* pBackButton = null;
542 Button* pBookmarkButton = null;
543 Button* pMultiWindowButton = null;
544 Bitmap *pIconBitmap = null;
545 Bitmap *pBGBitmap = null;
546 Label *pBGLabel = null;
548 if (__pFooterPanel == null)
550 __pFooterPanel = static_cast< Panel* >(GetControl(L"IDC_FOOTER_PANEL", true));
553 if (__pFooterPanel == null)
558 SetControlAlwaysOnTop(*__pFooterPanel, true);
560 __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
561 if ( __pFooterLabel == NULL )
565 //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
566 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
569 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
573 __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
575 if ( __pMultiWindowButton == NULL )
581 SetFormBackEventListener(this);
582 AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
583 if (__pMultiWindowButton != null)
585 Bitmap* pBitmap = null;
586 Bitmap* pPressedBitmap = null;
587 String imagePath = "I01_toolbar_icon_windows_manager_0";
588 String pressedImagePath = "I01_toolbar_icon_windows_manager_0";
589 int totalCount = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount();
590 imagePath.Append(totalCount);
591 imagePath.Append(".png");
593 pressedImagePath.Append(totalCount);
594 pressedImagePath.Append("_press.png");
596 pBitmap = AppResource::GetInstance()->GetBitmapN(imagePath);
597 pPressedBitmap = AppResource::GetInstance()->GetBitmapN(pressedImagePath);
598 if ( pBitmap == null )
603 Point startPoint = Point((__pMultiWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pMultiWindowButton->GetHeight() - pBitmap->GetHeight())/2);
606 __pMultiWindowButton->SetNormalBitmap(startPoint, *pBitmap);
607 __pMultiWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
612 __pMultiWindowButton->AddActionEventListener(*this);
613 __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
616 delete pPressedBitmap;
617 pPressedBitmap = null;
623 Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
624 Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE_PRESS);
627 Point startPoint((__pMoreButton->GetWidth() - pBitmap->GetWidth())/2,(__pMoreButton->GetHeight() - pBitmap->GetHeight())/2 );
628 __pMoreButton->SetNormalBitmap(startPoint, *pBitmap);
629 __pMoreButton->SetPressedBitmap(startPoint, *pPressedBitmap);
633 __pMoreButton->AddActionEventListener(*this);
634 __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
637 //Add the editfield for url
638 __pFooterUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
639 if (__pFooterUrlField == NULL)
641 return E_INVALID_KEY;
644 __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
645 __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
646 __pFooterUrlField->AddKeypadEventListener(*this);
647 __pFooterUrlField->SetPropagatedTouchEventListener(this);
648 __pFooterUrlField->AddFocusEventListener(*this);
650 if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
652 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
654 else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
656 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
660 //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
661 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
665 //Add the go Back Button
666 __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
667 if (__pGoBackBtn == NULL)
669 AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
670 return E_INVALID_KEY;
672 __pGoBackBtn->SetActionId(IDA_GO_BACK);
673 __pGoBackBtn->AddActionEventListener(*this);
675 //Add the go forward Button
676 __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
677 if (__pGoForwardBtn == NULL)
679 AppLogDebug("Control not found returning E_INVALID_KEY");
680 return E_INVALID_KEY;
682 __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
683 __pGoForwardBtn->AddActionEventListener(*this);
684 if (__pWebViewer && __pWebViewer->CanGoForward())
686 SetForwardButtonEnabled(true);
690 SetForwardButtonEnabled(false);
693 __pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
694 if (__pRefreshBtn == NULL)
696 AppLogDebug("Control not found returning E_INVALID_KEY");
697 return E_INVALID_KEY;
700 __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
701 __pRefreshBtn->AddActionEventListener(*this);
702 __pRefreshBtn->SetShowState(true);
704 //Add the backround label for displaying progressbar
705 __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
706 if (__pProgressbarLabel == NULL)
708 AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
709 return E_INVALID_KEY;
711 __pProgressbarLabel->SetShowState(false);
713 __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
714 if (__pStopBtn == NULL)
716 AppLogDebug("Control not found returning E_INVALID_KEY");
717 return E_INVALID_KEY;
719 __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
720 __pStopBtn->AddActionEventListener(*this);
721 __pStopBtn->SetShowState(false);
723 __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
724 if (__pClearBtn == NULL)
726 AppLogDebug("Control not found returning E_INVALID_KEY");
727 return E_INVALID_KEY;
729 __pClearBtn->SetActionId(IDA_CLEAR_URL);
730 __pClearBtn->AddActionEventListener(*this);
731 __pClearBtn->SetShowState(false);
733 __pReaderBtn = static_cast<Button*> (GetControl(L"IDC_READER_BUTTON",true));
734 if (__pReaderBtn == NULL)
736 AppLogDebug("Control not found returning E_INVALID_KEY");
737 return E_INVALID_KEY;
739 __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED);
740 __pReaderBtn->AddActionEventListener(*this);
741 __pReaderBtn->SetShowState(false);
743 // __pFooterPanel->Invalidate(true);
744 if(__isKeypadOpened == false && __pAddressbar && __pAddressbar->GetShowState() == false)
746 // AppLog("asdasdasdasda");
747 __pFooterPanel->SetShowState(true);
749 else if(__pAddressbar == null)
751 __pFooterPanel->SetShowState(true);
754 __pFooterPanel->SetShowState(false);
756 SetAddressbarMode(GetAddressbarMode());
757 AppLogDebug("MainForm::InitFooter exit");
762 MainForm::InitOptionMenu()
764 result r = E_SUCCESS;
765 bool isPrivateBrowsing = false;
766 Bitmap* pBitmap = null;
768 if (__pOptionMenu != null)
770 __pOptionMenu->SetFocusable(true);
771 __pOptionMenu->Invalidate(true);
775 __pOptionMenu = new(std::nothrow) OptionMenu();
776 r = __pOptionMenu->Construct();
777 TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
779 __pOptionMenu->SetFocusable(true);
780 isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
783 if (isPrivateBrowsing == true)
785 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
789 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
792 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
794 if ( pBitmap != NULL)
796 __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"), IDA_PRIVATEON_CLICKED,*pBitmap);
799 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_TAB_HISTORY"), IDA_HISTORY_CLICKED);
800 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
801 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
804 __pOptionMenu->SetMaxVisibleItemsCount(6);
805 __pOptionMenu->SetShowState(false);
806 __pOptionMenu->AddActionEventListener(*this);
807 SetControlAlwaysOnTop(*__pOptionMenu, true);
813 result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
815 result r = E_SUCCESS;
816 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
818 AppLog("MainForm::InitImageContextMenu clicked on image");
819 if (__pImageMenu != null)
824 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
829 __pImageMenu = new (std::nothrow) ContextMenu();
830 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
831 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
833 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
834 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
835 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED);
836 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_IMAGE_CLICKED);
837 __pImageMenu->SetMaxVisibleItemsCount(4);
838 __pImageMenu->AddActionEventListener(*this);
839 SetControlAlwaysOnTop(*__pImageMenu, true);
840 __pImageMenu->SetFocusable(true);
846 MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
848 result r = E_SUCCESS;
849 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
851 AppLog("MainForm::InitImageContextMenu clicked on image");
852 if (__pImageMenu != null)
858 // if(__pAddressbar->GetShowState() == true)
859 // p.y = p.y + __pAddressbar->GetHeight();
860 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
865 __pImageMenu = new (std::nothrow) ContextMenu();
866 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
867 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
869 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
870 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
871 //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
872 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
874 __pImageMenu->SetMaxVisibleItemsCount(3);
875 __pImageMenu->AddActionEventListener(*this);
876 SetControlAlwaysOnTop(*__pImageMenu, true);
877 __pImageMenu->SetFocusable(true);
884 MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOption = false)
886 result r = E_SUCCESS;
887 bool clipboardAvailable = true;
888 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
890 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
891 if (__pImageMenu != null)
897 // __pWebViewer->GetBlockRange(p,q);
902 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
906 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
910 Clipboard* pClipboard = Clipboard::GetInstance();
912 if(pClipboard == null)
914 clipboardAvailable = false;
918 // Retrieves a latest item
919 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
923 clipboardAvailable = false;
927 //Gets data from the clipboard item
928 String* pString = dynamic_cast<String*>(pItem->GetData());
932 clipboardAvailable = false;
936 if(clipboardAvailable == false && onlyPasteOption == true)
941 __pImageMenu = new (std::nothrow) ContextMenu();
942 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
943 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
945 if(onlyPasteOption == false)
947 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
949 if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
951 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
953 if(onlyPasteOption == false)
955 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
956 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
959 __pImageMenu->SetMaxVisibleItemsCount(3);
960 __pImageMenu->AddActionEventListener(*this);
961 SetControlAlwaysOnTop(*__pImageMenu, true);
962 __pImageMenu->SetFocusable(true);
969 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
971 result r = E_SUCCESS;
972 bool clipboardAvailable = true;
973 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
975 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
976 if (__pImageMenu != null)
981 // FloatPoint q(0.0,0.0);
982 // __pWebViewer->GetBlockRange(p,q);
986 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
990 if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
992 AppLog("asdasdafdsfdgfd");
995 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
999 Clipboard* pClipboard = Clipboard::GetInstance();
1001 if(pClipboard == null)
1003 clipboardAvailable = false;
1007 // Retrieves a latest item
1008 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
1012 clipboardAvailable = false;
1016 //Gets data from the clipboard item
1017 String* pString = dynamic_cast<String*>(pItem->GetData());
1021 clipboardAvailable = false;
1025 if(clipboardAvailable == false && onlyPasteOption == true)
1029 __pImageMenu = new (std::nothrow) ContextMenu();
1030 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
1031 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
1037 if(onlyPasteOption == false)
1039 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
1041 if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
1043 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
1045 if(onlyPasteOption == false)
1047 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
1048 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
1051 __pImageMenu->SetMaxVisibleItemsCount(3);
1052 __pImageMenu->AddActionEventListener(*this);
1053 SetControlAlwaysOnTop(*__pImageMenu, true);
1054 __pImageMenu->SetFocusable(true);
1061 MainForm::InitFindWordPanel(void)
1063 result r = E_SUCCESS;
1064 Bitmap *pIconBitmap = null;
1066 if (__pFindWordControl != null)
1068 AppLogDebug("Findword panel already initialized");
1069 if (__pFindWordBgLabel != null)
1071 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1072 if (pBitmap != null)
1074 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1078 if (__pFindWordBgLabelRightToLeft != null)
1080 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
1081 if (pBitmap != null)
1083 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1088 __pAddressbar->SetShowState(false);
1090 if(__isKeypadOpened == false)
1091 __pFooterPanel->SetShowState(true);
1095 __pFindWordControl = new (std::nothrow) Panel();
1096 r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE");
1099 AppLogException("There is some problem in the xml file. Please check.");
1102 AddControl(__pFindWordControl);
1103 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
1104 SetControlAlwaysOnTop(*__pFindWordControl,true);
1105 __pFindWordControl->SetShowState(false);
1106 __pFindWordControl->Invalidate(false);
1108 __pFindWordPanelLeftToRight = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1109 __pFindWordPanelLeftToRight->SetShowState(true);
1111 __pFindWordPanelRightToLeft = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL2", true));
1112 __pFindWordPanelRightToLeft->SetShowState(false);
1114 __pFindWordBgLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL1", true));
1115 if (__pFindWordBgLabel != null)
1117 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1118 Rectangle pRect = pPanel1->GetBounds();
1119 pRect.x = pRect.y = 0;
1120 __pFindWordBgLabel->SetBounds(pRect);
1121 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1122 if (pBitmap != null)
1124 AppLogDebug("InitFindWordPanel: Coming here");
1125 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1130 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1134 __pFindWordBgLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL2", true));
1135 if (__pFindWordBgLabelRightToLeft != null)
1137 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1138 Rectangle pRect = pPanel1->GetBounds();
1139 pRect.x = pRect.y = 0;
1140 __pFindWordBgLabelRightToLeft->SetBounds(pRect);
1141 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1142 if (pBitmap != null)
1144 AppLogDebug("InitFindWordPanel: Coming here");
1145 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1150 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1154 Button* pfindWordCancel = null;
1155 pfindWordCancel = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true));
1156 if (pfindWordCancel == null)
1158 AppLogException("There is some problem in the xml file. Please check.");
1161 pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED);
1162 pfindWordCancel->AddActionEventListener(*this);
1164 __pFindWordClear = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true));
1165 if (__pFindWordClear == null)
1167 AppLogException("There is some problem in the xml file. Please check.");
1171 __pFindWordClearRightToLeft = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR2", true));
1172 if (__pFindWordClearRightToLeft == null)
1174 AppLogException("There is some problem in the xml file. Please check.");
1178 __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED);
1179 __pFindWordClear->AddActionEventListener(*this);
1181 __pFindWordClearRightToLeft->SetActionId(IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED);
1182 __pFindWordClearRightToLeft->AddActionEventListener(*this);
1184 __pFindWordNext = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true));
1185 if (__pFindWordNext == null)
1187 AppLogException("There is some problem in the xml file. Please check.");
1191 __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED);
1192 __pFindWordNext->AddActionEventListener(*this);
1194 __pFindWordPrev = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true));
1195 if (__pFindWordPrev == null)
1197 AppLogException("There is some problem in the xml file. Please check.");
1201 __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED);
1202 __pFindWordPrev->AddActionEventListener(*this);
1204 __pFindWordNext->SetEnabled(false);
1205 __pFindWordPrev->SetEnabled(false);
1207 __pFindWordCountLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true));
1208 if (__pFindWordCountLabel == null)
1210 AppLogException("There is some problem in the xml file. Please check.");
1214 __pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
1215 if (__pFindWordCountLabelRightToLeft == null)
1217 AppLogException("There is some problem in the xml file. Please check.");
1221 __pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
1222 if (__pFindWordEditField == null)
1224 AppLogException("There is some problem in the xml file. Please check.");
1227 __pFindWordEditField->AddTextEventListener(*this);
1228 __pFindWordEditField->AddKeypadEventListener(*this);
1229 __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
1230 __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1232 __pFindWordEditFieldRightToLeft = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true));
1233 if (__pFindWordEditFieldRightToLeft == null)
1235 AppLogException("There is some problem in the xml file. Please check.");
1238 __pFindWordEditFieldRightToLeft->AddTextEventListener(*this);
1239 __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
1240 __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
1241 __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1244 __pAddressbar->SetShowState(false);
1246 if(__isKeypadOpened == false)
1247 __pFooterPanel->SetShowState(true);
1252 MainForm::CreateItem (int index, int itemWidth)
1254 Rectangle listImageRect;
1255 Rectangle pagetTitleRect;
1256 Rectangle pageURLRect;
1257 Rectangle deleteImageRect;
1258 String pageTitle(L"");
1259 String pageURL(L"");
1260 result r = E_SUCCESS;
1261 Bitmap* pListIconImage = null;
1264 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1265 if(pHistory == null)
1269 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
1270 if ( pAppResource == NULL )
1274 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
1276 CustomItem* pItem = new(std::nothrow) CustomItem();
1277 pageTitle = pHistory->GetHistoryTitle();
1278 pageURL = pHistory->GetHistoryUrl();
1280 if (pageURL.GetLength() == 0)
1283 pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
1284 pageURL = L"<"+ nourl +">";
1288 Rectangle screenBounds = GetBounds();
1291 r = pItem->Construct(Dimension(itemWidth, 128 + (__fontSize - 44)), style);
1300 Bitmap* pBitmap = pHistory->GetFavIconBitmap();
1302 if ( pBitmap != NULL)
1304 pListIconImage = new Bitmap();
1305 pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
1309 if(pListIconImage == null)
1311 pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png");
1314 if ( pListIconImage != NULL)
1316 listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28 + (__fontSize - 44)/2 , 72, 72);
1317 pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72 + (__fontSize - 44));
1318 pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
1321 if (pItem != null && pListIconImage != NULL)
1323 pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *pListIconImage, null, null);
1327 if (pageTitle.CompareTo(L"") != 0)
1331 pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, __fontSize, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true);
1335 if (pageURL.CompareTo(L"") != 0)
1339 pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
1344 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1346 if ( __pItemContext!= NULL)
1350 pItem->SetContextItem(__pItemContext);
1356 if ( __pItemContextLandscape!= NULL)
1360 pItem->SetContextItem(__pItemContextLandscape);
1364 if( pListIconImage != NULL)
1366 delete pListIconImage;
1367 pListIconImage = null;
1374 MainForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
1381 MainForm::GetItemCount (void)
1383 if(__pMostVisitedSites != null)
1385 __pMostVisitedSites->RemoveAll(true);
1387 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
1388 if(__pMostVisitedSites != null)
1390 return __pMostVisitedSites->GetCount();
1397 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
1399 AppLog("MainForm::OnListViewContextItemStateChanged called");
1400 if(__pMostVisitedSites != null)
1402 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1403 if (pHistory != null)
1405 String url = pHistory->GetHistoryUrl();
1407 HistoryPresentationModel::GetInstance()->DeleteHistory(url);
1408 __pMostVisitedListView->UpdateList();
1414 MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1416 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1417 String url = pHistory->GetHistoryUrl();
1425 MainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1431 MainForm::OnTerminating(void)
1433 result r = E_SUCCESS;
1435 RemoveOrientationEventListener(*this);
1439 __pAddressbar->SetAddressbarEventListener(null);
1444 __pWebViewer->RemoveTouchEventListener(*this);
1445 __pWebViewer->SetWebUiEventListenerF(null);
1446 __pWebViewer->SetWebKeypadEventListener(null);
1447 __pWebViewer->SetTextSearchListener(null);
1453 delete __pItemContext;
1455 if (__pItemContextLandscape)
1457 delete __pItemContextLandscape;
1461 delete __pSaveImage;
1463 if (__pMostVisitedSites)
1465 __pMostVisitedSites->RemoveAll(true);
1466 delete __pMostVisitedSites;
1472 MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1474 result r = E_SUCCESS;
1476 AppLogDebug("Clicked : %d", actionId);
1479 case IDA_BACKBTN_CLICKED:
1481 if(__pImageMenu && __pImageMenu->GetShowState() == true)
1483 AppLog("Hiding the menu");
1484 __pImageMenu->SetShowState(false);
1486 if (__pWebViewer && __pWebViewer->CanGoBack())
1488 __pWebViewer->GoBack();
1490 else if(__pWindowInfo->isJavascriptInitiated == false)
1493 pApp = UiApp::GetInstance();
1496 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1499 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1507 WindowInfo* pWindowInfo = null;
1509 SceneManager* pSceneManager = SceneManager::GetInstance();
1510 if (pSceneManager == null)
1514 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
1515 if (pAllWindowList == NULL)
1517 pApp = UiApp::GetInstance();
1520 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1523 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1528 if (pAllWindowList != null)
1530 totalCount = pAllWindowList->GetCount();
1532 for (int count = 0; count < totalCount; count++)
1534 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
1535 if (pWindowInfo == null)
1537 pApp = UiApp::GetInstance();
1540 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1543 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1550 if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
1552 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
1555 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1558 r = pAllWindowList->RemoveAt(count, true);
1559 __pWindowInfo = null;
1562 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1567 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
1571 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
1573 if (pWindowInfo == null)
1575 pApp = UiApp::GetInstance();
1578 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
1584 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
1585 // r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1588 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1600 case IDA_FORWARD_CLICKED:
1601 if (__pWebViewer == null)
1604 if (__pWebViewer->CanGoForward())
1606 __pWebViewer->GoForward();
1608 __pOptionMenu->SetShowState(false);
1609 __pOptionMenu->Invalidate(false);
1612 case IDA_FINDONPAGE_CLICKED:
1614 AppLogDebug("MainForm::OnActionPerformed findword clicked");
1615 __currentSearchStr.Clear();
1617 InitFindWordPanel();
1618 __pOptionMenu->SetShowState(false);
1619 __pOptionMenu->Invalidate(false);
1621 ShowFindWordPanel(true);
1623 if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
1625 __pFindWordEditField->SetFocus();
1626 // __pFindWordCountLabel->SetShowState(false);
1630 __pFindWordEditFieldRightToLeft->SetFocus();
1631 __pFindWordCountLabelRightToLeft->SetShowState(false);
1635 case IDA_PRIVATEON_CLICKED:
1637 result r = E_SUCCESS;
1639 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
1640 Bitmap* pBitmap = null;
1641 if (isPrivateBrowsing == true)
1643 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
1646 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1650 if (__pWebViewer != NULL)
1652 __pWebViewer->SetPrivateBrowsingEnabled(false);
1655 SettingPresentationModel::GetInstance()->SetPrivateOn(false);
1657 if (__pAddressbar != null)
1659 __pAddressbar->UpdateFaviconBitmap(false);
1665 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
1668 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1672 if (__pWebViewer != NULL)
1674 __pWebViewer->SetPrivateBrowsingEnabled(true);
1677 SettingPresentationModel::GetInstance()->SetPrivateOn(true);
1679 if (__pAddressbar != null)
1681 __pAddressbar->UpdateFaviconBitmap(true);
1685 itemIndex = __pOptionMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED);
1686 r = __pOptionMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
1687 AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex);
1688 __pOptionMenu->Invalidate(true);
1689 if ( pBitmap != NULL )
1696 case IDA_SETTINGS_CLICKED:
1699 ArrayList* pArgList = new(std::nothrow) ArrayList();
1702 pArgList->Construct();
1703 pArgList->Add(*__pWindowInfo);
1704 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList);
1706 __pOptionMenu->SetShowState(false);
1707 __pOptionMenu->Invalidate(false);
1709 if (pArgList != null)
1718 case IDA_ADDTOBOOKMARK_CLICKED:
1721 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
1723 int bookmarkCount=0;
1726 url=__pWindowInfo->pageUrl;
1727 result r = E_SUCCESS;
1728 Bitmap* pBitmap = null;
1729 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1737 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_REMOVED");
1738 BookmarkPresentationModel::GetInstance()->DeleteBookmark(url);
1739 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1741 if(__pNotification != null)
1743 RemoveControl(__pNotification);
1744 __pNotification = null;
1746 __pNotification = new (std::nothrow) NotificationPanel(*this);
1747 if (__pNotification != null)
1749 __pNotification->SetText(message);
1750 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1751 __pNotification->ShowNotification();
1756 String title=__pWindowInfo->pageTitle;
1757 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ADDED");
1758 BookmarkData* pBookmark=new (std::nothrow) BookmarkData();
1760 pBookmark->SetBookmarkTitle(title);
1761 pBookmark->SetUrl(url);
1762 if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
1764 pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
1766 String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
1767 pBookmark->SetFaviconId(id);
1768 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
1769 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
1771 if(__pNotification != null)
1773 RemoveControl(__pNotification);
1774 __pNotification = null;
1776 __pNotification = new (std::nothrow) NotificationPanel(*this);
1777 if (__pNotification != null)
1779 __pNotification->SetText(message);
1780 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1781 __pNotification->ShowNotification();
1782 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1785 if (pBitmap != null)
1787 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1792 __pOptionMenu->Invalidate(true);
1797 case IDA_PRINT_CLICKED:
1799 r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//shared//data//test.pdf");
1800 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
1802 AppLog("RequestPrint called!");
1803 AppControl* pAc = Tizen::App::AppManager::FindAppControlN(L"org.tizen.mobileprint", L"http://tizen.org/appcontrol/operation/print");
1804 result nResult = E_FAILURE;
1807 AppLog("TestPrint if (pAc) == true");
1812 String fileType = L"service_print_files_type";
1813 String typeVal = L"DOC";
1815 String fileCount = L"service_print_files_count";
1816 String countVal = L"1";
1817 String fileFolder= L"service_print_files_folder_name";
1818 String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//shared//data";
1820 map.Add(&fileCount, &countVal);
1821 map.Add(&fileFolder, &folderVal);
1822 map.Add(&fileType, &typeVal);
1824 String fileName = L"service_print_files_files_name";
1826 ArrayList fileNameList;
1827 fileNameList.Construct();
1828 String file1 = L"test.pdf";
1830 fileNameList.Add(&file1);
1831 map.Add(&fileName, &fileNameList);
1833 nResult = pAc->Start(NULL, NULL, &map, NULL);
1835 if (nResult == E_SUCCESS) AppLog("TestPrint ret == E_SUCCESS");
1836 else if (nResult == E_MAX_EXCEEDED)
1837 AppLog("TestPrint ret == E_MAX_EXCEEDED");
1838 else if (nResult == E_OBJ_NOT_FOUND)
1839 AppLog("TestPrint ret == E_OBJ_NOT_FOUND");
1840 else if (nResult == E_IN_PROGRESS)
1841 AppLog("TestPrint ret == E_IN_PROGRESS");
1842 else if (nResult == E_PRIVILEGE_DENIED)
1843 AppLog("TestPrint ret == E_PRIVILEGE_DENIED");
1844 else if(nResult == E_SYSTEM)
1845 AppLog("TestPrint ret == E_SYSTEM");
1851 int __modalMsgBoxResult;
1852 MessageBox* pMsgBox = new MessageBox();
1853 pMsgBox->Construct("Not Supported","Not Supported",MSGBOX_STYLE_OK,3000);
1854 pMsgBox->ShowAndWait(__modalMsgBoxResult);
1857 __modalMsgBoxResult = 0;
1861 case IDA_SHARE_CLICKED:
1863 if(__pPopUp != null)
1870 __pAddressbar->HideKeypad();
1872 __pPopUp = new(std::nothrow) SharePopup();
1873 __pPopUp->Initialize();
1874 if (__pWindowInfo != null)
1876 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
1877 pShareInfo->SetPageTitle(__pWindowInfo->pageTitle);
1878 pShareInfo->SetPageUrl(__pWindowInfo->pageUrl);
1879 pShareInfo->SetImageAttached(false);
1880 __pPopUp->RemoveAllShareInfo();
1881 __pPopUp->AddShareInfo(pShareInfo);
1883 __pPopUp->SetShowState(true);
1887 case IDA_BOOKMARKBTN_CLICKED:
1889 AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
1890 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1893 case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
1898 case IDA_MOREBTN_CLICKED:
1900 AppLog("IDA_MOREBTN_CLICKED");
1902 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
1904 int bookmarkCount=0;
1907 url=__pWindowInfo->pageUrl;
1908 result r = E_SUCCESS;
1909 Bitmap* pBitmap = null;
1911 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1914 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
1919 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1923 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1925 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
1927 if (__pOptionMenu->GetItemCount() == 9)
1929 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1933 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1938 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
1942 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
1943 if (__pOptionMenu->GetItemCount() != 9)
1945 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
1946 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
1947 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
1948 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
1949 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
1950 __pOptionMenu->SetMaxVisibleItemsCount(6);
1952 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1954 AppLog(" Orientation landscape");
1955 __pOptionMenu->SetMaxVisibleItemsCount(5);
1959 AppLog(" Orientation potrait");
1960 __pOptionMenu->SetMaxVisibleItemsCount(6);
1963 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
1966 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
1967 __pOptionMenu->SetShowState(true);
1968 __pOptionMenu->Invalidate(true);
1969 __pOptionMenu->Show();
1973 case IDA_HISTORY_CLICKED:
1975 AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
1976 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1979 case IDA_SAVED_PAGES_CLICKED:
1984 case IDA_DESKTOP_VIEW_CLICKED:
1989 case IDA_SAVE_CLICKED:
1994 case IDA_MULTIWINDOWBTN_CLICKED:
1996 result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1997 AppLog("IDA_MULTIWINDOWBTN_CLICKED result %s",GetErrorMessage(r));
2001 case IDA_NEWWINDOWBTN_CLICKED:
2003 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
2005 if (pNewWindowInfo == null)
2009 result r = E_SUCCESS;
2010 SceneManager* pSceneManager = SceneManager::GetInstance();
2012 if (pSceneManager == NULL)
2016 ArrayList* pArgList = new(std::nothrow) ArrayList();
2017 if (pArgList == NULL)
2021 r = pArgList->Construct();
2024 pArgList->Add(*pNewWindowInfo);
2025 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2031 AppLogDebug("MainForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
2036 case IDA_SMALLFONT_BTN_CLICKED:
2038 WebSetting setting = __pWebReader->GetSetting();
2039 setting.SetFontSize(15);
2040 __pWebReader->SetSetting(setting);
2043 case IDA_LARGEFONT_BTN_CLICKED:
2045 WebSetting setting = __pWebReader->GetSetting();
2046 setting.SetFontSize(25);
2047 __pWebReader->SetSetting(setting);
2050 case IDA_READER_CLOSE_CLICKED:
2052 if (__pArticleReaderPanel != null && __pBlankPanel != null)
2054 RemoveControl(__pBlankPanel);
2055 __pArticleReaderPanel = null;
2056 __pBlankPanel = null;
2057 __pArticleReaderLabel = null;
2059 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2062 case IDA_FINDWORD_CANCEL_CLICKED:
2064 __currentSearchStr = L"";
2065 __currentWordIndex = 0;
2066 __maxOccurrances = 0;
2068 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2070 __pFindWordEditField->SetText(L"");
2071 __pFindWordCountLabel->SetText(L"0/0");
2073 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2075 __pFindWordEditFieldRightToLeft->SetText(L"");
2076 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2079 __pFindWordNext->SetEnabled(false);
2080 __pFindWordPrev->SetEnabled(false);
2081 __pFindWordCountLabel->SetText(L"0/0");
2082 __pWebViewer->SearchTextAllAsync(L"",true);
2083 AppLog("akjshdasd 1");
2084 if(__isKeypadOpened == false)
2085 __pFooterPanel->SetShowState(true);
2086 ShowFindWordPanel(false);
2089 case IDA_FINDWORD_SEARCH_CLICKED:
2091 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2093 __currentSearchStr = __pFindWordEditField->GetText();
2095 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2097 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
2100 if (__currentSearchStr.GetLength() > 0)
2106 AppLogDebug("Enter something");
2110 case IDA_FINDWORD_CLEAR_CLICKED:
2112 __pFindWordCountLabel->SetText(L"0/0");
2113 __pFindWordEditField->SetText(L"");
2114 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2116 __currentSearchStr = L"";
2117 __pFindWordNext->SetEnabled(false);
2118 __pFindWordPrev->SetEnabled(false);
2119 // __pFindWordCountLabel->SetShowState(false);
2120 __pFindWordControl->Invalidate(true);
2123 case IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED:
2125 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2126 __pFindWordEditFieldRightToLeft->SetText(L"");
2127 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2129 __currentSearchStr = L"";
2130 __pFindWordNext->SetEnabled(false);
2131 __pFindWordPrev->SetEnabled(false);
2132 // __pFindWordCountLabelRightToLeft->SetShowState(false);
2133 __pFindWordControl->Invalidate(true);
2136 case IDA_FINDWORD_NEXT_CLICKED:
2141 case IDA_FINDWORD_PREV_CLICKED:
2143 FindNextWord(false);
2146 case IDA_BRIGHTNESS_BTN_CLICKED:
2148 AppLogDebug("IDA_BRIGHTNESS_BTN_CLICKED");
2149 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BRIGHTNESS, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2152 case IDA_COPY_IMAGE_CLICKED:
2154 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2155 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2157 const Bitmap* pBitmap = null;
2158 if (__pHitElementResult != null && __pHitElementResult->HasImage())
2160 pBitmap = __pHitElementResult->GetImage();
2163 String resourcePath = App::GetInstance()->GetAppResourcePath();
2164 r = item.Construct(CLIPBOARD_DATA_TYPE_IMAGE , *pBitmap);
2165 AppLog("Platofrm construct failed result %s",GetErrorMessage(r));
2166 // copying the item to clipboard
2167 Clipboard* pClipboard = Clipboard::GetInstance();
2168 if (pClipboard != null)
2170 r = pClipboard->CopyItem(item);
2171 AppLog("Platofrm copy failed result %s",GetErrorMessage(r));
2175 case IDA_VIEW_IMAGE_CLICKED:
2177 AppLogDebug("IDA_VIEW_IMAGE_CLICKED");
2178 WindowInfo* pNewWindowInfo = null;
2179 if (__pHitElementResult != null)
2181 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2182 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2188 case IDA_SAVE_IMAGE_CLICKED:
2190 AppLogDebug("IDA_SAVE_IMAGE_CLICKED");
2191 const Bitmap* pSaveBitmap = null;
2192 String imageName = GetImagePath();
2193 AppLog("Content manager image name %ls",imageName.GetPointer());
2196 imagePath.Append(imageName);
2197 imagePath.Format(100, L"%ls/Downloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2198 AppLog("Content manager image path %ls",imagePath.GetPointer());
2199 if (__pHitElementResult != null)
2201 pSaveBitmap = __pHitElementResult->GetImage();
2203 ByteBuffer* pBuffer = __pSaveImage->EncodeToBufferN(*pSaveBitmap, IMG_FORMAT_JPG);
2207 UpdateImageContent(pBuffer, imageName);
2209 if(__pNotification != null)
2211 RemoveControl(__pNotification);
2212 __pNotification = null;
2214 __pNotification = new NotificationPanel(*this);
2216 AppResource::GetInstance()->GetString("IDS_COM_SK_SAVE", msg);
2217 msg.Append(imagePath);
2218 if (__pNotification != null)
2220 __pNotification->SetText(msg);
2221 if (__pFooterPanel->GetShowState() == true)
2223 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
2227 __pNotification->SetPositionDiff(0);
2229 __pNotification->ShowNotification();
2234 int __modalMsgBoxResult;
2235 MessageBox* pMsgBox = new MessageBox();
2236 pMsgBox->Construct(CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
2237 pMsgBox->ShowAndWait(__modalMsgBoxResult);
2240 __modalMsgBoxResult = 0;
2244 case IDA_SHARE_IMAGE_CLICKED:
2246 AppLogDebug("IDA_SHARE_IMAGE_CLICKED");
2247 if (__pPopUp != null)
2254 __pAddressbar->HideKeypad();
2256 __pPopUp = new(std::nothrow) SharePopup();
2257 __pPopUp->Initialize();
2258 if (__pHitElementResult != null)
2260 const Bitmap* pSaveBitmap = null;
2261 String imageName = GetImagePath();
2262 AppLog("Content manager image name %ls",imageName.GetPointer());
2265 imagePath.Append(imageName);
2266 imagePath.Format(100, L"%lsDownloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2267 AppLog("Content manager image path %ls",imagePath.GetPointer());
2268 if (__pHitElementResult != null)
2270 pSaveBitmap = __pHitElementResult->GetImage();
2272 __pSaveImage->EncodeToFile(*pSaveBitmap, IMG_FORMAT_JPG, imagePath, true);
2274 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2275 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2277 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2278 pShareInfo->SetPageTitle(L"");
2279 pShareInfo->SetPageUrl(srcUrl);
2280 pShareInfo->SetImageAttached(true);
2281 pShareInfo->SetImagePath(imagePath);
2282 __pPopUp->RemoveAllShareInfo();
2283 __pPopUp->AddShareInfo(pShareInfo);
2284 __pPopUp->SetShowState(true);
2289 case IDA_HYPERLINK_OPEN_CLICKED:
2291 if (__pHitElementResult != null)
2293 String srcUrl = __pHitElementResult->GetUrl();
2295 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(srcUrl);
2297 if (pNewWindowInfo == null)
2301 pNewWindowInfo->isJavascriptInitiated = true;
2302 result r = E_SUCCESS;
2303 SceneManager* pSceneManager = SceneManager::GetInstance();
2304 if (pSceneManager == NULL)
2308 ArrayList* pArgList = new(std::nothrow) ArrayList();
2309 if (pArgList == NULL)
2313 pArgList->Construct();
2315 pArgList->Add(*pNewWindowInfo);
2316 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2317 if (pArgList != null)
2324 AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
2330 case IDA_HYPERLINK_SHARE_IMAGE_CLICKED:
2332 if (__pHitElementResult == null)
2337 if(__pPopUp != null)
2344 __pAddressbar->HideKeypad();
2346 __pPopUp = new(std::nothrow) SharePopup();
2347 __pPopUp->Initialize();
2349 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2350 pShareInfo->SetPageUrl(__pHitElementResult->GetUrl());
2351 pShareInfo->SetImageAttached(false);
2352 __pPopUp->RemoveAllShareInfo();
2353 __pPopUp->AddShareInfo(pShareInfo);
2355 __pPopUp->SetShowState(true);
2359 case IDA_HYPERLINK_COPY_LINK_CLICKED:
2363 if (__pHitElementResult != null)
2365 url = __pHitElementResult->GetUrl();
2368 String resourcePath = App::GetInstance()->GetAppResourcePath();
2369 item.Construct(CLIPBOARD_DATA_TYPE_TEXT , url);
2371 // copying the item to clipboard
2372 Clipboard* pClipboard = Clipboard::GetInstance();
2373 if (pClipboard != null)
2375 pClipboard->CopyItem(item);
2379 case IDA_FIND_TEXT__CLICKED:
2381 // AddressBarCancelledClicked(*__pAddressbar);
2382 RelayoutControls(false);
2383 // __pFooterPanel->SetShowState(false);
2384 AppLogDebug("MainForm::OnActionPerformed find word clicked");
2385 __currentSearchStr.Clear();
2386 __currentSearchStr.Append(__currentSelectedStr);
2387 InitFindWordPanel();
2388 __pFindWordEditField->SetText(__currentSearchStr);
2390 if(__pOptionMenu != null)
2392 __pOptionMenu->SetShowState(false);
2393 __pOptionMenu->Invalidate(false);
2395 __adressPanelPosition.y = 0;
2397 if (__pAddressbar != null && __pWebViewer != NULL)
2399 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
2400 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
2402 if (__pFooterPanel->GetShowState() == false)
2403 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
2405 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
2406 __pWebViewer->Invalidate(true);
2409 ShowFindWordPanel(true);
2410 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2412 __pFindWordEditField->SetText(__currentSearchStr);
2413 __pFindWordEditField->SetFocus();
2415 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2417 __pFindWordEditFieldRightToLeft->SetText(__currentSearchStr);
2418 __pFindWordEditFieldRightToLeft->SetFocus();
2421 if (__currentSearchStr.GetLength() > 0)
2427 AppLogDebug("Enter something");
2430 if (__pWebViewer != null)
2432 // releasing the set block
2433 __pWebViewer->ReleaseBlock();
2438 case IDA_SHARE_TEXT_CLICKED:
2440 __pWebViewer->ReleaseBlock();
2441 AppLogDebug("IDA_SHARE_TEXT_CLICKED");
2442 if(__pPopUp != null)
2449 __pAddressbar->HideKeypad();
2451 __pPopUp = new(std::nothrow) SharePopup();
2452 __pPopUp->Initialize();
2453 if (__pHitElementResult != null)
2455 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2456 pShareInfo->SetPageTitle(L"");
2457 pShareInfo->SetPageUrl(__currentSelectedStr);
2458 pShareInfo->SetImageAttached(false);
2459 __pPopUp->RemoveAllShareInfo();
2460 __pPopUp->AddShareInfo(pShareInfo);
2461 __pPopUp->SetShowState(true);
2466 case IDA_COPY_TEXT_CLICKED:
2468 __pWebViewer->ReleaseBlock();
2469 // need to implement
2470 //__currentSelectedStr
2471 // Sets data to a clip board item
2473 String resourcePath = App::GetInstance()->GetAppResourcePath();
2474 item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __currentSelectedStr);
2476 // copying the item to clipboard
2477 Clipboard* pClipboard = Clipboard::GetInstance();
2478 if (pClipboard != null)
2480 pClipboard->CopyItem(item);
2484 case IDA_PASTE_TEXT_CLICKED:
2486 Clipboard* pClipboard = Clipboard::GetInstance();
2488 if(pClipboard == null)
2492 // Retrieves a latest item
2493 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
2499 //Gets data from the clipboard item
2500 String* pString = dynamic_cast<String*>(pItem->GetData());
2502 if (pString != null)
2504 String idElement = __pHitElementResult->GetAttributeValue(L"id");
2505 String nameElement = __pHitElementResult->GetAttributeValue(L"name");
2506 String tagElement = __pHitElementResult->GetTagName();
2507 AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
2508 String str = L"document.getElementsByName('";
2509 str.Append(nameElement);
2510 str.Append("').length");
2511 String* pCount = __pWebViewer->EvaluateJavascriptN(str);
2514 if(idElement.GetLength() != 0)
2516 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; } } ";
2517 script.Append("insertAtCursor('");
2518 script.Append(idElement);
2519 script.Append("',");
2520 script.Append("\"");
2521 script.Append(*pString);
2522 script.Append("\");");
2524 else if (nameElement.GetLength() != 0 && pCount->Equals("1",false) == true)
2526 script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
2527 script.Append("insertAtCursor(document.getElementsByName('");
2528 script.Append(nameElement);
2529 script.Append("')[0],");
2530 script.Append("\"");
2531 script.Append(*pString);
2532 script.Append("\");");
2534 else if(tagElement.GetLength() != 0) //adding for twitter post page
2536 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; } } ";
2537 script.Append("insertAtCursor(document.getElementsByTagName('");
2538 script.Append(tagElement);
2539 script.Append("')[0],");
2540 script.Append("\"");
2541 script.Append(*pString);
2542 script.Append("\");");
2544 AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
2545 String* pStr = __pWebViewer->EvaluateJavascriptN(script);
2557 case IDA_GO_FORWARD:
2562 case IDA_REFRESH_BTN_CLICKED:
2564 __isLoadingCompleted = false;
2565 __isLoadingData = true;
2566 __progressPercentage = 0;
2567 __displayUrl = __pFooterUrlField->GetText();
2569 String url = __pFooterUrlField->GetText();
2570 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
2572 if (__pWebViewer != null && __pAddressbar != null)
2574 __pWebViewer->Reload();
2575 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
2579 UpdateProgressBitmap();
2582 case IDA_STOP_BTN_CLICKED:
2584 __isLoadingCompleted = false;
2585 __isLoadingData = false;
2586 __progressPercentage = 0;
2587 __pFooterUrlField->HideKeypad();
2588 __displayUrl = __pFooterUrlField->GetText();
2592 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2593 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2594 __pWebViewer->StopLoading();
2595 RequestRedraw(true);
2598 UpdateProgressBitmap();
2603 if (__pFooterUrlField->GetText().IsEmpty() == false)
2605 //__displayUrl = __pUrlField->GetText();
2606 __pFooterUrlField->Clear();
2611 case IDA_READER_BTN_CLICKED:
2622 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
2624 AppLog("MainForm::OnFormBackRequested entered");
2625 result r = E_FAILURE;
2626 if(__pImageMenu && __pImageMenu->GetShowState() == true)
2628 AppLog("Hiding the menu");
2629 __pImageMenu->SetShowState(false);
2631 if (__pWebViewer && __pWebViewer->CanGoBack())
2633 __pWebViewer->GoBack();
2635 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
2638 pApp = UiApp::GetInstance();
2641 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2644 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2652 WindowInfo* pWindowInfo = null;
2654 SceneManager* pSceneManager = SceneManager::GetInstance();
2655 if (pSceneManager == null)
2659 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
2660 if (pAllWindowList == NULL)
2662 pApp = UiApp::GetInstance();
2665 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2668 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2673 if (pAllWindowList != null)
2675 totalCount = pAllWindowList->GetCount();
2677 for (int count = 0; count < totalCount; count++)
2679 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
2680 if (pWindowInfo == null)
2682 pApp = UiApp::GetInstance();
2685 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2688 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2695 if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
2697 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
2700 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2703 r = pAllWindowList->RemoveAt(count, true);
2704 __pWindowInfo = null;
2707 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2712 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
2716 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
2718 if (pWindowInfo == null)
2720 pApp = UiApp::GetInstance();
2723 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2729 if(pWindowInfo != null)
2730 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
2733 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2739 // else if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == false)
2741 // UiApp* pApp = null;
2742 // pApp = UiApp::GetInstance();
2743 // if (pApp != null)
2745 // r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
2748 // AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2756 AppLog("MainForm::OnFormBackRequested exit");
2760 MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
2761 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
2764 AppLog("MainForm::OnSceneActivatedN called");
2765 String* pSelectedScene = NULL;
2766 Object* pValue = NULL;
2767 String* pUrl = null;
2768 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
2769 pSelectedScene = (String*) pValue;
2771 if (pSelectedScene != null)
2773 delete pSelectedScene;
2775 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
2776 String* selectedSceneID = new(std::nothrow) String(currentSceneId);
2777 AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
2778 AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer());
2780 // setting the current scene ID
2781 MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId);
2783 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID);
2785 if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
2787 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2788 if(__pWindowInfo == null)
2790 // if(__pWindowInfo == null)
2792 pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
2795 else if ( pArgs != null && pArgs->GetCount() == 1)
2797 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2803 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
2805 // hiding the address bar
2806 // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
2807 __pAddressbar->SetShowState(false);
2808 // if(__pWebViewer != null)
2810 // __pWebViewer->Resume();
2813 if(pUrl != null && pUrl->GetLength() > 0)
2817 else if(__pWindowInfo != null)
2819 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)
2821 LoadUrl(__pWindowInfo->pageUrl);
2823 else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
2825 LoadUrl(__pWindowInfo->pageUrl);
2826 __pWindowInfo->isAppcontrolTriggered = false;
2828 else if (__pWindowInfo->isJavascriptInitiated == true && __pWindowInfo->isFirstLaunch == true)
2830 __pWindowInfo->isFirstLaunch = false;
2833 __pWindowInfo->pCurrentWeb = __pWebViewer;
2834 if(__pWindowInfo->pageUrl.GetLength() > 0)
2835 LoadUrl(__pWindowInfo->pageUrl);
2839 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
2840 AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
2841 if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
2843 InitMostVisitedSitesView(GetOrientationStatus());
2845 else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
2847 if(__pMostVisitedListView != null)
2849 __pMostVisitedListView->SetShowState(false);
2853 if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
2855 String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
2857 if (pBookmarkUrl == null)
2859 AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
2860 //__pAddressbar->SetUrl(*pBookmarkUrl);
2861 SetUrl(*pBookmarkUrl);
2863 if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
2864 __pWebViewer->LoadUrl(*pBookmarkUrl);
2865 delete pBookmarkUrl;
2868 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
2869 Bitmap* pBitmap = null;
2870 if (isPrivateBrowsing == true)
2872 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
2874 if (__pWebViewer != null)
2876 __pWebViewer->SetPrivateBrowsingEnabled(true);
2879 if (__pAddressbar != null)
2881 // __pAddressbar->UpdateFaviconBitmap(true);
2887 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
2889 if (__pWebViewer != null)
2891 __pWebViewer->SetPrivateBrowsingEnabled(false);
2894 if (__pAddressbar != null)
2896 // __pAddressbar->UpdateFaviconBitmap(false);
2900 if (__pOptionMenu != null && __pOptionMenu->GetItemCount() != 9)
2902 __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2904 else if (__pOptionMenu != null )
2906 __pOptionMenu->SetItemAt(5,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2909 if (pBitmap != null)
2914 RelayoutControls(false);
2915 AppLog("ABC: OnSceneActivatedN started exit");
2920 MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
2921 const Tizen::Ui::Scenes::SceneId& nextSceneId)
2923 Canvas* pWebCanvas = null;
2924 if (__pWebViewer != null)
2926 pWebCanvas = __pWebViewer->GetCanvasN();
2929 if (pWebCanvas == null)
2933 if (__pWindowInfo != null)
2935 if (__pWindowInfo->pWebCanvasBitmap != null)
2937 delete __pWindowInfo->pWebCanvasBitmap;
2939 __pWindowInfo->pWebCanvasBitmap = new(std::nothrow) Bitmap();
2940 result r = __pWindowInfo->pWebCanvasBitmap->Construct(*pWebCanvas,Rectangle(0,0,pWebCanvas->GetBounds().width,pWebCanvas->GetBounds().height));
2941 AppLog("Bitmap Construction result %s",GetErrorMessage(r));
2943 Bitmap* pBitmap = GetCapturedBitmapN();
2944 AppLog("Coming here");
2945 Canvas* pCanvas = new(std::nothrow) Canvas();
2946 pCanvas->Construct(GetClientAreaBounds());
2949 pCanvas->DrawBitmap(Point(0,0),*pBitmap);
2952 if(__pWebViewer != null && __pWindowInfo != null)
2953 pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
2955 WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
2956 WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
2960 __pAddressbar->SetShowState(false);
2961 AppLog("Coming here");
2965 MainForm::OnHttpAuthenticationRequestedN(const Tizen::Base::String& host,
2966 const Tizen::Base::String& realm,
2967 const Tizen::Web::Controls::AuthenticationChallenge& authentication)
2973 MainForm::OnHttpAuthenticationCanceled(void)
2978 MainForm::OnLoadingStarted(void)
2980 AppLogDebug("MainForm::OnLoadingStarted entered");
2982 if(__pAddressbar == NULL || __pWebViewer == null)
2987 // this is added in case if menu is opened and user load the page
2988 if(__pOptionMenu != null && __pOptionMenu->GetShowState() == true)
2990 __pOptionMenu->SetShowState(false);
2991 __pOptionMenu->Invalidate(true);
2996 if(__pImageMenu != null && __pImageMenu->GetShowState() == true)
2998 __pImageMenu->SetShowState(false);
2999 __pImageMenu->Invalidate(true);
3001 String url = __pWebViewer->GetUrl();
3002 if(url.Contains(IDS_TIZEN_SERVICE))
3005 String delim(L":;,");
3007 // Creates a StringTokenizer instance
3008 StringTokenizer strTok(url, delim);
3010 int count = strTok.GetTokenCount(); // count == 4
3012 HashMap *pMap = new HashMap();
3017 while (strTok.HasMoreTokens())
3019 AppLog("Token: %ls", token.GetPointer());
3020 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3021 if(token.Contains(IDS_APPID))
3023 token.SubString(6, appId);
3024 AppLog("AppID:%ls", appId.GetPointer());
3026 else if(token.Contains(IDS_KEY))
3028 token.SubString(4, key);
3029 AppLog("key:%ls", key.GetPointer());
3031 else if(token.Contains(IDS_VALUE))
3033 token.SubString(6, value);
3034 AppLog("value:%ls", value.GetPointer());
3037 pMap->Add(key, value);
3041 AppControl *pAppControl = null;
3042 String operationId = L"http://tizen.org/appcontrol/operation/main";
3043 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3046 AppLog("Starting AppControl");
3047 result r = pAppControl->Start(null, null, pMap, null);
3048 AppLog("Result of Start %s", GetErrorMessage(r));
3052 AppLogException("AppControl not found");
3057 if ( __pAddressbar != null && __pAddressbar->GetShowState() == true)
3059 __pAddressbar->SetShowState(false);
3060 AddressBarCancelledClicked(*__pAddressbar);
3061 __pAddressbar->Invalidate(true);
3063 Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
3066 __pAddressbar->SetFaviconBitmap(*pBitmap);
3069 if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
3071 // updating the address bar position with respect to web control
3072 __adressPanelPosition.y = 0 - __pAddressbar->GetHeight() + 12; //-12 is for the progress label
3073 __distanceMoved = 0;
3077 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3078 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3079 if (__pWebViewer != null)
3081 AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
3082 //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
3083 SetUrl(__pWebViewer->GetUrl());
3084 if (__pWindowInfo != NULL)
3086 // resetting the page title to blank, it will be received in OnPageTitleReceived()
3087 __pWindowInfo->pageTitle = L"";
3088 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3090 __pAddressbar->Invalidate(true);
3096 MainForm::OnLoadingCanceled(void)
3103 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
3105 AppLog("XYZ::MainForm::OnKeypadWillOpen");
3110 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
3112 AppLog("XYZ::MainForm::OnKeypadOpened");
3113 __isKeypadOpened = true;
3114 __pFooterPanel->SetShowState(false);
3119 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
3121 AppLog("XYZ::MainForm::OnKeypadClosed");
3122 __isKeypadOpened = false;
3123 __pFooterPanel->SetShowState(true);
3124 RelayoutControls(true);
3128 MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
3130 AppLog("XYZ::KeypadBoundsChanged");
3131 RelayoutControls(false);
3135 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
3136 const Tizen::Base::String& reason)
3138 AppLogDebug("Error: %d, %ls", error, reason.GetPointer());
3142 MainForm::OnLoadingCompleted(void)
3144 AppLog("MainForm::OnLoadingCompleted start");
3146 result r = E_SUCCESS;
3148 if (__pWebViewer == null)
3153 if (__pAddressbar == null)
3158 if(__pImageMenu && __pImageMenu->GetShowState())
3160 __pImageMenu->SetShowState(false);
3161 __pImageMenu->Invalidate(true);
3164 if (__pWebViewer->CanGoForward())
3166 //__pAddressbar->SetForwardButtonEnabled(true);
3167 SetForwardButtonEnabled(true);
3171 //__pAddressbar->SetForwardButtonEnabled(false);
3172 SetForwardButtonEnabled(false);
3175 /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3177 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3179 //__pAddressbar->UpdateProgress(0);
3183 if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3185 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3189 AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
3190 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
3191 if (isPrivateBrowsing == false)
3193 if(__pHistory != null)
3199 __pHistory = new(std::nothrow) History;
3200 HistoryPresentationModel::GetCurrentDateTime(date);
3203 __pHistory->SetHistoryTitle(__pWindowInfo->pageTitle);
3204 AppLogDebug("MainForm::OnLoadingCompleted pagetitle = %ls", __pWindowInfo->pageTitle.GetPointer());
3206 __pHistory->SetHistoryUrl(__pWindowInfo->pageUrl);
3207 AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
3209 __pHistory->SetVisitedTime(date);
3211 if (__pWebViewer != null)
3213 AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
3215 Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
3216 if (pTempBitmap != null)
3218 AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
3219 __pHistory->SetFavIconBitmap(*pTempBitmap);
3222 AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
3225 Canvas* pCanvas = __pWebViewer->GetCanvasN();
3226 Bitmap* pBitmap = new(std::nothrow) Bitmap();
3227 if ( pCanvas != null && pCanvas != null && pBitmap != null)
3229 pBitmap->Construct(*pCanvas, pCanvas->GetBounds());
3230 pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
3231 __pHistory->SetThumbnail(pBitmap);
3233 Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
3236 __pHistory->SetFavIconBitmap(*pFavIcon);
3240 HistoryPresentationModel::GetInstance()->SaveTempHistory(*__pHistory);
3247 // if (__pWindowInfo && __pWindowInfo->faviconUrl == "")
3249 // temperary fixed (webpage can be not loaded)
3253 bool isReaderEnabled = SettingPresentationModel::GetInstance()->IsRunReaderEnabled();
3254 if (isReaderEnabled == true)
3258 delete __pReaderData;
3259 __pReaderData = null;
3261 String filePath = Tizen::App::UiApp::GetInstance()->GetAppRootPath();
3262 filePath.Append(L"data/reader.js");
3268 result r = E_SUCCESS;
3269 FileAttributes attr;
3271 File::GetAttributes(filePath,attr);
3273 r = file.Construct(filePath, L"r+");
3276 AppLogDebug("File construct failed with %s", GetErrorMessage(r));
3279 char* pScript = new(std::nothrow) char[attr.GetFileSize()+1];
3282 AppLogDebug("Memory allocation for file failed %s", GetErrorMessage(r));
3285 // file.Read(pScript,attr.GetFileSize());
3287 // AppLogDebug("scipt length %d",strlen(pScript));
3288 String strScript = L"";
3289 // strScript.Append(pScript);
3290 // for(int i=0; i<25; i++)
3292 file.Read(pScript,attr.GetFileSize());
3293 // AppLog("xyzz tell %d",file.Tell());
3294 // r = strScript.Append(pScript);
3295 // AppLog("xyzz append result %s",GetErrorMessage(r));
3296 // AppLog("xyzz strScript length %d",strScript.GetLength());
3298 // AppLog("xyzz final strScript length %d",strScript.GetLength());
3300 __pReaderData = __pWebViewer->EvaluateJavascriptN(pScript);
3301 if (__pReaderData == null)
3303 AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult()));
3304 __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>");
3307 AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
3308 if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
3310 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3311 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3317 AppLog("MainForm::OnLoadingCompleted done");
3321 MainForm::OnEstimatedProgress(int progress)
3323 AppLogDebug("MainForm::OnEstimatedProgress entered %d",progress);
3325 if (progress < DEFAULT_PROGRESS_PERCENTAGE)
3326 progress = DEFAULT_PROGRESS_PERCENTAGE;
3328 // __pAddressbar->UpdateProgress(progress);
3329 UpdateProgress(progress);
3332 void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
3334 AppLog("MainForm::OnFaviconReceived");
3335 if (__pWebViewer != null && __pHistory != null && __pWindowInfo != null && (__pWindowInfo->pageUrl.CompareTo(__pHistory->GetHistoryUrl()) == 0))
3337 Bitmap* favIcon = __pWebViewer->GetFaviconN();
3340 HistoryPresentationModel::GetInstance()->UpdateHistoryFavIcon(*__pHistory, *favIcon);
3347 MainForm::OnUrlValueChanged(Addressbar&)
3353 MainForm::OnUrlSubmitted(Addressbar& addBar)
3355 AppLog("MainForm::OnUrlSubmitted");
3356 String url = addBar.GetUrl();
3357 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
3359 if(__pFooterUrlField)
3360 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
3361 AddressBarCancelledClicked(*__pAddressbar);
3366 MainForm::LoadUrl(String& url)
3370 // UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3371 AppLogDebug("MainForm::LoadUrl enter");
3373 if (__pWebViewer != null)
3375 __pWebViewer->SetShowState(true);
3376 __pWebViewer->Invalidate(true);
3379 if (url.CompareTo(L"") == 0)
3383 if(__pFooterPanel != null)
3385 __pFooterPanel->SetShowState(true);
3386 __pFooterPanel->Invalidate(true);
3393 String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");
3394 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)
3396 RegularExpression firstRegex;
3397 RegularExpression secondRegex;
3399 firstRegex.Construct(firstPattern, REGEX_CASELESS);
3400 secondRegex.Construct(secondPattern, REGEX_CASELESS);
3403 ret = firstRegex.Match(url, false); // This returns true value
3404 flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it)
3406 if (ret == true && __pWebViewer != null)
3409 __pWebViewer->LoadUrl(url);
3411 else if(__pWebViewer != null)
3413 String tempUrl = L"http://";
3414 tempUrl.Append(url);
3418 __pWebViewer->LoadUrl(tempUrl);
3422 UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3423 __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
3426 if (__pAddressbar != null)
3428 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3429 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3432 AppLogDebug("MainForm::LoadUrl exit");
3439 MainForm::OnFocusGained(const Tizen::Ui::Control& source)
3441 AppLog("MainForm::OnFocusGained");
3444 __pFooterPanel->SetShowState(false);
3449 __pAddressbar->SetShowState(true);
3450 __pAddressbar->SetAddressbarURLFocus();
3452 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3454 __currentSearchStr = L"";
3455 __currentWordIndex = 0;
3456 __maxOccurrances = 0;
3458 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
3460 __pFindWordEditField->SetText(L"");
3461 __pFindWordEditField->HideKeypad();
3462 __pFindWordControl->SetShowState(false);
3463 __pFindWordCountLabel->SetText(L"0/0");
3465 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
3467 __pFindWordEditFieldRightToLeft->SetText(L"");
3468 __pFindWordEditFieldRightToLeft->HideKeypad();
3469 __pFindWordControl->SetShowState(false);
3470 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
3473 __pFindWordNext->SetEnabled(false);
3474 __pFindWordPrev->SetEnabled(false);
3476 __pWebViewer->SearchTextAllAsync(L"",true);
3477 __pFindWordControl->SetShowState(false);
3479 RelayoutControls(false);
3483 MainForm::OnFocusLost(const Tizen::Ui::Control& source)
3485 AppLog("MainForm::OnFocusLost called");
3489 MainForm::OnStopClicked(Addressbar& addBar)
3491 AppLogDebug("MainForm::OnStopClicked called");
3494 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3495 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3496 __pWebViewer->StopLoading();
3497 RequestRedraw(true);
3502 MainForm::OnBackClicked(/*const Addressbar& addBar*/)
3504 // AppLog("MainForm::OnBackClicked");
3505 result r = E_FAILURE;
3506 if(__pImageMenu && __pImageMenu->GetShowState() == true)
3508 AppLog("Hiding the menu");
3509 __pImageMenu->SetShowState(false);
3512 if (__pWebViewer && __pWebViewer->CanGoBack())
3514 __pWebViewer->GoBack();
3516 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
3519 pApp = UiApp::GetInstance();
3522 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3525 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3533 WindowInfo* pWindowInfo = null;
3535 SceneManager* pSceneManager = SceneManager::GetInstance();
3536 if (pSceneManager == null)
3540 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
3541 if (pAllWindowList == NULL)
3543 pApp = UiApp::GetInstance();
3546 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3549 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3554 if (pAllWindowList != null)
3556 totalCount = pAllWindowList->GetCount();
3558 for (int count = 0; count < totalCount; count++)
3560 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
3561 if (pWindowInfo == null)
3563 pApp = UiApp::GetInstance();
3566 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3569 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3574 if (pSceneManager != null && pWindowInfo != null && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
3576 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
3579 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3582 r = pAllWindowList->RemoveAt(count, true);
3583 __pWindowInfo = null;
3586 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3591 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
3593 else if(pAllWindowList->GetCount() > 0)
3595 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
3599 pApp = UiApp::GetInstance();
3602 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3607 if (pWindowInfo == null)
3609 pApp = UiApp::GetInstance();
3612 r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
3618 r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
3619 // r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
3622 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3636 MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
3638 AppLog("MainForm::OnForwardClicked");
3639 if (__pWebViewer == null)
3642 if (__pWebViewer->CanGoForward())
3644 __pWebViewer->GoForward();
3649 MainForm::OnAddressBarFocusGained(const Addressbar& addBar)
3651 AppLog("XYZ::MainForm::OnAddressBarFocusGained");
3652 if(__pFooterPanel != null)
3654 __pFooterPanel->SetShowState(false);
3657 if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
3659 __pAddressbar->SetShowState(true);
3660 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3663 RelayoutControls(false);
3667 MainForm::OnAddressBarFocusLost(const Addressbar& addBar, bool addressbarKeyPadState)
3669 AppLog("XYZ::MainForm::OnAddressBarFocusLost");
3671 int Height = GetClientAreaBounds().height;
3672 AppLog("MainForm::OnAddressBarFocusLost height is %d",Height);
3674 RelayoutControls(false);
3678 MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
3680 AddressBarCancelledClicked(addBar);
3684 MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
3686 __prevAddressBarMode = __curAddressBarMode;
3688 if (__pAddressbar != null)
3690 __curAddressBarMode = GetAddressbarMode();
3693 if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
3695 __adressPanelPosition.y = 0;
3696 if (__pAddressbar != null)
3698 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
3699 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3700 __pAddressbar->Invalidate(true);
3702 if (__pWebViewer != null)
3704 __pWebViewer->StopLoading();
3707 else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
3709 __adressPanelPosition.y = 0;
3710 if (__pAddressbar != null)
3712 __webControlPosition.y = 0;
3713 __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
3714 __pAddressbar->Invalidate(true);
3720 MainForm::OnClipboardClosed(const Addressbar& addBar)
3722 AppLog("XYZ::MainForm::OnClipboardClosed");
3723 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3725 AppLog("akjshdasd 3");
3726 __pFooterPanel->SetShowState(true);
3728 __isKeypadOpened = false;
3729 RelayoutControls(false);
3733 MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
3735 AppLog("XYZ::MainForm::OnAddressBarKeypadClosed");
3736 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3738 AppLog("akjshdasd 3");
3739 __pFooterPanel->SetShowState(true);
3741 __isKeypadOpened = false;
3742 if(__pNotification && __pNotification->GetShowState())
3744 __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
3747 RelayoutControls(false,footerState);
3751 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
3753 AppLog("XYZ::MainForm::OnAddressBarKeypadOpened");
3754 __isKeypadOpened = true;
3755 if(__pNotification && __pNotification->GetShowState())
3757 __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
3759 RelayoutControls(false);
3763 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
3765 __isKeypadOpened = true;
3766 __pFooterPanel->SetShowState(false);
3770 MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
3772 AppLog("XYZ::MainForm::OnAddressBarKeypadBoundsChanged");
3773 RelayoutControls(false);
3777 MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
3779 AppLog("MainForm::OnPageTitleReceived %ls",title.GetPointer());
3782 __pWindowInfo->pageTitle = title;
3783 if (__pWebViewer != null)
3785 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3786 AppLog("MainForm::OnPageTitleReceived url %ls",__pWindowInfo->pageUrl.GetPointer());
3789 if (__pAddressbar != null && __pWebViewer != null)
3791 SetUrl(__pWebViewer->GetUrl());
3792 __pAddressbar->Invalidate(true);
3797 MainForm::UpdateFavicon(void)
3799 bool urlImageType = false;
3800 String *tempPath = null;
3802 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();");
3803 Bitmap* pBitmap = null;
3805 if (tempPath && tempPath->GetLength() > 0 && tempPath->CompareTo(L"undefined") != 0)
3807 if (__pWindowInfo != null)
3810 url.SetUri(*tempPath);
3811 if (url.GetHost().GetLength() == 0)
3815 webUrl.SetUri(__pWebViewer->GetUrl());
3816 result r = url.SetHost(webUrl.GetHost());
3823 if (url.GetScheme().GetLength() == 0)
3827 webUrl.SetUri(__pWebViewer->GetUrl());
3828 url.SetScheme(webUrl.GetScheme());
3830 __pWindowInfo->faviconUrl = url.ToString();
3832 pBitmap = __pWebViewer->GetFaviconN();
3834 if (pBitmap != null)
3836 if (__pWindowInfo->pFavicon != NULL)
3838 __pWindowInfo->pFavicon = null;
3840 __pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
3841 __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
3843 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3845 FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
3847 else if(__pWindowInfo->pFavicon != null)
3849 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3853 Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
3854 if(pDefaultBmp != null)
3856 __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
3870 if(tempPath != null)
3874 AppLogDebug("Error occured: %s", GetErrorMessage(GetLastResult()));
3880 MainForm::OnLoadingRequested(const Tizen::Base::String& url,
3881 Tizen::Web::Controls::WebNavigationType type)
3883 AppLog("urlk %ls",url.GetPointer());
3884 // when load new page if find word panel is open its show state is false
3885 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3887 __currentSearchStr = L"";
3888 __currentWordIndex = 0;
3889 __maxOccurrances = 0;
3890 __pFindWordEditField->SetText(L"");
3891 __pFindWordNext->SetEnabled(false);
3892 __pFindWordPrev->SetEnabled(false);
3893 __pFindWordCountLabel->SetText(L"0/0");
3894 __pFindWordControl->SetShowState(false);
3895 __pFindWordEditField->HideKeypad();
3896 RelayoutControls(false);
3899 __pFooterPanel->Invalidate(true);
3902 uriInfo.SetUri(url);
3904 if(url.Contains(IDS_TIZEN_SERVICE))
3907 String delim(L":;,");
3909 // Creates a StringTokenizer instance
3910 StringTokenizer strTok(url, delim);
3912 int count = strTok.GetTokenCount(); // count == 4
3914 HashMap *pMap = new HashMap();
3920 while (strTok.HasMoreTokens())
3922 AppLog("Token: %ls", token.GetPointer());
3923 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3924 if(token.Contains(IDS_APPID))
3926 token.SubString(6, appId);
3927 AppLog("AppID:%ls", appId.GetPointer());
3929 else if(token.Contains(IDS_KEY))
3931 token.SubString(4, key);
3932 AppLog("key:%ls", key.GetPointer());
3934 else if(token.Contains(IDS_VALUE))
3936 token.SubString(6, value);
3937 AppLog("value:%ls", value.GetPointer());
3940 pMap->Add(key, value);
3944 AppControl *pAppControl = null;
3945 String operationId = L"http://tizen.org/appcontrol/operation/main";
3946 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3949 result r = pAppControl->Start(null, null, pMap, null);
3953 AppLogException("AppControl not found");
3963 MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
3964 const Tizen::Net::Http::HttpHeader& httpHeader)
3966 return Tizen::Web::Controls::WEB_DECISION_CONTINUE;
3970 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
3972 AppLog("MainForm::OnWebPageBlockSelected");
3973 // if(__isLongPressedDone == false)
3976 if (__pHitElementResult != null)
3978 delete __pHitElementResult;
3979 __pHitElementResult = null;
3982 if (__pWebViewer != null)
3984 AppLog("MainForm::OnWebPageBlockSelected web not null");
3985 __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
3987 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
3989 AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
3990 __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
3991 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
3993 __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
3995 AppLog("datafirst endpoint error %s",GetErrorMessage(GetLastResult()));
3999 if (__pHitElementResult == null)
4004 if (__pHitElementResult->HasImage() != true)
4006 String tagName = __pHitElementResult->GetTagName();
4007 String type = __pHitElementResult->GetAttributeValue("type");
4010 AppLog("TagName %ls",tagName.GetPointer());
4011 __currentSelectedStr.Clear();
4012 AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
4013 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4014 AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
4015 if(tagName.Equals(L"TEXTAREA",false) == true)
4017 AppLog("Tagnameseemstobe TEXTAREA");
4019 else if(tagName.Equals(L"INPUT",false) == true)
4021 AppLog("Tagnameseemstobe INPUT");
4024 if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
4026 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4028 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
4031 __pImageMenu->SetShowState(true);
4032 __pImageMenu->Show();
4033 __pImageMenu->Invalidate(true);
4036 else /*if(__isLongPressedDone == true)*/
4038 AppLog("MainForm::OnWebPageBlockSelected no paste option");
4040 if(__pHitElementResult->GetUrl().GetLength() > 0)
4042 __currentSelectedStr.Clear();
4043 __currentSelectedStr = __pHitElementResult->GetUrl();
4045 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
4048 __pImageMenu->SetShowState(true);
4049 __pImageMenu->Show();
4050 __pImageMenu->Invalidate(true);
4054 AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
4055 AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
4056 AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
4062 MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source)
4068 MainForm::OnWebWindowCreateRequested(void)
4070 AppLog("MainForm::OnWebWindowCreateRequested entered");
4071 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
4073 if (pNewWindowInfo == null)
4077 result r = E_SUCCESS;
4078 SceneManager* pSceneManager = SceneManager::GetInstance();
4079 if (pSceneManager == NULL)
4083 ArrayList* pArgList = new(std::nothrow) ArrayList();
4084 if (pArgList == NULL)
4088 r = pArgList->Construct();
4091 pNewWindowInfo->isJavascriptInitiated = true;
4092 pArgList->Add(*pNewWindowInfo);
4093 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
4097 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
4104 return pNewWindowInfo->pCurrentWeb;
4108 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
4110 AppLog("xyz:: MainForm::RelayoutControls called");
4111 __webControlPosition.y = 0;
4112 __webControlHeight = GetClientAreaBounds().height;
4113 AppLog("Client area height: %d", __webControlHeight);
4115 AppLog("Client area height: %d", __webControlHeight);
4116 if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
4118 __webControlPosition.y += __pAddressbar->GetHeight();
4119 __webControlHeight -= __pAddressbar->GetHeight();
4120 __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
4122 else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
4124 __webControlPosition.y += __pFindWordControl->GetHeight();
4125 __webControlHeight -= __pFindWordControl->GetHeight();
4126 __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
4129 if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true && relayoutFooter == true)
4131 __webControlHeight -= __pFooterPanel->GetHeight();
4133 __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
4134 __webControlHeight = __webControlHeight + 12;
4136 if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
4138 if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight )
4143 __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight );
4144 AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
4145 __pWebViewer->Invalidate(false);
4148 if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
4150 __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
4157 MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
4159 if (__pFindWordControl == null)
4164 Tizen::Locales::LocaleManager localeManager;
4165 Tizen::Locales::Locale local = localeManager.GetSystemLocale();
4167 String languageCode;
4168 result r = SettingInfo::GetValue(L"Language", languageCode);
4169 // int languagecode = local.GetLanguageCode();
4170 AppLog("rahul language is %S", languageCode.GetPointer());
4174 InitFindWordPanel();
4176 if (languageCode.CompareTo("ara") == 0)
4178 AppLog("rahul language is arabic");
4180 __pFindWordPanelLeftToRight->SetShowState(false);
4181 __pFindWordPanelRightToLeft->SetShowState(true);
4183 __pFindWordClear->SetShowState(false);
4184 __pFindWordCountLabel->SetShowState(false);
4185 __pFindWordEditField->SetShowState(false);
4187 __pFindWordClearRightToLeft->SetShowState(true);
4188 __pFindWordCountLabelRightToLeft->SetShowState(true);
4189 __pFindWordEditFieldRightToLeft->SetShowState(true);
4193 AppLog("rahul language is not arabic");
4196 __pFindWordPanelLeftToRight->SetShowState(true);
4197 __pFindWordPanelRightToLeft->SetShowState(false);
4199 __pFindWordClear->SetShowState(true);
4200 __pFindWordCountLabel->SetShowState(true);
4201 __pFindWordEditField->SetShowState(true);
4203 __pFindWordClearRightToLeft->SetShowState(false);
4204 __pFindWordCountLabelRightToLeft->SetShowState(false);
4205 __pFindWordEditFieldRightToLeft->SetShowState(false);
4207 __pFindWordControl->SetShowState(true);
4211 if(__pFindWordControl != null)
4213 __pFindWordControl->SetShowState(false);
4217 AppLog("MainForm::ShowFindWordPanel %d",show);
4218 if (show && !isTouchPressed)
4220 if (languageCode.CompareTo("ara") == 0)
4222 if (__pFindWordEditFieldRightToLeft)
4224 __pFindWordEditFieldRightToLeft->SetFocus();
4225 __pFindWordEditFieldRightToLeft->ShowKeypad();
4230 if (__pFindWordEditField)
4232 __pFindWordEditField->SetFocus();
4233 __pFindWordEditField->ShowKeypad();
4239 if (languageCode.CompareTo("ara") == 0)
4241 if (__pFindWordEditFieldRightToLeft)
4242 __pFindWordEditFieldRightToLeft->HideKeypad();
4246 if (__pFindWordEditField)
4247 __pFindWordEditField->HideKeypad();
4251 RelayoutControls(false);
4255 MainForm::StartWordSearch()
4257 //Get the count of occurances of the word in the current page
4258 __maxOccurrances = 0;
4259 __currentWordIndex = 0;
4261 __pFindWordPrev->SetEnabled(false);
4262 String *pCountStr = null;
4265 result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
4266 AppLog("Search Result %s",GetErrorMessage(r));
4269 /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;");
4270 if (pCountStr != null)
4272 Integer::Parse(*pCountStr, 10, __maxOccurrances);
4276 AppLogDebug("'%ls' is found %d times", __currentSearchStr.GetPointer(), __maxOccurrances);
4281 void MainForm::OnTextFound(int totalCount, int currentOrdinal)
4283 AppLog("MainForm::OnTextFound totalCount %d",totalCount);
4284 AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
4286 if(totalCount == -1 || totalCount == 0)
4288 if (__pFindWordCountLabel)
4290 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
4292 if (__pFindWordEditField)
4294 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
4297 else if(totalCount > 100)
4299 if (__pFindWordCountLabel)
4301 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4303 if (__pFindWordEditField)
4305 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4310 if (__pFindWordCountLabel)
4312 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4314 if (__pFindWordEditField)
4316 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4320 __maxOccurrances = totalCount;
4321 __currentWordIndex = currentOrdinal;
4323 //Reset the UI controls as per the maxOccurrance value
4324 if (totalCount <= 0)
4326 AppLog("Word not found");
4327 //Show error notification to user
4328 __pFindWordNext->SetEnabled(false);
4329 if(__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4331 __pFindWordCountLabel->SetText(L"0/0");
4332 __pFindWordCountLabel->Invalidate(false);
4334 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4336 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4337 __pFindWordCountLabelRightToLeft->Invalidate(false);
4339 __pFindWordNext->Invalidate(false);
4340 __pFindWordPrev->Invalidate(false);
4345 if (totalCount == 1 || totalCount == currentOrdinal)
4347 __pFindWordNext->SetEnabled(false);
4351 __pFindWordNext->SetEnabled(true);
4354 String countStr = L"";
4355 countStr.Append(__currentWordIndex);
4356 countStr.Append(L"/");
4357 countStr.Append(__maxOccurrances);
4358 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4360 __pFindWordCountLabel->SetText(countStr);
4361 __pFindWordCountLabel->Invalidate(false);
4362 __pFindWordCountLabel->Invalidate(false);
4364 else if (__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4366 __pFindWordCountLabelRightToLeft->SetText(countStr);
4367 __pFindWordCountLabelRightToLeft->Invalidate(false);
4368 __pFindWordCountLabelRightToLeft->Invalidate(false);
4370 if (__pFindWordNext)
4372 __pFindWordNext->Invalidate(false);
4374 if (__pFindWordPrev)
4376 __pFindWordPrev->Invalidate(false);
4382 MainForm::FindNextWord(bool next)
4386 //if (__pWebViewer->SearchText(__currentSearchStr, true) == true)
4387 if (__pWebViewer->SearchNextAsync(true) == E_SUCCESS)
4389 if (__currentWordIndex < __maxOccurrances)
4391 __currentWordIndex++;
4397 //if (__pWebViewer->SearchText(__currentSearchStr, false) == true)
4398 if (__pWebViewer->SearchNextAsync(false) == E_SUCCESS)
4400 if(__currentWordIndex > 1)
4402 __currentWordIndex--;
4407 String countStr = L"";
4408 countStr.Append(__currentWordIndex);
4409 countStr.Append(L"/");
4410 countStr.Append(__maxOccurrances);
4412 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4414 __pFindWordCountLabel->SetText(countStr);
4415 __pFindWordCountLabel->Invalidate(false);
4417 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4419 __pFindWordCountLabelRightToLeft->SetText(countStr);
4420 __pFindWordCountLabelRightToLeft->Invalidate(false);
4423 if (__currentWordIndex >= __maxOccurrances)
4425 __pFindWordNext->SetEnabled(false);
4429 __pFindWordNext->SetEnabled(true);
4431 if (__currentWordIndex <= 1)
4433 __pFindWordPrev->SetEnabled(false);
4437 __pFindWordPrev->SetEnabled(true);
4439 __pFindWordPrev->Invalidate(false);
4440 __pFindWordNext->Invalidate(false);
4442 __pFindWordControl->Invalidate(true);
4446 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
4448 AppLog("xyz::MainForm::OnWebKeypadWillOpen");
4449 __isKeypadOpened = true;
4450 __pFooterPanel->SetShowState(false);
4451 // OnAddressBarKeypadOpened(*__pAddressbar);
4455 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
4457 __isKeypadOpened = true;
4458 AppLog("xyz::MainForm::OnWebKeypadOpened");
4460 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4462 __currentSearchStr = L"";
4463 __currentWordIndex = 0;
4464 __maxOccurrances = 0;
4465 __pFindWordEditField->SetText(L"");
4466 __pFindWordNext->SetEnabled(false);
4467 __pFindWordPrev->SetEnabled(false);
4468 __pFindWordCountLabel->SetText(L"0/0");
4469 __pWebViewer->SearchTextAllAsync(L"",false);
4470 __pFindWordControl->SetShowState(false);
4471 __pFindWordEditField->HideKeypad();
4475 if (__pWebViewer != null && __pFooterPanel != null)
4477 AppLog("MainForm::OnWebKeypadOpened GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
4478 if(__pAddressbar != null)
4480 __pAddressbar->SetShowState(false);
4482 if(__pFindWordControl != null)
4484 __pFindWordControl->SetShowState(false);
4486 __pFooterPanel->SetShowState(false);
4487 __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
4489 // if(__pImageMenu && __pImageMenu->GetShowState() == true)
4491 // __pImageMenu->SetAnchorPosition(Point(__pImageMenu->GetAnchorPosition().x/2,__pImageMenu->GetAnchorPosition().y/2));
4492 // AppLog("omgomgomg");
4498 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
4500 AppLog("abcde::MainForm::OnWebKeypadClosed");
4501 AppLog("xyz::MainForm::OnWebKeypadClosed");
4502 AppLog("akjshdasd 4");
4503 __pFooterPanel->SetShowState(true);
4504 // OnAddressBarKeypadClosed(*__pAddressbar);
4505 RelayoutControls(false);
4506 __isKeypadOpened = false;
4509 if(__pImageMenu && __pImageMenu->GetShowState() == true)
4511 AppLog("abcde: imagemenu visible.");
4514 __pWebViewer->GetBlockRange(p,q);
4515 if (p == Point(0,0) && q == Point(0,0))
4518 __pImageMenu->SetAnchorPosition(p);
4519 __pImageMenu->Show();
4525 MainForm::OnWebKeypadBoundsChanged(Tizen::Web::Controls::Web& source)
4527 // RelativeLayout(false);
4528 if(__pWebViewer != null)
4530 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,GetClientAreaBounds().height));
4535 MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
4537 Control* temp = const_cast< Control* >(&source);
4538 Header* pHeader = dynamic_cast< Header* >(temp);
4539 if (pHeader != null)
4541 //Header double - clicked
4542 AppLog("Header double clicked");
4544 if(__pFindWordControl)
4546 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
4547 ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
4551 AppLog("MainScene::OnTouchDoublePressed");
4555 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4557 AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
4558 if(TouchEventManager::GetInstance() && TouchEventManager::GetInstance()->GetTouchInfoListN() && TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
4560 AppLog("Returning because of more than one touch point.");
4563 __longPressPoint = currentPosition;
4565 if (__pHitElementResult != null)
4567 delete __pHitElementResult;
4568 __pHitElementResult = null;
4571 if (__pWebViewer != null)
4573 AppLog("MainForm::OnTouchLongPressed web not null");
4574 __pHitElementResult = __pWebViewer->GetElementByPointN(currentPosition);
4577 if (__pHitElementResult == null)
4582 if (__pHitElementResult->HasImage() == true)
4584 if(__pWebViewer != null)
4585 InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4586 __pImageMenu->SetShowState(true);
4587 __pImageMenu->Show();
4588 __pImageMenu->Invalidate(true);
4590 else if(__pHitElementResult->HasUrl() == true)
4592 String tempURl = __pHitElementResult->GetUrl();
4593 AppLog("tempURl is %ls", tempURl.GetPointer());
4594 const Bitmap* pBitmap = __pHitElementResult->GetImage();
4595 if (pBitmap != null)
4603 InitImageLinkContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4604 __pImageMenu->SetShowState(true);
4605 __pImageMenu->Show();
4606 __pImageMenu->Invalidate(true);
4610 String tagName = __pHitElementResult->GetTagName();
4611 String type = __pHitElementResult->GetAttributeValue("type");
4612 String value = __pHitElementResult->GetAttributeValue(L"value");
4613 String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
4615 __currentSelectedStr.Clear();
4616 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4618 AppLog("tag name is %ls", tagName.GetPointer());
4619 AppLog("type is %ls", type.GetPointer());
4623 __isLongPressedDone = true;
4624 result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
4625 if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) && innerHtml.GetLength() == 0 && type.Equals(L"submit",false) !=true && type.Equals(L"range",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
4627 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4629 InitSelectTextContextMenu(Point(currentPosition.x , currentPosition.y + __pWebViewer->GetY()),true, true);
4632 __pImageMenu->SetShowState(true);
4633 __pImageMenu->Show();
4634 __pImageMenu->Invalidate(true);
4637 AppLog("setselectionselectedornot %s",GetErrorMessage(r));
4640 // __inputEventToBeSupressed = true;
4644 MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4646 AppLog("xyz:: MainForm::OnTouchReleased called");
4648 if (__pAddressbar && __pAddressbar->GetShowState() == true)
4650 __pAddressbar->SetShowState(false);
4652 if(__pFooterPanel && __isKeypadOpened == false)
4654 __pFooterPanel->SetShowState(true);
4658 /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
4659 if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true)
4661 __pWebViewer->ConsumeInputEvent();
4663 if(pHitElement != null)
4667 __inputEventToBeSupressed = false;*/
4671 MainForm::OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4678 MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4680 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4682 __currentSearchStr = L"";
4683 __currentWordIndex = 0;
4684 __maxOccurrances = 0;
4686 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
4688 __pFindWordEditField->SetText(L"");
4689 __pFindWordEditField->HideKeypad();
4690 __pFindWordControl->SetShowState(false);
4691 __pFindWordCountLabel->SetText(L"0/0");
4693 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
4695 __pFindWordEditFieldRightToLeft->SetText(L"");
4696 __pFindWordEditFieldRightToLeft->HideKeypad();
4697 __pFindWordControl->SetShowState(false);
4698 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4701 __pFindWordNext->SetEnabled(false);
4702 __pFindWordPrev->SetEnabled(false);
4704 __pWebViewer->SearchTextAllAsync(L"",true);
4705 __pFindWordControl->SetShowState(false);
4707 AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
4708 if(__pAddressbar->GetShowState() == false)
4710 __pAddressbar->SetAddressbarURLFocus();
4711 __pFooterPanel->SetShowState(false);
4718 MainForm::OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4724 MainForm::OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4730 MainForm::OnPreviewTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4736 MainForm::OnPreviewTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4742 MainForm::OnPreviewTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4748 MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
4750 AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
4751 int widthContextItem = 0;
4752 if(__pFindWordCountLabel)
4753 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4754 // As per the platform engineer comment removed this line
4755 /*if(__pWebViewer != null)
4757 // 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
4758 __pWebViewer->ReleaseBlock();
4761 // if(__pFindWordControl != null)
4762 // ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
4764 if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
4766 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4768 AppLog(" Orientation landscape");
4769 __pOptionMenu->SetMaxVisibleItemsCount(5);
4773 AppLog(" Orientation potrait");
4774 __pOptionMenu->SetMaxVisibleItemsCount(6);
4777 if(__pNotification && __pNotification->GetShowState() == true)
4779 __pNotification->SetShowState(false);
4780 __pNotification->Invalidate(false);
4782 if ( __pFooterLabel != null)
4784 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
4787 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
4793 if (__pFindWordBgLabel != null)
4795 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
4796 if (pBitmap != null)
4798 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
4803 if (__pFindWordBgLabelRightToLeft != null)
4805 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
4806 if (pBitmap != null)
4808 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
4814 // if(__pOptionMenu != null)
4815 // __pOptionMenu->SetShowState(false);
4817 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4819 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
4823 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
4828 AppLog("__pFooterPanel->GetShowState() is true");
4830 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
4831 __pFooterPanel->Invalidate(true);
4835 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
4836 if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
4838 InitMostVisitedSitesView(orientationStatus);
4841 RelayoutControls(false);
4842 if (__pArticleReaderPanel != null)
4844 if (__pArticleReaderPanel->GetShowState() == true)
4846 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
4848 if (__pBlankPanel != null)
4849 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
4851 if (__pWebReader != null)
4853 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight() - 96));
4855 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4856 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4858 if ( pBitmap != null && pSrcBitmap != null)
4860 AppLog("CreateReaderPanel ninepatchbitmap found");
4861 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
4864 __pArticleReaderLabel->SetBounds(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()));
4865 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
4866 if (pBitmap != null)
4871 if (pSrcBitmap != null)
4880 if (__pAddressbar != null)
4882 int width = GetClientAreaBounds().width;
4883 __pAddressbar->OrientationChanged(width);
4888 MainForm::OnSettingsChange(int settingvalue)
4890 AppLogDebug("MainForm::OnSettingsChange entered");
4892 if(settingvalue == (int)REGISTRY_SETTING_HOMEPAGE)
4894 __pAddressbar->ResetGuideText();
4896 if (__pWebViewer == null)
4898 AppLogDebug("Webviewer is not initialized yet.");
4902 if (settingvalue == (int) REGISTRY_SETTING_DEFAULT_VIEW)
4904 WebSetting settings = __pWebViewer->GetSetting();
4905 if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
4907 settings.SetAutoFittingEnabled(true);
4909 else if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_READABLE")) == 0)
4911 settings.SetAutoFittingEnabled(false);
4913 __pWebViewer->SetSetting(settings);
4915 else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
4917 WebSetting settings = __pWebViewer->GetSetting();
4918 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
4919 __pWebViewer->SetSetting(settings);
4921 else if (settingvalue == (int) REGISTRY_SETTING_DISPLAY_IMAGES)
4923 WebSetting settings = __pWebViewer->GetSetting();
4924 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
4925 __pWebViewer->SetSetting(settings);
4926 __pWebViewer->Reload();
4928 else if (settingvalue == (int) REGISTRY_SETTING_BLOCK_POPUP)
4930 WebSetting settings = __pWebViewer->GetSetting();
4931 settings.SetJavaScriptPopupEnabled(SettingPresentationModel::GetInstance()->IsBlockPopUp());
4932 __pWebViewer->SetSetting(settings);
4934 else if (settingvalue == (int) REGISTRY_SETTING_ACCEPT_COOKIES)
4938 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4941 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_FORM_DATA)
4945 WebSetting settings = __pWebViewer->GetSetting();
4946 settings.SetAutoFormDataShowEnabled(SettingPresentationModel::GetInstance()->IsRememberFormData());
4947 __pWebViewer->SetSetting(settings);
4950 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_PASSWORD)
4954 WebSetting settings = __pWebViewer->GetSetting();
4955 settings.SetAutoLoginFormFillEnabled(SettingPresentationModel::GetInstance()->IsRememberPassword());
4956 __pWebViewer->SetSetting(settings);
4959 else if (settingvalue == (int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS)
4961 WebSetting settings = __pWebViewer->GetSetting();
4962 if (SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled() == true)
4964 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
4968 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
4970 __pWebViewer->SetSetting(settings);
4972 else if (settingvalue == (int) REGISTRY_SETTING_READER_FONT_SIZE)
4976 AppLogDebug("IntMainForm fontsize Changed to %d",SettingPresentationModel::GetInstance()->GetReaderFontSize());
4977 WebSetting settings = __pWebReader->GetSetting();
4978 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
4979 __pWebReader->SetSetting(settings);
4985 MainForm::OnSettingsReset()
4989 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4990 __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
4995 MainForm::OnClearCache()
4997 result r = E_SUCCESS;
4999 if (__pWebViewer != NULL)
5001 r = __pWebViewer->ClearCache();
5004 AppLogDebug("Cache cleared success");
5008 AppLogDebug("Cache cleared fail");
5014 MainForm::OnClearCookie()
5016 result r = E_SUCCESS;
5018 if (__pWebViewer != NULL)
5020 __pWebViewer->ClearCookie();
5024 AppLogDebug("Cookie cleared success");
5028 AppLogDebug("Cache cleared fail");
5033 MainForm::OnClearFormData()
5035 result r = E_SUCCESS;
5037 if (__pWebViewer != NULL)
5039 __pWebViewer->ClearFormData();
5043 AppLogDebug("Cookie cleared success");
5047 AppLogDebug("Cache cleared fail");
5052 MainForm::OnClearPasswords()
5054 result r = E_SUCCESS;
5056 if (__pWebViewer != NULL)
5058 __pWebViewer->ClearLoginFormData();
5062 AppLogDebug("Cookie cleared success");
5066 AppLogDebug("Cache cleared fail");
5072 MainForm::findDistance(int x1,int y1,int x2, int y2)
5074 int deltaX = Math::Abs(x2 - x1);
5075 int deltaY = Math::Abs(y2 - y1);
5076 double num = deltaX*deltaX + deltaY*deltaY;
5082 for (i = 0; i < 20; i++)
5084 x = (((x*x)+ num)/(2*x));
5095 MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5097 AppLog("xyz:: MainForm::OnTouchPressed called");
5098 if(__pFindWordControl)
5100 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
5101 // ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
5103 __isLongPressedDone = false;
5108 IList* pList = null;
5109 pList = touch.GetTouchInfoListN(source);
5113 int count = pList->GetCount();
5116 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5117 __touchPoint1 = pTouchInfo->position;
5119 /*if (__pAddressbar != null)
5121 if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5123 if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5125 __pAddressbar->SaveAddressbarEditText();
5127 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5130 __pAddressbar->Invalidate(true);
5132 if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5134 if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5136 //__pAddressbar->SaveAddressbarEditText();
5138 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5141 else if (count == 2)
5143 AppLogDebug("MainForm::OnTouchPressed count is two");
5144 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5145 __touchPoint1 = pTouchInfo->position;
5147 pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
5148 __touchPoint2 = pTouchInfo->position;
5153 pList->RemoveAll(true);
5158 __pAddressbar->SetShowState(false);
5160 if(__pFooterPanel && __isKeypadOpened == false)
5162 __pFooterPanel->SetShowState(true);
5164 RelayoutControls(false);
5169 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5171 // __currentWordIndex = 0;
5172 __isLongPressedDone = false;
5177 MainForm::MoveUiControls()
5182 MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
5184 if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
5186 if(__pFooterUrlField->GetTextLength() == 0)
5188 __pFooterUrlField->SetKeypadActionEnabled(false);
5192 __pFooterUrlField->SetKeypadActionEnabled(true);
5195 if (__pFindWordEditField != null && __pFindWordEditField->GetShowState() == true)
5197 __currentSearchStr = __pFindWordEditField->GetText();
5198 if (__currentSearchStr.GetLength() > 0)
5200 __pFindWordCountLabel->SetShowState(true);
5204 // __pFindWordCountLabel->SetShowState(false);
5205 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
5206 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
5209 __pFindWordNext->SetEnabled(false);
5210 __pFindWordPrev->SetEnabled(false);
5211 __pFindWordNext->Invalidate(true);
5212 __pFindWordPrev->Invalidate(true);
5213 __pFindWordCountLabel->SetText(L"0/0");
5214 __pFindWordCountLabel->Invalidate(true);
5216 else if (__pFindWordEditFieldRightToLeft != null && __pFindWordEditFieldRightToLeft->GetShowState() == true)
5218 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
5219 if (__currentSearchStr.GetLength() > 0)
5221 __pFindWordCountLabelRightToLeft->SetShowState(true);
5225 __pFindWordCountLabelRightToLeft->SetShowState(false);
5228 __pFindWordNext->SetEnabled(false);
5229 __pFindWordPrev->SetEnabled(false);
5230 __pFindWordNext->Invalidate(true);
5231 __pFindWordPrev->Invalidate(true);
5232 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
5233 __pFindWordCountLabelRightToLeft->Invalidate(true);
5235 AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer());
5236 if (__currentSearchStr.GetLength() > 0)
5242 __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
5244 __currentSearchStr = L"";
5245 AppLogDebug("Enter something");
5250 MainForm::InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus)
5257 MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus)
5259 if(__pWebViewer != null)
5262 AppLog("MainForm::InitMostVisitedSitesView");
5263 result r = E_SUCCESS;
5266 if (__pWebViewer != null && __pMostVisitedListView != null)
5271 if (__pMostVisitedListView != null)
5273 RemoveControl(__pMostVisitedListView);
5275 if(__pMostVisitedSites != null)
5277 __pMostVisitedSites->RemoveAll(true);
5280 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
5282 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
5283 __pMostVisitedListView = new(std::nothrow) ListView();
5285 int height = GetClientAreaBounds().height;
5287 if(__pFooterPanel->GetShowState() == true)
5289 height = height - __pFooterPanel->GetHeight();
5291 if(__pAddressbar->GetShowState() == true)
5293 height -= __pAddressbar->GetHeight();
5296 r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
5300 delete __pMostVisitedListView;
5301 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
5304 __pMostVisitedListView->SetItemProvider(*this);
5305 __pMostVisitedListView->AddListViewItemEventListener(*this);
5306 __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_VISITED_SITES"));
5307 AddControl(__pMostVisitedListView);
5308 __pMostVisitedListView->UpdateList();
5315 MainForm::GetImagePath(void)
5319 String formattedTime;
5320 DateTime currentTime;
5321 LocaleManager localManager;
5322 SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
5324 localManager.Construct();
5325 Locale locale = localManager.GetSystemLocale();
5326 //Locale locale(LANGUAGE_ENG, COUNTRY_US);
5328 // Get date formatter
5329 DateTimeFormatter* pTimeFormatter = DateTimeFormatter::CreateDateTimeFormatterN(locale, DATE_TIME_STYLE_DEFAULT);
5333 pTimeFormatter->Format(currentTime, formattedTime);
5336 AppLog("current time stamp is %ls", formattedTime.GetPointer());
5337 String delim(L" :");
5338 StringTokenizer strTok(formattedTime, delim);
5341 String str1("GMT+00");
5342 while (strTok.HasMoreTokens())
5344 strTok.GetNextToken(token); // Osp, StringTokenizer, Sample, code
5345 if(token.Equals(str1))
5347 AppLog("token is %ls", token.GetPointer());
5348 imageName.Append(token);
5354 void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
5356 result r = E_FAILURE;
5357 AppLog("Content manager 1");
5358 ContentId contentId;
5359 ContentManager contentManager;
5360 r = contentManager.Construct();
5363 AppLog("Content manager update content result %s" ,GetErrorMessage(r));
5366 Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Downloads/";
5367 Tizen::Io::Directory::Create(contentPath,true);
5368 if(GetLastResult() == E_FILE_ALREADY_EXIST)
5370 AppLog("Already exists");
5372 else if(GetLastResult() == E_SUCCESS)
5374 AppLog("created success");
5376 contentPath.Append(imageName);
5377 contentPath.Append(".jpg");
5378 contentId = contentManager.CreateContent(*aBuffer, contentPath);
5379 ShowIndicatorNotification(L"Download Complete",contentPath);
5380 AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
5384 MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
5386 AppLogDebug("ENTER");
5388 NotificationRequest request;
5389 request.SetAlertText(messageText);
5390 request.SetTitleText(L"");
5391 request.SetAppMessage(contentPath);
5392 request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
5393 request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
5394 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
5395 String homePath = pApp->GetAppRootPath();
5396 String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
5397 AppLog("The iconPath is : %ls", homePath.GetPointer());
5398 request.SetIconFilePath(iconPath);
5400 Tizen::Shell::NotificationManager notiMgr;
5401 notiMgr.Construct();
5402 notiMgr.NotifyOngoingActivity(request);
5403 AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
5408 MainForm::SetForwardButtonEnabled(bool isEnabled)
5410 __pGoForwardBtn->SetEnabled(isEnabled);
5411 __pGoForwardBtn->Invalidate(true);
5415 MainForm::SetBackButtonEnabled(bool isEnabled)
5417 __pGoBackBtn->SetEnabled(isEnabled);
5418 __pGoBackBtn->Invalidate(true);
5422 MainForm::UpdateProgress(int percentage)
5424 __progressPercentage = percentage;
5425 if (percentage == 0 || percentage == 100)
5427 __isLoadingData = false;
5428 if (percentage == 100)
5430 __isLoadingCompleted = true;
5431 __progressPercentage = 0;
5435 __isLoadingCompleted = false;
5440 __isLoadingData = true;
5442 UpdateProgressBitmap();
5446 MainForm::GetProgress(void)
5448 return __progressPercentage;
5452 MainForm::UpdateProgressBitmap(void)
5454 result r = E_SUCCESS;
5455 if (__pProgressbarLabel == null)
5457 int w = __pProgressbarLabel->GetWidth();
5458 int h = __pProgressbarLabel->GetHeight();
5460 int progressWidth = 0;
5461 Bitmap* pRetBitmap = null;
5463 if (__progressPercentage == 0 || __progressPercentage == 100)
5465 __pProgressbarLabel->SetShowState(false);
5466 __pProgressbarLabel->Invalidate(false);
5471 __pProgressbarLabel->SetShowState(true);
5472 __pProgressbarLabel->Invalidate(false);
5475 r = canvas.Construct(Rectangle(0, 0, w, h));
5479 AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
5484 Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
5488 pBgBmp->Scale(Dimension(w, h));
5489 canvas.DrawBitmap(Point(0,0), *pBgBmp);
5493 progressWidth = (double) (w) * __progressPercentage / 100;
5494 AppLogDebug("progressWidth: %d", progressWidth);
5495 Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
5497 if (pProgressBmp != null)
5499 pProgressBmp->Scale(Dimension(progressWidth, h));
5500 canvas.DrawBitmap(Point(0,0), *pProgressBmp);
5501 delete pProgressBmp;
5504 pRetBitmap = new (std::nothrow) Bitmap();
5506 if (pRetBitmap == null)
5508 AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
5512 pRetBitmap->Construct(canvas, canvas.GetBounds());
5514 if (__pProgressbarLabel != null && pRetBitmap != null)
5516 __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
5517 __pProgressbarLabel->Invalidate(false);
5520 if (pRetBitmap != null)
5529 MainForm::ReaderClicked()
5531 result r = E_SUCCESS;
5532 ArrayList* pArgList = new(std::nothrow) ArrayList();
5533 if (pArgList != null)
5535 r = pArgList->Construct();
5542 r = pArgList->Add(*new(std::nothrow) String(*__pReaderData));
5549 r = pArgList->Add(*new(std::nothrow) String(__pWebViewer->GetUrl()));
5556 r = pArgList->Add(*new(std::nothrow) String(__pWindowInfo->pageTitle));
5564 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
5570 void MainForm::SetAddressbarMode(AddressBarMode addMode)
5572 AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
5574 __currentAddMode = addMode;
5578 case ADDRESSBAR_MODE_INVALID:
5583 case ADDRESSBAR_MODE_READER:
5585 __pStopBtn->SetShowState(false);
5586 __pRefreshBtn->SetShowState(false);
5587 __pClearBtn->SetShowState(false);
5588 __pReaderBtn->SetShowState(false);
5591 case ADDRESSBAR_MODE_LOADING:
5593 __pRefreshBtn->SetShowState(false);
5594 __pStopBtn->SetShowState(true);
5595 __pClearBtn->SetShowState(false);
5596 __pReaderBtn->SetShowState(false);
5599 case ADDRESSBAR_MODE_LOADING_COMPLETE:
5601 // SetUrl(__pAddressbar->GetUrl());
5603 __pRefreshBtn->SetShowState(true);
5604 __pStopBtn->SetShowState(false);
5605 __pClearBtn->SetShowState(false);
5606 __pReaderBtn->SetShowState(false);
5609 case ADDRESSBAR_MODE_EDIT:
5611 __pRefreshBtn->SetShowState(false);
5612 __pStopBtn->SetShowState(false);
5613 __pReaderBtn->SetShowState(false);
5614 __pClearBtn->SetShowState(true);
5621 OnAddressBarModeChanged();
5624 AddressBarMode MainForm::GetAddressbarMode(void)
5626 return __currentAddMode;
5629 void MainForm::SetUrl(const String& url)
5632 if(__displayUrl.GetLength() > 2048)
5633 __displayUrl.SubString(0,2048,__displayUrl);
5635 if (__pFooterUrlField != NULL)
5637 String removedHttpUrl = RemoveHttpTextFromDisplayURL();
5638 if (removedHttpUrl.IsEmpty() == false)
5640 __pFooterUrlField->SetText(removedHttpUrl);
5641 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5642 __pAddressbar->SetUrl(__displayUrl);
5646 __pFooterUrlField->SetText(__displayUrl);
5647 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5648 __pAddressbar->SetUrl(__displayUrl);
5650 if(__pFooterUrlField)
5651 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
5652 __pFooterUrlField->Invalidate(false);
5653 if(__pAddressbar != NULL && __pAddressbar->HasFocus())
5654 __pAddressbar->Invalidate(true);
5655 // __pFooterUrlField->SetCursorPosition(0);
5660 MainForm::RemoveHttpTextFromDisplayURL(void)
5662 AppLog("MainForm::RemoveHttpTextFromDisplayURL __displayUrl %ls",__displayUrl.GetPointer());
5664 // bool isHttpText = __displayUrl.Contains(L"http://");
5665 String updatedDisplayUrl;
5666 updatedDisplayUrl.Clear();
5667 if(__displayUrl.IndexOf(L"http://",0,index) == E_SUCCESS && index == 0)
5669 __displayUrl.SubString(7,updatedDisplayUrl);
5671 else if(__displayUrl.IndexOf(L"https://",0,index) == E_SUCCESS && index == 0)
5673 __displayUrl.SubString(8,updatedDisplayUrl);
5675 return updatedDisplayUrl;
5678 void MainForm::OnSharePopupControlStarted(void)
5680 __pWebViewer->AddTouchEventListener(*this);
5684 MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
5686 if (requestId == BACK_GROUND_APP_EVENT)
5688 if(__pWebViewer != null)
5690 __pWebViewer->Pause();
5694 __pImageMenu->SetShowState(false);
5696 if(__pAddressbar != null)
5698 __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
5701 else if(requestId == FORE_GROUND_APP_EVENT)
5703 if(__pWebViewer != null)
5705 __pWebViewer->Resume();
5707 if(__pAddressbar != null)
5709 __pAddressbar->SendUserEvent(FORE_GROUND_APP_EVENT,NULL);
5715 MainForm::AddressBarCancelledClicked(const Addressbar& addBar)
5717 AppLog("XYZ::MainForm::AddressBarCancelledClicked");
5718 result r = E_SUCCESS;
5721 __pAddressbar->SetShowState(false);
5723 AppLog("akjshdasd 5");
5724 __pFooterPanel->SetShowState(true);
5727 __pWebViewer->SetFocus();
5728 else if(__pMostVisitedListView)
5729 __pMostVisitedListView->SetFocus();
5730 else if(__pMultiWindowButton)
5731 __pMultiWindowButton->SetFocus();
5732 else if(__pMoreButton)
5733 __pMoreButton->SetFocus();
5735 __pAddressbar->SetShowState(false);
5737 RelayoutControls(false);
5741 MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
5743 AppLog("MainForm::OnFormMenuRequested called");
5745 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
5747 int bookmarkCount=0;
5750 url=__pWindowInfo->pageUrl;
5751 AppLog("MainForm::OnFormMenuRequested url %ls",url.GetPointer());
5752 result r = E_SUCCESS;
5753 Bitmap* pBitmap = null;
5754 String lastChar = L"";
5755 // if(url.SubString(url.GetLength()-1,lastChar));
5756 // if(lastChar == L"/")
5758 // bool exist1 = false;
5759 // bool exist2 = false;
5760 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist1);
5761 // url.SubString(0,url.GetLength() - 1,url);
5762 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist2);
5763 // exist = exist1 | exist2;
5767 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
5770 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
5776 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
5780 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
5782 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
5784 if (__pOptionMenu->GetItemCount() == 9)
5786 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5790 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5795 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
5799 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
5800 if (__pOptionMenu->GetItemCount() != 9)
5802 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
5803 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
5804 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
5805 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
5806 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
5807 __pOptionMenu->SetMaxVisibleItemsCount(6);
5809 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
5811 AppLog(" Orientation landscape");
5812 __pOptionMenu->SetMaxVisibleItemsCount(5);
5816 AppLog(" Orientation potrait");
5817 __pOptionMenu->SetMaxVisibleItemsCount(6);
5820 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
5823 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
5825 __pAddressbar->SetShowState(false);
5827 __pFooterPanel->SetShowState(true);
5828 result r = __pOptionMenu->SetShowState(true);
5829 AppLog("ajsghd %s",GetErrorMessage(r));
5830 RelayoutControls(false);
5831 __pOptionMenu->Invalidate(true);
5832 __pOptionMenu->Show();