--- a/webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp Tue Aug 31 16:17:46 2010 +0300
+++ b/webengine/osswebengine/WebKit/s60/webcoresupport/WebEditorClient.cpp Wed Sep 01 12:28:30 2010 +0100
@@ -31,9 +31,9 @@
#include "WebView.h"
#include "WebFrame.h"
#include "WebFormFill.h"
-#include "HTMLNames.h"
+#include "HtmlNames.h"
#include "WebFepTextEditor.h"
-#include <EIKCOCTL.rsg>
+#include <eikcoctl.rsg>
#include <eikon.hrh>
@@ -317,7 +317,7 @@
//-----------------------------------------------------------------------------
void WebEditorClient::handleKeypress(KeyboardEvent* event)
{
- if (!m_webView && !m_webView->page()) {
+ if (!(m_webView && m_webView->page())) {
return;
}
@@ -380,12 +380,12 @@
frame->editor()->execCommand("MoveLeft");
}
m_webView->fepTextEditor()->HandleUpdateCursor();
- if (frame->selectionController()->start() != startPos &&
- frame->selectionController()->end() != endPos) {
- event->setDefaultHandled();
+ if (frame->selectionController()->start() == startPos &&
+ frame->selectionController()->end() == endPos && !select) {
+ m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() || m_webView->fepTextEditor()->IsInputElementFocused());
}
else {
- m_shouldEndEditing = !m_webView->fepTextEditor()->IsTextAreaFocused();
+ event->setDefaultHandled();
}
break;
@@ -403,37 +403,51 @@
frame->editor()->execCommand("MoveRight");
}
m_webView->fepTextEditor()->HandleUpdateCursor();
- if (frame->selectionController()->start() != startPos &&
- frame->selectionController()->end() != endPos) {
- event->setDefaultHandled();
+ if (frame->selectionController()->start() == startPos &&
+ frame->selectionController()->end() == endPos && !select) {
+ m_shouldEndEditing = !(m_webView->fepTextEditor()->IsTextAreaFocused() || m_webView->fepTextEditor()->IsInputElementFocused());
}
else {
- m_shouldEndEditing = !m_webView->fepTextEditor()->IsTextAreaFocused();
+ event->setDefaultHandled();
}
break;
case EKeyUpArrow:
- frame->editor()->execCommand("MoveUp");
- m_webView->fepTextEditor()->HandleUpdateCursor();
- if (frame->selectionController()->start() != startPos &&
- frame->selectionController()->end() != endPos) {
- event->setDefaultHandled();
+ if (select) { //If shift is pressed then highlight the selection
+ if(kevent->isKeyDown())
+ break;
+ frame->editor()->execCommand("MoveUpAndModifySelection");//from createCommandMap()
}
else {
+ frame->editor()->execCommand("MoveUp");
+ }
+ m_webView->fepTextEditor()->HandleUpdateCursor();
+ if (frame->selectionController()->start() == startPos &&
+ frame->selectionController()->end() == endPos && !select) {
m_shouldEndEditing = true;
}
+ else {
+ event->setDefaultHandled();
+ }
break;
case EKeyDownArrow:
- frame->editor()->execCommand("MoveDown");
- m_webView->fepTextEditor()->HandleUpdateCursor();
- if (frame->selectionController()->start() != startPos &&
- frame->selectionController()->end() != endPos) {
- event->setDefaultHandled();
+ if (select) {//If shift is pressed then highlight the selection
+ if(kevent->isKeyDown())
+ break;
+ frame->editor()->execCommand("MoveDownAndModifySelection");//from createCommandMap()
}
else {
+ frame->editor()->execCommand("MoveDown");
+ }
+ m_webView->fepTextEditor()->HandleUpdateCursor();
+ if (frame->selectionController()->start() == startPos &&
+ frame->selectionController()->end() == endPos && !select) {
m_shouldEndEditing = true;
}
+ else {
+ event->setDefaultHandled();
+ }
break;
case EKeyEnter:
@@ -451,26 +465,6 @@
break;
case EKeyF18:
- if (magnify)
- {
- switch (kevent->symbianEvent().iScanCode)
- {
- case EEikCmdEditCut:
- m_webView->fepTextEditor()->CcpuCutL();
- frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
- CharacterGranularity, false, true);
- m_webView->fepTextEditor()->HandleUpdateCursor();
- break;
- case EEikCmdEditCopy:
- m_webView->fepTextEditor()->CcpuCopyL();
- break;
- case EEikCmdEditPaste:
- m_webView->fepTextEditor()->CcpuPasteL();
- break;
- default:
- break;
- }
- }
break;
// All of the diagonal KeyEvents are allowed to flow through the "default" case...
@@ -506,6 +500,8 @@
break;
}
+ if(m_webView->fepTextEditor()->inlineTextEditingStarted())
+ return;
if (TChar(kevent->symbianEvent().iCode).IsPrint()) {
if (m_webView->fepTextEditor()->DocumentLengthForFep() <
m_webView->fepTextEditor()->DocumentMaximumLengthForFep()) {
@@ -526,9 +522,11 @@
//-----------------------------------------------------------------------------
// WebEditorClient::handleInputMethodKeypress
//-----------------------------------------------------------------------------
-void WebEditorClient::handleInputMethodKeypress(KeyboardEvent*)
+void WebEditorClient::handleInputMethodKeypress(KeyboardEvent* event)
{
- notImplemented();
+ const PlatformKeyboardEvent* kevent = event->keyEvent();
+ if(kevent->isKeyDown())
+ handleKeypress(event);
}
//-----------------------------------------------------------------------------
@@ -563,8 +561,9 @@
//-----------------------------------------------------------------------------
bool WebEditorClient::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
{
- notImplemented();
- return false;
+
+ notImplemented();
+ return false;
}
//-----------------------------------------------------------------------------
@@ -691,3 +690,7 @@
}
}
+
+
+
+