2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet MainForm class
19 *@brief: The %MainForm provides the common functionalities for the Main View of the Browser including the addressbar,
20 * loading,handling events etc.
24 #include <FGraphics.h>
29 //#include <FShellNotificationManager.h>
31 #include "IntBookmarkData.h"
32 #include "IntBookmarkPresentationModel.h"
33 #include "IntCommonLib.h"
34 #include "IntFaviconManager.h"
35 #include "IntInternetApp.h"
36 #include "IntMainForm.h"
37 #include "IntSceneRegister.h"
38 #include "IntSettingPresentationModel.h"
40 using namespace Tizen::App;
41 using namespace Tizen::Base;
42 using namespace Tizen::Base::Collection;
43 using namespace Tizen::Base::Runtime;
44 using namespace Tizen::Base::Utility;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
47 using namespace Tizen::Locales;
48 using namespace Tizen::Media;
49 using namespace Tizen::Shell;
50 using namespace Tizen::Ui;
51 using namespace Tizen::Ui::Controls;
52 using namespace Tizen::Content;
53 using namespace Tizen::Ui::Scenes;
54 using namespace Tizen::System;
55 using namespace Tizen::Web;
56 using namespace Tizen::Web::Controls;
58 static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
59 static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
60 static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
61 static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
62 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
63 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK_PRESS = L"I01_search_list_icon_favorite_press.png";
64 static const wchar_t* IDB_CONTRLBAR_ICON_MORE = L"I01_icon_more.png";
65 static const wchar_t* IDB_CONTRLBAR_ICON_MORE_PRESS = L"I01_icon_more_press.png";
66 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW = L"I01_icon_plus.png";
67 static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_press.png";
68 static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
69 static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
70 static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
71 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
72 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
73 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
74 static const wchar_t* IDS_APPID = L"AppID";
75 static const wchar_t* IDS_KEY = L"key";
76 static const wchar_t* IDS_VALUE = L"value";
77 static const wchar_t* IDB_TITLE_PROGRESS_BAR_BG = L"I01_title_progress_bar_bg.png";
78 static const wchar_t* IDB_TITLE_PROGRESS_BAR = L"I01_title_progress_bar.png";
79 //static const wchar_t* IDB_ADDRESS_BAR_BACKGROUND = L"I01_toolbar_bg_02.9.png";
81 const int IDA_BACKBTN_CLICKED = 101;
82 const int IDA_BOOKMARKBTN_CLICKED = 102;
83 const int IDA_MOREBTN_CLICKED = 103;
84 const int IDA_MULTIWINDOWBTN_CLICKED = 104;
85 const int IDA_NEWWINDOWBTN_CLICKED = 105;
86 const int IDA_FORWARD_CLICKED = 106;
87 const int IDA_ADDTOBOOKMARK_CLICKED = 107;
88 const int IDA_SHARE_CLICKED = 108;
89 const int IDA_FINDONPAGE_CLICKED = 109;
90 const int IDA_PRIVATEON_CLICKED = 110;
91 const int IDA_SETTINGS_CLICKED = 111;
92 const int IDA_READER_CLOSE_CLICKED = 112;
93 const int IDA_SMALLFONT_BTN_CLICKED = 113;
94 const int IDA_LARGEFONT_BTN_CLICKED = 114;
95 const int IDA_BRIGHTNESS_BTN_CLICKED = 115;
96 const int IDA_HISTORY_CLICKED = 116;
97 const int IDA_ADD_TO_BOOKMARKBTN_CLICKED = 117;
98 const int IDA_ADD_TO_HOME_CLICKED = 118;
99 const int IDA_SAVED_PAGES_CLICKED = 119;
100 const int IDA_DESKTOP_VIEW_CLICKED = 120;
101 const int IDA_SAVE_CLICKED = 121;
102 const int IDA_PRINT_CLICKED = 122;
104 const int IDA_FINDWORD_SEARCH_CLICKED = 201;
105 const int IDA_FINDWORD_NEXT_CLICKED = 202;
106 const int IDA_FINDWORD_PREV_CLICKED = 203;
107 const int IDA_FINDWORD_CLEAR_CLICKED = 204;
108 const int IDA_FINDWORD_CANCEL_CLICKED = 205;
110 const int IDA_COPY_IMAGE_CLICKED = 206;
111 const int IDA_VIEW_IMAGE_CLICKED = 207;
112 const int IDA_SAVE_IMAGE_CLICKED = 208;
113 const int IDA_SHARE_IMAGE_CLICKED = 209;
115 const int IDA_COPY_TEXT_CLICKED = 210;
116 const int IDA_PASTE_TEXT_CLICKED = 211;
117 const int IDA_FIND_TEXT__CLICKED = 212;
118 const int IDA_SHARE_TEXT_CLICKED = 213;
120 const int IDA_GO_BACK = 214;
121 const int IDA_GO_FORWARD = 215;
122 const int IDA_REFRESH_BTN_CLICKED = 216;
123 const int IDA_STOP_BTN_CLICKED = 217;
124 const int IDA_CLEAR_URL = 218;
125 const int IDA_READER_BTN_CLICKED = 219;
128 const int IDA_HYPERLINK_OPEN_CLICKED = 220;
129 const int IDA_HYPERLINK_COPY_LINK_CLICKED = 221;
130 const int IDA_HYPERLINK_SAVE_IMAGE_CLICKED = 222;
131 const int IDA_HYPERLINK_SHARE_IMAGE_CLICKED = 223;
133 const int IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED = 224;
135 const int DEFAULT_PROGRESS_PERCENTAGE = 10;
137 const int MainForm::IDA_FORMAT_BITMAP = 500;
138 const int MainForm::IDA_FORMAT_DELETE_BITMAP = 501;
139 const int MainForm::IDA_FORMAT_TITLE_STRING = 502;
140 const int MainForm::IDA_FORMAT_URL_STRING = 503;
141 const int MainForm::IDA_CONTEXT_ITEM_DELETE = 504;
143 static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
144 static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
145 static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
147 static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
148 MainForm::MainForm(void)
150 __isLongPressedDone = false;
152 __pAddressbar = null;
153 // __pMostVisitedSitesPanel = null;
154 __pMostVisitedListView = null;
155 __pFooterPanel = null;
156 __pHitElementResult = null;
157 __pWindowInfo = null;
160 __pOptionMenu = null;
161 __pFindWordControl = null;
162 __pFindWordPanelLeftToRight = null;
163 __pFindWordPanelRightToLeft = null;
164 __pFindWordBgLabel = null;
165 __pFindWordBgLabelRightToLeft = null;
166 __pFindWordEditField = null;
167 __pFindWordEditFieldRightToLeft = null;
168 __pFindWordClear = null;
169 __pFindWordClearRightToLeft = null;
170 __pFindWordCountLabel = null;
171 __pFindWordClearRightToLeft = null;
172 __pFindWordNext = null;
173 __pFindWordPrev = null;
174 __previousZoomLevel = 1.0;
176 __currentAddMode = ADDRESSBAR_MODE_LOADING_COMPLETE;
179 __currentSearchStr = L"";
180 __currentSelectedStr = L"";
181 __maxOccurrances = 0;
182 __currentWordIndex = 0;
185 //__inputEventToBeSupressed = false;
186 __isLoadingData = false;
187 __isLoadingCompleted = false;
188 __progressPercentage = 0;
189 __touchPoint1 = Point(-1,-1);
190 __touchPoint2 = Point(-1,-1);
191 __longPressPoint = Point(-1,-1);
193 // __pReaderPopup = null;
194 __pReaderData = null;
196 __pReaderCloseBtn = null;
197 //__pNewWindowButton = null;
198 __pMoreButton = null;
199 __pMultiWindowButton = null;
200 __pArticleReaderPanel = null;
201 __pBlankPanel = null;
202 __pArticleReaderLabel = null;
203 __webControlHeight = 0;
204 __prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
205 __curAddressBarMode = ADDRESSBAR_MODE_INVALID;
206 __pMostVisitedSites = null;
207 __pFooterUrlField = null;
209 __pGoForwardBtn = null;
210 __pRefreshBtn = null;
211 __pProgressbarLabel = null;
212 __pFooterLabel = null;
216 __isKeypadOpened = false;
218 __pNotification = null;
221 MainForm::~MainForm(void)
223 SettingPresentationModel::GetInstance()->RemoveSettingsEventListener(*this);
227 __pAddressbar->SetAddressbarEventListener(null);
230 if(__pHistory != null)
236 if (__pReaderData != null)
238 delete __pReaderData;
239 __pReaderData = null;
242 if (__pPopUp != null)
248 if (__pHitElementResult != null)
250 delete __pHitElementResult;
251 __pHitElementResult = null;
255 delete __pOptionMenu;
256 __pOptionMenu = null;
259 String* pSelectedScene = NULL;
260 Object* pValue = NULL;
261 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
262 pSelectedScene = (String*) pValue;
264 /*if (pSelectedScene != null)
266 delete pSelectedScene;
268 MultiWindowPresentationModel::SetValue(SELECTED_SCENE_ID, null);*/
272 MainForm::Initialize(void)
274 Construct(L"IDL_FORM");
276 // SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_FOOTER);
281 MainForm::OnInitializing(void)
283 AppLog("get client area width = %d",GetClientAreaBounds().width);
284 AppLog("get client area height = %d",GetClientAreaBounds().height);
285 const int WIDTH_CONTEXT_MENU_BUTTON = 336;
286 const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
288 __fontSize = CommonUtil::GetFontSize();
289 Panel* pFooterPanel = null;
291 __pSaveImage = new Image();
292 __pSaveImage->Construct();
294 // Setup back event listener
295 SettingPresentationModel::GetInstance()->AddSettingsEventListener(*this);
296 SceneManager::GetInstance()->AddSceneEventListener(IDSCN_MAIN_VIEW, *this);
297 AddOrientationEventListener(*this);
299 AppLogDebug(" MainForm::OnInitializing ended");
300 if (__pMostVisitedSites == null)
302 __pMostVisitedSites = new(std::nothrow) ArrayList();
303 __pMostVisitedSites->Construct();
305 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
307 __pItemContext= new(std::nothrow) ListContextItem();
308 __pItemContext->Construct();
310 __pItemContext->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"),true);
313 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
314 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
315 __pItemContext->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
317 __pItemContextLandscape= new(std::nothrow) ListContextItem();
318 __pItemContextLandscape->Construct();
320 __pItemContextLandscape->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), true);
321 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
322 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
323 __pItemContextLandscape->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
324 SetFormMenuEventListener(this);
325 AppLog("SetFormMenuEventListener result %s",GetErrorMessage(GetLastResult()));
330 MainForm::InitAddressbar(void)
332 AppLogDebug("MainForm::InitAddressbar entered");
334 result r = E_SUCCESS;
336 if (__pAddressbar != null)
340 __pAddressbar = new(std::nothrow) Addressbar();
341 AppLog("MainForm::InitAddressbar GetClientAreaBounds().width %d",GetClientAreaBounds().width);
342 r = __pAddressbar->Initialize(Tizen::Graphics::Rectangle(0, 0, GetClientAreaBounds().width, 82));
345 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
348 __pAddressbar->SetAddressbarEventListener(this);
349 AddControl(__pAddressbar);
350 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
351 SetControlAlwaysOnTop(*__pAddressbar, true);
352 __adressPanelPosition = __pAddressbar->GetPosition();
354 AppLogDebug("MainForm::InitAddressbar exit");
360 MainForm::CreateReaderPanel(void)
362 AppLogDebug("CreateReaderPanel() width %d",GetClientAreaBounds().width);
363 result r = E_FAILURE;
365 Button *pSmallFontBtn = null;
366 Button *pLargeFontBtn = null;
368 __pBlankPanel = new (std::nothrow) Panel();
369 __pBlankPanel->Construct(L"IDL_BLANK_PANEL");
371 __pArticleReaderPanel = new (std::nothrow) Panel();
372 __pArticleReaderPanel->Construct(L"IDL_ARTICLE_READER");
374 __pReaderCloseBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_CLOSE_READER",true));
375 if (__pReaderCloseBtn)
377 AppLogDebug("CreateReaderPanel() 6");
378 __pReaderCloseBtn->AddActionEventListener(*this);
379 __pReaderCloseBtn->SetActionId(IDA_READER_CLOSE_CLICKED);
382 __pWebReader = new (std::nothrow) Web();
383 __pWebReader->Construct(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
385 settings.SetInputStyle(INPUT_STYLE_OVERLAY);
386 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
388 r = __pWebReader->SetSetting(settings);
390 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
393 __pArticleReaderLabel = new Label();
394 __pArticleReaderLabel->Construct(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()),L"");
396 __pBlankPanel->AddControl(__pArticleReaderLabel);
397 __pBlankPanel->AddControl(__pArticleReaderPanel);
398 AddControl(__pBlankPanel);
400 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
401 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
402 __pArticleReaderLabel->SetBounds(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
404 __pArticleReaderPanel->AddControl(__pWebReader);
405 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth()-2,__pArticleReaderPanel->GetHeight() - 96 -2));
406 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
407 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
409 if (pBitmap != null && pSrcBitmap != null)
411 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
413 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
415 pSmallFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_SMALL_FONT",true));
418 pSmallFontBtn->AddActionEventListener(*this);
419 pSmallFontBtn->SetActionId(IDA_SMALLFONT_BTN_CLICKED);
422 pLargeFontBtn = static_cast<Button*>(__pArticleReaderPanel->GetControl(L"IDC_LARGE_FONT",true));
425 pLargeFontBtn->AddActionEventListener(*this);
426 pLargeFontBtn->SetActionId(IDA_LARGEFONT_BTN_CLICKED);
435 if (pSrcBitmap != null)
441 SetControlAlwaysOnTop(*__pBlankPanel, true);
442 //__pBlankPanel->SetControlAlwaysAtBottom(*__pArticleReaderPanel, true);
449 MainForm::InitWebControl()
451 AppLogDebug("MainForm::InitWebControl enter");
452 result r = E_SUCCESS;
453 AppLogDebug("InitWebControl");
455 if (__pAddressbar == null || __pFooterPanel == null)
458 const int Y_WEBCONTROL_POSITION = 0;
460 __webControlHeight = GetHeight() - __pFooterPanel->GetHeight();
462 if (__pMostVisitedListView)
464 __pMostVisitedListView->SetShowState(false);
466 if (__pWebViewer != null)
468 AppLogDebug("Already initialized");
471 __pWebViewer = new(std::nothrow) Web();
472 if(__pWebViewer == NULL)
474 AppLogDebug("Initialization failed");
477 r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight + 12));
481 AppLogDebug("Web construct failed with %s", GetErrorMessage(r));
488 r = AddControl(__pWebViewer);
494 AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
497 __webControlPosition = __pWebViewer->GetPosition();
498 r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
501 AppLogDebug("Web setting add failed with %s", GetErrorMessage(r));
505 __pWebViewer->SetLoadingListener(this);
506 __pWebViewer->SetWebUiEventListenerF(this);
507 __pWebViewer->SetWebKeypadEventListener(this);
508 __pWebViewer->SetFocus();
509 __pWebViewer->AddTouchEventListener(*this);
511 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
512 __pWebViewer->SetTextSearchListener(this);
515 AppLogDebug("MainForm :before return");
517 AppLogDebug("MainForm::InitWebControl Exit");
523 MainForm::SetJavascriptEnabled()
525 WebSetting settings = __pWebViewer->GetSetting();
526 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
527 __pWebViewer->SetSetting(settings);
531 MainForm::SetImageLoadEnabled()
533 WebSetting settings = __pWebViewer->GetSetting();
534 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
535 __pWebViewer->SetSetting(settings);
539 MainForm::InitFooter(void)
541 AppLogDebug("MainForm::InitFooter entered");
542 Button* pBackButton = null;
543 Button* pBookmarkButton = null;
544 Button* pMultiWindowButton = null;
545 Bitmap *pIconBitmap = null;
546 Bitmap *pBGBitmap = null;
547 Label *pBGLabel = null;
549 if (__pFooterPanel == null)
551 __pFooterPanel = static_cast< Panel* >(GetControl(L"IDC_FOOTER_PANEL", true));
554 if (__pFooterPanel == null)
559 SetControlAlwaysOnTop(*__pFooterPanel, true);
561 __pFooterLabel = static_cast< Label* >(GetControl(L"IDC_FOOTER_LABEL", true));
562 if ( __pFooterLabel == NULL )
566 //__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
567 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
570 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
574 __pMultiWindowButton = static_cast< Button* >(GetControl(L"IDC_MULTIWINDOW_BUTTON", true));
576 if ( __pMultiWindowButton == NULL )
582 SetFormBackEventListener(this);
583 AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult()));
584 if (__pMultiWindowButton != null)
586 Bitmap* pBitmap = null;
587 Bitmap* pPressedBitmap = null;
588 String imagePath = "I01_toolbar_icon_windows_manager_0";
589 String pressedImagePath = "I01_toolbar_icon_windows_manager_0";
590 int totalCount = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList()->GetCount();
591 imagePath.Append(totalCount);
592 imagePath.Append(".png");
594 pressedImagePath.Append(totalCount);
595 pressedImagePath.Append("_press.png");
597 pBitmap = AppResource::GetInstance()->GetBitmapN(imagePath);
598 pPressedBitmap = AppResource::GetInstance()->GetBitmapN(pressedImagePath);
599 if ( pBitmap == null )
604 Point startPoint = Point((__pMultiWindowButton->GetWidth() - pBitmap->GetWidth())/2,(__pMultiWindowButton->GetHeight() - pBitmap->GetHeight())/2);
607 __pMultiWindowButton->SetNormalBitmap(startPoint, *pBitmap);
608 __pMultiWindowButton->SetPressedBitmap(startPoint, *pPressedBitmap);
613 __pMultiWindowButton->AddActionEventListener(*this);
614 __pMultiWindowButton->SetActionId(IDA_MULTIWINDOWBTN_CLICKED);
617 delete pPressedBitmap;
618 pPressedBitmap = null;
624 Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE);
625 Bitmap* pPressedBitmap = AppResource::GetInstance()->GetBitmapN(IDB_CONTRLBAR_ICON_MORE_PRESS);
628 Point startPoint((__pMoreButton->GetWidth() - pBitmap->GetWidth())/2,(__pMoreButton->GetHeight() - pBitmap->GetHeight())/2 );
629 __pMoreButton->SetNormalBitmap(startPoint, *pBitmap);
630 __pMoreButton->SetPressedBitmap(startPoint, *pPressedBitmap);
634 __pMoreButton->AddActionEventListener(*this);
635 __pMoreButton->SetActionId(IDA_MOREBTN_CLICKED);
638 //Add the editfield for url
639 __pFooterUrlField = static_cast<EditField*> (GetControl(L"IDC_URL_EDIT_FIELD",true));
640 if (__pFooterUrlField == NULL)
642 return E_INVALID_KEY;
645 __pFooterUrlField->SetOverlayKeypadCommandButtonVisible(false);
646 __pFooterUrlField->SetKeypadAction(KEYPAD_ACTION_GO);
647 __pFooterUrlField->AddKeypadEventListener(*this);
648 __pFooterUrlField->SetPropagatedTouchEventListener(this);
649 __pFooterUrlField->AddFocusEventListener(*this);
651 if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
653 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
655 else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
657 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
661 //__pUrlField->SetText(SettingPresentationModel::GetInstance()->GetFavoriteURL());
662 __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_SEARCH_OR_ENTER_URL"));
666 //Add the go Back Button
667 __pGoBackBtn = static_cast<Button*> (GetControl(L"IDC_PAGEBACK_BUTTON",true));
668 if (__pGoBackBtn == NULL)
670 AppLogDebug("__pGoBackBtn Control not found returning E_INVALID_KEY");
671 return E_INVALID_KEY;
673 __pGoBackBtn->SetActionId(IDA_GO_BACK);
674 __pGoBackBtn->AddActionEventListener(*this);
676 //Add the go forward Button
677 __pGoForwardBtn = static_cast<Button*> (GetControl(L"IDC_PAGEFORWARD_BUTTON",true));
678 if (__pGoForwardBtn == NULL)
680 AppLogDebug("Control not found returning E_INVALID_KEY");
681 return E_INVALID_KEY;
683 __pGoForwardBtn->SetActionId(IDA_GO_FORWARD);
684 __pGoForwardBtn->AddActionEventListener(*this);
685 if (__pWebViewer && __pWebViewer->CanGoForward())
687 SetForwardButtonEnabled(true);
691 SetForwardButtonEnabled(false);
694 __pRefreshBtn = static_cast<Button*> (GetControl(L"IDC_REFRESH_BUTTON",true));
695 if (__pRefreshBtn == NULL)
697 AppLogDebug("Control not found returning E_INVALID_KEY");
698 return E_INVALID_KEY;
701 __pRefreshBtn->SetActionId(IDA_REFRESH_BTN_CLICKED);
702 __pRefreshBtn->AddActionEventListener(*this);
703 __pRefreshBtn->SetShowState(true);
705 //Add the backround label for displaying progressbar
706 __pProgressbarLabel = static_cast<Label*> (GetControl(L"IDC_PROGRESS_BAR_LABEL",true));
707 if (__pProgressbarLabel == NULL)
709 AppLogDebug("__pProgressbarLabel Control not found returning E_INVALID_KEY");
710 return E_INVALID_KEY;
712 __pProgressbarLabel->SetShowState(false);
714 __pStopBtn = static_cast<Button*> (GetControl(L"IDC_STOP_BUTTON",true));
715 if (__pStopBtn == NULL)
717 AppLogDebug("Control not found returning E_INVALID_KEY");
718 return E_INVALID_KEY;
720 __pStopBtn->SetActionId(IDA_STOP_BTN_CLICKED);
721 __pStopBtn->AddActionEventListener(*this);
722 __pStopBtn->SetShowState(false);
724 __pClearBtn = static_cast<Button*> (GetControl(L"IDC_CLEAR_BUTTON",true));
725 if (__pClearBtn == NULL)
727 AppLogDebug("Control not found returning E_INVALID_KEY");
728 return E_INVALID_KEY;
730 __pClearBtn->SetActionId(IDA_CLEAR_URL);
731 __pClearBtn->AddActionEventListener(*this);
732 __pClearBtn->SetShowState(false);
734 __pReaderBtn = static_cast<Button*> (GetControl(L"IDC_READER_BUTTON",true));
735 if (__pReaderBtn == NULL)
737 AppLogDebug("Control not found returning E_INVALID_KEY");
738 return E_INVALID_KEY;
740 __pReaderBtn->SetActionId(IDA_READER_BTN_CLICKED);
741 __pReaderBtn->AddActionEventListener(*this);
742 __pReaderBtn->SetShowState(false);
744 // __pFooterPanel->Invalidate(true);
745 AppLogDebug("MainForm::InitFooter exit");
750 MainForm::InitOptionMenu()
752 result r = E_SUCCESS;
753 bool isPrivateBrowsing = false;
754 Bitmap* pBitmap = null;
756 if (__pOptionMenu != null)
758 __pOptionMenu->SetFocusable(true);
759 __pOptionMenu->Invalidate(true);
763 __pOptionMenu = new(std::nothrow) OptionMenu();
764 r = __pOptionMenu->Construct();
765 TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
767 __pOptionMenu->SetFocusable(true);
768 isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
771 if (isPrivateBrowsing == true)
773 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
777 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
780 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED);
782 if ( pBitmap != NULL)
784 __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"), IDA_PRIVATEON_CLICKED,*pBitmap);
787 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_TAB_HISTORY"), IDA_HISTORY_CLICKED);
788 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED);
789 r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED);
792 __pOptionMenu->SetMaxVisibleItemsCount(6);
793 __pOptionMenu->SetShowState(false);
794 __pOptionMenu->AddActionEventListener(*this);
795 SetControlAlwaysOnTop(*__pOptionMenu, true);
801 result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
803 result r = E_SUCCESS;
804 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
806 AppLog("MainForm::InitImageContextMenu clicked on image");
807 if (__pImageMenu != null)
812 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
817 __pImageMenu = new (std::nothrow) ContextMenu();
818 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
819 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
821 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
822 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
823 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED);
824 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_IMAGE_CLICKED);
825 __pImageMenu->SetMaxVisibleItemsCount(4);
826 __pImageMenu->AddActionEventListener(*this);
827 SetControlAlwaysOnTop(*__pImageMenu, true);
828 __pImageMenu->SetFocusable(true);
834 MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
836 result r = E_SUCCESS;
837 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
839 AppLog("MainForm::InitImageContextMenu clicked on image");
840 if (__pImageMenu != null)
846 // if(__pAddressbar->GetShowState() == true)
847 // p.y = p.y + __pAddressbar->GetHeight();
848 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
853 __pImageMenu = new (std::nothrow) ContextMenu();
854 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
855 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
857 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
858 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
859 //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
860 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
862 __pImageMenu->SetMaxVisibleItemsCount(3);
863 __pImageMenu->AddActionEventListener(*this);
864 SetControlAlwaysOnTop(*__pImageMenu, true);
865 __pImageMenu->SetFocusable(true);
872 MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOption = false)
874 result r = E_SUCCESS;
875 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
877 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
878 if (__pImageMenu != null)
887 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
891 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
893 __pImageMenu = new (std::nothrow) ContextMenu();
894 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
895 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
897 if(onlyPasteOption == false)
899 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
901 if (pasteOption || onlyPasteOption)
903 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
905 if(onlyPasteOption == false)
907 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
908 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
911 __pImageMenu->SetMaxVisibleItemsCount(3);
912 __pImageMenu->AddActionEventListener(*this);
913 SetControlAlwaysOnTop(*__pImageMenu, true);
914 __pImageMenu->SetFocusable(true);
921 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
923 result r = E_SUCCESS;
924 ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
926 AppLog("MainForm::InitSelectTextContextMenu clicked on text");
927 if (__pImageMenu != null)
936 direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
940 direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
942 __pImageMenu = new (std::nothrow) ContextMenu();
943 r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
944 TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
946 if(onlyPasteOption == false)
948 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
950 if (pasteOption || onlyPasteOption)
952 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
954 if(onlyPasteOption == false)
956 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
957 r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
960 __pImageMenu->SetMaxVisibleItemsCount(3);
961 __pImageMenu->AddActionEventListener(*this);
962 SetControlAlwaysOnTop(*__pImageMenu, true);
963 __pImageMenu->SetFocusable(true);
970 MainForm::InitFindWordPanel(void)
972 result r = E_SUCCESS;
973 Bitmap *pIconBitmap = null;
975 if (__pFindWordControl != null)
977 AppLogDebug("Findword panel already initialized");
978 if (__pFindWordBgLabel != null)
980 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
983 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
987 if (__pFindWordBgLabelRightToLeft != null)
989 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
992 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
997 __pAddressbar->SetShowState(false);
999 if(__isKeypadOpened == false)
1000 __pFooterPanel->SetShowState(true);
1004 __pFindWordControl = new (std::nothrow) Panel();
1005 r = __pFindWordControl->Construct(L"IDL_FIND_ON_PAGE");
1008 AppLogException("There is some problem in the xml file. Please check.");
1011 AddControl(__pFindWordControl);
1012 __pFindWordControl->SetBounds(0,0, __pFindWordControl->GetWidth(), __pFindWordControl->GetHeight());
1013 SetControlAlwaysOnTop(*__pFindWordControl,true);
1014 __pFindWordControl->SetShowState(false);
1015 __pFindWordControl->Invalidate(false);
1017 __pFindWordPanelLeftToRight = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1018 __pFindWordPanelLeftToRight->SetShowState(true);
1020 __pFindWordPanelRightToLeft = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL2", true));
1021 __pFindWordPanelRightToLeft->SetShowState(false);
1023 __pFindWordBgLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL1", true));
1024 if (__pFindWordBgLabel != null)
1026 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1027 Rectangle pRect = pPanel1->GetBounds();
1028 pRect.x = pRect.y = 0;
1029 __pFindWordBgLabel->SetBounds(pRect);
1030 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1031 if (pBitmap != null)
1033 AppLogDebug("InitFindWordPanel: Coming here");
1034 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
1039 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1043 __pFindWordBgLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_LABEL2", true));
1044 if (__pFindWordBgLabelRightToLeft != null)
1046 Panel* pPanel1 = static_cast<Panel*>(__pFindWordControl->GetControl(L"IDC_PANEL1", true));
1047 Rectangle pRect = pPanel1->GetBounds();
1048 pRect.x = pRect.y = 0;
1049 __pFindWordBgLabelRightToLeft->SetBounds(pRect);
1050 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
1051 if (pBitmap != null)
1053 AppLogDebug("InitFindWordPanel: Coming here");
1054 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
1059 AppLogDebug("InitFindWordPanel: shouldn't Come here");
1063 Button* pfindWordCancel = null;
1064 pfindWordCancel = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CANCEL", true));
1065 if (pfindWordCancel == null)
1067 AppLogException("There is some problem in the xml file. Please check.");
1070 pfindWordCancel->SetActionId(IDA_FINDWORD_CANCEL_CLICKED);
1071 pfindWordCancel->AddActionEventListener(*this);
1073 __pFindWordClear = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR", true));
1074 if (__pFindWordClear == null)
1076 AppLogException("There is some problem in the xml file. Please check.");
1080 __pFindWordClearRightToLeft = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_CLEAR2", true));
1081 if (__pFindWordClearRightToLeft == null)
1083 AppLogException("There is some problem in the xml file. Please check.");
1087 __pFindWordClear->SetActionId(IDA_FINDWORD_CLEAR_CLICKED);
1088 __pFindWordClear->AddActionEventListener(*this);
1090 __pFindWordClearRightToLeft->SetActionId(IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED);
1091 __pFindWordClearRightToLeft->AddActionEventListener(*this);
1093 __pFindWordNext = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_NEXT", true));
1094 if (__pFindWordNext == null)
1096 AppLogException("There is some problem in the xml file. Please check.");
1100 __pFindWordNext->SetActionId(IDA_FINDWORD_NEXT_CLICKED);
1101 __pFindWordNext->AddActionEventListener(*this);
1103 __pFindWordPrev = static_cast<Button*>(__pFindWordControl->GetControl(L"IDC_FIND_PREV", true));
1104 if (__pFindWordPrev == null)
1106 AppLogException("There is some problem in the xml file. Please check.");
1110 __pFindWordPrev->SetActionId(IDA_FINDWORD_PREV_CLICKED);
1111 __pFindWordPrev->AddActionEventListener(*this);
1113 __pFindWordNext->SetEnabled(false);
1114 __pFindWordPrev->SetEnabled(false);
1116 __pFindWordCountLabel = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL", true));
1117 if (__pFindWordCountLabel == null)
1119 AppLogException("There is some problem in the xml file. Please check.");
1123 __pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
1124 if (__pFindWordCountLabel == null)
1126 AppLogException("There is some problem in the xml file. Please check.");
1130 __pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
1131 if (__pFindWordEditField == null)
1133 AppLogException("There is some problem in the xml file. Please check.");
1136 __pFindWordEditField->AddTextEventListener(*this);
1137 __pFindWordEditField->AddKeypadEventListener(*this);
1138 __pFindWordEditField->SetOverlayKeypadCommandButtonVisible(false);
1139 __pFindWordEditField->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1141 __pFindWordEditFieldRightToLeft = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD2", true));
1142 if (__pFindWordEditFieldRightToLeft == null)
1144 AppLogException("There is some problem in the xml file. Please check.");
1147 __pFindWordEditFieldRightToLeft->AddTextEventListener(*this);
1148 __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
1149 __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
1150 __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
1153 __pAddressbar->SetShowState(false);
1155 if(__isKeypadOpened == false)
1156 __pFooterPanel->SetShowState(true);
1161 MainForm::CreateItem (int index, int itemWidth)
1163 Rectangle listImageRect;
1164 Rectangle pagetTitleRect;
1165 Rectangle pageURLRect;
1166 Rectangle deleteImageRect;
1167 String pageTitle(L"");
1168 String pageURL(L"");
1169 result r = E_SUCCESS;
1170 Bitmap* pListIconImage = null;
1173 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1174 if(pHistory == null)
1178 AppResource* pAppResource = Application::GetInstance()->GetAppResource();
1179 if ( pAppResource == NULL )
1183 ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
1185 CustomItem* pItem = new(std::nothrow) CustomItem();
1186 pageTitle = pHistory->GetHistoryTitle();
1187 pageURL = pHistory->GetHistoryUrl();
1189 if (pageURL.GetLength() == 0)
1192 pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
1193 pageURL = L"<"+ nourl +">";
1197 Rectangle screenBounds = GetBounds();
1200 r = pItem->Construct(Dimension(itemWidth, 128 + (__fontSize - 44)), style);
1209 Bitmap* pBitmap = pHistory->GetFavIconBitmap();
1211 if ( pBitmap != NULL)
1213 pListIconImage = new Bitmap();
1214 pListIconImage->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
1218 if(pListIconImage == null)
1220 pListIconImage = pAppResource->GetBitmapN(L"I01_icon_default_favicon.png");
1223 if ( pListIconImage != NULL)
1225 listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28 + (__fontSize - 44)/2 , 72, 72);
1226 pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72 + (__fontSize - 44));
1227 pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
1230 if (pItem != null && pListIconImage != NULL)
1232 pItem->AddElement(listImageRect, IDA_FORMAT_BITMAP, *pListIconImage, null, null);
1236 if (pageTitle.CompareTo(L"") != 0)
1240 pItem->AddElement(pagetTitleRect, IDA_FORMAT_TITLE_STRING, pageTitle, __fontSize, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, true);
1244 if (pageURL.CompareTo(L"") != 0)
1248 pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
1253 if(GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
1255 if ( __pItemContext!= NULL)
1259 pItem->SetContextItem(__pItemContext);
1265 if ( __pItemContextLandscape!= NULL)
1269 pItem->SetContextItem(__pItemContextLandscape);
1273 if( pListIconImage != NULL)
1275 delete pListIconImage;
1276 pListIconImage = null;
1283 MainForm::DeleteItem (int index, Tizen::Ui::Controls::ListItemBase *pItem, int itemWidth)
1290 MainForm::GetItemCount (void)
1292 if(__pMostVisitedSites != null)
1294 __pMostVisitedSites->RemoveAll(true);
1296 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
1297 if(__pMostVisitedSites != null)
1299 return __pMostVisitedSites->GetCount();
1306 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
1308 AppLog("MainForm::OnListViewContextItemStateChanged called");
1309 if(__pMostVisitedSites != null)
1311 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1312 if (pHistory != null)
1314 String url = pHistory->GetHistoryUrl();
1316 HistoryPresentationModel::GetInstance()->DeleteHistory(url);
1317 __pMostVisitedListView->UpdateList();
1323 MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1325 History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
1326 String url = pHistory->GetHistoryUrl();
1334 MainForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1340 MainForm::OnTerminating(void)
1342 result r = E_SUCCESS;
1344 RemoveOrientationEventListener(*this);
1348 __pAddressbar->SetAddressbarEventListener(null);
1353 __pWebViewer->RemoveTouchEventListener(*this);
1354 __pWebViewer->SetWebUiEventListenerF(null);
1355 __pWebViewer->SetWebKeypadEventListener(null);
1356 __pWebViewer->SetTextSearchListener(null);
1362 delete __pItemContext;
1364 if (__pItemContextLandscape)
1366 delete __pItemContextLandscape;
1370 delete __pSaveImage;
1372 if (__pMostVisitedSites)
1374 __pMostVisitedSites->RemoveAll(true);
1375 delete __pMostVisitedSites;
1381 MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
1383 result r = E_SUCCESS;
1385 AppLogDebug("Clicked : %d", actionId);
1388 case IDA_BACKBTN_CLICKED:
1390 if(__pImageMenu && __pImageMenu->GetShowState() == true)
1392 AppLog("Hiding the menu");
1393 __pImageMenu->SetShowState(false);
1395 if (__pWebViewer && __pWebViewer->CanGoBack())
1397 __pWebViewer->GoBack();
1399 else if(__pWindowInfo->isJavascriptInitiated == false)
1402 pApp = UiApp::GetInstance();
1405 RemoveOrientationEventListener(*this);
1409 __pAddressbar->SetAddressbarEventListener(null);
1414 __pWebViewer->RemoveTouchEventListener(*this);
1415 __pWebViewer->SetWebUiEventListenerF(null);
1416 __pWebViewer->SetWebKeypadEventListener(null);
1417 __pWebViewer->SetTextSearchListener(null);
1418 __pWebViewer->SetLoadingListener(null);
1420 r = pApp->Terminate();
1423 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1431 WindowInfo* pWindowInfo = null;
1433 SceneManager* pSceneManager = SceneManager::GetInstance();
1434 if (pSceneManager == null)
1438 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
1439 if (pAllWindowList == NULL)
1441 pApp = UiApp::GetInstance();
1444 RemoveOrientationEventListener(*this);
1448 __pAddressbar->SetAddressbarEventListener(null);
1453 __pWebViewer->RemoveTouchEventListener(*this);
1454 __pWebViewer->SetWebUiEventListenerF(null);
1455 __pWebViewer->SetWebKeypadEventListener(null);
1456 __pWebViewer->SetTextSearchListener(null);
1457 __pWebViewer->SetLoadingListener(null);
1459 r = pApp->Terminate();
1462 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1467 if (pAllWindowList != null)
1469 totalCount = pAllWindowList->GetCount();
1471 for (int count = 0; count < totalCount; count++)
1473 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
1474 if (pWindowInfo == null)
1476 pApp = UiApp::GetInstance();
1479 RemoveOrientationEventListener(*this);
1483 __pAddressbar->SetAddressbarEventListener(null);
1488 __pWebViewer->RemoveTouchEventListener(*this);
1489 __pWebViewer->SetWebUiEventListenerF(null);
1490 __pWebViewer->SetWebKeypadEventListener(null);
1491 __pWebViewer->SetTextSearchListener(null);
1492 __pWebViewer->SetLoadingListener(null);
1494 r = pApp->Terminate();
1497 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1504 if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
1506 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
1509 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1512 r = pAllWindowList->RemoveAt(count, true);
1513 __pWindowInfo = null;
1516 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1521 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
1525 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
1527 if (pWindowInfo == null)
1529 pApp = UiApp::GetInstance();
1533 RemoveOrientationEventListener(*this);
1537 __pAddressbar->SetAddressbarEventListener(null);
1542 __pWebViewer->RemoveTouchEventListener(*this);
1543 __pWebViewer->SetWebUiEventListenerF(null);
1544 __pWebViewer->SetWebKeypadEventListener(null);
1545 __pWebViewer->SetTextSearchListener(null);
1546 __pWebViewer->SetLoadingListener(null);
1548 r = pApp->Terminate();
1554 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1557 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
1569 case IDA_FORWARD_CLICKED:
1570 if (__pWebViewer == null)
1573 if (__pWebViewer->CanGoForward())
1575 __pWebViewer->GoForward();
1577 __pOptionMenu->SetShowState(false);
1578 __pOptionMenu->Invalidate(false);
1581 case IDA_FINDONPAGE_CLICKED:
1583 AppLogDebug("MainForm::OnActionPerformed findword clicked");
1584 __currentSearchStr.Clear();
1586 InitFindWordPanel();
1587 __pOptionMenu->SetShowState(false);
1588 __pOptionMenu->Invalidate(false);
1590 ShowFindWordPanel(true);
1592 if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
1594 __pFindWordEditField->SetFocus();
1595 // __pFindWordCountLabel->SetShowState(false);
1599 __pFindWordEditFieldRightToLeft->SetFocus();
1600 __pFindWordCountLabelRightToLeft->SetShowState(false);
1604 case IDA_PRIVATEON_CLICKED:
1606 result r = E_SUCCESS;
1608 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
1609 Bitmap* pBitmap = null;
1610 if (isPrivateBrowsing == true)
1612 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
1615 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1619 if (__pWebViewer != NULL)
1621 __pWebViewer->SetPrivateBrowsingEnabled(false);
1624 SettingPresentationModel::GetInstance()->SetPrivateOn(false);
1626 if (__pAddressbar != null)
1628 __pAddressbar->UpdateFaviconBitmap(false);
1634 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
1637 AppLogException("Contextmenu additem:Find on page failed with %s", GetErrorMessage(r));
1641 if (__pWebViewer != NULL)
1643 __pWebViewer->SetPrivateBrowsingEnabled(true);
1646 SettingPresentationModel::GetInstance()->SetPrivateOn(true);
1648 if (__pAddressbar != null)
1650 __pAddressbar->UpdateFaviconBitmap(true);
1654 itemIndex = __pOptionMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED);
1655 r = __pOptionMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
1656 AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex);
1657 __pOptionMenu->Invalidate(true);
1658 if ( pBitmap != NULL )
1665 case IDA_SETTINGS_CLICKED:
1668 ArrayList* pArgList = new(std::nothrow) ArrayList();
1671 pArgList->Construct();
1672 pArgList->Add(*__pWindowInfo);
1673 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList);
1675 __pOptionMenu->SetShowState(false);
1676 __pOptionMenu->Invalidate(false);
1678 if (pArgList != null)
1687 case IDA_ADDTOBOOKMARK_CLICKED:
1690 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL)
1692 int bookmarkCount=0;
1695 url=__pWindowInfo->pageUrl;
1696 result r = E_SUCCESS;
1697 Bitmap* pBitmap = null;
1698 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1706 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_REMOVED");
1707 BookmarkPresentationModel::GetInstance()->DeleteBookmark(url);
1708 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1710 if(__pNotification != null)
1712 RemoveControl(__pNotification);
1713 __pNotification = null;
1715 __pNotification = new (std::nothrow) NotificationPanel(*this);
1716 if (__pNotification != null)
1718 __pNotification->SetText(message);
1719 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1720 __pNotification->ShowNotification();
1725 String title=__pWindowInfo->pageTitle;
1726 String message = CommonUtil::GetString(L"IDS_BR_POP_BOOKMARK_ADDED");
1727 BookmarkData* pBookmark=new (std::nothrow) BookmarkData();
1729 pBookmark->SetBookmarkTitle(title);
1730 pBookmark->SetUrl(url);
1731 if (__pWebViewer != null && __pWebViewer->GetFaviconN() != null)
1733 pBookmark->SetFavIconBitmap(*(__pWebViewer->GetFaviconN()));
1735 String id = FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
1736 pBookmark->SetFaviconId(id);
1737 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(*pBookmark);
1738 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(*pBookmark);
1740 if(__pNotification != null)
1742 RemoveControl(__pNotification);
1743 __pNotification = null;
1745 __pNotification = new (std::nothrow) NotificationPanel(*this);
1746 if (__pNotification != null)
1748 __pNotification->SetText(message);
1749 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight() - 12);
1750 __pNotification->ShowNotification();
1751 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1754 if (pBitmap != null)
1756 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1761 __pOptionMenu->Invalidate(true);
1766 case IDA_PRINT_CLICKED:
1768 r = __pWebViewer->SavePageAsPdf(UiApp::GetInstance()->GetAppRootPath()+"//shared//data//test.pdf");
1769 AppLog("SavePageAsPdf result %s",GetErrorMessage(r));
1771 AppLog("RequestPrint called!");
1772 AppControl* pAc = Tizen::App::AppManager::FindAppControlN(L"org.tizen.mobileprint", L"http://tizen.org/appcontrol/operation/print");
1773 result nResult = E_FAILURE;
1776 AppLog("TestPrint if (pAc) == true");
1781 String fileType = L"service_print_files_type";
1782 String typeVal = L"DOC";
1784 String fileCount = L"service_print_files_count";
1785 String countVal = L"1";
1786 String fileFolder= L"service_print_files_folder_name";
1787 String folderVal = UiApp::GetInstance()->GetAppRootPath()+"//shared//data";
1789 map.Add(&fileCount, &countVal);
1790 map.Add(&fileFolder, &folderVal);
1791 map.Add(&fileType, &typeVal);
1793 String fileName = L"service_print_files_files_name";
1795 ArrayList fileNameList;
1796 fileNameList.Construct();
1797 String file1 = L"test.pdf";
1799 fileNameList.Add(&file1);
1800 map.Add(&fileName, &fileNameList);
1802 nResult = pAc->Start(NULL, NULL, &map, NULL);
1804 if (nResult == E_SUCCESS) AppLog("TestPrint ret == E_SUCCESS");
1805 else if (nResult == E_MAX_EXCEEDED)
1806 AppLog("TestPrint ret == E_MAX_EXCEEDED");
1807 else if (nResult == E_OBJ_NOT_FOUND)
1808 AppLog("TestPrint ret == E_OBJ_NOT_FOUND");
1809 else if (nResult == E_IN_PROGRESS)
1810 AppLog("TestPrint ret == E_IN_PROGRESS");
1811 else if (nResult == E_PRIVILEGE_DENIED)
1812 AppLog("TestPrint ret == E_PRIVILEGE_DENIED");
1813 else if(nResult == E_SYSTEM)
1814 AppLog("TestPrint ret == E_SYSTEM");
1820 int __modalMsgBoxResult;
1821 MessageBox* pMsgBox = new MessageBox();
1822 pMsgBox->Construct("Not Supported","Not Supported",MSGBOX_STYLE_OK,3000);
1823 pMsgBox->ShowAndWait(__modalMsgBoxResult);
1826 __modalMsgBoxResult = 0;
1830 case IDA_SHARE_CLICKED:
1832 if(__pPopUp != null)
1839 __pAddressbar->HideKeypad();
1841 __pPopUp = new(std::nothrow) SharePopup();
1842 __pPopUp->Initialize();
1843 if (__pWindowInfo != null)
1845 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
1846 pShareInfo->SetPageTitle(__pWindowInfo->pageTitle);
1847 pShareInfo->SetPageUrl(__pWindowInfo->pageUrl);
1848 pShareInfo->SetImageAttached(false);
1849 __pPopUp->RemoveAllShareInfo();
1850 __pPopUp->AddShareInfo(pShareInfo);
1852 __pPopUp->SetShowState(true);
1856 case IDA_BOOKMARKBTN_CLICKED:
1858 AppLogDebug("ONACTION_PERFORMED:IDA_BOOKMARKBTN_CLICKED");
1859 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1862 case IDA_ADD_TO_BOOKMARKBTN_CLICKED:
1867 case IDA_MOREBTN_CLICKED:
1869 AppLog("IDA_MOREBTN_CLICKED");
1871 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
1873 int bookmarkCount=0;
1876 url=__pWindowInfo->pageUrl;
1877 result r = E_SUCCESS;
1878 Bitmap* pBitmap = null;
1880 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
1883 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
1888 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
1892 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
1894 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
1896 if (__pOptionMenu->GetItemCount() == 9)
1898 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1902 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
1907 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
1911 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
1912 if (__pOptionMenu->GetItemCount() != 9)
1914 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
1915 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
1916 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
1917 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
1918 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
1919 __pOptionMenu->SetMaxVisibleItemsCount(6);
1921 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
1923 AppLog(" Orientation landscape");
1924 __pOptionMenu->SetMaxVisibleItemsCount(5);
1928 AppLog(" Orientation potrait");
1929 __pOptionMenu->SetMaxVisibleItemsCount(6);
1932 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
1935 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
1936 __pOptionMenu->SetShowState(true);
1937 __pOptionMenu->Invalidate(true);
1938 __pOptionMenu->Show();
1942 case IDA_HISTORY_CLICKED:
1944 AppLogDebug("ONACTION_PERFORMED:IDA_HISTORYBTN_CLICKED");
1945 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1948 case IDA_SAVED_PAGES_CLICKED:
1953 case IDA_DESKTOP_VIEW_CLICKED:
1958 case IDA_SAVE_CLICKED:
1963 case IDA_MULTIWINDOWBTN_CLICKED:
1965 result r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MULTIPLE_WINDOW, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
1966 AppLog("IDA_MULTIWINDOWBTN_CLICKED result %s",GetErrorMessage(r));
1970 case IDA_NEWWINDOWBTN_CLICKED:
1972 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
1974 if (pNewWindowInfo == null)
1978 result r = E_SUCCESS;
1979 SceneManager* pSceneManager = SceneManager::GetInstance();
1981 if (pSceneManager == NULL)
1985 ArrayList* pArgList = new(std::nothrow) ArrayList();
1986 if (pArgList == NULL)
1990 r = pArgList->Construct();
1993 pArgList->Add(*pNewWindowInfo);
1994 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2000 AppLogDebug("MainForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
2005 case IDA_SMALLFONT_BTN_CLICKED:
2007 WebSetting setting = __pWebReader->GetSetting();
2008 setting.SetFontSize(15);
2009 __pWebReader->SetSetting(setting);
2012 case IDA_LARGEFONT_BTN_CLICKED:
2014 WebSetting setting = __pWebReader->GetSetting();
2015 setting.SetFontSize(25);
2016 __pWebReader->SetSetting(setting);
2019 case IDA_READER_CLOSE_CLICKED:
2021 if (__pArticleReaderPanel != null && __pBlankPanel != null)
2023 RemoveControl(__pBlankPanel);
2024 __pArticleReaderPanel = null;
2025 __pBlankPanel = null;
2026 __pArticleReaderLabel = null;
2028 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2031 case IDA_FINDWORD_CANCEL_CLICKED:
2033 __currentSearchStr = L"";
2034 __currentWordIndex = 0;
2035 __maxOccurrances = 0;
2037 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2039 __pFindWordEditField->SetText(L"");
2040 __pFindWordCountLabel->SetText(L"0/0");
2042 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2044 __pFindWordEditFieldRightToLeft->SetText(L"");
2045 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2048 __pFindWordNext->SetEnabled(false);
2049 __pFindWordPrev->SetEnabled(false);
2050 __pFindWordCountLabel->SetText(L"0/0");
2051 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
2052 AppLog("akjshdasd 1");
2053 if(__isKeypadOpened == false)
2054 __pFooterPanel->SetShowState(true);
2055 ShowFindWordPanel(false);
2058 case IDA_FINDWORD_SEARCH_CLICKED:
2060 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2062 __currentSearchStr = __pFindWordEditField->GetText();
2064 else if (__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2066 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
2069 if (__currentSearchStr.GetLength() > 0)
2075 AppLogDebug("Enter something");
2079 case IDA_FINDWORD_CLEAR_CLICKED:
2081 __pFindWordCountLabel->SetText(L"0/0");
2082 __pFindWordEditField->SetText(L"");
2083 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2085 __currentSearchStr = L"";
2086 __pFindWordNext->SetEnabled(false);
2087 __pFindWordPrev->SetEnabled(false);
2088 // __pFindWordCountLabel->SetShowState(false);
2089 __pFindWordControl->Invalidate(true);
2092 case IDA_FINDWORD_CLEAR_RIGHT_TO_LEFT_CLICKED:
2094 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
2095 __pFindWordEditFieldRightToLeft->SetText(L"");
2096 __currentSearchStr = L"aaaaaabbbbbbccccccc";
2098 __currentSearchStr = L"";
2099 __pFindWordNext->SetEnabled(false);
2100 __pFindWordPrev->SetEnabled(false);
2101 // __pFindWordCountLabelRightToLeft->SetShowState(false);
2102 __pFindWordControl->Invalidate(true);
2105 case IDA_FINDWORD_NEXT_CLICKED:
2110 case IDA_FINDWORD_PREV_CLICKED:
2112 FindNextWord(false);
2115 case IDA_BRIGHTNESS_BTN_CLICKED:
2117 AppLogDebug("IDA_BRIGHTNESS_BTN_CLICKED");
2118 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_BRIGHTNESS, SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2121 case IDA_COPY_IMAGE_CLICKED:
2123 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2124 AppLogDebug("IDA_COPY_IMAGE_CLICKED");
2126 const Bitmap* pBitmap = null;
2127 if (__pHitElementResult != null && __pHitElementResult->HasImage())
2129 pBitmap = __pHitElementResult->GetImage();
2132 String resourcePath = App::GetInstance()->GetAppResourcePath();
2133 r = item.Construct(CLIPBOARD_DATA_TYPE_IMAGE , *pBitmap);
2134 AppLog("Platofrm construct failed result %s",GetErrorMessage(r));
2135 // copying the item to clipboard
2136 Clipboard* pClipboard = Clipboard::GetInstance();
2137 if (pClipboard != null)
2139 r = pClipboard->CopyItem(item);
2140 AppLog("Platofrm copy failed result %s",GetErrorMessage(r));
2144 case IDA_VIEW_IMAGE_CLICKED:
2146 AppLogDebug("IDA_VIEW_IMAGE_CLICKED");
2147 WindowInfo* pNewWindowInfo = null;
2148 if (__pHitElementResult != null)
2150 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2151 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2157 case IDA_SAVE_IMAGE_CLICKED:
2159 AppLogDebug("IDA_SAVE_IMAGE_CLICKED");
2160 const Bitmap* pSaveBitmap = null;
2161 String imageName = GetImagePath();
2162 AppLog("Content manager image name %ls",imageName.GetPointer());
2165 imagePath.Append(imageName);
2166 imagePath.Format(100, L"%ls/Downloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2167 AppLog("Content manager image path %ls",imagePath.GetPointer());
2168 if (__pHitElementResult != null)
2170 pSaveBitmap = __pHitElementResult->GetImage();
2172 ByteBuffer* pBuffer = __pSaveImage->EncodeToBufferN(*pSaveBitmap, IMG_FORMAT_JPG);
2176 UpdateImageContent(pBuffer, imageName);
2178 if(__pNotification != null)
2180 RemoveControl(__pNotification);
2181 __pNotification = null;
2183 __pNotification = new NotificationPanel(*this);
2185 AppResource::GetInstance()->GetString("IDS_COM_SK_SAVE", msg);
2186 msg.Append(imagePath);
2187 if (__pNotification != null)
2189 __pNotification->SetText(msg);
2190 if (__pFooterPanel->GetShowState() == true)
2192 __pNotification->SetPositionDiff(__pFooterPanel->GetHeight());
2196 __pNotification->SetPositionDiff(0);
2199 __pNotification->ShowNotification();
2204 int __modalMsgBoxResult;
2205 MessageBox* pMsgBox = new MessageBox();
2206 pMsgBox->Construct(CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
2207 pMsgBox->ShowAndWait(__modalMsgBoxResult);
2210 __modalMsgBoxResult = 0;
2214 case IDA_SHARE_IMAGE_CLICKED:
2216 AppLogDebug("IDA_SHARE_IMAGE_CLICKED");
2217 if (__pPopUp != null)
2224 __pAddressbar->HideKeypad();
2226 __pPopUp = new(std::nothrow) SharePopup();
2227 __pPopUp->Initialize();
2228 if (__pHitElementResult != null)
2230 const Bitmap* pSaveBitmap = null;
2231 String imageName = GetImagePath();
2232 AppLog("Content manager image name %ls",imageName.GetPointer());
2235 imagePath.Append(imageName);
2236 imagePath.Format(100, L"%lsDownloads/%ls.jpg",Tizen::System::Environment::GetMediaPath().GetPointer(), imageName.GetPointer());
2237 AppLog("Content manager image path %ls",imagePath.GetPointer());
2238 if (__pHitElementResult != null)
2240 pSaveBitmap = __pHitElementResult->GetImage();
2242 __pSaveImage->EncodeToFile(*pSaveBitmap, IMG_FORMAT_JPG, imagePath, true);
2244 String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
2245 AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
2247 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2248 pShareInfo->SetPageTitle(L"");
2249 pShareInfo->SetPageUrl(srcUrl);
2250 pShareInfo->SetImageAttached(true);
2251 pShareInfo->SetImagePath(imagePath);
2252 __pPopUp->RemoveAllShareInfo();
2253 __pPopUp->AddShareInfo(pShareInfo);
2254 __pPopUp->SetShowState(true);
2259 case IDA_HYPERLINK_OPEN_CLICKED:
2261 if (__pHitElementResult != null)
2263 String srcUrl = __pHitElementResult->GetUrl();
2265 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN(srcUrl);
2267 if (pNewWindowInfo == null)
2271 result r = E_SUCCESS;
2272 SceneManager* pSceneManager = SceneManager::GetInstance();
2273 if (pSceneManager == NULL)
2277 ArrayList* pArgList = new(std::nothrow) ArrayList();
2278 if (pArgList == NULL)
2282 pArgList->Construct();
2284 pArgList->Add(*pNewWindowInfo);
2285 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
2286 if (pArgList != null)
2293 AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
2299 case IDA_HYPERLINK_SHARE_IMAGE_CLICKED:
2301 if (__pHitElementResult == null)
2306 if(__pPopUp != null)
2313 __pAddressbar->HideKeypad();
2315 __pPopUp = new(std::nothrow) SharePopup();
2316 __pPopUp->Initialize();
2318 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2319 pShareInfo->SetPageUrl(__pHitElementResult->GetUrl());
2320 pShareInfo->SetImageAttached(false);
2321 __pPopUp->RemoveAllShareInfo();
2322 __pPopUp->AddShareInfo(pShareInfo);
2324 __pPopUp->SetShowState(true);
2328 case IDA_HYPERLINK_COPY_LINK_CLICKED:
2332 if (__pHitElementResult != null)
2334 url = __pHitElementResult->GetUrl();
2337 String resourcePath = App::GetInstance()->GetAppResourcePath();
2338 item.Construct(CLIPBOARD_DATA_TYPE_TEXT , url);
2340 // copying the item to clipboard
2341 Clipboard* pClipboard = Clipboard::GetInstance();
2342 if (pClipboard != null)
2344 pClipboard->CopyItem(item);
2348 case IDA_FIND_TEXT__CLICKED:
2350 // AddressBarCancelledClicked(*__pAddressbar);
2351 RelayoutControls(false);
2352 // __pFooterPanel->SetShowState(false);
2353 AppLogDebug("MainForm::OnActionPerformed find word clicked");
2354 __currentSearchStr.Clear();
2355 __currentSearchStr.Append(__currentSelectedStr);
2356 InitFindWordPanel();
2357 __pFindWordEditField->SetText(__currentSearchStr);
2359 if(__pOptionMenu != null)
2361 __pOptionMenu->SetShowState(false);
2362 __pOptionMenu->Invalidate(false);
2364 __adressPanelPosition.y = 0;
2366 if (__pAddressbar != null && __pWebViewer != NULL)
2368 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
2369 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
2371 if (__pFooterPanel->GetShowState() == false)
2372 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
2374 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, __webControlHeight));
2375 __pWebViewer->Invalidate(true);
2378 ShowFindWordPanel(true);
2379 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
2381 __pFindWordEditField->SetText(__currentSearchStr);
2382 __pFindWordEditField->SetFocus();
2384 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
2386 __pFindWordEditFieldRightToLeft->SetText(__currentSearchStr);
2387 __pFindWordEditFieldRightToLeft->SetFocus();
2390 if (__currentSearchStr.GetLength() > 0)
2396 AppLogDebug("Enter something");
2399 if (__pWebViewer != null)
2401 // releasing the set block
2402 __pWebViewer->ReleaseBlock();
2407 case IDA_SHARE_TEXT_CLICKED:
2409 __pWebViewer->ReleaseBlock();
2410 AppLogDebug("IDA_SHARE_TEXT_CLICKED");
2411 if(__pPopUp != null)
2418 __pAddressbar->HideKeypad();
2420 __pPopUp = new(std::nothrow) SharePopup();
2421 __pPopUp->Initialize();
2422 if (__pHitElementResult != null)
2424 ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
2425 pShareInfo->SetPageTitle(L"");
2426 pShareInfo->SetPageUrl(__currentSelectedStr);
2427 pShareInfo->SetImageAttached(false);
2428 __pPopUp->RemoveAllShareInfo();
2429 __pPopUp->AddShareInfo(pShareInfo);
2430 __pPopUp->SetShowState(true);
2435 case IDA_COPY_TEXT_CLICKED:
2437 __pWebViewer->ReleaseBlock();
2438 // need to implement
2439 //__currentSelectedStr
2440 // Sets data to a clip board item
2442 String resourcePath = App::GetInstance()->GetAppResourcePath();
2443 item.Construct(CLIPBOARD_DATA_TYPE_TEXT, __currentSelectedStr);
2445 // copying the item to clipboard
2446 Clipboard* pClipboard = Clipboard::GetInstance();
2447 if (pClipboard != null)
2449 pClipboard->CopyItem(item);
2453 case IDA_PASTE_TEXT_CLICKED:
2455 Clipboard* pClipboard = Clipboard::GetInstance();
2457 if(pClipboard == null)
2461 // Retrieves a latest item
2462 ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
2468 //Gets data from the clipboard item
2469 String* pString = dynamic_cast<String*>(pItem->GetData());
2471 if (pString != null)
2473 String idElement = __pHitElementResult->GetAttributeValue(L"id");
2474 String nameElement = __pHitElementResult->GetAttributeValue(L"name");
2475 String tagElement = __pHitElementResult->GetTagName();
2476 AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
2479 if(idElement.GetLength() != 0)
2481 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; } } ";
2482 script.Append("insertAtCursor('");
2483 script.Append(idElement);
2484 script.Append("',");
2485 script.Append("\"");
2486 script.Append(*pString);
2487 script.Append("\");");
2489 else if (nameElement.GetLength() != 0)
2491 script = L"function insertAtCursor(myField, myValue) { if (document.selection) { document.getElementByName(myField)[0].focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { document.getElementByName(myField)[0].value += myValue; } } ";
2492 script.Append("insertAtCursor(document.getElementsByName('");
2493 script.Append(nameElement);
2494 script.Append("')[0],");
2495 script.Append("\"");
2496 script.Append(*pString);
2497 script.Append("\");");
2499 else//adding for twitter post page
2501 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; } } ";
2502 script.Append("insertAtCursor(document.getElementsByTagName('");
2503 script.Append(tagElement);
2504 script.Append("')[0],");
2505 script.Append("\"");
2506 script.Append(*pString);
2507 script.Append("\");");
2509 AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
2510 String* pStr = __pWebViewer->EvaluateJavascriptN(script);
2521 case IDA_GO_FORWARD:
2526 case IDA_REFRESH_BTN_CLICKED:
2528 __isLoadingCompleted = false;
2529 __isLoadingData = true;
2530 __progressPercentage = 0;
2531 __displayUrl = __pFooterUrlField->GetText();
2533 String url = __pFooterUrlField->GetText();
2534 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
2536 if (__pWebViewer != null && __pAddressbar != null)
2538 __pWebViewer->Reload();
2539 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
2543 UpdateProgressBitmap();
2546 case IDA_STOP_BTN_CLICKED:
2548 __isLoadingCompleted = false;
2549 __isLoadingData = false;
2550 __progressPercentage = 0;
2551 __pFooterUrlField->HideKeypad();
2552 __displayUrl = __pFooterUrlField->GetText();
2556 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2557 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
2558 __pWebViewer->StopLoading();
2559 RequestRedraw(true);
2562 UpdateProgressBitmap();
2567 if (__pFooterUrlField->GetText().IsEmpty() == false)
2569 //__displayUrl = __pUrlField->GetText();
2570 __pFooterUrlField->Clear();
2575 case IDA_READER_BTN_CLICKED:
2586 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
2588 result r = E_FAILURE;
2589 if(__pImageMenu && __pImageMenu->GetShowState() == true)
2591 AppLog("Hiding the menu");
2592 __pImageMenu->SetShowState(false);
2594 if (__pWebViewer && __pWebViewer->CanGoBack())
2596 __pWebViewer->GoBack();
2598 else if(__pWindowInfo->isJavascriptInitiated == false)
2601 pApp = UiApp::GetInstance();
2604 RemoveOrientationEventListener(*this);
2608 __pAddressbar->SetAddressbarEventListener(null);
2613 __pWebViewer->RemoveTouchEventListener(*this);
2614 __pWebViewer->SetWebUiEventListenerF(null);
2615 __pWebViewer->SetWebKeypadEventListener(null);
2616 __pWebViewer->SetTextSearchListener(null);
2617 __pWebViewer->SetLoadingListener(null);
2619 r = pApp->Terminate();
2622 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2630 WindowInfo* pWindowInfo = null;
2632 SceneManager* pSceneManager = SceneManager::GetInstance();
2633 if (pSceneManager == null)
2637 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
2638 if (pAllWindowList == NULL)
2640 pApp = UiApp::GetInstance();
2643 RemoveOrientationEventListener(*this);
2647 __pAddressbar->SetAddressbarEventListener(null);
2652 __pWebViewer->RemoveTouchEventListener(*this);
2653 __pWebViewer->SetWebUiEventListenerF(null);
2654 __pWebViewer->SetWebKeypadEventListener(null);
2655 __pWebViewer->SetTextSearchListener(null);
2656 __pWebViewer->SetLoadingListener(null);
2658 r = pApp->Terminate();
2661 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2666 if (pAllWindowList != null)
2668 totalCount = pAllWindowList->GetCount();
2670 for (int count = 0; count < totalCount; count++)
2672 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
2673 if (pWindowInfo == null)
2675 pApp = UiApp::GetInstance();
2678 RemoveOrientationEventListener(*this);
2682 __pAddressbar->SetAddressbarEventListener(null);
2687 __pWebViewer->RemoveTouchEventListener(*this);
2688 __pWebViewer->SetWebUiEventListenerF(null);
2689 __pWebViewer->SetWebKeypadEventListener(null);
2690 __pWebViewer->SetTextSearchListener(null);
2691 __pWebViewer->SetLoadingListener(null);
2693 r = pApp->Terminate();
2696 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2703 if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
2705 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
2708 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2711 r = pAllWindowList->RemoveAt(count, true);
2712 __pWindowInfo = null;
2715 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2720 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
2724 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
2726 if (pWindowInfo == null)
2728 pApp = UiApp::GetInstance();
2731 RemoveOrientationEventListener(*this);
2735 __pAddressbar->SetAddressbarEventListener(null);
2740 __pWebViewer->RemoveTouchEventListener(*this);
2741 __pWebViewer->SetWebUiEventListenerF(null);
2742 __pWebViewer->SetWebKeypadEventListener(null);
2743 __pWebViewer->SetTextSearchListener(null);
2744 __pWebViewer->SetLoadingListener(null);
2746 r = pApp->Terminate();
2752 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
2755 AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
2767 MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
2768 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
2771 AppLog("MainForm::OnSceneActivatedN called");
2772 String* pSelectedScene = NULL;
2773 Object* pValue = NULL;
2774 String* pUrl = null;
2775 MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
2776 pSelectedScene = (String*) pValue;
2778 if (pSelectedScene != null)
2780 delete pSelectedScene;
2782 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
2783 String* selectedSceneID = new(std::nothrow) String(currentSceneId);
2784 AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
2785 AppLogDebug("selected scene id is %ls", currentSceneId.GetPointer());
2787 // setting the current scene ID
2788 MultipleWindowPresentationModel::GetInstance()->SetCurrentSceneID(currentSceneId);
2790 MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, (Object*) selectedSceneID);
2792 if(pArgs != null && pArgs->GetCount() > 0 && pArgs->GetCount() == 2)
2794 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2795 if(__pWindowInfo == null)
2797 // if(__pWindowInfo == null)
2799 pUrl = dynamic_cast< String* >(pArgs->GetAt(1));
2802 else if ( pArgs != null && pArgs->GetCount() == 1)
2804 __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
2810 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
2812 // hiding the address bar
2813 // __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
2814 __pAddressbar->SetShowState(false);
2815 // if(__pWebViewer != null)
2817 // __pWebViewer->Resume();
2820 if(pUrl != null && pUrl->GetLength() > 0)
2824 else if(__pWindowInfo != null)
2826 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)
2828 LoadUrl(__pWindowInfo->pageUrl);
2830 else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
2832 LoadUrl(__pWindowInfo->pageUrl);
2834 else if (__pWindowInfo->isJavascriptInitiated == true)
2838 __pWindowInfo->pCurrentWeb = __pWebViewer;
2842 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
2843 AppLog("Homepage Value in Onsceneactivated is %ls",homePage.GetPointer());
2844 if(homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
2846 InitMostVisitedSitesView(GetOrientationStatus());
2848 else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
2850 if(__pMostVisitedListView != null)
2852 __pMostVisitedListView->SetShowState(false);
2856 if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
2858 String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
2860 if (pBookmarkUrl == null)
2862 AppLogDebug("bookmarkUrl = %ls",pBookmarkUrl->GetPointer());
2863 //__pAddressbar->SetUrl(*pBookmarkUrl);
2864 SetUrl(*pBookmarkUrl);
2866 if (__pWebViewer != null && homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) != 0)
2867 __pWebViewer->LoadUrl(*pBookmarkUrl);
2868 delete pBookmarkUrl;
2871 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
2872 Bitmap* pBitmap = null;
2873 if (isPrivateBrowsing == true)
2875 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON);
2877 if (__pWebViewer != null)
2879 __pWebViewer->SetPrivateBrowsingEnabled(true);
2882 if (__pAddressbar != null)
2884 // __pAddressbar->UpdateFaviconBitmap(true);
2890 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF);
2892 if (__pWebViewer != null)
2894 __pWebViewer->SetPrivateBrowsingEnabled(false);
2897 if (__pAddressbar != null)
2899 // __pAddressbar->UpdateFaviconBitmap(false);
2903 if (__pOptionMenu != null && __pOptionMenu->GetItemCount() != 9)
2905 __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2907 else if (__pOptionMenu != null )
2909 __pOptionMenu->SetItemAt(5,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap);
2912 if (pBitmap != null)
2917 RelayoutControls(false);
2918 AppLog("ABC: OnSceneActivatedN started exit");
2923 MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
2924 const Tizen::Ui::Scenes::SceneId& nextSceneId)
2926 Canvas* pWebCanvas = null;
2927 if (__pWebViewer != null)
2929 pWebCanvas = __pWebViewer->GetCanvasN();
2932 if (pWebCanvas == null)
2936 if (__pWindowInfo != null)
2938 if (__pWindowInfo->pWebCanvasBitmap != null)
2940 delete __pWindowInfo->pWebCanvasBitmap;
2942 __pWindowInfo->pWebCanvasBitmap = new(std::nothrow) Bitmap();
2943 result r = __pWindowInfo->pWebCanvasBitmap->Construct(*pWebCanvas,Rectangle(0,0,pWebCanvas->GetBounds().width,pWebCanvas->GetBounds().height));
2944 AppLog("Bitmap Construction result %s",GetErrorMessage(r));
2946 Bitmap* pBitmap = GetCapturedBitmapN();
2947 AppLog("Coming here");
2948 Canvas* pCanvas = new(std::nothrow) Canvas();
2949 pCanvas->Construct(GetClientAreaBounds());
2952 pCanvas->DrawBitmap(Point(0,0),*pBitmap);
2955 if(__pWebViewer != null && __pWindowInfo != null)
2956 pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
2958 WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
2959 WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
2963 __pAddressbar->SetShowState(false);
2964 AppLog("Coming here");
2968 MainForm::OnHttpAuthenticationRequestedN(const Tizen::Base::String& host,
2969 const Tizen::Base::String& realm,
2970 const Tizen::Web::Controls::AuthenticationChallenge& authentication)
2976 MainForm::OnHttpAuthenticationCanceled(void)
2981 MainForm::OnLoadingStarted(void)
2983 AppLogDebug("MainForm::OnLoadingStarted entered");
2985 if(__pAddressbar == NULL || __pWebViewer == null)
2990 // this is added in case if menu is opened and user load the page
2991 if(__pOptionMenu != null && __pOptionMenu->GetShowState() == true)
2993 __pOptionMenu->SetShowState(false);
2994 __pOptionMenu->Invalidate(true);
2999 if(__pImageMenu != null && __pImageMenu->GetShowState() == true)
3001 __pImageMenu->SetShowState(false);
3002 __pImageMenu->Invalidate(true);
3004 String url = __pWebViewer->GetUrl();
3005 if(url.Contains(IDS_TIZEN_SERVICE))
3008 String delim(L":;,");
3010 // Creates a StringTokenizer instance
3011 StringTokenizer strTok(url, delim);
3013 int count = strTok.GetTokenCount(); // count == 4
3015 HashMap *pMap = new HashMap();
3020 while (strTok.HasMoreTokens())
3022 AppLog("Token: %ls", token.GetPointer());
3023 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3024 if(token.Contains(IDS_APPID))
3026 token.SubString(6, appId);
3027 AppLog("AppID:%ls", appId.GetPointer());
3029 else if(token.Contains(IDS_KEY))
3031 token.SubString(4, key);
3032 AppLog("key:%ls", key.GetPointer());
3034 else if(token.Contains(IDS_VALUE))
3036 token.SubString(6, value);
3037 AppLog("value:%ls", value.GetPointer());
3040 pMap->Add(key, value);
3044 AppControl *pAppControl = null;
3045 String operationId = L"http://tizen.org/appcontrol/operation/main";
3046 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
3049 AppLog("Starting AppControl");
3050 result r = pAppControl->Start(null, null, pMap, null);
3051 AppLog("Result of Start %s", GetErrorMessage(r));
3055 AppLogException("AppControl not found");
3060 if ( __pAddressbar != null && __pAddressbar->GetShowState() == true)
3062 __pAddressbar->SetShowState(false);
3063 AddressBarCancelledClicked(*__pAddressbar);
3064 __pAddressbar->Invalidate(true);
3066 Bitmap* pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
3069 __pAddressbar->SetFaviconBitmap(*pBitmap);
3072 if (__adressPanelPosition.y < (0 - __pAddressbar->GetHeight() + 12))
3074 // updating the address bar position with respect to web control
3075 __adressPanelPosition.y = 0 - __pAddressbar->GetHeight() + 12; //-12 is for the progress label
3076 __distanceMoved = 0;
3080 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3081 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3082 if (__pWebViewer != null)
3084 AppLog("MainForm::OnLoadingStarted __pWebViewer->GetUrl() %ls",__pWebViewer->GetUrl().GetPointer());
3085 //__pAddressbar->SetUrl(__pWebViewer->GetUrl());
3086 SetUrl(__pWebViewer->GetUrl());
3087 if (__pWindowInfo != NULL)
3089 // resetting the page title to blank, it will be received in OnPageTitleReceived()
3090 __pWindowInfo->pageTitle = L"";
3091 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3093 __pAddressbar->Invalidate(true);
3099 MainForm::OnLoadingCanceled(void)
3106 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
3108 AppLog("XYZ::MainForm::OnKeypadWillOpen");
3113 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
3115 AppLog("XYZ::MainForm::OnKeypadOpened");
3116 __isKeypadOpened = true;
3117 __pFooterPanel->SetShowState(false);
3122 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
3124 AppLog("XYZ::MainForm::OnKeypadClosed");
3125 __isKeypadOpened = false;
3126 __pFooterPanel->SetShowState(true);
3127 RelayoutControls(true);
3131 MainForm::OnKeypadBoundsChanged(Tizen::Ui::Control &source)
3133 AppLog("XYZ::KeypadBoundsChanged");
3134 RelayoutControls(false);
3138 MainForm::OnLoadingErrorOccurred(LoadingErrorType error,
3139 const Tizen::Base::String& reason)
3141 AppLogDebug("Error: %d, %ls", error, reason.GetPointer());
3145 MainForm::OnLoadingCompleted(void)
3147 AppLog("MainForm::OnLoadingCompleted start");
3149 result r = E_SUCCESS;
3151 if (__pWebViewer == null)
3156 if (__pAddressbar == null)
3161 if(__pImageMenu && __pImageMenu->GetShowState())
3163 __pImageMenu->SetShowState(false);
3164 __pImageMenu->Invalidate(true);
3167 if (__pWebViewer->CanGoForward())
3169 //__pAddressbar->SetForwardButtonEnabled(true);
3170 SetForwardButtonEnabled(true);
3174 //__pAddressbar->SetForwardButtonEnabled(false);
3175 SetForwardButtonEnabled(false);
3178 /*if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3180 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3182 //__pAddressbar->UpdateProgress(0);
3186 if(GetAddressbarMode() != ADDRESSBAR_MODE_EDIT)
3188 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3192 AppLog("PrivateBrowsing %d",__pWebViewer->IsPrivateBrowsingEnabled());
3193 bool isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
3194 if (isPrivateBrowsing == false)
3196 if(__pHistory != null)
3202 __pHistory = new(std::nothrow) History;
3203 HistoryPresentationModel::GetCurrentDateTime(date);
3206 __pHistory->SetHistoryTitle(__pWindowInfo->pageTitle);
3207 AppLogDebug("MainForm::OnLoadingCompleted pagetitle = %ls", __pWindowInfo->pageTitle.GetPointer());
3209 __pHistory->SetHistoryUrl(__pWindowInfo->pageUrl);
3210 AppLogDebug("MainForm::OnLoadingCompleted pageUrl = %ls", __pWindowInfo->pageUrl.GetPointer());
3212 __pHistory->SetVisitedTime(date);
3214 if (__pWebViewer != null)
3216 AppLog("MainForm::OnLoadingCompleted setting the fav icon 0");
3218 Bitmap* pTempBitmap = __pWebViewer->GetFaviconN();
3219 if (pTempBitmap != null)
3221 AppLog("MainForm::OnLoadingCompleted setting the fav icon 1");
3222 __pHistory->SetFavIconBitmap(*pTempBitmap);
3225 AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
3228 Canvas* pCanvas = __pWebViewer->GetCanvasN();
3229 Bitmap* pBitmap = new(std::nothrow) Bitmap();
3230 if ( pCanvas != null && pCanvas != null && pBitmap != null)
3232 pBitmap->Construct(*pCanvas, pCanvas->GetBounds());
3233 pBitmap->Scale(Dimension(pBitmap->GetWidth()/4, pBitmap->GetHeight()/4));
3234 __pHistory->SetThumbnail(pBitmap);
3236 Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
3239 __pHistory->SetFavIconBitmap(*pFavIcon);
3243 HistoryPresentationModel::GetInstance()->SaveTempHistory(*__pHistory);
3250 // if (__pWindowInfo && __pWindowInfo->faviconUrl == "")
3252 // temperary fixed (webpage can be not loaded)
3256 bool isReaderEnabled = SettingPresentationModel::GetInstance()->IsRunReaderEnabled();
3257 if (isReaderEnabled == true)
3261 delete __pReaderData;
3262 __pReaderData = null;
3264 String filePath = Tizen::App::UiApp::GetInstance()->GetAppRootPath();
3265 filePath.Append(L"data/reader.js");
3271 result r = E_SUCCESS;
3272 FileAttributes attr;
3274 File::GetAttributes(filePath,attr);
3276 r = file.Construct(filePath, L"r+");
3279 AppLogDebug("File construct failed with %s", GetErrorMessage(r));
3282 char* pScript = new(std::nothrow) char[attr.GetFileSize()+1];
3285 AppLogDebug("Memory allocation for file failed %s", GetErrorMessage(r));
3288 // file.Read(pScript,attr.GetFileSize());
3290 // AppLogDebug("scipt length %d",strlen(pScript));
3291 String strScript = L"";
3292 // strScript.Append(pScript);
3293 // for(int i=0; i<25; i++)
3295 file.Read(pScript,attr.GetFileSize());
3296 // AppLog("xyzz tell %d",file.Tell());
3297 // r = strScript.Append(pScript);
3298 // AppLog("xyzz append result %s",GetErrorMessage(r));
3299 // AppLog("xyzz strScript length %d",strScript.GetLength());
3301 // AppLog("xyzz final strScript length %d",strScript.GetLength());
3303 __pReaderData = __pWebViewer->EvaluateJavascriptN(pScript);
3304 if (__pReaderData == null)
3306 AppLog("MainScene::data is null Error :%s",GetErrorMessage(GetLastResult()));
3307 __pReaderData = new String(L"<meta name=\"viewport\" content=\"width=0, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi\"> <h1>Chinese PM Li Keqiang vows to open up markets to India</h1><div><span class=\"arttle\"><h1>Chinese PM Li Keqiang vows to open up markets to India</h1></span></div>");
3310 AppLogDebug("evaluateJavascript result %s , __pReaderData %ls",GetErrorMessage(GetLastResult()),__pReaderData->GetPointer());
3311 if (__pReaderData->CompareTo(L"undefined") != 0 && __pReaderData->CompareTo(L"") != 0)
3313 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3314 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_READER);
3320 AppLog("MainForm::OnLoadingCompleted done");
3324 MainForm::OnEstimatedProgress(int progress)
3326 AppLogDebug("MainForm::OnEstimatedProgress entered");
3328 if (progress < DEFAULT_PROGRESS_PERCENTAGE)
3329 progress = DEFAULT_PROGRESS_PERCENTAGE;
3331 // __pAddressbar->UpdateProgress(progress);
3332 UpdateProgress(progress);
3335 void MainForm::OnFaviconReceived(const Tizen::Graphics::Bitmap& favicon)
3337 AppLog("MainForm::OnFaviconReceived");
3338 if (__pWebViewer != null && __pHistory != null && __pWindowInfo != null && (__pWindowInfo->pageUrl.CompareTo(__pHistory->GetHistoryUrl()) == 0))
3340 Bitmap* favIcon = __pWebViewer->GetFaviconN();
3343 HistoryPresentationModel::GetInstance()->UpdateHistoryFavIcon(*__pHistory, *favIcon);
3350 MainForm::OnUrlValueChanged(Addressbar&)
3356 MainForm::OnUrlSubmitted(Addressbar& addBar)
3358 AppLog("MainForm::OnUrlSubmitted");
3359 String url = addBar.GetUrl();
3360 AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
3362 if(__pFooterUrlField)
3363 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
3364 AddressBarCancelledClicked(*__pAddressbar);
3369 MainForm::LoadUrl(String& url)
3373 // UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3374 AppLogDebug("MainForm::LoadUrl enter");
3376 if (__pWebViewer != null)
3378 __pWebViewer->SetShowState(true);
3379 __pWebViewer->Invalidate(true);
3382 if (url.CompareTo(L"") == 0)
3386 if(__pFooterPanel != null)
3388 __pFooterPanel->SetShowState(true);
3389 __pFooterPanel->Invalidate(true);
3396 String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");
3397 String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9!\+-=:#@%/;$~()_?\\\.&]{2,}$"); // URL of type abc.com (i.e without protocol in front of it)
3399 RegularExpression firstRegex;
3400 RegularExpression secondRegex;
3402 firstRegex.Construct(firstPattern, REGEX_CASELESS);
3403 secondRegex.Construct(secondPattern, REGEX_CASELESS);
3406 ret = firstRegex.Match(url, false); // This returns true value
3407 flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it)
3409 if (ret == true && __pWebViewer != null)
3412 __pWebViewer->LoadUrl(url);
3414 else if(__pWebViewer != null)
3416 String tempUrl = L"http://";
3417 tempUrl.Append(url);
3421 __pWebViewer->LoadUrl(tempUrl);
3425 UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
3426 __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
3429 if (__pAddressbar != null)
3431 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3432 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
3435 AppLogDebug("MainForm::LoadUrl exit");
3442 MainForm::OnFocusGained(const Tizen::Ui::Control& source)
3444 AppLog("MainForm::OnFocusGained");
3447 __pFooterPanel->SetShowState(false);
3452 __pAddressbar->SetShowState(true);
3453 __pAddressbar->SetAddressbarURLFocus();
3455 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3457 __currentSearchStr = L"";
3458 __currentWordIndex = 0;
3459 __maxOccurrances = 0;
3461 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
3463 __pFindWordEditField->SetText(L"");
3464 __pFindWordEditField->HideKeypad();
3465 __pFindWordControl->SetShowState(false);
3466 __pFindWordCountLabel->SetText(L"0/0");
3468 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
3470 __pFindWordEditFieldRightToLeft->SetText(L"");
3471 __pFindWordEditFieldRightToLeft->HideKeypad();
3472 __pFindWordControl->SetShowState(false);
3473 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
3476 __pFindWordNext->SetEnabled(false);
3477 __pFindWordPrev->SetEnabled(false);
3479 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
3480 __pFindWordControl->SetShowState(false);
3482 RelayoutControls(false);
3486 MainForm::OnFocusLost(const Tizen::Ui::Control& source)
3488 AppLog("MainForm::OnFocusLost called");
3492 MainForm::OnStopClicked(Addressbar& addBar)
3494 AppLogDebug("MainForm::OnStopClicked called");
3497 //__pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3498 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
3499 __pWebViewer->StopLoading();
3500 RequestRedraw(true);
3505 MainForm::OnBackClicked(/*const Addressbar& addBar*/)
3507 // AppLog("MainForm::OnBackClicked");
3508 result r = E_FAILURE;
3509 if(__pImageMenu && __pImageMenu->GetShowState() == true)
3511 AppLog("Hiding the menu");
3512 __pImageMenu->SetShowState(false);
3515 if (__pWebViewer && __pWebViewer->CanGoBack())
3517 __pWebViewer->GoBack();
3519 else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
3522 pApp = UiApp::GetInstance();
3526 RemoveOrientationEventListener(*this);
3530 __pAddressbar->SetAddressbarEventListener(null);
3535 __pWebViewer->RemoveTouchEventListener(*this);
3536 __pWebViewer->SetWebUiEventListenerF(null);
3537 __pWebViewer->SetWebKeypadEventListener(null);
3538 __pWebViewer->SetTextSearchListener(null);
3539 __pWebViewer->SetLoadingListener(null);
3543 r = pApp->Terminate();
3546 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3554 WindowInfo* pWindowInfo = null;
3556 SceneManager* pSceneManager = SceneManager::GetInstance();
3557 if (pSceneManager == null)
3561 ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
3562 if (pAllWindowList == NULL)
3564 pApp = UiApp::GetInstance();
3567 RemoveOrientationEventListener(*this);
3571 __pAddressbar->SetAddressbarEventListener(null);
3576 __pWebViewer->RemoveTouchEventListener(*this);
3577 __pWebViewer->SetWebUiEventListenerF(null);
3578 __pWebViewer->SetWebKeypadEventListener(null);
3579 __pWebViewer->SetTextSearchListener(null);
3580 __pWebViewer->SetLoadingListener(null);
3584 r = pApp->Terminate();
3587 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3592 if (pAllWindowList != null)
3594 totalCount = pAllWindowList->GetCount();
3596 for (int count = 0; count < totalCount; count++)
3598 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
3599 if (pWindowInfo == null)
3601 pApp = UiApp::GetInstance();
3604 RemoveOrientationEventListener(*this);
3608 __pAddressbar->SetAddressbarEventListener(null);
3613 __pWebViewer->RemoveTouchEventListener(*this);
3614 __pWebViewer->SetWebUiEventListenerF(null);
3615 __pWebViewer->SetWebKeypadEventListener(null);
3616 __pWebViewer->SetTextSearchListener(null);
3617 __pWebViewer->SetLoadingListener(null);
3621 r = pApp->Terminate();
3624 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3629 if (pSceneManager != null && pWindowInfo != null && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
3631 r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
3634 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3637 r = pAllWindowList->RemoveAt(count, true);
3638 __pWindowInfo = null;
3641 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3646 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1));
3648 else if(pAllWindowList->GetCount() > 0)
3650 pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
3654 pApp = UiApp::GetInstance();
3657 RemoveOrientationEventListener(*this);
3661 __pAddressbar->SetAddressbarEventListener(null);
3666 __pWebViewer->RemoveTouchEventListener(*this);
3667 __pWebViewer->SetWebUiEventListenerF(null);
3668 __pWebViewer->SetWebKeypadEventListener(null);
3669 __pWebViewer->SetTextSearchListener(null);
3670 __pWebViewer->SetLoadingListener(null);
3674 r = pApp->Terminate();
3679 if (pWindowInfo == null)
3681 pApp = UiApp::GetInstance();
3684 RemoveOrientationEventListener(*this);
3688 __pAddressbar->SetAddressbarEventListener(null);
3693 __pWebViewer->RemoveTouchEventListener(*this);
3694 __pWebViewer->SetWebUiEventListenerF(null);
3695 __pWebViewer->SetWebKeypadEventListener(null);
3696 __pWebViewer->SetTextSearchListener(null);
3697 __pWebViewer->SetLoadingListener(null);
3701 r = pApp->Terminate();
3707 r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
3710 AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
3724 MainForm::OnForwardClicked(/*const Addressbar& addBar*/)
3726 AppLog("MainForm::OnForwardClicked");
3727 if (__pWebViewer == null)
3730 if (__pWebViewer->CanGoForward())
3732 __pWebViewer->GoForward();
3737 MainForm::OnAddressBarFocusGained(const Addressbar& addBar)
3739 AppLog("XYZ::MainForm::OnAddressBarFocusGained");
3740 if(__pFooterPanel != null)
3742 __pFooterPanel->SetShowState(false);
3745 if (__pAddressbar != null && __pAddressbar->GetShowState() == false)
3747 __pAddressbar->SetShowState(true);
3748 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3751 RelayoutControls(false);
3755 MainForm::OnAddressBarFocusLost(const Addressbar& addBar, bool addressbarKeyPadState)
3757 AppLog("XYZ::MainForm::OnAddressBarFocusLost");
3759 int Height = GetClientAreaBounds().height;
3760 AppLog("MainForm::OnAddressBarFocusLost height is %d",Height);
3762 RelayoutControls(false);
3766 MainForm::OnAddressCancelledClicked(const Addressbar& addBar)
3768 AddressBarCancelledClicked(addBar);
3772 MainForm::OnAddressBarModeChanged(/*const Addressbar& addBar*/)
3774 __prevAddressBarMode = __curAddressBarMode;
3776 if (__pAddressbar != null)
3778 __curAddressBarMode = GetAddressbarMode();
3781 if (__curAddressBarMode == ADDRESSBAR_MODE_EDIT)
3783 __adressPanelPosition.y = 0;
3784 if (__pAddressbar != null)
3786 __webControlPosition.y = __pAddressbar->GetHeight() - 12;
3787 __pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
3788 __pAddressbar->Invalidate(true);
3790 if (__pWebViewer != null)
3792 __pWebViewer->StopLoading();
3795 else if(__curAddressBarMode == ADDRESSBAR_MODE_LOADING)
3797 __adressPanelPosition.y = 0;
3798 if (__pAddressbar != null)
3800 __webControlPosition.y = 0;
3801 __pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
3802 __pAddressbar->Invalidate(true);
3808 MainForm::OnClipboardClosed(const Addressbar& addBar)
3810 AppLog("XYZ::MainForm::OnClipboardClosed");
3811 RelayoutControls(false);
3815 MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
3817 AppLog("XYZ::MainForm::OnAddressBarKeypadClosed");
3818 if (__pFooterPanel && __pAddressbar->GetShowState() == false)
3820 AppLog("akjshdasd 3");
3821 __pFooterPanel->SetShowState(true);
3824 RelayoutControls(false,footerState);
3828 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
3830 AppLog("XYZ::MainForm::OnAddressBarKeypadOpened");
3831 RelayoutControls(false);
3835 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
3837 __pFooterPanel->SetShowState(false);
3841 MainForm::OnAddressBarKeypadBoundsChanged(const Addressbar& addBar)
3843 AppLog("XYZ::MainForm::OnAddressBarKeypadBoundsChanged");
3844 RelayoutControls(false);
3848 MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
3850 AppLog("MainForm::OnPageTitleReceived %ls",title.GetPointer());
3853 __pWindowInfo->pageTitle = title;
3854 if (__pWebViewer != null)
3856 __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
3859 if (__pAddressbar != null && __pWebViewer != null)
3861 SetUrl(__pWebViewer->GetUrl());
3862 __pAddressbar->Invalidate(true);
3867 MainForm::UpdateFavicon(void)
3869 bool urlImageType = false;
3870 String *tempPath = null;
3872 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();");
3873 Bitmap* pBitmap = null;
3875 if (tempPath && tempPath->GetLength() > 0 && tempPath->CompareTo(L"undefined") != 0)
3877 if (__pWindowInfo != null)
3880 url.SetUri(*tempPath);
3881 if (url.GetHost().GetLength() == 0)
3884 webUrl.SetUri(__pWebViewer->GetUrl());
3885 result r = url.SetHost(webUrl.GetHost());
3892 if (url.GetScheme().GetLength() == 0)
3895 webUrl.SetUri(__pWebViewer->GetUrl());
3896 url.SetScheme(webUrl.GetScheme());
3898 __pWindowInfo->faviconUrl = url.ToString();
3900 pBitmap = __pWebViewer->GetFaviconN();
3902 if (pBitmap != null)
3904 if (__pWindowInfo->pFavicon != NULL)
3906 __pWindowInfo->pFavicon = null;
3908 __pWindowInfo->pFavicon = new(std::nothrow) Bitmap();
3909 __pWindowInfo->pFavicon->Construct(*pBitmap,Rectangle(0,0,pBitmap->GetWidth(),pBitmap->GetHeight()));
3911 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3913 FaviconManager::GetInstance()->SaveFavicon(*__pWindowInfo->pFavicon, __pWindowInfo->faviconUrl);
3915 else if(__pWindowInfo->pFavicon != null)
3917 __pAddressbar->SetFaviconBitmap(*__pWindowInfo->pFavicon);
3921 Bitmap *pDefaultBmp = FaviconManager::GetInstance()->GetDefaultFaviconN();
3922 if(pDefaultBmp != null)
3924 __pAddressbar->SetFaviconBitmap(*pDefaultBmp);
3938 if(tempPath != null)
3942 AppLogDebug("Error occured: %s", GetErrorMessage(GetLastResult()));
3948 MainForm::OnLoadingRequested(const Tizen::Base::String& url,
3949 Tizen::Web::Controls::WebNavigationType type)
3951 AppLog("urlk %ls",url.GetPointer());
3952 // when load new page if find word panel is open its show state is false
3953 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
3955 __currentSearchStr = L"";
3956 __currentWordIndex = 0;
3957 __maxOccurrances = 0;
3958 __pFindWordEditField->SetText(L"");
3959 __pFindWordNext->SetEnabled(false);
3960 __pFindWordPrev->SetEnabled(false);
3961 __pFindWordCountLabel->SetText(L"0/0");
3962 __pFindWordControl->SetShowState(false);
3963 __pFindWordEditField->HideKeypad();
3964 RelayoutControls(false);
3967 __pFooterPanel->Invalidate(true);
3970 uriInfo.SetUri(url);
3972 if(url.Contains(IDS_TIZEN_SERVICE))
3975 String delim(L":;,");
3977 // Creates a StringTokenizer instance
3978 StringTokenizer strTok(url, delim);
3980 int count = strTok.GetTokenCount(); // count == 4
3982 HashMap *pMap = new HashMap();
3988 while (strTok.HasMoreTokens())
3990 AppLog("Token: %ls", token.GetPointer());
3991 strTok.GetNextToken(token); // Tizen, StringTokenizer, Sample, code
3992 if(token.Contains(IDS_APPID))
3994 token.SubString(6, appId);
3995 AppLog("AppID:%ls", appId.GetPointer());
3997 else if(token.Contains(IDS_KEY))
3999 token.SubString(4, key);
4000 AppLog("key:%ls", key.GetPointer());
4002 else if(token.Contains(IDS_VALUE))
4004 token.SubString(6, value);
4005 AppLog("value:%ls", value.GetPointer());
4008 pMap->Add(key, value);
4012 AppControl *pAppControl = null;
4013 String operationId = L"http://tizen.org/appcontrol/operation/main";
4014 pAppControl = dynamic_cast<AppControl*>(AppManager::FindAppControlN(appId, operationId));
4017 result r = pAppControl->Start(null, null, pMap, null);
4021 AppLogException("AppControl not found");
4031 MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
4032 const Tizen::Net::Http::HttpHeader& httpHeader)
4034 return Tizen::Web::Controls::WEB_DECISION_CONTINUE;
4038 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
4040 if(__isLongPressedDone == false)
4042 AppLog("MainForm::OnWebPageBlockSelected");
4043 if (__pHitElementResult != null)
4045 delete __pHitElementResult;
4046 __pHitElementResult = null;
4049 if (__pWebViewer != null)
4051 AppLog("MainForm::OnWebPageBlockSelected web not null");
4052 __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
4054 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
4056 AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
4057 __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
4058 if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
4060 __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
4062 AppLog("datafirst endpoint error %s",GetErrorMessage(GetLastResult()));
4066 if (__pHitElementResult == null)
4071 if (__pHitElementResult->HasImage() != true)
4073 String tagName = __pHitElementResult->GetTagName();
4074 String type = __pHitElementResult->GetAttributeValue("type");
4077 AppLog("TagName %ls",tagName.GetPointer());
4078 __currentSelectedStr.Clear();
4079 AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
4080 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4081 AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
4083 if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
4085 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4087 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
4088 __pImageMenu->SetShowState(true);
4089 __pImageMenu->Show();
4090 __pImageMenu->Invalidate(true);
4092 else /*if(__isLongPressedDone == true)*/
4094 AppLog("MainForm::OnWebPageBlockSelected no paste option");
4096 if(__pHitElementResult->GetUrl().GetLength() > 0)
4098 __currentSelectedStr.Clear();
4099 __currentSelectedStr = __pHitElementResult->GetUrl();
4101 InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
4102 __pImageMenu->SetShowState(true);
4103 __pImageMenu->Show();
4104 __pImageMenu->Invalidate(true);
4107 AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
4108 AppLog("MainForm::OnWebPageBlockSelected tag name is %ls",tagName.GetPointer());
4109 AppLog("MainForm::OnWebPageBlockSelected type name is %ls",type.GetPointer());
4115 MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source)
4121 MainForm::OnWebWindowCreateRequested(void)
4123 WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
4125 if (pNewWindowInfo == null)
4129 result r = E_SUCCESS;
4130 SceneManager* pSceneManager = SceneManager::GetInstance();
4131 if (pSceneManager == NULL)
4135 ArrayList* pArgList = new(std::nothrow) ArrayList();
4136 if (pArgList == NULL)
4140 r = pArgList->Construct();
4143 pNewWindowInfo->isJavascriptInitiated = true;
4144 pArgList->Add(*pNewWindowInfo);
4145 r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
4149 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
4156 return pNewWindowInfo->pCurrentWeb;
4160 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
4162 AppLog("xyz:: MainForm::RelayoutControls called");
4163 __webControlPosition.y = 0;
4164 __webControlHeight = GetClientAreaBounds().height;
4165 AppLog("Client area height: %d", __webControlHeight);
4167 AppLog("Client area height: %d", __webControlHeight);
4168 if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
4170 __webControlPosition.y += __pAddressbar->GetHeight();
4171 __webControlHeight -= __pAddressbar->GetHeight();
4172 __pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
4174 else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
4176 __webControlPosition.y += __pFindWordControl->GetHeight();
4177 __webControlHeight -= __pFindWordControl->GetHeight();
4178 __pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
4181 if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true && relayoutFooter == true)
4183 __webControlHeight -= __pFooterPanel->GetHeight();
4185 __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
4187 if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
4189 if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight + 12 )
4194 __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight + 12);
4195 AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
4196 __pWebViewer->Invalidate(false);
4199 if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
4201 __pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
4208 MainForm::ShowFindWordPanel(bool show , bool isTouchPressed)
4210 if (__pFindWordControl == null)
4215 Tizen::Locales::LocaleManager localeManager;
4216 Tizen::Locales::Locale local = localeManager.GetSystemLocale();
4218 String languageCode;
4219 result r = SettingInfo::GetValue(L"Language", languageCode);
4220 // int languagecode = local.GetLanguageCode();
4221 AppLog("rahul language is %S", languageCode.GetPointer());
4225 InitFindWordPanel();
4227 if (languageCode.CompareTo("ara") == 0)
4229 AppLog("rahul language is arabic");
4231 __pFindWordPanelLeftToRight->SetShowState(false);
4232 __pFindWordPanelRightToLeft->SetShowState(true);
4234 __pFindWordClear->SetShowState(false);
4235 // __pFindWordCountLabel->SetShowState(false);
4236 __pFindWordEditField->SetShowState(false);
4238 __pFindWordClearRightToLeft->SetShowState(true);
4239 __pFindWordCountLabelRightToLeft->SetShowState(true);
4240 __pFindWordEditFieldRightToLeft->SetShowState(true);
4244 AppLog("rahul language is not arabic");
4247 __pFindWordPanelLeftToRight->SetShowState(true);
4248 __pFindWordPanelRightToLeft->SetShowState(false);
4250 __pFindWordClear->SetShowState(true);
4251 __pFindWordCountLabel->SetShowState(true);
4252 __pFindWordEditField->SetShowState(true);
4254 __pFindWordClearRightToLeft->SetShowState(false);
4255 __pFindWordCountLabelRightToLeft->SetShowState(false);
4256 __pFindWordEditFieldRightToLeft->SetShowState(false);
4258 __pFindWordControl->SetShowState(true);
4262 if(__pFindWordControl != null)
4264 __pFindWordControl->SetShowState(false);
4268 AppLog("MainForm::ShowFindWordPanel %d",show);
4269 if (show && !isTouchPressed)
4271 if (languageCode.CompareTo("ara") == 0)
4273 if (__pFindWordEditFieldRightToLeft)
4275 __pFindWordEditFieldRightToLeft->SetFocus();
4276 __pFindWordEditFieldRightToLeft->ShowKeypad();
4281 if (__pFindWordEditField)
4283 __pFindWordEditField->SetFocus();
4284 __pFindWordEditField->ShowKeypad();
4290 if (languageCode.CompareTo("ara") == 0)
4292 if (__pFindWordEditFieldRightToLeft)
4293 __pFindWordEditFieldRightToLeft->HideKeypad();
4297 if (__pFindWordEditField)
4298 __pFindWordEditField->HideKeypad();
4302 RelayoutControls(false);
4306 MainForm::StartWordSearch()
4308 //Get the count of occurances of the word in the current page
4309 __maxOccurrances = 0;
4310 __currentWordIndex = 0;
4312 __pFindWordPrev->SetEnabled(false);
4313 String *pCountStr = null;
4314 result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
4315 AppLog("Search Result %s",GetErrorMessage(r));
4316 /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;");
4317 if (pCountStr != null)
4319 Integer::Parse(*pCountStr, 10, __maxOccurrances);
4323 AppLogDebug("'%ls' is found %d times", __currentSearchStr.GetPointer(), __maxOccurrances);
4328 void MainForm::OnTextFound(int totalCount, int currentOrdinal)
4330 AppLog("MainForm::OnTextFound totalCount %d",totalCount);
4331 AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
4333 if(totalCount == -1 || totalCount == 0)
4335 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
4336 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
4339 else if(totalCount > 100)
4341 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4342 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4346 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4347 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
4350 __maxOccurrances = totalCount;
4351 __currentWordIndex = currentOrdinal;
4353 //Reset the UI controls as per the maxOccurrance value
4354 if (totalCount <= 0)
4356 AppLog("Word not found");
4357 //Show error notification to user
4358 __pFindWordNext->SetEnabled(false);
4359 if(__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4361 __pFindWordCountLabel->SetText(L"0/0");
4362 __pFindWordCountLabel->Invalidate(false);
4364 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4366 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4367 __pFindWordCountLabelRightToLeft->Invalidate(false);
4369 __pFindWordNext->Invalidate(false);
4370 __pFindWordPrev->Invalidate(false);
4375 if (totalCount == 1)
4377 __pFindWordNext->SetEnabled(false);
4381 __pFindWordNext->SetEnabled(true);
4384 String countStr = L"";
4385 countStr.Append(__currentWordIndex);
4386 countStr.Append(L"/");
4387 countStr.Append(__maxOccurrances);
4388 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4390 __pFindWordCountLabel->SetText(countStr);
4391 __pFindWordCountLabel->Invalidate(false);
4392 __pFindWordCountLabel->Invalidate(false);
4394 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4396 __pFindWordCountLabelRightToLeft->SetText(countStr);
4397 __pFindWordCountLabelRightToLeft->Invalidate(false);
4398 __pFindWordCountLabelRightToLeft->Invalidate(false);
4400 //FindNextWord(true);
4401 //Update the controls
4402 __pFindWordNext->Invalidate(false);
4403 __pFindWordPrev->Invalidate(false);
4408 MainForm::FindNextWord(bool next)
4412 //if (__pWebViewer->SearchText(__currentSearchStr, true) == true)
4413 if (__pWebViewer->SearchNextAsync(true) == E_SUCCESS)
4415 if (__currentWordIndex < __maxOccurrances)
4417 __currentWordIndex++;
4423 //if (__pWebViewer->SearchText(__currentSearchStr, false) == true)
4424 if (__pWebViewer->SearchNextAsync(false) == E_SUCCESS)
4426 if(__currentWordIndex > 1)
4428 __currentWordIndex--;
4433 String countStr = L"";
4434 countStr.Append(__currentWordIndex);
4435 countStr.Append(L"/");
4436 countStr.Append(__maxOccurrances);
4438 if (__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
4440 __pFindWordCountLabel->SetText(countStr);
4441 __pFindWordCountLabel->Invalidate(false);
4443 else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
4445 __pFindWordCountLabelRightToLeft->SetText(countStr);
4446 __pFindWordCountLabelRightToLeft->Invalidate(false);
4449 if (__currentWordIndex >= __maxOccurrances)
4451 __pFindWordNext->SetEnabled(false);
4455 __pFindWordNext->SetEnabled(true);
4457 if (__currentWordIndex <= 1)
4459 __pFindWordPrev->SetEnabled(false);
4463 __pFindWordPrev->SetEnabled(true);
4465 __pFindWordPrev->Invalidate(false);
4466 __pFindWordNext->Invalidate(false);
4468 __pFindWordControl->Invalidate(true);
4472 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
4474 AppLog("xyz::MainForm::OnWebKeypadWillOpen");
4475 __isKeypadOpened = true;
4476 __pFooterPanel->SetShowState(false);
4477 // OnAddressBarKeypadOpened(*__pAddressbar);
4481 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
4483 __isKeypadOpened = true;
4484 AppLog("xyz::MainForm::OnWebKeypadOpened");
4486 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4488 __currentSearchStr = L"";
4489 __currentWordIndex = 0;
4490 __maxOccurrances = 0;
4491 __pFindWordEditField->SetText(L"");
4492 __pFindWordNext->SetEnabled(false);
4493 __pFindWordPrev->SetEnabled(false);
4494 __pFindWordCountLabel->SetText(L"0/0");
4495 __pWebViewer->SearchTextAllAsync(L"",false);
4496 __pFindWordControl->SetShowState(false);
4497 __pFindWordEditField->HideKeypad();
4501 if (__pWebViewer != null && __pFooterPanel != null)
4503 AppLog("MainForm::OnWebKeypadOpened GetClientAreaBounds().height %d ", GetClientAreaBounds().height);
4504 if(__pAddressbar != null)
4506 __pAddressbar->SetShowState(false);
4508 if(__pFindWordControl != null)
4510 __pFindWordControl->SetShowState(false);
4512 __pFooterPanel->SetShowState(false);
4513 __pWebViewer->SetBounds(Rectangle(0, 0,GetClientAreaBounds().width, GetClientAreaBounds().height));
4515 // if(__pImageMenu && __pImageMenu->GetShowState() == true)
4517 // __pImageMenu->SetAnchorPosition(Point(__pImageMenu->GetAnchorPosition().x/2,__pImageMenu->GetAnchorPosition().y/2));
4518 // AppLog("omgomgomg");
4524 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
4526 AppLog("xyz::MainForm::OnWebKeypadClosed");
4527 AppLog("akjshdasd 4");
4528 __pFooterPanel->SetShowState(true);
4529 // OnAddressBarKeypadClosed(*__pAddressbar);
4530 RelayoutControls(false);
4531 __isKeypadOpened = false;
4535 MainForm::OnWebKeypadBoundsChanged(Tizen::Web::Controls::Web& source)
4537 // RelativeLayout(false);
4538 if(__pWebViewer != null)
4540 __pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width,GetClientAreaBounds().height));
4545 MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
4547 Control* temp = const_cast< Control* >(&source);
4548 Header* pHeader = dynamic_cast< Header* >(temp);
4549 if (pHeader != null)
4551 //Header double - clicked
4552 AppLog("Header double clicked");
4554 if(__pFindWordControl)
4556 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
4557 ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
4561 AppLog("MainScene::OnTouchDoublePressed");
4565 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4567 AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
4568 if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
4570 AppLog("Returning because of more than one touch point.");
4573 __longPressPoint = currentPosition;
4575 if (__pHitElementResult != null)
4577 delete __pHitElementResult;
4578 __pHitElementResult = null;
4581 if (__pWebViewer != null)
4583 AppLog("MainForm::OnTouchLongPressed web not null");
4584 __pHitElementResult = __pWebViewer->GetElementByPointN(currentPosition);
4587 if (__pHitElementResult == null)
4592 if (__pHitElementResult->HasImage() == true)
4594 if(__pWebViewer != null)
4595 InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4596 __pImageMenu->SetShowState(true);
4597 __pImageMenu->Show();
4598 __pImageMenu->Invalidate(true);
4600 else if(__pHitElementResult->HasUrl() == true)
4602 String tempURl = __pHitElementResult->GetUrl();
4603 AppLog("tempURl is %ls", tempURl.GetPointer());
4604 const Bitmap* pBitmap = __pHitElementResult->GetImage();
4605 if (pBitmap != null)
4613 InitImageLinkContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
4614 __pImageMenu->SetShowState(true);
4615 __pImageMenu->Show();
4616 __pImageMenu->Invalidate(true);
4620 String tagName = __pHitElementResult->GetTagName();
4621 String type = __pHitElementResult->GetAttributeValue("type");
4622 String value = __pHitElementResult->GetAttributeValue(L"value");
4623 String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
4625 __currentSelectedStr.Clear();
4626 __currentSelectedStr = __pWebViewer->GetTextFromBlock();
4628 AppLog("tag name is %ls", tagName.GetPointer());
4629 AppLog("type is %ls", type.GetPointer());
4633 __isLongPressedDone = true;
4634 result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
4635 if (((tagName.CompareTo(L"INPUT") == 0) || tagName.CompareTo(L"TEXTAREA") == 0) && innerHtml.GetLength() == 0 && type.CompareTo(L"submit") !=0/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.CompareTo(L"") == 0 && r == E_INVALID_ARG)
4637 AppLog("MainForm::OnWebPageBlockSelected show paste option");
4639 InitSelectTextContextMenu(Point(currentPosition.x , currentPosition.y + __pWebViewer->GetY()),true, true);
4642 __pImageMenu->SetShowState(true);
4643 __pImageMenu->Show();
4644 __pImageMenu->Invalidate(true);
4647 AppLog("setselectionselectedornot %s",GetErrorMessage(r));
4650 // __inputEventToBeSupressed = true;
4654 MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
4656 AppLog("xyz:: MainForm::OnTouchReleased called");
4658 if (__pAddressbar && __pAddressbar->GetShowState() == true)
4660 __pAddressbar->SetShowState(false);
4662 if(__pFooterPanel && __isKeypadOpened == false)
4664 __pFooterPanel->SetShowState(true);
4668 /*HitElementResult* pHitElement = __pWebViewer->GetElementByPointN(currentPosition);
4669 if(pHitElement != null && pHitElement->HasUrl() == true && __inputEventToBeSupressed == true)
4671 __pWebViewer->ConsumeInputEvent();
4673 if(pHitElement != null)
4677 __inputEventToBeSupressed = false;*/
4681 MainForm::OnTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4688 MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4690 if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
4692 __currentSearchStr = L"";
4693 __currentWordIndex = 0;
4694 __maxOccurrances = 0;
4696 if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
4698 __pFindWordEditField->SetText(L"");
4699 __pFindWordEditField->HideKeypad();
4700 __pFindWordControl->SetShowState(false);
4701 __pFindWordCountLabel->SetText(L"0/0");
4703 else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
4705 __pFindWordEditFieldRightToLeft->SetText(L"");
4706 __pFindWordEditFieldRightToLeft->HideKeypad();
4707 __pFindWordControl->SetShowState(false);
4708 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
4711 __pFindWordNext->SetEnabled(false);
4712 __pFindWordPrev->SetEnabled(false);
4714 __pWebViewer->SearchText(L"aaaabbbbcccc",true);
4715 __pFindWordControl->SetShowState(false);
4717 AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
4718 if(__pAddressbar->GetShowState() == false)
4720 __pAddressbar->SetAddressbarURLFocus();
4721 __pFooterPanel->SetShowState(false);
4728 MainForm::OnTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4734 MainForm::OnTouchCanceled(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4740 MainForm::OnPreviewTouchPressed(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4746 MainForm::OnPreviewTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4752 MainForm::OnPreviewTouchMoved(Tizen::Ui::Control& source, const Tizen::Ui::TouchEventInfo& touchEventInfo)
4758 MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
4760 AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
4761 int widthContextItem = 0;
4762 if(__pFindWordCountLabel)
4763 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
4764 // As per the platform engineer comment removed this line
4765 /*if(__pWebViewer != null)
4767 // 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
4768 __pWebViewer->ReleaseBlock();
4771 // if(__pFindWordControl != null)
4772 // ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
4774 if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
4776 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
4778 AppLog(" Orientation landscape");
4779 __pOptionMenu->SetMaxVisibleItemsCount(5);
4783 AppLog(" Orientation potrait");
4784 __pOptionMenu->SetMaxVisibleItemsCount(6);
4787 if(__pNotification && __pNotification->GetShowState() == true)
4789 __pNotification->SetShowState(false);
4790 __pNotification->Invalidate(false);
4792 if ( __pFooterLabel != null)
4794 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
4797 __pFooterLabel->SetBackgroundBitmap(*pBitmap);
4803 if (__pFindWordBgLabel != null)
4805 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
4806 if (pBitmap != null)
4808 __pFindWordBgLabel->SetBackgroundBitmap(*pBitmap);
4813 if (__pFindWordBgLabelRightToLeft != null)
4815 Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_FINDWORD_INPUT_FIELD_BG, __pFindWordBgLabelRightToLeft->GetWidth(), __pFindWordBgLabelRightToLeft->GetHeight());
4816 if (pBitmap != null)
4818 __pFindWordBgLabelRightToLeft->SetBackgroundBitmap(*pBitmap);
4824 // if(__pOptionMenu != null)
4825 // __pOptionMenu->SetShowState(false);
4827 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
4829 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE;
4833 widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT;
4838 AppLog("__pFooterPanel->GetShowState() is true");
4840 __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
4841 __pFooterPanel->Invalidate(true);
4845 String homePage = SettingPresentationModel::GetInstance()->GetHomepage();
4846 if (homePage.CompareTo((L"IDS_BR_BODY_MOST_VISITED_SITES")) == 0)
4848 InitMostVisitedSitesView(orientationStatus);
4851 RelayoutControls(false);
4852 if (__pArticleReaderPanel != null)
4854 if (__pArticleReaderPanel->GetShowState() == true)
4856 __pArticleReaderPanel->SetBounds((GetClientAreaBounds().width - __pArticleReaderPanel->GetWidth())/2,(GetClientAreaBounds().height - __pArticleReaderPanel->GetHeight())/2, __pArticleReaderPanel->GetWidth(), __pArticleReaderPanel->GetHeight());
4858 if (__pBlankPanel != null)
4859 __pBlankPanel->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height);
4861 if (__pWebReader != null)
4863 __pWebReader->SetBounds(Rectangle(2,2, __pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight() - 96));
4865 Bitmap* pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4866 Bitmap* pSrcBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_popup_bottom_bg.9.png",__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight());
4868 if ( pBitmap != null && pSrcBitmap != null)
4870 AppLog("CreateReaderPanel ninepatchbitmap found");
4871 pBitmap->Merge(Point(0,__pArticleReaderPanel->GetHeight() - 96),*pSrcBitmap,Rectangle(0,0,pSrcBitmap->GetWidth(),pSrcBitmap->GetHeight()));
4874 __pArticleReaderLabel->SetBounds(Rectangle(__pArticleReaderPanel->GetX(),__pArticleReaderPanel->GetY(),__pArticleReaderPanel->GetWidth(),__pArticleReaderPanel->GetHeight()));
4875 __pArticleReaderLabel->SetBackgroundBitmap(*pBitmap);
4876 if (pBitmap != null)
4881 if (pSrcBitmap != null)
4890 if (__pAddressbar != null)
4892 int width = GetClientAreaBounds().width;
4893 __pAddressbar->OrientationChanged(width);
4898 MainForm::OnSettingsChange(int settingvalue)
4900 AppLogDebug("MainForm::OnSettingsChange entered");
4902 if(settingvalue == (int)REGISTRY_SETTING_HOMEPAGE)
4904 __pAddressbar->ResetGuideText();
4906 if (__pWebViewer == null)
4908 AppLogDebug("Webviewer is not initialized yet.");
4912 if (settingvalue == (int) REGISTRY_SETTING_DEFAULT_VIEW)
4914 WebSetting settings = __pWebViewer->GetSetting();
4915 if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_FIT_TO_WIDTH")) == 0)
4917 settings.SetAutoFittingEnabled(true);
4919 else if (SettingPresentationModel::GetInstance()->GetDefaultView().CompareTo((L"IDS_BR_BODY_READABLE")) == 0)
4921 settings.SetAutoFittingEnabled(false);
4923 __pWebViewer->SetSetting(settings);
4925 else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
4927 WebSetting settings = __pWebViewer->GetSetting();
4928 settings.SetJavascriptEnabled(SettingPresentationModel::GetInstance()->IsRunJavascriptEnabled());
4929 __pWebViewer->SetSetting(settings);
4931 else if (settingvalue == (int) REGISTRY_SETTING_DISPLAY_IMAGES)
4933 WebSetting settings = __pWebViewer->GetSetting();
4934 settings.SetAutoImageLoadEnabled(SettingPresentationModel::GetInstance()->IsDisplayImagesEnabled());
4935 __pWebViewer->SetSetting(settings);
4936 __pWebViewer->Reload();
4938 else if (settingvalue == (int) REGISTRY_SETTING_BLOCK_POPUP)
4940 WebSetting settings = __pWebViewer->GetSetting();
4941 settings.SetJavaScriptPopupEnabled(SettingPresentationModel::GetInstance()->IsBlockPopUp());
4942 __pWebViewer->SetSetting(settings);
4944 else if (settingvalue == (int) REGISTRY_SETTING_ACCEPT_COOKIES)
4948 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
4951 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_FORM_DATA)
4955 WebSetting settings = __pWebViewer->GetSetting();
4956 settings.SetAutoFormDataShowEnabled(SettingPresentationModel::GetInstance()->IsRememberFormData());
4957 __pWebViewer->SetSetting(settings);
4960 else if(settingvalue == (int) REGISTRY_SETTING_REMEMBER_PASSWORD)
4964 WebSetting settings = __pWebViewer->GetSetting();
4965 settings.SetAutoLoginFormFillEnabled(SettingPresentationModel::GetInstance()->IsRememberPassword());
4966 __pWebViewer->SetSetting(settings);
4969 else if (settingvalue == (int) REGISTRY_SETTING_SHOW_SECURITY_WARNINGS)
4971 WebSetting settings = __pWebViewer->GetSetting();
4972 if (SettingPresentationModel::GetInstance()->IsSecurityWarningsEnabled() == true)
4974 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_USER_CONFIRM);
4978 settings.SetCertificateErrorHandlingMode(WEB_CERTIFICATE_ERROR_HANDLING_MODE_CONTINUE);
4980 __pWebViewer->SetSetting(settings);
4982 else if (settingvalue == (int) REGISTRY_SETTING_READER_FONT_SIZE)
4986 AppLogDebug("IntMainForm fontsize Changed to %d",SettingPresentationModel::GetInstance()->GetReaderFontSize());
4987 WebSetting settings = __pWebReader->GetSetting();
4988 settings.SetFontSize(SettingPresentationModel::GetInstance()->GetReaderFontSize());
4989 __pWebReader->SetSetting(settings);
4995 MainForm::OnSettingsReset()
4999 __pWebViewer->SetCookieEnabled(SettingPresentationModel::GetInstance()->IsCookiesEnabled());
5000 __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
5005 MainForm::OnClearCache()
5007 result r = E_SUCCESS;
5009 if (__pWebViewer != NULL)
5011 r = __pWebViewer->ClearCache();
5014 AppLogDebug("Cache cleared success");
5018 AppLogDebug("Cache cleared fail");
5024 MainForm::OnClearCookie()
5026 result r = E_SUCCESS;
5028 if (__pWebViewer != NULL)
5030 __pWebViewer->ClearCookie();
5034 AppLogDebug("Cookie cleared success");
5038 AppLogDebug("Cache cleared fail");
5043 MainForm::OnClearFormData()
5045 result r = E_SUCCESS;
5047 if (__pWebViewer != NULL)
5049 __pWebViewer->ClearFormData();
5053 AppLogDebug("Cookie cleared success");
5057 AppLogDebug("Cache cleared fail");
5062 MainForm::OnClearPasswords()
5064 result r = E_SUCCESS;
5066 if (__pWebViewer != NULL)
5068 __pWebViewer->ClearLoginFormData();
5072 AppLogDebug("Cookie cleared success");
5076 AppLogDebug("Cache cleared fail");
5082 MainForm::findDistance(int x1,int y1,int x2, int y2)
5084 int deltaX = Math::Abs(x2 - x1);
5085 int deltaY = Math::Abs(y2 - y1);
5086 double num = deltaX*deltaX + deltaY*deltaY;
5092 for (i = 0; i < 20; i++)
5094 x = (((x*x)+ num)/(2*x));
5105 MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5107 AppLog("xyz:: MainForm::OnTouchPressed called");
5108 if(__pFindWordControl)
5110 AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
5111 // ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
5113 __isLongPressedDone = false;
5118 IList* pList = null;
5119 pList = touch.GetTouchInfoListN(source);
5123 int count = pList->GetCount();
5126 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5127 __touchPoint1 = pTouchInfo->position;
5129 /*if (__pAddressbar != null)
5131 if (__pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && __pAddressbar->GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5133 if (__pAddressbar->GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5135 __pAddressbar->SaveAddressbarEditText();
5137 __pAddressbar->SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5140 __pAddressbar->Invalidate(true);
5142 if (GetAddressbarMode() != ADDRESSBAR_MODE_LOADING_COMPLETE && GetAddressbarMode() != ADDRESSBAR_MODE_LOADING)
5144 if (GetAddressbarMode() == ADDRESSBAR_MODE_EDIT)
5146 //__pAddressbar->SaveAddressbarEditText();
5148 SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING_COMPLETE);
5151 else if (count == 2)
5153 AppLogDebug("MainForm::OnTouchPressed count is two");
5154 TouchInfo* pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(0));
5155 __touchPoint1 = pTouchInfo->position;
5157 pTouchInfo = static_cast<TouchInfo*>(pList->GetAt(1));
5158 __touchPoint2 = pTouchInfo->position;
5163 pList->RemoveAll(true);
5168 __pAddressbar->SetShowState(false);
5170 if(__pFooterPanel && __isKeypadOpened == false)
5172 __pFooterPanel->SetShowState(true);
5174 RelayoutControls(false);
5179 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
5181 // __currentWordIndex = 0;
5182 __isLongPressedDone = false;
5187 MainForm::MoveUiControls()
5192 MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
5194 if(&source == dynamic_cast<Control*>(__pFooterUrlField) && __pFooterUrlField != null)
5196 if(__pFooterUrlField->GetTextLength() == 0)
5198 __pFooterUrlField->SetKeypadActionEnabled(false);
5202 __pFooterUrlField->SetKeypadActionEnabled(true);
5205 if (__pFindWordEditField != null && __pFindWordEditField->GetShowState() == true)
5207 __currentSearchStr = __pFindWordEditField->GetText();
5208 if (__currentSearchStr.GetLength() > 0)
5210 __pFindWordCountLabel->SetShowState(true);
5214 // __pFindWordCountLabel->SetShowState(false);
5215 __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
5216 __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
5219 __pFindWordNext->SetEnabled(false);
5220 __pFindWordPrev->SetEnabled(false);
5221 __pFindWordNext->Invalidate(true);
5222 __pFindWordPrev->Invalidate(true);
5223 __pFindWordCountLabel->SetText(L"0/0");
5224 __pFindWordCountLabel->Invalidate(true);
5226 else if (__pFindWordEditFieldRightToLeft != null && __pFindWordEditFieldRightToLeft->GetShowState() == true)
5228 __currentSearchStr = __pFindWordEditFieldRightToLeft->GetText();
5229 if (__currentSearchStr.GetLength() > 0)
5231 __pFindWordCountLabelRightToLeft->SetShowState(true);
5235 __pFindWordCountLabelRightToLeft->SetShowState(false);
5238 __pFindWordNext->SetEnabled(false);
5239 __pFindWordPrev->SetEnabled(false);
5240 __pFindWordNext->Invalidate(true);
5241 __pFindWordPrev->Invalidate(true);
5242 __pFindWordCountLabelRightToLeft->SetText(L"0/0");
5243 __pFindWordCountLabelRightToLeft->Invalidate(true);
5245 AppLog("__currentSearchStr %ls",__currentSearchStr.GetPointer());
5246 if (__currentSearchStr.GetLength() > 0)
5252 __currentSearchStr = L"aaaaaaaabbbbbbbccccccc";
5254 __currentSearchStr = L"";
5255 AppLogDebug("Enter something");
5260 MainForm::InitMostVisitedSitesPanel(Tizen::Ui::OrientationStatus orientationStatus)
5267 MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatus)
5269 if(__pWebViewer != null)
5272 AppLog("MainForm::InitMostVisitedSitesView");
5273 result r = E_SUCCESS;
5276 if (__pWebViewer != null && __pMostVisitedListView != null)
5281 if (__pMostVisitedListView != null)
5283 RemoveControl(__pMostVisitedListView);
5285 if(__pMostVisitedSites != null)
5287 __pMostVisitedSites->RemoveAll(true);
5290 HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
5292 __webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
5293 __pMostVisitedListView = new(std::nothrow) ListView();
5295 int height = GetClientAreaBounds().height;
5297 if(__pFooterPanel->GetShowState() == true)
5299 height = height - __pFooterPanel->GetHeight();
5301 if(__pAddressbar->GetShowState() == true)
5303 height -= __pAddressbar->GetHeight();
5306 r = __pMostVisitedListView->Construct(Tizen::Graphics::Rectangle(0,0 , GetClientAreaBounds().width, height),true,false);
5310 delete __pMostVisitedListView;
5311 AppLogDebug("Addressbar init failed with %s", GetErrorMessage(r));
5314 __pMostVisitedListView->SetItemProvider(*this);
5315 __pMostVisitedListView->AddListViewItemEventListener(*this);
5316 __pMostVisitedListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_VISITED_SITES"));
5317 AddControl(__pMostVisitedListView);
5318 __pMostVisitedListView->UpdateList();
5325 MainForm::GetImagePath(void)
5329 String formattedTime;
5330 DateTime currentTime;
5331 LocaleManager localManager;
5332 SystemTime::GetCurrentTime(TIME_MODE_WALL, currentTime);
5334 localManager.Construct();
5335 Locale locale = localManager.GetSystemLocale();
5336 //Locale locale(LANGUAGE_ENG, COUNTRY_US);
5338 // Get date formatter
5339 DateTimeFormatter* pTimeFormatter = DateTimeFormatter::CreateDateTimeFormatterN(locale, DATE_TIME_STYLE_DEFAULT);
5343 pTimeFormatter->Format(currentTime, formattedTime);
5346 AppLog("current time stamp is %ls", formattedTime.GetPointer());
5347 String delim(L" :");
5348 StringTokenizer strTok(formattedTime, delim);
5351 String str1("GMT+00");
5352 while (strTok.HasMoreTokens())
5354 strTok.GetNextToken(token); // Osp, StringTokenizer, Sample, code
5355 if(token.Equals(str1))
5357 AppLog("token is %ls", token.GetPointer());
5358 imageName.Append(token);
5364 void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
5366 result r = E_FAILURE;
5367 AppLog("Content manager 1");
5368 ContentId contentId;
5369 ContentManager contentManager;
5370 r = contentManager.Construct();
5373 AppLog("Content manager update content result %s" ,GetErrorMessage(r));
5376 Tizen::Base::String contentPath = Tizen::System::Environment::GetMediaPath() + L"Downloads/";
5377 Tizen::Io::Directory::Create(contentPath,true);
5378 if(GetLastResult() == E_FILE_ALREADY_EXIST)
5380 AppLog("Already exists");
5382 else if(GetLastResult() == E_SUCCESS)
5384 AppLog("created success");
5386 contentPath.Append(imageName);
5387 contentPath.Append(".jpg");
5388 contentId = contentManager.CreateContent(*aBuffer, contentPath);
5389 ShowIndicatorNotification(L"Download Complete",contentPath);
5390 AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
5394 MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
5396 AppLogDebug("ENTER");
5398 NotificationRequest request;
5399 request.SetAlertText(messageText);
5400 request.SetTitleText(L"");
5401 request.SetAppMessage(contentPath);
5402 request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
5403 request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
5404 Tizen::App::App* pApp = Tizen::App::App::GetInstance();
5405 String homePath = pApp->GetAppRootPath();
5406 String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
5407 AppLog("The iconPath is : %ls", homePath.GetPointer());
5408 request.SetIconFilePath(iconPath);
5410 Tizen::Shell::NotificationManager notiMgr;
5411 notiMgr.Construct();
5412 notiMgr.Notify(request);
5413 AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
5418 MainForm::SetForwardButtonEnabled(bool isEnabled)
5420 __pGoForwardBtn->SetEnabled(isEnabled);
5421 __pGoForwardBtn->Invalidate(true);
5425 MainForm::SetBackButtonEnabled(bool isEnabled)
5427 __pGoBackBtn->SetEnabled(isEnabled);
5428 __pGoBackBtn->Invalidate(true);
5432 MainForm::UpdateProgress(int percentage)
5434 __progressPercentage = percentage;
5435 if (percentage == 0 || percentage == 100)
5437 __isLoadingData = false;
5438 if (percentage == 100)
5440 __isLoadingCompleted = true;
5441 __progressPercentage = 0;
5445 __isLoadingCompleted = false;
5450 __isLoadingData = true;
5452 UpdateProgressBitmap();
5456 MainForm::GetProgress(void)
5458 return __progressPercentage;
5462 MainForm::UpdateProgressBitmap(void)
5464 result r = E_SUCCESS;
5465 if (__pProgressbarLabel == null)
5467 int w = __pProgressbarLabel->GetWidth();
5468 int h = __pProgressbarLabel->GetHeight();
5470 int progressWidth = 0;
5471 Bitmap* pRetBitmap = null;
5473 if (__progressPercentage == 0 || __progressPercentage == 100)
5475 __pProgressbarLabel->SetShowState(false);
5476 __pProgressbarLabel->Invalidate(false);
5481 __pProgressbarLabel->SetShowState(true);
5482 __pProgressbarLabel->Invalidate(false);
5485 r = canvas.Construct(Rectangle(0, 0, w, h));
5489 AppLogException("Canvas construction failed with %s", GetErrorMessage(r));
5494 Bitmap *pBgBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR_BG);
5498 pBgBmp->Scale(Dimension(w, h));
5499 canvas.DrawBitmap(Point(0,0), *pBgBmp);
5503 progressWidth = (double) (w) * __progressPercentage / 100;
5504 AppLogDebug("progressWidth: %d", progressWidth);
5505 Bitmap *pProgressBmp = AppResource::GetInstance()->GetBitmapN(IDB_TITLE_PROGRESS_BAR);
5507 if (pProgressBmp != null)
5509 pProgressBmp->Scale(Dimension(progressWidth, h));
5510 canvas.DrawBitmap(Point(0,0), *pProgressBmp);
5511 delete pProgressBmp;
5514 pRetBitmap = new (std::nothrow) Bitmap();
5516 if (pRetBitmap == null)
5518 AppLogException("Bitmap creation failed with %s", GetErrorMessage(r));
5522 pRetBitmap->Construct(canvas, canvas.GetBounds());
5524 if (__pProgressbarLabel != null && pRetBitmap != null)
5526 __pProgressbarLabel->SetBackgroundBitmap(*pRetBitmap);
5527 __pProgressbarLabel->Invalidate(false);
5530 if (pRetBitmap != null)
5539 MainForm::ReaderClicked()
5541 result r = E_SUCCESS;
5542 ArrayList* pArgList = new(std::nothrow) ArrayList();
5543 if (pArgList != null)
5545 r = pArgList->Construct();
5552 r = pArgList->Add(*new(std::nothrow) String(*__pReaderData));
5559 r = pArgList->Add(*new(std::nothrow) String(__pWebViewer->GetUrl()));
5566 r = pArgList->Add(*new(std::nothrow) String(__pWindowInfo->pageTitle));
5574 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_ARTICLE_READER, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
5580 void MainForm::SetAddressbarMode(AddressBarMode addMode)
5582 AppLogDebug("AddressBar::setAddressbarMode to %d",addMode);
5584 __currentAddMode = addMode;
5588 case ADDRESSBAR_MODE_INVALID:
5593 case ADDRESSBAR_MODE_READER:
5595 __pStopBtn->SetShowState(false);
5596 __pRefreshBtn->SetShowState(false);
5597 __pClearBtn->SetShowState(false);
5598 __pReaderBtn->SetShowState(false);
5601 case ADDRESSBAR_MODE_LOADING:
5603 __pRefreshBtn->SetShowState(false);
5604 __pStopBtn->SetShowState(true);
5605 __pClearBtn->SetShowState(false);
5606 __pReaderBtn->SetShowState(false);
5609 case ADDRESSBAR_MODE_LOADING_COMPLETE:
5611 // SetUrl(__pAddressbar->GetUrl());
5613 __pRefreshBtn->SetShowState(true);
5614 __pStopBtn->SetShowState(false);
5615 __pClearBtn->SetShowState(false);
5616 __pReaderBtn->SetShowState(false);
5619 case ADDRESSBAR_MODE_EDIT:
5621 __pRefreshBtn->SetShowState(false);
5622 __pStopBtn->SetShowState(false);
5623 __pReaderBtn->SetShowState(false);
5624 __pClearBtn->SetShowState(true);
5631 OnAddressBarModeChanged();
5634 AddressBarMode MainForm::GetAddressbarMode(void)
5636 return __currentAddMode;
5639 void MainForm::SetUrl(const String& url)
5642 if(__displayUrl.GetLength() > 2048)
5643 __displayUrl.SubString(0,2048,__displayUrl);
5645 if (__pFooterUrlField != NULL)
5647 String removedHttpUrl = RemoveHttpTextFromDisplayURL();
5648 if (removedHttpUrl.IsEmpty() == false)
5650 __pFooterUrlField->SetText(removedHttpUrl);
5651 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5652 __pAddressbar->SetUrl(__displayUrl);
5656 __pFooterUrlField->SetText(__displayUrl);
5657 if(__pAddressbar != NULL && __pAddressbar->HasCurrentFocus() == false)
5658 __pAddressbar->SetUrl(__displayUrl);
5660 if(__pFooterUrlField)
5661 __pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
5662 __pFooterUrlField->Invalidate(false);
5663 if(__pAddressbar != NULL && __pAddressbar->HasFocus())
5664 __pAddressbar->Invalidate(true);
5665 // __pFooterUrlField->SetCursorPosition(0);
5670 MainForm::RemoveHttpTextFromDisplayURL(void)
5672 AppLog("MainForm::RemoveHttpTextFromDisplayURL __displayUrl %ls",__displayUrl.GetPointer());
5674 // bool isHttpText = __displayUrl.Contains(L"http://");
5675 String updatedDisplayUrl;
5676 updatedDisplayUrl.Clear();
5677 if(__displayUrl.IndexOf(L"http://",0,index) == E_SUCCESS && index == 0)
5679 __displayUrl.SubString(7,updatedDisplayUrl);
5681 else if(__displayUrl.IndexOf(L"https://",0,index) == E_SUCCESS && index == 0)
5683 __displayUrl.SubString(8,updatedDisplayUrl);
5685 return updatedDisplayUrl;
5688 void MainForm::OnSharePopupControlStarted(void)
5690 __pWebViewer->AddTouchEventListener(*this);
5694 MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
5696 if (requestId == BACK_GROUND_APP_EVENT)
5698 if(__pWebViewer != null)
5700 __pWebViewer->Pause();
5704 __pImageMenu->SetShowState(false);
5706 if(__pAddressbar != null)
5708 __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
5711 else if(requestId == FORE_GROUND_APP_EVENT)
5713 if(__pWebViewer != null)
5715 __pWebViewer->Resume();
5717 if(__pAddressbar != null)
5719 __pAddressbar->SendUserEvent(FORE_GROUND_APP_EVENT,NULL);
5725 MainForm::AddressBarCancelledClicked(const Addressbar& addBar)
5727 AppLog("XYZ::MainForm::AddressBarCancelledClicked");
5728 result r = E_SUCCESS;
5731 __pAddressbar->SetShowState(false);
5733 AppLog("akjshdasd 5");
5734 __pFooterPanel->SetShowState(true);
5737 __pWebViewer->SetFocus();
5738 else if(__pMostVisitedListView)
5739 __pMostVisitedListView->SetFocus();
5740 else if(__pMultiWindowButton)
5741 __pMultiWindowButton->SetFocus();
5742 else if(__pMoreButton)
5743 __pMoreButton->SetFocus();
5745 __pAddressbar->SetShowState(false);
5747 RelayoutControls(false);
5751 MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
5753 AppLog("MainForm::OnFormMenuRequested called");
5755 if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
5757 int bookmarkCount=0;
5760 url=__pWindowInfo->pageUrl;
5761 AppLog("MainForm::OnFormMenuRequested url %ls",url.GetPointer());
5762 result r = E_SUCCESS;
5763 Bitmap* pBitmap = null;
5764 String lastChar = L"";
5765 // if(url.SubString(url.GetLength()-1,lastChar));
5766 // if(lastChar == L"/")
5768 // bool exist1 = false;
5769 // bool exist2 = false;
5770 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist1);
5771 // url.SubString(0,url.GetLength() - 1,url);
5772 // r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist2);
5773 // exist = exist1 | exist2;
5777 r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist);
5780 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed");
5786 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
5790 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
5792 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3");
5794 if (__pOptionMenu->GetItemCount() == 9)
5796 r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5800 r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap);
5805 AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r));
5809 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4");
5810 if (__pOptionMenu->GetItemCount() != 9)
5812 __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED);
5813 __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED);
5814 // __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED);
5815 __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED);
5816 __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
5817 __pOptionMenu->SetMaxVisibleItemsCount(6);
5819 if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
5821 AppLog(" Orientation landscape");
5822 __pOptionMenu->SetMaxVisibleItemsCount(5);
5826 AppLog(" Orientation potrait");
5827 __pOptionMenu->SetMaxVisibleItemsCount(6);
5830 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5");
5833 AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
5835 __pAddressbar->SetShowState(false);
5837 __pFooterPanel->SetShowState(true);
5838 result r = __pOptionMenu->SetShowState(true);
5839 AppLog("ajsghd %s",GetErrorMessage(r));
5840 __pOptionMenu->Invalidate(true);
5841 __pOptionMenu->Show();