Merge lp:~michael-sheldon/ubuntu-keyboard/hide-setting into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 285
Merged at revision: 298
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/hide-setting
Merge into: lp:ubuntu-keyboard
Diff against target: 180 lines (+46/-12)
6 files modified
data/schemas/com.canonical.keyboard.maliit.gschema.xml (+5/-0)
src/plugin/inputmethod.cpp (+6/-3)
src/plugin/inputmethod_p.h (+6/-0)
src/plugin/keyboardsettings.cpp (+12/-0)
src/plugin/keyboardsettings.h (+2/-0)
tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp (+15/-9)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/hide-setting
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+246415@code.launchpad.net

Commit message

Adds a setting to allow the keyboard to remain hidden at all times (e.g. when a hardware keyboard is connected)

Description of the change

Adds a setting to allow the keyboard to remain hidden at all times (e.g. when a hardware keyboard is connected)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

Tested this and works fine.

review: Approve
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)

 * Yes

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

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/schemas/com.canonical.keyboard.maliit.gschema.xml'
2--- data/schemas/com.canonical.keyboard.maliit.gschema.xml 2014-09-02 19:29:43 +0000
3+++ data/schemas/com.canonical.keyboard.maliit.gschema.xml 2015-01-14 12:09:44 +0000
4@@ -56,5 +56,10 @@
5 <description>Insert a full-stop when space is pressed twice.</description>
6 <default>true</default>
7 </key>
8+ <key name="stay-hidden" type="b">
9+ <summary>Stay hidden</summary>
10+ <description>Never show the keyboard (e.g. because a hardware keyboard has been connected.)</description>
11+ <default>false</default>
12+ </key>
13 </schema>
14 </schemalist>
15
16=== modified file 'src/plugin/inputmethod.cpp'
17--- src/plugin/inputmethod.cpp 2014-12-05 00:49:11 +0000
18+++ src/plugin/inputmethod.cpp 2015-01-14 12:09:44 +0000
19@@ -116,6 +116,7 @@
20 d->registerActiveLanguage();
21 d->registerEnabledLanguages();
22 d->registerDoubleSpaceFullStop();
23+ d->registerStayHidden();
24
25 //fire signal so all listeners know what active language is
26 Q_EMIT activeLanguageChanged(d->activeLanguage);
27@@ -135,9 +136,11 @@
28 {
29 Q_D(InputMethod);
30
31- d->m_geometry->setShown(true);
32- update();
33- d->view->setVisible(true);
34+ if(!d->m_settings.stayHidden()) {
35+ d->m_geometry->setShown(true);
36+ update();
37+ d->view->setVisible(true);
38+ }
39 }
40
41 //! \brief InputMethod::hide
42
43=== modified file 'src/plugin/inputmethod_p.h'
44--- src/plugin/inputmethod_p.h 2014-12-05 00:49:11 +0000
45+++ src/plugin/inputmethod_p.h 2015-01-14 12:09:44 +0000
46@@ -255,6 +255,12 @@
47 editor.setDoubleSpaceFullStopEnabled(m_settings.doubleSpaceFullStop());
48 }
49
50+ void registerStayHidden()
51+ {
52+ QObject::connect(&m_settings, SIGNAL(stayHiddenChanged(bool)),
53+ q, SLOT(hide()));
54+ }
55+
56 void closeOskWindow()
57 {
58 if (!view->isVisible())
59
60=== modified file 'src/plugin/keyboardsettings.cpp'
61--- src/plugin/keyboardsettings.cpp 2014-07-22 14:02:39 +0000
62+++ src/plugin/keyboardsettings.cpp 2015-01-14 12:09:44 +0000
63@@ -44,6 +44,7 @@
64 const QLatin1String KEY_PRESS_AUDIO_FEEDBACK_SOUND_KEY = QLatin1String("keyPressFeedbackSound");
65 const QLatin1String KEY_PRESS_HAPTIC_FEEDBACK_KEY = QLatin1String("keyPressHapticFeedback");
66 const QLatin1String DOUBLE_SPACE_FULL_STOP = QLatin1String("doubleSpaceFullStop");
67+const QLatin1String STAY_HIDDEN = QLatin1String("stayHidden");
68
69 /*!
70 * \brief KeyboardSettings::KeyboardSettings class to load the settings, and
71@@ -163,6 +164,15 @@
72 }
73
74 /*!
75+ * \brief KeyboardSettings:stayHidden returns true if the keyboard should
76+ * always remain hidden (e.g. if a hardware keyboard has been connected).
77+ */
78+bool KeyboardSettings::stayHidden() const
79+{
80+ return m_settings->get(STAY_HIDDEN).toBool();
81+}
82+
83+/*!
84 * \brief KeyboardSettings::settingUpdated slot to handle changes in the settings backend
85 * A specialized signal is emitted for the affected setting
86 * \param key
87@@ -199,6 +209,8 @@
88 } else if (key == DOUBLE_SPACE_FULL_STOP) {
89 Q_EMIT doubleSpaceFullStopChanged(doubleSpaceFullStop());
90 return;
91+ } else if (key == STAY_HIDDEN) {
92+ Q_EMIT stayHiddenChanged(stayHidden());
93 }
94
95 qWarning() << Q_FUNC_INFO << "unknown settings key:" << key;
96
97=== modified file 'src/plugin/keyboardsettings.h'
98--- src/plugin/keyboardsettings.h 2014-07-22 14:02:39 +0000
99+++ src/plugin/keyboardsettings.h 2015-01-14 12:09:44 +0000
100@@ -54,6 +54,7 @@
101 QString keyPressAudioFeedbackSound() const;
102 bool keyPressHapticFeedback() const;
103 bool doubleSpaceFullStop() const;
104+ bool stayHidden() const;
105
106 Q_SIGNALS:
107 void activeLanguageChanged(QString);
108@@ -66,6 +67,7 @@
109 void keyPressAudioFeedbackSoundChanged(QString);
110 void keyPressHapticFeedbackChanged(bool);
111 void doubleSpaceFullStopChanged(bool);
112+ void stayHiddenChanged(bool);
113
114 private:
115 Q_SLOT void settingUpdated(const QString &key);
116
117=== modified file 'tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp'
118--- tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp 2014-07-22 14:02:39 +0000
119+++ tests/unittests/ut_keyboardsettings/ut_keyboardsettings.cpp 2015-01-14 12:09:44 +0000
120@@ -67,25 +67,28 @@
121 QTest::addColumn<int>("feedbackSpyCount");
122 QTest::addColumn<int>("feedbackSoundSpyCount");
123 QTest::addColumn<int>("doubleSpaceFullStopSpyCount");
124+ QTest::addColumn<int>("stayHiddenSpyCount");
125
126 QTest::newRow("languages changed") << QString("enabledLanguages")
127- << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
128+ << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
129 QTest::newRow("capitalization changed") << QString("autoCapitalization")
130- << 0 << 1 << 0 << 0 << 0 << 0 << 0 << 0;
131+ << 0 << 1 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
132 QTest::newRow("completion changed") << QString("autoCompletion")
133- << 0 << 0 << 1 << 0 << 0 << 0 << 0 << 0;
134+ << 0 << 0 << 1 << 0 << 0 << 0 << 0 << 0 << 0;
135 QTest::newRow("predict changed") << QString("predictiveText")
136- << 0 << 0 << 0 << 1 << 0 << 0 << 0 << 0;
137+ << 0 << 0 << 0 << 1 << 0 << 0 << 0 << 0 << 0;
138 QTest::newRow("spellcheck changed") << QString("spellChecking")
139- << 0 << 0 << 0 << 0 << 1 << 0 << 0 << 0;
140+ << 0 << 0 << 0 << 0 << 1 << 0 << 0 << 0 << 0;
141 QTest::newRow("feedback changed") << QString("keyPressFeedback")
142- << 0 << 0 << 0 << 0 << 0 << 1 << 0 << 0;
143+ << 0 << 0 << 0 << 0 << 0 << 1 << 0 << 0 << 0;
144 QTest::newRow("feedback sound changed") << QString("keyPressFeedbackSound")
145- << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 0;
146+ << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 0 << 0;
147 QTest::newRow("doule space full-stop changed") << QString("doubleSpaceFullStop")
148- << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1;
149+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1 << 0;
150+ QTest::newRow("stay hidden changed") << QString("stayHidden")
151+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 1;
152 QTest::newRow("unknown changed") << QString("unknownKey")
153- << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
154+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
155 }
156
157 Q_SLOT void testSettingUpdated()
158@@ -99,6 +102,7 @@
159 QFETCH(int, feedbackSpyCount);
160 QFETCH(int, feedbackSoundSpyCount);
161 QFETCH(int, doubleSpaceFullStopSpyCount);
162+ QFETCH(int, stayHiddenSpyCount);
163
164 QSignalSpy languagesSpy(m_settings, SIGNAL(enabledLanguagesChanged(QStringList)));
165 QSignalSpy capitalSpy(m_settings, SIGNAL(autoCapitalizationChanged(bool)));
166@@ -108,6 +112,7 @@
167 QSignalSpy feedbackSpy(m_settings, SIGNAL(keyPressAudioFeedbackChanged(bool)));
168 QSignalSpy feedbackSoundSpy(m_settings, SIGNAL(keyPressAudioFeedbackSoundChanged(QString)));
169 QSignalSpy doubleSpaceFullStopSpy(m_settings, SIGNAL(doubleSpaceFullStopChanged(bool)));
170+ QSignalSpy stayHiddenSpy(m_settings, SIGNAL(stayHiddenChanged(bool)));
171
172 m_settings->settingUpdated(key);
173
174@@ -119,6 +124,7 @@
175 QCOMPARE(feedbackSpy.count(), feedbackSpyCount);
176 QCOMPARE(feedbackSoundSpy.count(), feedbackSoundSpyCount);
177 QCOMPARE(doubleSpaceFullStopSpy.count(), doubleSpaceFullStopSpyCount);
178+ QCOMPARE(stayHiddenSpy.count(), stayHiddenSpyCount);
179 }
180 };
181

Subscribers

People subscribed via source and target branches