0, // InspectElement,
+ "InsertNewline", // InsertParagraphSeparator
+ "InsertLineBreak", // InsertLineSeparator
+
0 // WebActionCount
};
static struct {
QKeySequence::StandardKey standardKey;
QWebPage::WebAction action;
- } editorActions[32] = {
+ } editorActions[] = {
{ QKeySequence::Cut, QWebPage::Cut },
{ QKeySequence::Copy, QWebPage::Copy },
{ QKeySequence::Paste, QWebPage::Paste },
{ QKeySequence::SelectEndOfDocument, QWebPage::SelectEndOfDocument },
{ QKeySequence::DeleteStartOfWord, QWebPage::DeleteStartOfWord },
{ QKeySequence::DeleteEndOfWord, QWebPage::DeleteEndOfWord },
+#if QT_VERSION >= 0x040500
+ { QKeySequence::InsertParagraphSeparator, QWebPage::InsertParagraphSeparator },
+ { QKeySequence::InsertLineSeparator, QWebPage::InsertLineSeparator },
+#endif
{ QKeySequence::UnknownKey, QWebPage::NoWebAction }
};
\value ToggleItalic Toggle the formatting between italic and normal style.
\value ToggleUnderline Toggle underlining.
\value InspectElement Show the Web Inspector with the currently highlighted HTML element.
+ \value InsertParagraphSeparator Insert a new paragraph.
+ \value InsertLineSeparator Insert a new line.
\omitvalue WebActionCount
*/
+2008-08-05 Tor Arne Vestbø <tavestbo@trolltech.com>
+
+ Reviewed by Simon.
+
+ Move event handling of the return-key from EditorClientQt to QWebPage.
+
+ https://bugs.webkit.org/show_bug.cgi?id=20191
+
+ This is a first step in refactoring the big switch block
+ in EditorClientQt::handleKeyboardEvent to using WebActions
+ instead.
+
+ The new logic uses two new StandardKeys from QKeySequence:
+
+ - InsertParagraphSeparator
+ - InsertLineSeparator
+
+ Which translate to the commands InsertNewline and InsertLineBreak
+ respectivly. On Windows/X11 pressing the shift modifier will invoke
+ the latter action. For Mac this is triggered by pressing the meta
+ modifier (Ctrl).
+
+ Initial patch by: Erik Bunce
+
+ * Api/qwebpage.cpp:
+ (editorActionForKeyEvent):
+ * Api/qwebpage.h:
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::handleKeyboardEvent):
+
2008-08-04 Erik Bunce <elbunce@thehive.com>
Reviewed by Simon.
// FIXME: refactor all of this to use Actions or something like them
if (start->isContentEditable()) {
switch (kevent->windowsVirtualKeyCode()) {
+#if QT_VERSION < 0x040500
case VK_RETURN:
- frame->editor()->command("InsertLineBreak").execute();
+#ifdef QT_WS_MAC
+ if (kevent->shiftKey() || kevent->metaKey())
+#else
+ if (kevent->shiftKey())
+#endif
+ frame->editor()->command("InsertLineBreak").execute();
+ else
+ frame->editor()->command("InsertNewline").execute();
break;
+#endif
case VK_BACK:
frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
CharacterGranularity, false, true);