Merge lp:~thomas-voss/trust-store/fix-1354092 into lp:trust-store

Proposed by Thomas Voß
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
Merged at revision: 46
Proposed branch: lp:~thomas-voss/trust-store/fix-1354092
Merge into: lp:trust-store
Diff against target: 545 lines (+293/-24)
19 files modified
CMakeLists.txt (+2/-1)
debian/changelog (+6/-0)
debian/libtrust-store1.install (+1/-0)
debian/libtrust-store1.install.with_mir (+0/-3)
debian/libtrust-store1.symbols (+5/-0)
debian/trust-store-bin.install (+2/-1)
debian/trust-store-bin.install.with_mir (+4/-0)
po/CMakeLists.txt (+37/-0)
po/de.po (+24/-0)
po/trust-store.pot (+24/-0)
src/CMakeLists.txt (+4/-5)
src/core/trust/daemon.cpp (+9/-0)
src/core/trust/daemon.h (+6/-0)
src/core/trust/i18n.cpp (+85/-0)
src/core/trust/i18n.h (+46/-0)
src/core/trust/mir/agent.cpp (+25/-2)
src/core/trust/mir/agent.h (+8/-9)
src/core/trust/mir/prompt_main.cpp (+2/-0)
tests/mir_agent_test.cpp (+3/-3)
To merge this branch: bzr merge lp:~thomas-voss/trust-store/fix-1354092
Reviewer Review Type Date Requested Status
Martin Pitt Approve
PS Jenkins bot continuous-integration Approve
Alberto Aguirre (community) Approve
Víctor R. Ruiz (community) Needs Fixing
Loïc Minier Approve
Review via email: mp+235299@code.launchpad.net

Commit message

Add i18n support to trust-store.

Description of the change

Add i18n support to trust-store.

To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote :

LGTM, even if I dont fully grasp the mutable_service_text_domain() = domain; stuff

review: Approve
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

It doesn't compile for me.

