using namespace Tizen::Web;
using namespace Tizen::Web::Controls;
-static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
-static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
+static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.#.png";
+static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.#.png";
static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
-static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
-static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
+static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP =L"00_icon_favorite_off_74x74.png";
+static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"00_icon_favorite_on_74x74.png";
static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
static const wchar_t* IDS_APPID = L"AppID";
static const wchar_t* IDS_KEY = L"key";
__pBlankPanel = null;
__pArticleReaderLabel = null;
__webControlHeight = 0;
+ __webControlHeightF = 0;
__prevAddressBarMode = ADDRESSBAR_MODE_INVALID;
__curAddressBarMode = ADDRESSBAR_MODE_INVALID;
__pMostVisitedSites = null;
const int Y_WEBCONTROL_POSITION = 0;
__webControlHeight = GetHeight() - __pFooterPanel->GetHeight();
+ __webControlHeightF = GetHeightF() - __pFooterPanel->GetHeightF();
if (__pMostVisitedListView)
{
AppLogDebug("Initialization failed");
return E_FAILURE;
}
+ AppLog("GetClientAreaBounds().width %d",GetClientAreaBounds().width);
r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight + 12));
if (IsFailed(r))
else
{
r = AddControl(__pWebViewer);
-
if (IsFailed(r))
{
- delete __pWebViewer;
+ __pWebViewer->Destroy();
__pWebViewer = null;
AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
return r;
}
__webControlPosition = __pWebViewer->GetPosition();
+ __webControlPositionF = __pWebViewer->GetPositionF();
r = __pWebViewer->SetSetting(SettingPresentationModel::GetInstance()->GetWebSettings());
if (IsFailed(r))
{
{
return E_FAILURE;
}
+// __pFooterPanel->SetBackgroundColor(Color(255,0,0));
//__pFooterPanel->SetBackgroundColor(CUSTOM_COLOR_TRANSPARENT);
Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight());
if (pBitmap != null)
{
result r = E_SUCCESS;
ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
+ String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
AppLog("MainForm::InitImageContextMenu clicked on image");
if (__pImageMenu != null)
r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
+
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE"),IDA_COPY_IMAGE_CLICKED);
- r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
+ AppLog("srcUrl %ls __pWebViewer->GetUrl() %ls",srcUrl.GetPointer(),__pWebViewer->GetUrl().GetPointer());
+
+ if(__pWebViewer && srcUrl.Equals(__pWebViewer->GetUrl(),false) == false)
+ r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_VIEW_IMAGE"),IDA_VIEW_IMAGE_CLICKED);
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_SAVE_IMAGE_CLICKED);
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_IMAGE_CLICKED);
__pImageMenu->SetMaxVisibleItemsCount(4);
}
// FloatPoint q(0.0,0.0);
// __pWebViewer->GetBlockRange(p,q);
+ if(p.y < 0)
+ p.y =0;
if(p.y < 150)
{
- p.y = p.y + 50;
+ p.y = p.y + 100;
+ if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
+ {
+ p.y = p.y - 50;
+ }
direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
}
+ else if(__pWebViewer != null && (p.y > (__pWebViewer->GetHeight() + __pWebViewer->GetY())))
+ {
+ p.y = __pWebViewer->GetHeight() + __pWebViewer->GetY();
+ }
else
{
if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
}
}
}
- if(clipboardAvailable == false && onlyPasteOption == true)
+ if(clipboardAvailable == false && (onlyPasteOption == true || __pHitElementResult->GetAttributeValue("type").Equals(L"password",false) == true))
{
return E_FAILURE;
}
r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
-
-
-
-
- if(onlyPasteOption == false)
+ if(onlyPasteOption == false && __pHitElementResult->GetAttributeValue("type").Equals(L"password",false) == false)
{
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
}
{
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
}
- if(onlyPasteOption == false)
+ if(onlyPasteOption == false && __pHitElementResult->GetAttributeValue("type").Equals(L"password",false) == false)
{
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
Rectangle pRect = pPanel1->GetBounds();
pRect.x = pRect.y = 0;
__pFindWordBgLabel->SetBounds(pRect);
- Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.#.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
if (pBitmap != null)
{
AppLogDebug("InitFindWordPanel: Coming here");
Rectangle pRect = pPanel1->GetBounds();
pRect.x = pRect.y = 0;
__pFindWordBgLabelRightToLeft->SetBounds(pRect);
- Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.9.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
+ Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(L"I01_search_input_field_bg.#.png", __pFindWordBgLabel->GetWidth(), __pFindWordBgLabel->GetHeight());
if (pBitmap != null)
{
AppLogDebug("InitFindWordPanel: Coming here");
AppLogException("There is some problem in the xml file. Please check.");
return E_FAILURE;
}
+ __pFindWordCountLabel->SetText(L"0/0");
__pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
if (__pFindWordCountLabelRightToLeft == null)
AppLogException("There is some problem in the xml file. Please check.");
return E_FAILURE;
}
+ __pFindWordCountLabelRightToLeft->SetText(L"0/0");
__pFindWordEditField = static_cast<EditField*>(__pFindWordControl->GetControl(L"IDC_FIND_WORD_EDITFIELD", true));
if (__pFindWordEditField == null)
{
if (pItem != null)
{
- pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
+ pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_LISTVIEW_TEXT, CUSTOM_COLOR_LISTVIEW_TEXT, true);
}
}
void
MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
+ AppLog("MainForm::OnListViewItemStateChanged called");
History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
String url = pHistory->GetHistoryUrl();
if (url != null)
if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
{
__pFindWordEditField->SetFocus();
-// __pFindWordCountLabel->SetShowState(false);
}
else
{
__pFindWordEditFieldRightToLeft->SetFocus();
- __pFindWordCountLabelRightToLeft->SetShowState(false);
}
}
break;
{
String srcUrl = __pHitElementResult->GetAttributeValue(L"src");
AppLog("MainForm::OnTouchLongPressed srcUrl is %ls",srcUrl.GetPointer());
- LoadUrl(srcUrl);
+ Uri currentUri;
+ currentUri.SetUri(__pWebViewer->GetUrl());
+
+ String newUrl;
+ Uri newUri;
+ newUri.SetUri(srcUrl);
+ AppLog("newuri gethost %ls",newUri.GetHost().GetPointer());
+ if(newUri.GetHost().GetLength() == 0)
+ {
+ newUrl = currentUri.GetHost();
+ newUrl.Append(srcUrl);
+ srcUrl = newUrl;
+ }
+
+ LoadUrl(srcUrl);
}
}
break;
if (__pAddressbar != null && __pWebViewer != NULL)
{
__webControlPosition.y = __pAddressbar->GetHeight() - 12;
+ __webControlPositionF.y = __pAddressbar->GetHeightF() - 12.0f;
__webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12);
+ __webControlHeightF = GetClientAreaBoundsF().height - __pFooterPanel->GetHeightF() - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeightF() - 12.0f);
if (__pFooterPanel->GetShowState() == false)
__pWebViewer->SetBounds(Rectangle(0,__webControlPosition.y,GetClientAreaBounds().width, GetClientAreaBounds().height - ( /*__pAddressbar->GetY() +*/ __pAddressbar->GetHeight() - 12)));
break;
case IDA_COPY_TEXT_CLICKED:
{
- __pWebViewer->ReleaseBlock();
+// __pWebViewer->ReleaseBlock();//as per hyunn lee request for issue 53500
// need to implement
//__currentSelectedStr
// Sets data to a clip board item
{
String idElement = __pHitElementResult->GetAttributeValue(L"id");
String nameElement = __pHitElementResult->GetAttributeValue(L"name");
+ String classElement = __pHitElementResult->GetAttributeValue(L"class");
String tagElement = __pHitElementResult->GetTagName();
+ String contenteditable = __pHitElementResult->GetAttributeValue("contenteditable");
AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
String str = L"document.getElementsByName('";
str.Append(nameElement);
str.Append("').length");
- String* pCount = __pWebViewer->EvaluateJavascriptN(str);
- AppLog("pCount %ls",pCount->GetPointer());
+ String* pNameCount = __pWebViewer->EvaluateJavascriptN(str);
+ str.Clear();
+ str = L"document.getElementsByClassName('";
+ str.Append(classElement);
+ str.Append("').length");
+ String* pClassCount = __pWebViewer->EvaluateJavascriptN(str);
String script;
- if(idElement.GetLength() != 0)
+ if(contenteditable.Equals(L"true",false) == true)
{
- 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; } } ";
- script.Append("insertAtCursor('");
- script.Append(idElement);
- script.Append("',");
+ AppLog("gmail paste need to support");
+
+ script = L"function replaceSelectedText(replacementText) { var sel, range; if (window.getSelection) { sel = window.getSelection(); if (sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); range.insertNode(document.createTextNode(replacementText)); } } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); range.text = replacementText; } }";
+ script.Append("replaceSelectedText(");
script.Append("\"");
script.Append(*pString);
script.Append("\");");
}
-
-
- else if (nameElement.GetLength() != 0 && pCount->Equals("1",false) == true)
+ else if(idElement.GetLength() != 0)
+ {
+ script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
+ script.Append("insertAtCursor(");
+ script.Append(L"document.activeElement");
+ script.Append(",");
+ script.Append("\"");
+ script.Append(*pString);
+ script.Append("\");");
+ }
+ else if (classElement.GetLength() != 0 && pClassCount->Equals("1",false) == true)
+ {
+ script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
+ script.Append("insertAtCursor(document.getElementsByClassName('");
+ script.Append(classElement);
+ script.Append("')[0],");
+ script.Append("\"");
+ script.Append(*pString);
+ script.Append("\");");
+ }
+ else if (nameElement.GetLength() != 0 && pNameCount->Equals("1",false) == true)
{
script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
script.Append("insertAtCursor(document.getElementsByName('");
}
else if(tagElement.GetLength() != 0) //adding for twitter post page
{
- 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; } } ";
- script.Append("insertAtCursor(document.getElementsByTagName('");
- script.Append(tagElement);
- script.Append("')[0],");
+ script = L"function insertAtCursor(myField, myValue) { if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = myValue; } else if (myField.selectionStart || myField.selectionStart == '0'){ var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); } else { myField.value += myValue; } } ";
+
+ script.Append("insertAtCursor(document.activeElement,");
script.Append("\"");
script.Append(*pString);
script.Append("\");");
AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
String* pStr = __pWebViewer->EvaluateJavascriptN(script);
delete pStr;
+ delete pNameCount;
+ delete pClassCount;
}
delete pItem;
+ if(__pWebViewer)
+ __pWebViewer->ReleaseBlock();
}
break;
case IDA_GO_BACK:
// LoadUrl(url);
if (__pWebViewer != null && __pAddressbar != null)
{
- __pWebViewer->Reload();
+ LoadUrl(url);
+ //__pWebViewer->Reload();
SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
}
InitFooter();
InitAddressbar();
- __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), GetClientAreaBounds().width, __pFooterPanel->GetHeight());
+ FloatRectangle footerPanelBounds = FloatRectangle(0.0f, (GetClientAreaBoundsF().height) - __pFooterPanel->GetHeightF(), GetClientAreaBoundsF().width, __pFooterPanel->GetHeightF());
+ __pFooterPanel->SetBounds(CoordinateSystem::AlignToDevice(footerPanelBounds));
// hiding the address bar
// __pAddressbar->SetBounds(__pAddressbar->GetX(), __pAddressbar->GetY() - __pAddressbar->GetHeight(), __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
{
InitMostVisitedSitesView(GetOrientationStatus());
}
- else if (homePage.CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
+ else
{
if(__pMostVisitedListView != null)
{
}
}
+ if(__pMostVisitedListView && __pMostVisitedListView->GetShowState() == true)
+ {
+ __pMostVisitedListView->UpdateList();
+ }
if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
{
String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
RelayoutControls(false);
AppLog("ABC: OnSceneActivatedN started exit");
+ if(__pWebViewer)
+ {
+ AppLog("WebControl's width height %d %d,",__pWebViewer->GetWidth(),__pWebViewer->GetHeight());
+ __pWebViewer->Resume();
+ }
}
pCanvas->DrawBitmap(Point(0,0),*pBitmap);
delete pBitmap;
}
- if(__pWebViewer != null && __pWindowInfo != null)
+ if(__pWebViewer != null && __pWindowInfo != null && __pWindowInfo->pWebCanvasBitmap != null)
pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
- WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+ if (__pFooterPanel)
+ {
+ WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+ }
delete pCanvas;
delete pWebCanvas;
if(__pAddressbar)
__pAddressbar->SetShowState(false);
+ if(__pWebViewer)
+ {
+ __pWebViewer->Pause();
+ }
AppLog("Coming here");
}
if (__pWindowInfo != NULL)
{
// resetting the page title to blank, it will be received in OnPageTitleReceived()
- __pWindowInfo->pageTitle = L"";
+// __pWindowInfo->pageTitle = L"";
__pWindowInfo->pageUrl = __pWebViewer->GetUrl();
}
__pAddressbar->Invalidate(true);
}
-
void
MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
{
AppLog("XYZ::MainForm::OnKeypadOpened");
__isKeypadOpened = true;
__pFooterPanel->SetShowState(false);
-
+ RelayoutControls(false);
}
void
return;
}
+ if(__pWindowInfo && __pWebViewer)
+ __pWindowInfo->pageTitle = __pWebViewer->GetTitle();
if(__pImageMenu && __pImageMenu->GetShowState())
{
__pImageMenu->SetShowState(false);
__pHistory->SetFavIconBitmap(*pTempBitmap);
}
- AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
}
Canvas* pCanvas = __pWebViewer->GetCanvasN();
Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
if (pFavIcon)
{
+ Tizen::Graphics::BufferInfo bmpInfo;
+ pFavIcon->Lock(bmpInfo);
+ AppLog("rrrr:: width %d height %d of the faviconbitmap from bufferinfo", bmpInfo.width, bmpInfo.height);
+
+ AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
+
+ AppLog("rrrr:: width %d height %d of the faviconbitmap",pFavIcon->GetWidth(),pFavIcon->GetHeight());
__pHistory->SetFavIconBitmap(*pFavIcon);
delete pFavIcon;
}
String url = addBar.GetUrl();
AppLog("MainForm::OnUrlSubmitted url is %ls", url.GetPointer());
+
if(__pFooterUrlField)
+ {
+ AppLog("Position:: %d, %ls",__pFooterUrlField->GetTextLength(),__pFooterUrlField->GetText().GetPointer());
__pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
+ }
AddressBarCancelledClicked(*__pAddressbar);
LoadUrl(url);
}
ret = firstRegex.Match(url, false); // This returns true value
flag = secondRegex.Match(url, false); // Checks whether URL typed is of type abc.com (i.e without protocol in front of it)
+
+
if (ret == true && __pWebViewer != null)
{
SetUrl(url);
}
else
{
- UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+ UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
__pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
}
}
__pFooterPanel->SetShowState(false);
}
+ if(__pWebViewer)
+ {
+ __pWebViewer->ReleaseBlock();
+ }
+
if(__pAddressbar)
{
__pAddressbar->SetShowState(true);
__pFindWordNext->SetEnabled(false);
__pFindWordPrev->SetEnabled(false);
- __pWebViewer->SearchTextAllAsync(L"",true);
+ if(__pWebViewer)
+ __pWebViewer->SearchTextAllAsync(L"",true);
__pFindWordControl->SetShowState(false);
}
RelayoutControls(false);
if (__pAddressbar != null)
{
__webControlPosition.y = __pAddressbar->GetHeight() - 12;
+ __webControlPositionF.y = __pAddressbar->GetHeightF() - 12.0f;
__pAddressbar->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,__pAddressbar->GetHeight()));
__pAddressbar->Invalidate(true);
}
if (__pAddressbar != null)
{
__webControlPosition.y = 0;
+ __webControlPositionF.y = 0.0f;
__pAddressbar->SetBounds(Rectangle(0, __pAddressbar->GetY() - __pAddressbar->GetHeight(), GetClientAreaBounds().width, __pAddressbar->GetHeight()));
__pAddressbar->Invalidate(true);
}
void
MainForm::UpdateFavicon(void)
{
+ AppLog("MainForm::UpdateFavicon called");
bool urlImageType = false;
String *tempPath = null;
if(__pWebViewer)
if (pBitmap != null)
{
+ AppLog("__pWindowInfo->pFavicon updating favicon");
if (__pWindowInfo->pFavicon != NULL)
{
__pWindowInfo->pFavicon = null;
void
MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
{
- AppLog("MainForm::OnWebPageBlockSelected");
+ AppLog("LMN::MainForm::OnWebPageBlockSelected");
// if(__isLongPressedDone == false)
// return;
if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
{
__pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
+ if(__pHitElementResult == null)
+ {
+ __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
+ }
}
AppLog("datafirst endpoint error %s",GetErrorMessage(GetLastResult()));
}
{
String tagName = __pHitElementResult->GetTagName();
String type = __pHitElementResult->GetAttributeValue("type");
+ String contenteditable = __pHitElementResult->GetAttributeValue("contenteditable");
AppLog("TagName %ls",tagName.GetPointer());
AppLog("Tagnameseemstobe INPUT");
}
- if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
+ if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) || contenteditable.Equals(L"true",false) == true/*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0 )
{
AppLog("MainForm::OnWebPageBlockSelected show paste option");
- InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
+ InitSelectTextContextMenuF(FloatPoint(startPoint.x,startPoint.y + __pWebViewer->GetY()),true);
if(__pImageMenu)
{
__pImageMenu->SetShowState(true);
__currentSelectedStr.Clear();
__currentSelectedStr = __pHitElementResult->GetUrl();
}
- InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
+ InitSelectTextContextMenuF(FloatPoint(startPoint.x,startPoint.y + __pWebViewer->GetY()),false);
if(__pImageMenu)
{
__pImageMenu->SetShowState(true);
}
void
+MainForm::OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source)
+{
+ AppLog("OnWebWindowCloseRequested");
+ ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ WindowInfo* pWindowInfo = null;
+ WindowInfo* pNewWindowInfo = null;
+ int totalCount = 0;
+ UiApp* pApp = null;
+ result r = E_FAILURE;
+
+ if (pAllWindowList != null)
+ {
+ totalCount = pAllWindowList->GetCount();
+ }
+
+ for (int count = 0; count < totalCount; count++)
+ {
+ pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+
+ if (__pWindowInfo != null && pWindowInfo != null && __pWindowInfo->sceneID == pWindowInfo->sceneID)
+ {
+ r = SceneRegister::DestroyAndUnRegisterScene(__pWindowInfo->sceneID);
+ r = pAllWindowList->RemoveAt(count, true);
+
+ Form* pCurrentForm = null;
+ if(SceneManager::GetInstance()->GetCurrentScene() != null)
+ pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
+ if (pCurrentForm)
+ {
+ pCurrentForm->SendUserEvent(UPDATE_MAINFORM_FOOTER_ON_WINDOWCLOSED, null);
+ }
+
+ if (pAllWindowList->GetCount() > 0)
+ {
+ pNewWindowInfo = null;
+ pNewWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+ }
+ else
+ {
+ WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
+
+ if (pNewWindowInfo == null)
+ {
+ return;
+ }
+ result r = E_SUCCESS;
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ if (pSceneManager == NULL)
+ {
+ return;
+ }
+ ArrayList* pArgList = new(std::nothrow) ArrayList();
+ if (pArgList == NULL)
+ {
+ return;
+ }
+ r = pArgList->Construct();
+ if (r == E_SUCCESS)
+ {
+ pArgList->Add(*pNewWindowInfo);
+ result r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
+ if (pArgList != null)
+ {
+ delete pArgList;
+ pArgList = null;
+ }
+ if(IsFailed(r))
+ {
+ AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
+ return;
+ }
+ }
+
+ pApp = UiApp::GetInstance();
+ if (pApp != null)
+ {
+ r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+ return;
+ }
+ }
+ if(pNewWindowInfo)
+ r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+
+ break;
+ }
+
+ }
+
+
+}
+
+void
MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
{
AppLog("xyz:: MainForm::RelayoutControls called");
__webControlPosition.y = 0;
+ __webControlPositionF.y = 0.0f;
__webControlHeight = GetClientAreaBounds().height;
- AppLog("Client area height: %d", __webControlHeight);
+ __webControlHeightF = GetClientAreaBoundsF().height;
+ AppLog("Client area height: %d width %d", __webControlHeight,GetClientAreaBounds().width);
AppLog("Client area height: %d", __webControlHeight);
if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
{
__webControlPosition.y += __pAddressbar->GetHeight();
+ __webControlPositionF.y += __pAddressbar->GetHeightF();
__webControlHeight -= __pAddressbar->GetHeight();
+ __webControlHeightF -= __pAddressbar->GetHeightF();
__pAddressbar->SetBounds(0, 0, __pAddressbar->GetWidth(), __pAddressbar->GetHeight());
}
else if(__pFindWordControl != null && __pFindWordControl->GetShowState() == true)
{
__webControlPosition.y += __pFindWordControl->GetHeight();
+ __webControlPositionF.y += __pFindWordControl->GetHeightF();
__webControlHeight -= __pFindWordControl->GetHeight();
+ __webControlHeightF -= __pFindWordControl->GetHeightF();
__pFindWordControl->SetBounds(0, 0, GetClientAreaBounds().width, __pFindWordControl->GetHeight());
}
if(__pFooterPanel != null && __pFooterPanel->GetShowState() == true && relayoutFooter == true)
{
__webControlHeight -= __pFooterPanel->GetHeight();
+ __webControlHeightF -= __pFooterPanel->GetHeightF();
- __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
+ __pFooterPanel->SetBounds(CoordinateSystem::AlignToDevice(FloatRectangle(0.0F, __webControlPositionF.y + __webControlHeightF, GetClientAreaBoundsF().width, __pFooterPanel->GetHeightF())));
__webControlHeight = __webControlHeight + 12;
+ __webControlHeightF = __webControlHeightF + 12.0f;
}
+
+
+
if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
{
if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight )
}
else
{
- __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight );
+ __pWebViewer->SetBounds(CoordinateSystem::AlignToDevice(FloatRectangle(0.0f, __webControlPositionF.y, GetClientAreaBoundsF().width, __webControlHeightF)));
AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
__pWebViewer->Invalidate(false);
}
}
+
if(__pMostVisitedListView != null && __pAddressbar != null && __pFooterPanel != null)
{
__pMostVisitedListView->SetBounds(Tizen::Graphics::Rectangle(0,__webControlPosition.y , GetClientAreaBounds().width, __webControlHeight));
__pFindWordPrev->SetEnabled(false);
String *pCountStr = null;
- result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
- AppLog("Search Result %s",GetErrorMessage(r));
+ if (__pWebViewer)
+ {
+ result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
+ AppLog("Search Result %s",GetErrorMessage(r));
+ }
+
/*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;");
if (pCountStr != null)
{
AppLog("MainForm::OnTextFound totalCount %d",totalCount);
AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
- if(totalCount == -1 || totalCount == 0)
+ if(totalCount <= 9)
{
- __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
- __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
-// return;
+ if (__pFindWordCountLabel)
+ {
+ __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
+ }
+ if (__pFindWordEditField)
+ {
+ __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
+ }
}
- else if(totalCount > 100)
+ else if(totalCount >= 100)
{
- __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
- __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+ if (__pFindWordCountLabel)
+ {
+ __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+ }
+ if (__pFindWordEditField)
+ {
+ __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+ }
}
else
{
- __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
- __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+ if (__pFindWordCountLabel)
+ {
+ __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+ }
+ if (__pFindWordEditField)
+ {
+ __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+ }
}
__maxOccurrances = totalCount;
{
AppLog("Word not found");
//Show error notification to user
- __pFindWordNext->SetEnabled(false);
+ if(__pFindWordNext)
+ __pFindWordNext->SetEnabled(false);
if(__pFindWordCountLabel && __pFindWordCountLabel->GetShowState() == true)
{
__pFindWordCountLabel->SetText(L"0/0");
__pFindWordCountLabelRightToLeft->SetText(L"0/0");
__pFindWordCountLabelRightToLeft->Invalidate(false);
}
- __pFindWordNext->Invalidate(false);
+ if(__pFindWordNext)
+ __pFindWordNext->Invalidate(false);
__pFindWordPrev->Invalidate(false);
return;
if (totalCount == 1 || totalCount == currentOrdinal)
{
- __pFindWordNext->SetEnabled(false);
+ if(__pFindWordNext)
+ __pFindWordNext->SetEnabled(false);
}
else
{
- __pFindWordNext->SetEnabled(true);
+ if(__pFindWordNext)
+ __pFindWordNext->SetEnabled(true);
}
String countStr = L"";
__pFindWordCountLabel->Invalidate(false);
__pFindWordCountLabel->Invalidate(false);
}
- else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
+ else if (__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
{
__pFindWordCountLabelRightToLeft->SetText(countStr);
__pFindWordCountLabelRightToLeft->Invalidate(false);
__pFindWordCountLabelRightToLeft->Invalidate(false);
}
- //FindNextWord(true);
- //Update the controls
- __pFindWordNext->Invalidate(false);
- __pFindWordPrev->Invalidate(false);
+ if (__pFindWordNext)
+ {
+ __pFindWordNext->Invalidate(false);
+ }
+ if (__pFindWordPrev)
+ {
+ __pFindWordPrev->Invalidate(false);
+ }
}
Point p(0,0);
Point q(0,0);
__pWebViewer->GetBlockRange(p,q);
+ if (p == Point(0,0) && q == Point(0,0))
+ return;
+ if(p.y < 150)
+ {
+ p.y = p.y + 100;
+
+ }
+
__pImageMenu->SetAnchorPosition(p);
__pImageMenu->Show();
Invalidate(true);
void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
{
- AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
- if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
+ AppLog("LMN::abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
+ if(TouchEventManager::GetInstance() && TouchEventManager::GetInstance()->GetTouchInfoListN() && TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
{
AppLog("Returning because of more than one touch point.");
return;
}
+// if(__pWebViewer)
+// __pWebViewer->ReleaseBlock();
+ if(__pWebViewer)
+ __pWebViewer->SetFocus();
__longPressPoint = currentPosition;
if (__pHitElementResult != null)
if (__pHitElementResult->HasImage() == true)
{
if(__pWebViewer != null)
+ {
+ __pWebViewer->ReleaseBlock();//N_SE-52389
InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
+ }
__pImageMenu->SetShowState(true);
__pImageMenu->Show();
__pImageMenu->Invalidate(true);
}
else if(__pHitElementResult->HasUrl() == true)
{
+ if(__pWebViewer != null)
+ __pWebViewer->ReleaseBlock();//N_SE-52389
String tempURl = __pHitElementResult->GetUrl();
AppLog("tempURl is %ls", tempURl.GetPointer());
const Bitmap* pBitmap = __pHitElementResult->GetImage();
String type = __pHitElementResult->GetAttributeValue("type");
String value = __pHitElementResult->GetAttributeValue(L"value");
String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
-
+ result r = E_FAILURE;
__currentSelectedStr.Clear();
__currentSelectedStr = __pWebViewer->GetTextFromBlock();
__isLongPressedDone = true;
- result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
- if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) && innerHtml.GetLength() == 0 && type.Equals(L"submit",false) !=true && type.Equals(L"range",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
+ if( type.Equals(L"submit",false) !=true && type.Equals(L"checkbox",false) !=true && type.Equals(L"range",false) !=true && type.Equals(L"file",false) !=true)
+ r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
+ if (((tagName.Equals(L"INPUT",false) == true) || tagName.Equals(L"TEXTAREA",false) == true) && innerHtml.GetLength() == 0 && type.Equals(L"submit",false) !=true && type.Equals(L"checkbox",false) !=true && type.Equals(L"range",false) !=true && type.Equals(L"file",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
{
AppLog("MainForm::OnWebPageBlockSelected show paste option");
{
AppLog("MainForm::OnOrientationChanged GetClientAreaBounds %d, %d",GetClientAreaBounds().width,GetClientAreaBounds().height);
int widthContextItem = 0;
- if(__pFindWordCountLabel)
- __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+ //if(__pFindWordCountLabel)
+ // __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
// As per the platform engineer comment removed this line
/*if(__pWebViewer != null)
{
{
AppLog("__pFooterPanel->GetShowState() is true");
InitFooter();
- __pFooterPanel->SetBounds(0, GetClientAreaBounds().height - __pFooterPanel->GetHeight(), __pFooterPanel->GetWidth(), __pFooterPanel->GetHeight());
+ __pFooterPanel->SetBounds(CoordinateSystem::AlignToDevice(FloatRectangle(0, GetClientAreaBoundsF().height - __pFooterPanel->GetHeightF(), __pFooterPanel->GetWidthF(), __pFooterPanel->GetHeightF())));
__pFooterPanel->Invalidate(true);
}
InitAddressbar();
settings.SetAutoFittingEnabled(false);
}
__pWebViewer->SetSetting(settings);
+
}
else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
{
void
MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
{
+ AppLog("LMN::MainForm::OnTouchMoved entered");
// __currentWordIndex = 0;
__isLongPressedDone = false;
result r = E_SUCCESS;
- if (__pWebViewer != null && __pMostVisitedListView != null)
+ if (__pMostVisitedListView != null)
{
+ __pMostVisitedListView->SetShowState(true);
return E_SUCCESS;
}
HistoryPresentationModel::GetInstance()->GetMostVisitedSites(*__pMostVisitedSites);
__webControlHeight = GetClientAreaBounds().height - __pFooterPanel->GetHeight();
+ __webControlHeightF = GetClientAreaBoundsF().height - __pFooterPanel->GetHeightF();
__pMostVisitedListView = new(std::nothrow) ListView();
int height = GetClientAreaBounds().height;
request.SetAlertText(messageText);
request.SetTitleText(L"");
request.SetAppMessage(contentPath);
- request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
- request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
+
Tizen::App::App* pApp = Tizen::App::App::GetInstance();
String homePath = pApp->GetAppRootPath();
String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
Tizen::Shell::NotificationManager notiMgr;
notiMgr.Construct();
- notiMgr.NotifyOngoingActivity(request);
+ notiMgr.Notify(request);
AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
return;
}
__pAddressbar->SetUrl(__displayUrl);
}
if(__pFooterUrlField)
+ {
+ AppLog("Position:: %d, %ls",__pFooterUrlField->GetTextLength(),__pFooterUrlField->GetText().GetPointer());
__pFooterUrlField->SetCursorPosition(__pFooterUrlField->GetTextLength());
+ }
__pFooterUrlField->Invalidate(false);
if(__pAddressbar != NULL && __pAddressbar->HasFocus())
__pAddressbar->Invalidate(true);
void
MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
{
- if (requestId == BACK_GROUND_APP_EVENT)
+ if (requestId == UPDATE_MAINFORM_FOOTER_ON_WINDOWCLOSED)
+ {
+ AppLog("OnWebWindowCloseRequested mainform test 1 OnUserEventReceivedN");
+ InitFooter();
+ }
+ else if (requestId == BACK_GROUND_APP_EVENT)
{
if(__pWebViewer != null)
{