Fixed Nabi Issues N_SE-52525,52761,52458,52443,52423,52179,52389 and third party...
[apps/osp/Internet.git] / src / IntMainForm.cpp
index d9b4a8d..4d4815d 100644 (file)
@@ -1340,7 +1340,7 @@ MainForm::CreateItem (int index, int itemWidth)
        {
                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);
                }
        }
 
@@ -1417,6 +1417,7 @@ MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listV
 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)
@@ -2508,6 +2509,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        String idElement = __pHitElementResult->GetAttributeValue(L"id");
                        String nameElement = __pHitElementResult->GetAttributeValue(L"name");
                        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);
@@ -2515,7 +2517,17 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        String* pCount = __pWebViewer->EvaluateJavascriptN(str);
 
                        String script;
-                       if(idElement.GetLength() != 0)
+                       if(contenteditable.Equals(L"true",false) == true)
+                       {
+                               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(idElement.GetLength() != 0)
                        {
                                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('");
@@ -4021,6 +4033,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
        {
                String tagName = __pHitElementResult->GetTagName();
                String type = __pHitElementResult->GetAttributeValue("type");
+               String contenteditable = __pHitElementResult->GetAttributeValue("contenteditable");
 
 
                AppLog("TagName %ls",tagName.GetPointer());
@@ -4037,7 +4050,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                        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");
 
@@ -4698,13 +4711,18 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
        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();
@@ -5382,7 +5400,7 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
        result r = E_SUCCESS;
 
 
-       if (__pWebViewer != null && __pMostVisitedListView != null)
+       if (__pMostVisitedListView != null)
        {
                return E_SUCCESS;
        }