/home/phablet/trust-store/src/core/trust/daemon.cpp:334: undefined reference to `core::trust::i18n::set_service_text_domain(std::string const&)'
collect2: error: ld returned 1 exit status

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
41. By Thomas Voß

Throw on invalid mir connection or invalid prompt session. Fixes: 1370444
Approved by: Alberto Aguirre, PS Jenkins bot

42. By PS Jenkins bot

Replaced 0replaceme with real versions.

43. By PS Jenkins bot

Releasing 1.0.0+14.10.20141001-0ubuntu1

44. By Alberto Aguirre

Attempt mir connection more than once Fixes: 1377159
Approved by: PS Jenkins bot, Thomas Voß

45. By PS Jenkins bot

Releasing 1.0.0+14.10.20141006-0ubuntu1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Martin Pitt (pitti) wrote :

Packaging fixes ack. (as discussed on IRC)

review: Approve
46. By Thomas Voß

Add i18n support to trust-store. Fixes: 1353333, 1354092, 1367707
Approved by: Loïc Minier, Alberto Aguirre, PS Jenkins bot, Martin Pitt

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-08-13 08:24:18 +0000
3+++ CMakeLists.txt 2014-10-08 09:35:22 +0000
4@@ -48,7 +48,7 @@
5 pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
6
7 set(TRUST_STORE_VERSION_MAJOR 1)
8-set(TRUST_STORE_VERSION_MINOR 0)
9+set(TRUST_STORE_VERSION_MINOR 1)
10 set(TRUST_STORE_VERSION_PATCH 0)
11
12 include(CTest)
13@@ -64,6 +64,7 @@
14 add_subdirectory(doc)
15 add_subdirectory(data)
16 add_subdirectory(include)
17+add_subdirectory(po)
18 add_subdirectory(src)
19 add_subdirectory(tests)
20
21
22=== modified file 'debian/changelog'
23--- debian/changelog 2014-10-06 16:36:29 +0000
24+++ debian/changelog 2014-10-08 09:35:22 +0000
25@@ -1,3 +1,9 @@
26+trust-store (1.1.0) UNRELEASED; urgency=medium
27+
28+ * Add i18n support to the store.
29+
30+ -- Thomas Voß <thomas.voss@canonical.com> Fri, 19 Sep 2014 21:51:00 +0200
31+
32 trust-store (1.0.0+14.10.20141006-0ubuntu1) utopic; urgency=low
33
34 [ Alberto Aguirre ]
35
36=== modified file 'debian/libtrust-store1.install'
37--- debian/libtrust-store1.install 2014-08-06 11:31:59 +0000
38+++ debian/libtrust-store1.install 2014-10-08 09:35:22 +0000
39@@ -1,1 +1,2 @@
40 usr/lib/*/lib*.so.*
41+
42
43=== removed symlink 'debian/libtrust-store1.install.amd64'
44=== target was u'libtrust-store1.install.with_mir'
45=== removed symlink 'debian/libtrust-store1.install.arm64'
46=== target was u'libtrust-store1.install.with_mir'
47=== removed symlink 'debian/libtrust-store1.install.armhf'
48=== target was u'libtrust-store1.install.with_mir'
49=== removed symlink 'debian/libtrust-store1.install.i386'
50=== target was u'libtrust-store1.install.with_mir'
51=== removed file 'debian/libtrust-store1.install.with_mir'
52--- debian/libtrust-store1.install.with_mir 2014-08-06 11:31:59 +0000
53+++ debian/libtrust-store1.install.with_mir 1970-01-01 00:00:00 +0000
54@@ -1,3 +0,0 @@
55-usr/lib/*/lib*.so.*
56-usr/lib/*/trust-prompt
57-usr/share/core/trust/mir/*
58
59=== modified file 'debian/libtrust-store1.symbols'
60--- debian/libtrust-store1.symbols 2014-10-01 20:32:28 +0000
61+++ debian/libtrust-store1.symbols 2014-10-08 09:35:22 +0000
62@@ -1,4 +1,9 @@
63 libtrust-store.so.1 libtrust-store1 #MINVER#
64+ (c++)"core::trust::i18n::default_text_domain()@Base" 0replaceme
65+ (c++)"core::trust::i18n::service_text_domain()@Base" 0replaceme
66+ (c++)"core::trust::i18n::set_service_text_domain(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0replaceme
67+ (c++)"core::trust::i18n::tr(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0replaceme
68+ (c++)"core::trust::i18n::tr(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0replaceme
69 (c++)"core::trust::CachedAgent::Configuration::~Configuration()@Base" 1.0.0+14.10.20140806.7
70 (c++)"core::trust::CachedAgent::authenticate_request_with_parameters(core::trust::Agent::RequestParameters const&)@Base" 1.0.0+14.10.20140806.7
71 (c++)"core::trust::CachedAgent::Reporter::report_cached_answer_found(core::trust::Agent::RequestParameters const&, core::trust::Request const&)@Base" 1.0.0+14.10.20140814.1
72
73=== modified file 'debian/trust-store-bin.install'
74--- debian/trust-store-bin.install 2014-07-29 20:39:51 +0000
75+++ debian/trust-store-bin.install 2014-10-08 09:35:22 +0000
76@@ -1,1 +1,2 @@
77-usr/bin/trust*
78\ No newline at end of file
79+usr/bin/trust*
80+usr/share/locale/*
81
82=== added symlink 'debian/trust-store-bin.install.amd64'
83=== target is u'trust-store-bin.install.with_mir'
84=== added symlink 'debian/trust-store-bin.install.arm64'
85=== target is u'trust-store-bin.install.with_mir'
86=== added symlink 'debian/trust-store-bin.install.armhf'
87=== target is u'trust-store-bin.install.with_mir'
88=== added symlink 'debian/trust-store-bin.install.i386'
89=== target is u'trust-store-bin.install.with_mir'
90=== added file 'debian/trust-store-bin.install.with_mir'
91--- debian/trust-store-bin.install.with_mir 1970-01-01 00:00:00 +0000
92+++ debian/trust-store-bin.install.with_mir 2014-10-08 09:35:22 +0000
93@@ -0,0 +1,4 @@
94+usr/bin/trust*
95+usr/lib/*/trust-prompt
96+usr/share/locale/*
97+usr/share/core/trust/mir/*
98\ No newline at end of file
99
100=== added directory 'po'
101=== added file 'po/CMakeLists.txt'
102--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
103+++ po/CMakeLists.txt 2014-10-08 09:35:22 +0000
104@@ -0,0 +1,37 @@
105+include(FindGettext REQUIRED)
106+find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
107+
108+set(DOMAIN trust-store)
109+set(POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${DOMAIN}.pot)
110+file(GLOB PO_FILES *.po)
111+
112+# We look through all source files and find
113+# usages of i18n::tr.
114+file(
115+ GLOB_RECURSE I18N_CPP_SRC_FILES
116+ ${CMAKE_SOURCE_DIR}/src/*.cpp ${CMAKE_SOURCE_DIR}/src/*.qml)
117+
118+list(SORT I18N_CPP_SRC_FILES)
119+
120+add_custom_target(
121+ trust-store-pot
122+ COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
123+ --default-domain=trust-store
124+ --output=${POT_FILE}
125+ --from-code=UTF-8
126+ --c++ --add-comments=TRANSLATORS
127+ --keyword='tr'
128+ --boost
129+ --package-name=trust-store
130+ --copyright-holder='Canonical Ltd.'
131+ ${I18N_CPP_SRC_FILES})
132+
133+foreach(PO_FILE ${PO_FILES})
134+ get_filename_component(LANG ${PO_FILE} NAME_WE)
135+ gettext_process_po_files(${LANG} ALL PO_FILES ${PO_FILE})
136+ set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES)
137+ install(
138+ FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo
139+ DESTINATION ${INSTALL_DIR}
140+ RENAME ${DOMAIN}.mo)
141+endforeach(PO_FILE)
142
143=== added file 'po/de.po'
144--- po/de.po 1970-01-01 00:00:00 +0000
145+++ po/de.po 2014-10-08 09:35:22 +0000
146@@ -0,0 +1,24 @@
147+# Copyright (C) 2014 Canonical Ltd.
148+# This file is distributed under the same license as the PACKAGE package.
149+#
150+msgid ""
151+msgstr ""
152+"Project-Id-Version: trust-store\n"
153+"Report-Msgid-Bugs-To: \n"
154+"POT-Creation-Date: 2014-09-19 16:15+0200\n"
155+"PO-Revision-Date: 2014-09-19 16:29+0100\n"
156+"Last-Translator: \n"
157+"Language-Team: \n"
158+"MIME-Version: 1.0\n"
159+"Content-Type: text/plain; charset=UTF-8\n"
160+"Content-Transfer-Encoding: 8bit\n"
161+"X-Generator: Poedit 1.5.4\n"
162+"Language: de\n"
163+
164+#: /tmp/trust-store-i18n/src/core/trust/mir/prompt_main.qml:42
165+msgid "Deny"
166+msgstr "Verbieten"
167+
168+#: /tmp/trust-store-i18n/src/core/trust/mir/prompt_main.qml:49
169+msgid "Allow"
170+msgstr "Erlauben"
171
172=== added file 'po/trust-store.pot'
173--- po/trust-store.pot 1970-01-01 00:00:00 +0000
174+++ po/trust-store.pot 2014-10-08 09:35:22 +0000
175@@ -0,0 +1,24 @@
176+# Copyright (C) 2014 Canonical Ltd.
177+# This file is distributed under the same license as the PACKAGE package.
178+#
179+#, fuzzy
180+msgid ""
181+msgstr ""
182+"Project-Id-Version: trust-store\n"
183+"Report-Msgid-Bugs-To: \n"
184+"POT-Creation-Date: 2014-09-19 16:15+0200\n"
185+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
186+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
187+"Language-Team: LANGUAGE <LL@li.org>\n"
188+"Language: \n"
189+"MIME-Version: 1.0\n"
190+"Content-Type: text/plain; charset=CHARSET\n"
191+"Content-Transfer-Encoding: 8bit\n"
192+
193+#: /tmp/trust-store-i18n/src/core/trust/mir/prompt_main.qml:42
194+msgid "Deny"
195+msgstr ""
196+
197+#: /tmp/trust-store-i18n/src/core/trust/mir/prompt_main.qml:49
198+msgid "Allow"
199+msgstr ""
200
201=== modified file 'src/CMakeLists.txt'
202--- src/CMakeLists.txt 2014-08-19 14:11:30 +0000
203+++ src/CMakeLists.txt 2014-10-08 09:35:22 +0000
204@@ -35,6 +35,10 @@
205 set(
206 TRUST_STORE_AGENT_SOURCES
207
208+ # Translation helper
209+ core/trust/i18n.h
210+ core/trust/i18n.cpp
211+
212 # An agent-implementation transforming ensuring legible application ids.
213 core/trust/app_id_formatting_trust_agent.h
214 core/trust/app_id_formatting_trust_agent.cpp
215@@ -87,11 +91,6 @@
216 core/trust/mir/prompt_main.cpp
217 )
218
219- set_target_properties(
220- trust-prompt
221- PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/core/trust/mir
222- )
223-
224 qt5_use_modules(trust-prompt Core Gui Qml Quick)
225
226 target_link_libraries(
227
228=== modified file 'src/core/trust/daemon.cpp'
229--- src/core/trust/daemon.cpp 2014-10-06 14:46:58 +0000
230+++ src/core/trust/daemon.cpp 2014-10-08 09:35:22 +0000
231@@ -21,6 +21,7 @@
232 #include <core/trust/app_id_formatting_trust_agent.h>
233 #include <core/trust/cached_agent.h>
234 #include <core/trust/expose.h>
235+#include <core/trust/i18n.h>
236 #include <core/trust/store.h>
237
238 #include <core/trust/mir_agent.h>
239@@ -311,6 +312,7 @@
240 Options::options_description options{"Known options"};
241 options.add_options()
242 (Parameters::ForService::name, Options::value<std::string>()->required(), Parameters::ForService::description)
243+ (Parameters::WithTextDomain::name, Options::value<std::string>(), Parameters::WithTextDomain::description)
244 (Parameters::StoreBus::name, Options::value<std::string>()->default_value("session"), Parameters::StoreBus::description)
245 (Parameters::LocalAgent::name, Options::value<std::string>()->required(), Parameters::LocalAgent::description)
246 (Parameters::RemoteAgent::name, Options::value<std::string>()->required(), Parameters::RemoteAgent::description);
247@@ -338,6 +340,13 @@
248
249 auto service_name = vm[Parameters::ForService::name].as<std::string>();
250
251+ auto service_text_domain = service_name;
252+
253+ if (vm.count(Parameters::WithTextDomain::name) > 0)
254+ service_text_domain = vm[Parameters::WithTextDomain::name].as<std::string>();
255+
256+ core::trust::i18n::set_service_text_domain(service_text_domain);
257+
258 auto local_agent_factory = core::trust::Daemon::Skeleton::known_local_agent_factories()
259 .at(vm[Parameters::LocalAgent::name].as<std::string>());
260
261
262=== modified file 'src/core/trust/daemon.h'
263--- src/core/trust/daemon.h 2014-07-30 08:20:19 +0000
264+++ src/core/trust/daemon.h 2014-10-08 09:35:22 +0000
265@@ -143,6 +143,12 @@
266 static constexpr const char* description{"The name of the service to handle trust for"};
267 };
268
269+ struct WithTextDomain
270+ {
271+ static constexpr const char* name{"with-text-domain"};
272+ static constexpr const char* description{"The text domain that should be used for translations"};
273+ };
274+
275 struct LocalAgent
276 {
277 static constexpr const char* name{"local-agent"};
278
279=== added file 'src/core/trust/i18n.cpp'
280--- src/core/trust/i18n.cpp 1970-01-01 00:00:00 +0000
281+++ src/core/trust/i18n.cpp 2014-10-08 09:35:22 +0000
282@@ -0,0 +1,85 @@
283+/*
284+ * Copyright © 2014 Canonical Ltd.
285+ *
286+ * This program is free software: you can redistribute it and/or modify it
287+ * under the terms of the GNU Lesser General Public License version 3,
288+ * as published by the Free Software Foundation.
289+ *
290+ * This program is distributed in the hope that it will be useful,
291+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
292+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
293+ * GNU Lesser General Public License for more details.
294+ *
295+ * You should have received a copy of the GNU Lesser General Public License
296+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
297+ *
298+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
299+ */
300+
301+#include <core/trust/i18n.h>
302+
303+#include <libintl.h>
304+
305+#include <clocale>
306+
307+#include <iostream>
308+
309+namespace
310+{
311+static constexpr const char* this_text_domain
312+{
313+ "trust-store"
314+};
315+
316+std::string& mutable_service_text_domain()
317+{
318+ static std::string s{this_text_domain};
319+ return s;
320+}
321+
322+bool init()
323+{
324+ // Make sure that *gettext calls work correctly.
325+ std::setlocale(LC_ALL, "");
326+
327+ ::bindtextdomain(this_text_domain, nullptr);
328+ ::textdomain(this_text_domain);
329+
330+ return true;
331+}
332+
333+static const bool initialized = init();
334+}
335+
336+std::string core::trust::i18n::default_text_domain()
337+{
338+ return this_text_domain;
339+}
340+
341+// Returns the text domain of the service we are acting for
342+std::string core::trust::i18n::service_text_domain()
343+{
344+ return mutable_service_text_domain();
345+}
346+
347+// Adjusts the text domain of the service;
348+void core::trust::i18n::set_service_text_domain(const std::string& domain)
349+{
350+ mutable_service_text_domain() = domain;
351+}
352+
353+std::string core::trust::i18n::tr(const std::string& in)
354+{
355+ if (not initialized)
356+ return in;
357+
358+ return ::gettext(in.c_str());
359+}
360+
361+std::string core::trust::i18n::tr(const std::string& in, const std::string& domain)
362+{
363+ if (not initialized)
364+ return in;
365+
366+ return ::dgettext(domain.c_str(), in.c_str());
367+}
368
369=== added file 'src/core/trust/i18n.h'
370--- src/core/trust/i18n.h 1970-01-01 00:00:00 +0000
371+++ src/core/trust/i18n.h 2014-10-08 09:35:22 +0000
372@@ -0,0 +1,46 @@
373+/*
374+ * Copyright © 2014 Canonical Ltd.
375+ *
376+ * This program is free software: you can redistribute it and/or modify it
377+ * under the terms of the GNU Lesser General Public License version 3,
378+ * as published by the Free Software Foundation.
379+ *
380+ * This program is distributed in the hope that it will be useful,
381+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
382+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
383+ * GNU Lesser General Public License for more details.
384+ *
385+ * You should have received a copy of the GNU Lesser General Public License
386+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
387+ *
388+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
389+ */
390+
391+#ifndef CORE_TRUST_I18N_H_
392+#define CORE_TRUST_I18N_H_
393+
394+#include <core/trust/visibility.h>
395+
396+#include <string>
397+
398+namespace core
399+{
400+namespace trust
401+{
402+namespace i18n
403+{
404+// Returns the default text domain of this package.
405+CORE_TRUST_DLL_PUBLIC std::string default_text_domain();
406+// Returns the text domain of the service we are acting for
407+CORE_TRUST_DLL_PUBLIC std::string service_text_domain();
408+// Adjusts the text domain of the service;
409+CORE_TRUST_DLL_PUBLIC void set_service_text_domain(const std::string& domain);
410+// Translates the given input string for the default domain.
411+CORE_TRUST_DLL_PUBLIC std::string tr(const std::string& in);
412+// Translates the given input string for the given domain.
413+CORE_TRUST_DLL_PUBLIC std::string tr(const std::string& in, const std::string& domain);
414+}
415+}
416+}
417+
418+#endif // CORE_TRUST_I18N_H_
419
420=== modified file 'src/core/trust/mir/agent.cpp'
421--- src/core/trust/mir/agent.cpp 2014-10-03 22:09:14 +0000
422+++ src/core/trust/mir/agent.cpp 2014-10-08 09:35:22 +0000
423@@ -20,6 +20,12 @@
424 #include "prompt_main.h"
425 #include <core/trust/mir_agent.h>
426
427+#include <core/trust/i18n.h>
428+
429+#include <boost/format.hpp>
430+
431+#include <regex>
432+
433 // For getuid
434 #include <fcntl.h>
435 #include <unistd.h>
436@@ -128,11 +134,28 @@
437 {
438 static auto child_setup = []() {};
439
440+ // We translate to human readable strings here, and do it a non-translateable way first
441+ // We post-process the application id and try to extract the unversioned package name.
442+ // Please see https://wiki.ubuntu.com/AppStore/Interfaces/ApplicationId.
443+ static const std::regex regex_full_app_id{"(.*)_(.*)_(.*)"};
444+ static const std::regex regex_short_app_id{"(.*)_(.*)"};
445+ static constexpr std::size_t index_app{2};
446+
447+ auto app_name = args.application_id;
448+
449+ std::smatch match;
450+ if (std::regex_match(app_name, match, regex_full_app_id))
451+ app_name = std::string{match[index_app]};
452+ else if (std::regex_match(app_name, match, regex_short_app_id))
453+ app_name = std::string{match[index_app]};
454+
455+ auto description = (boost::format(i18n::tr(args.description, i18n::service_text_domain())) % app_name).str();
456+
457 std::vector<std::string> argv
458 {
459 "--" + std::string{core::trust::mir::cli::option_server_socket}, "fd://" + std::to_string(args.fd),
460- "--" + std::string{core::trust::mir::cli::option_title}, args.application_id,
461- "--" + std::string{core::trust::mir::cli::option_description}, args.description
462+ "--" + std::string{core::trust::mir::cli::option_title}, app_name,
463+ "--" + std::string{core::trust::mir::cli::option_description}, description
464 };
465
466 // We just copy the environment
467
468=== modified file 'src/core/trust/mir/agent.h'
469--- src/core/trust/mir/agent.h 2014-09-18 20:57:58 +0000
470+++ src/core/trust/mir/agent.h 2014-10-08 09:35:22 +0000
471@@ -128,7 +128,7 @@
472 {
473 // The pre-authenticated fd that the helper
474 // should use for connecting to Mir.
475- int fd;
476+ int fd;
477 // The application id of the requesting app.
478 std::string application_id;
479 // The extended description that should be presented to the user.
480@@ -178,14 +178,13 @@
481 static std::function<core::trust::Request::Answer(const core::posix::wait::Result&)> translator_only_accepting_exit_status_success();
482
483 // Creates a new MirAgent instance with the given MirConnectionVirtualTable instance.
484- Agent(
485- // VTable object providing access to Mir's trusted prompting functionality.
486- const ConnectionVirtualTable::Ptr& connection_vtable,
487- // Exec helper for starting up prompt provider child processes with the correct setup
488- // of command line arguments and environment variables.
489- const PromptProviderHelper::Ptr& exec_helper,
490- // A translator function for mapping child process exit states to trust::Request answers.
491- const std::function<core::trust::Request::Answer(const core::posix::wait::Result&)>& translator);
492+ Agent(// VTable object providing access to Mir's trusted prompting functionality.
493+ const ConnectionVirtualTable::Ptr& connection_vtable,
494+ // Exec helper for starting up prompt provider child processes with the correct setup
495+ // of command line arguments and environment variables.
496+ const PromptProviderHelper::Ptr& exec_helper,
497+ // A translator function for mapping child process exit states to trust::Request answers.
498+ const std::function<core::trust::Request::Answer(const core::posix::wait::Result&)>& translator);
499
500 // From core::trust::Agent:
501 // Throws a std::logic_error if anything unforeseen happens during execution, thus
502
503=== modified file 'src/core/trust/mir/prompt_main.cpp'
504--- src/core/trust/mir/prompt_main.cpp 2014-08-05 08:56:32 +0000
505+++ src/core/trust/mir/prompt_main.cpp 2014-10-08 09:35:22 +0000
506@@ -31,6 +31,8 @@
507 #include <boost/program_options.hpp>
508 #include <boost/program_options/environment_iterator.hpp>
509
510+#include <core/trust/i18n.h>
511+
512 #include <core/posix/this_process.h>
513
514 #include "prompt_config.h"
515
516=== modified file 'tests/mir_agent_test.cpp'
517--- tests/mir_agent_test.cpp 2014-09-18 20:57:58 +0000
518+++ tests/mir_agent_test.cpp 2014-10-08 09:35:22 +0000
519@@ -173,7 +173,7 @@
520 {
521 42,
522 "does.not.exist.application",
523- "Just an extended description"
524+ "Just an extended description for %1%"
525 };
526
527 core::trust::mir::PromptProviderHelper helper{cargs};
528@@ -195,7 +195,7 @@
529 const core::trust::Pid app_pid {21};
530 const std::string app_id {"does.not.exist.application"};
531 const core::trust::Feature feature{42};
532- const std::string app_description {"This is just an extended description"};
533+ const std::string app_description {"This is just an extended description %1%"};
534 const int pre_authenticated_fd {42};
535
536 const core::trust::mir::PromptProviderHelper::InvocationArguments reference_invocation_args
537@@ -252,7 +252,7 @@
538 const core::trust::Pid app_pid {21};
539 const std::string app_id {"does.not.exist.application"};
540 const core::trust::Feature feature{42};
541- const std::string app_description {"This is just an extended description"};
542+ const std::string app_description {"This is just an extended description for %1%"};
543 const int pre_authenticated_fd {42};
544
545 auto a_spinning_process = []()

Subscribers

People subscribed via source and target branches