From 181a9338f42dd79ef9f8b6a5ad2029e344a96074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 18 Jan 2010 10:06:40 +0000 Subject: [PATCH] * GuiSpellchecker: - implement event filter and allow selection of suggestions with the keyboard (second part of bug 6460). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@33079 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiSpellchecker.cpp | 21 +++++++++++++++++++++ src/frontends/qt4/GuiSpellchecker.h | 3 +++ status.16x | 16 +++++----------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 5a57971c47..b8090dc78b 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -30,6 +30,7 @@ #include "support/lstrings.h" #include "support/textutils.h" +#include #include #if defined(USE_ASPELL) @@ -74,6 +75,8 @@ GuiSpellchecker::GuiSpellchecker(GuiView & lv) wordED->setReadOnly(true); + suggestionsLW->installEventFilter(this); + bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); bc().setCancel(closePB); } @@ -85,6 +88,24 @@ GuiSpellchecker::~GuiSpellchecker() } +bool GuiSpellchecker::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == suggestionsLW && event->type() == QEvent::KeyPress) { + QKeyEvent *e = static_cast (event); + if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { + suggestionChanged(suggestionsLW->currentItem()); + replace(); + return true; + } else if (e->key() == Qt::Key_Right) { + suggestionChanged(suggestionsLW->currentItem()); + return true; + } + } + // standard event processing + return QWidget::eventFilter(obj, event); +} + + void GuiSpellchecker::suggestionChanged(QListWidgetItem * item) { if (replaceCO->count() != 0) diff --git a/src/frontends/qt4/GuiSpellchecker.h b/src/frontends/qt4/GuiSpellchecker.h index 19186ee211..2eedf4f6a7 100644 --- a/src/frontends/qt4/GuiSpellchecker.h +++ b/src/frontends/qt4/GuiSpellchecker.h @@ -52,6 +52,9 @@ private: /// void updateContents(); + /// + bool eventFilter(QObject *obj, QEvent *event); + /// enum State { SPELL_PROGRESSED, //< update progress bar diff --git a/status.16x b/status.16x index ecc525db67..bd4dff2a5a 100644 --- a/status.16x +++ b/status.16x @@ -27,8 +27,6 @@ What's new - LyX now supports SVG images when either the librsvg library or or Inkscape (version 0.47 recommended) is installed (bug 3349). -- The definition of multi-accented polytonic Greek has been simplified. - - LaTeX import (tex2lyx) now recognizes the types of quotes dependent on the document language. (When importing e.g. a Spanish document, LyX will use comillas latinas as quotes.) @@ -57,8 +55,8 @@ What's new - The dinbrief template was revised. -- Updated Czech, German, Indonesian, Italian, Russian, Slovak and Spanish - user interface localization. +- Updated Czech, French, German, Indonesian, Italian, Russian, Slovak + and Spanish user interface localization. - The rpm README file was updated. @@ -72,7 +70,6 @@ What's new - Add support for Cygwin 1.7. - ** Bug fixes: ************* @@ -96,8 +93,6 @@ What's new - LaTeX import (tex2lyx) now also recognizes the document language Kazakh. -- Fix polytonic Greek macro definition. - * USER INTERFACE @@ -118,8 +113,8 @@ What's new - Fix cursor placement in math when inserting 'active' insets (bug 6382). -- Fix display of author names containing a thin space (\,) in the - citation inset. +- Fix on-screen display of author names containing a thin space + (such as W.\,H. Auden). - Take into account the current zoom factor, dip, or preview scale factor when an instant preview is generated. @@ -146,8 +141,7 @@ What's new - Better detection and response on svn conflicts. -- Add more keyboard accelerators to the spellchecker dialog - (part of bug 6460). +- Enable full keyboard navigation in the spellchecker dialog (bug 6460). * DOCUMENTATION AND LOCALIZATION