Merge lp:~michael-sheldon/ubuntu-keyboard/fix-1358224 into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 224
Merged at revision: 224
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-1358224
Merge into: lp:ubuntu-keyboard
Diff against target: 207 lines (+115/-10)
5 files modified
qml/keys/LanguageMenu.qml (+12/-8)
src/plugin/greeterstatus.cpp (+54/-0)
src/plugin/greeterstatus.h (+41/-0)
src/plugin/inputmethod_p.h (+4/-0)
src/plugin/plugin.pro (+4/-2)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-1358224
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+234661@code.launchpad.net

Commit message

Hide the settings option in the keyboard's language menu when the phone is locked.

Description of the change

Hide the settings option in the keyboard's language menu when the phone is locked.

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 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

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

Did you perform an exploratory manual test run of the 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/<package-name>) on device or emulator?
yes

Did CI run pass? If not, please explain why.
yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/sr/src/database_sr.db'
2Binary files plugins/sr/src/database_sr.db 2014-09-10 14:57:12 +0000 and plugins/sr/src/database_sr.db 2014-09-15 10:38:09 +0000 differ
3=== modified file 'qml/keys/LanguageMenu.qml'
4--- qml/keys/LanguageMenu.qml 2014-08-26 17:26:33 +0000
5+++ qml/keys/LanguageMenu.qml 2014-09-15 10:38:09 +0000
6@@ -53,16 +53,20 @@
7 maliit_input_method.activeLanguage = modelData
8 canvas.languageMenuShown = false;
9 }
10- }
11+ }
12
13- footer: ListItem.Standard {
14- text: i18n.tr("Settings")
15- onClicked: {
16- Qt.openUrlExternally("settings:///system/language")
17- canvas.languageMenuShown = false;
18- maliit_input_method.hide();
19+ Component {
20+ id: settingsItem
21+ ListItem.Standard {
22+ text: i18n.tr("Settings")
23+ onClicked: {
24+ Qt.openUrlExternally("settings:///system/language")
25+ canvas.languageMenuShown = false;
26+ maliit_input_method.hide();
27+ }
28 }
29- }
30+ }
31+ footer: greeter_status.greeterActive ? null : settingsItem
32 }
33
34 function languageIdToName(languageId)
35
36=== added file 'src/plugin/greeterstatus.cpp'
37--- src/plugin/greeterstatus.cpp 1970-01-01 00:00:00 +0000
38+++ src/plugin/greeterstatus.cpp 2014-09-15 10:38:09 +0000
39@@ -0,0 +1,54 @@
40+/*
41+ * Copyright 2014 Canonical Ltd.
42+ *
43+ * This program is free software; you can redistribute it and/or modify
44+ * it under the terms of the GNU Lesser General Public License as published by
45+ * the Free Software Foundation; version 3.
46+ *
47+ * This program is distributed in the hope that it will be useful,
48+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+ * GNU Lesser General Public License for more details.
51+ *
52+ * You should have received a copy of the GNU Lesser General Public License
53+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
54+ */
55+
56+#include <QDBusConnection>
57+#include <QDBusInterface>
58+#include <QDBusReply>
59+#include "greeterstatus.h"
60+
61+GreeterStatus::GreeterStatus(QObject *parent) : QObject(parent)
62+{
63+ QDBusConnection connection = QDBusConnection::sessionBus();
64+ QDBusInterface greeterPropsIface("com.canonical.UnityGreeter",
65+ "/",
66+ "org.freedesktop.DBus.Properties");
67+ QDBusReply<QVariant> reply = greeterPropsIface.call("Get", "com.canonical.UnityGreeter", "IsActive");
68+ m_greeterActive = reply.isValid() && reply.value().toBool();
69+ connection.connect("com.canonical.UnityGreeter",
70+ "/",
71+ "org.freedesktop.DBus.Properties",
72+ "PropertiesChanged",
73+ this,
74+ SLOT(greeterPropertiesChanged(QString, QVariantMap, QStringList)));
75+}
76+
77+bool GreeterStatus::greeterActive() const
78+{
79+ return m_greeterActive;
80+}
81+
82+void GreeterStatus::greeterPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated)
83+{
84+ Q_UNUSED(invalidated);
85+
86+ if (interface == "com.canonical.UnityGreeter") {
87+ if (changed.contains("IsActive")) {
88+ m_greeterActive = changed.value("IsActive").toBool();
89+ Q_EMIT greeterActiveChanged();
90+ }
91+ }
92+}
93+
94
95=== added file 'src/plugin/greeterstatus.h'
96--- src/plugin/greeterstatus.h 1970-01-01 00:00:00 +0000
97+++ src/plugin/greeterstatus.h 2014-09-15 10:38:09 +0000
98@@ -0,0 +1,41 @@
99+/*
100+ * Copyright 2014 Canonical Ltd.
101+ *
102+ * This program is free software; you can redistribute it and/or modify
103+ * it under the terms of the GNU Lesser General Public License as published by
104+ * the Free Software Foundation; version 3.
105+ *
106+ * This program is distributed in the hope that it will be useful,
107+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
108+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109+ * GNU Lesser General Public License for more details.
110+ *
111+ * You should have received a copy of the GNU Lesser General Public License
112+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
113+ */
114+
115+#ifndef GREETERSTATUS_H
116+#define GREETERSTATUS_H
117+
118+#include <QObject>
119+
120+class GreeterStatus : public QObject
121+{
122+ Q_OBJECT
123+ Q_PROPERTY(bool greeterActive READ greeterActive NOTIFY greeterActiveChanged)
124+
125+public:
126+ GreeterStatus(QObject *parent = 0);
127+ bool greeterActive() const;
128+
129+Q_SIGNALS:
130+ void greeterActiveChanged();
131+
132+private Q_SLOTS:
133+ void greeterPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
134+
135+private:
136+ bool m_greeterActive;
137+};
138+
139+#endif // GREETERSTATUS_H
140
141=== modified file 'src/plugin/inputmethod_p.h'
142--- src/plugin/inputmethod_p.h 2014-09-09 11:26:52 +0000
143+++ src/plugin/inputmethod_p.h 2014-09-15 10:38:09 +0000
144@@ -3,6 +3,7 @@
145
146 #include "logic/layoutupdater.h"
147 #include "editor.h"
148+#include "greeterstatus.h"
149 #include "keyboardgeometry.h"
150 #include "keyboardsettings.h"
151
152@@ -60,6 +61,7 @@
153
154 KeyboardGeometry *m_geometry;
155 KeyboardSettings m_settings;
156+ GreeterStatus *m_greeterStatus;
157
158 WordRibbon* wordRibbon;
159
160@@ -82,6 +84,7 @@
161 , keyboardState("CHARACTERS")
162 , m_geometry(new KeyboardGeometry(q))
163 , m_settings()
164+ , m_greeterStatus(new GreeterStatus())
165 , wordRibbon(new WordRibbon)
166 , previous_position(-1)
167 {
168@@ -174,6 +177,7 @@
169 qml_context->setContextProperty("maliit_event_handler", &event_handler);
170 qml_context->setContextProperty("maliit_wordribbon", wordRibbon);
171 qml_context->setContextProperty("maliit_word_engine", editor.wordEngine());
172+ qml_context->setContextProperty("greeter_status", m_greeterStatus);
173 }
174
175
176
177=== modified file 'src/plugin/plugin.pro'
178--- src/plugin/plugin.pro 2013-12-19 15:55:17 +0000
179+++ src/plugin/plugin.pro 2014-09-15 10:38:09 +0000
180@@ -14,9 +14,9 @@
181 DEFINES += MALIIT_DEFAULT_PROFILE=\\\"$$MALIIT_DEFAULT_PROFILE\\\"
182
183 contains(QT_MAJOR_VERSION, 4) {
184- QT = core gui
185+ QT = core gui dbus
186 } else {
187- QT = core gui widgets quick qml
188+ QT = core gui widgets quick qml dbus
189 }
190
191 CONFIG += \
192@@ -27,6 +27,7 @@
193 inputmethod.h \
194 inputmethod_p.h \
195 editor.h \
196+ greeterstatus.h \
197 keyboardgeometry.h \
198 keyboardsettings.h \
199 # updatenotifier.h \
200@@ -36,6 +37,7 @@
201 plugin.cpp \
202 inputmethod.cpp \
203 editor.cpp \
204+ greeterstatus.cpp \
205 keyboardgeometry.cpp \
206 keyboardsettings.cpp \
207 # updatenotifier.cpp \

Subscribers

People subscribed via source and target branches