Merge lp:~michael-sheldon/ubuntu-keyboard/fix-1372948-rtm into lp:ubuntu-keyboard/rtm-14.09

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 237
Merged at revision: 237
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-1372948-rtm
Merge into: lp:ubuntu-keyboard/rtm-14.09
Diff against target: 129 lines (+30/-6)
5 files modified
plugins/en/src/englishplugin.h (+1/-0)
plugins/westernsupport/spellpredictworker.cpp (+18/-5)
plugins/westernsupport/spellpredictworker.h (+3/-1)
plugins/westernsupport/westernlanguagesplugin.cpp (+6/-0)
plugins/westernsupport/westernlanguagesplugin.h (+2/-0)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-1372948-rtm
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
Review via email: mp+243564@code.launchpad.net

Commit message

Automatically correct 'i' to 'I' when using the English language plugin.

Description of the change

Automatically correct 'i' to 'I' when using the English language plugin.

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * In sync with rtm-14.09 branch

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * Yes, except for last test in word prediction section as this isn't implemented in the 14.09 branch.

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/en/src/englishplugin.h'
--- plugins/en/src/englishplugin.h 2014-05-19 11:53:27 +0000
+++ plugins/en/src/englishplugin.h 2014-12-03 17:17:29 +0000
@@ -17,6 +17,7 @@
17 explicit EnglishPlugin(QObject* parent = 0)17 explicit EnglishPlugin(QObject* parent = 0)
18 : WesternLanguagesPlugin(parent)18 : WesternLanguagesPlugin(parent)
19 {19 {
20 addOverride("i", "I");
20 }21 }
2122
22 virtual ~EnglishPlugin()23 virtual ~EnglishPlugin()
2324
=== modified file 'plugins/westernsupport/spellpredictworker.cpp'
--- plugins/westernsupport/spellpredictworker.cpp 2014-08-07 17:04:01 +0000
+++ plugins/westernsupport/spellpredictworker.cpp 2014-12-03 17:17:29 +0000
@@ -43,14 +43,23 @@
43 m_presage.config("Presage.Selector.REPEAT_SUGGESTIONS", "yes");43 m_presage.config("Presage.Selector.REPEAT_SUGGESTIONS", "yes");
44}44}
4545
46void SpellPredictWorker::parsePredictionText(const QString& surroundingLeft, const QString& preedit)46void SpellPredictWorker::parsePredictionText(const QString& surroundingLeft, const QString& origPreedit)
47{47{
48 m_candidatesContext = (surroundingLeft.toStdString() + preedit.toStdString());48 m_candidatesContext = (surroundingLeft.toStdString() + origPreedit.toStdString());
4949
50 QStringList list;50 QStringList list;
5151
52 // If the user input is spelt correctly add it to the start of the predictions52 QString preedit = origPreedit;
53 if(m_spellChecker.spell(preedit)) {53
54 // Allow plugins to override certain words such as ('i' -> 'I')
55 if(m_overrides.contains(preedit)) {
56 preedit = m_overrides[preedit];
57 list << preedit;
58 // Emit the override corrections instantly so they're always up-to-date
59 // as they're often used for short words like 'I'
60 Q_EMIT newPredictionSuggestions(origPreedit, list);
61 } else if(m_spellChecker.spell(preedit)) {
62 // If the user input is spelt correctly add it to the start of the predictions
54 list << preedit;63 list << preedit;
55 }64 }
5665
@@ -74,7 +83,7 @@
74 qWarning() << "An exception was thrown in libpresage when calling predict(), exception nr: " << error;83 qWarning() << "An exception was thrown in libpresage when calling predict(), exception nr: " << error;
75 }84 }
7685
77 Q_EMIT newPredictionSuggestions(preedit, list);86 Q_EMIT newPredictionSuggestions(origPreedit, list);
78}87}
7988
80void SpellPredictWorker::setLanguage(QString locale)89void SpellPredictWorker::setLanguage(QString locale)
@@ -131,3 +140,7 @@
131 m_limit = limit;140 m_limit = limit;
132}141}
133142
143void SpellPredictWorker::addOverride(const QString& orig, const QString& overriden)
144{
145 m_overrides[orig] = overriden;
146}
134147
=== modified file 'plugins/westernsupport/spellpredictworker.h'
--- plugins/westernsupport/spellpredictworker.h 2014-08-07 17:04:01 +0000
+++ plugins/westernsupport/spellpredictworker.h 2014-12-03 17:17:29 +0000
@@ -34,6 +34,7 @@
3434
35#include <QObject>35#include <QObject>
36#include <QStringList>36#include <QStringList>
37#include <QMap>
3738
38class CandidatesCallback;39class CandidatesCallback;
3940
@@ -51,6 +52,7 @@
51 void setLanguage(QString language);52 void setLanguage(QString language);
52 void setSpellCheckLimit(int limit);53 void setSpellCheckLimit(int limit);
53 void addToUserWordList(const QString& word);54 void addToUserWordList(const QString& word);
55 void addOverride(const QString& orig, const QString& overriden);
5456
55signals:57signals:
56 void newSpellingSuggestions(QString word, QStringList suggestions);58 void newSpellingSuggestions(QString word, QStringList suggestions);
@@ -64,7 +66,7 @@
64 QString m_word;66 QString m_word;
65 int m_limit;67 int m_limit;
66 bool m_processingWords;68 bool m_processingWords;
6769 QMap<QString, QString> m_overrides;
68};70};
6971
70#endif // SPELLPREDICTWORKER_H72#endif // SPELLPREDICTWORKER_H
7173
=== modified file 'plugins/westernsupport/westernlanguagesplugin.cpp'
--- plugins/westernsupport/westernlanguagesplugin.cpp 2014-08-07 17:04:01 +0000
+++ plugins/westernsupport/westernlanguagesplugin.cpp 2014-12-03 17:17:29 +0000
@@ -20,6 +20,7 @@
20 connect(this, SIGNAL(setSpellCheckLimit(int)), spellPredictWorker, SLOT(setSpellCheckLimit(int)));20 connect(this, SIGNAL(setSpellCheckLimit(int)), spellPredictWorker, SLOT(setSpellCheckLimit(int)));
21 connect(this, SIGNAL(parsePredictionText(QString, QString)), spellPredictWorker, SLOT(parsePredictionText(QString, QString)));21 connect(this, SIGNAL(parsePredictionText(QString, QString)), spellPredictWorker, SLOT(parsePredictionText(QString, QString)));
22 connect(this, SIGNAL(addToUserWordList(QString)), spellPredictWorker, SLOT(addToUserWordList(QString)));22 connect(this, SIGNAL(addToUserWordList(QString)), spellPredictWorker, SLOT(addToUserWordList(QString)));
23 connect(this, SIGNAL(addOverride(QString, QString)), spellPredictWorker, SLOT(addOverride(QString, QString)));
23 m_spellPredictThread->start();24 m_spellPredictThread->start();
24}25}
2526
@@ -59,3 +60,8 @@
59 Q_EMIT setSpellPredictLanguage(languageId);60 Q_EMIT setSpellPredictLanguage(languageId);
60 return true;61 return true;
61}62}
63
64void WesternLanguagesPlugin::addSpellingOverride(const QString& orig, const QString& overriden)
65{
66 Q_EMIT addOverride(orig, overriden);
67}
6268
=== modified file 'plugins/westernsupport/westernlanguagesplugin.h'
--- plugins/westernsupport/westernlanguagesplugin.h 2014-08-07 17:04:01 +0000
+++ plugins/westernsupport/westernlanguagesplugin.h 2014-12-03 17:17:29 +0000
@@ -31,6 +31,7 @@
31 virtual void spellCheckerSuggest(const QString& word, int limit);31 virtual void spellCheckerSuggest(const QString& word, int limit);
32 virtual void addToSpellCheckerUserWordList(const QString& word);32 virtual void addToSpellCheckerUserWordList(const QString& word);
33 virtual bool setLanguage(const QString& languageId);33 virtual bool setLanguage(const QString& languageId);
34 virtual void addSpellingOverride(const QString& orig, const QString& overriden);
3435
35signals:36signals:
36 void newSpellingSuggestions(QString word, QStringList suggestions);37 void newSpellingSuggestions(QString word, QStringList suggestions);
@@ -41,6 +42,7 @@
41 void parsePredictionText(QString surroundingLeft, QString preedit);42 void parsePredictionText(QString surroundingLeft, QString preedit);
42 void setPredictionLanguage(QString language);43 void setPredictionLanguage(QString language);
43 void addToUserWordList(const QString& word);44 void addToUserWordList(const QString& word);
45 void addOverride(const QString& orig, const QString& overriden);
4446
45public slots:47public slots:
4648

Subscribers

People subscribed via source and target branches