Merge lp:~seb128/ubuntu-system-settings/security-trust-localized-names into lp:ubuntu-system-settings

Proposed by Sebastien Bacher
Status: Merged
Approved by: Ken VanDine
Approved revision: 1084
Merged at revision: 1105
Proposed branch: lp:~seb128/ubuntu-system-settings/security-trust-localized-names
Merge into: lp:ubuntu-system-settings
Diff against target: 103 lines (+40/-8)
3 files modified
plugins/security-privacy/CMakeLists.txt (+2/-0)
plugins/security-privacy/trust-store-model.cpp (+36/-6)
tests/plugins/security-privacy/CMakeLists.txt (+2/-2)
To merge this branch: bzr merge lp:~seb128/ubuntu-system-settings/security-trust-localized-names
Reviewer Review Type Date Requested Status
Alberto Mardegan Approve
Ken VanDine Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+236137@code.launchpad.net

Commit message

[security] get localized application names from the trust-store

Description of the change

[security] get localized application names from the trust-store

use glib api for that since qt/qsettings don't seem to support that feature, and it's better to use a tested and supported glib function than doing a custom implementation around qt

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

Just a few comments, but otherwise it looks good!

By the way, do we have a dependency on libglib2.0-dev in debian/control? (we might not need it, if we already depend on some library which depend on it)

review: Needs Fixing
Revision history for this message
Alberto Mardegan (mardy) wrote :

Oh, and please remove the QSettings #include.

1081. By Sebastien Bacher

indentation and spacing

1082. By Sebastien Bacher

Use QString::fromUtf8 as recommended in the review

Revision history for this message
Sebastien Bacher (seb128) wrote :

> Just a few comments, but otherwise it looks good!

thanks, addressed those

> By the way, do we have a dependency on libglib2.0-dev in debian/control?

yes we do, quite some of the backends use glib or glib based libraries

> Oh, and please remove the QSettings #include.

done as well

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1083. By Sebastien Bacher

some extra spacing tweak

1084. By Sebastien Bacher

update the cmakelist to fix build issue

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

the CI errors seem to have nothing to do with those changes (they are in the phone/sim section)

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good

review: Approve
Revision history for this message
Alberto Mardegan (mardy) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/security-privacy/CMakeLists.txt'
--- plugins/security-privacy/CMakeLists.txt 2014-08-27 05:19:24 +0000
+++ plugins/security-privacy/CMakeLists.txt 2014-09-29 11:03:33 +0000
@@ -47,6 +47,7 @@
47include_directories(47include_directories(
48 ${CMAKE_CURRENT_BINARY_DIR}48 ${CMAKE_CURRENT_BINARY_DIR}
49 ${TRUST_STORE_INCLUDE_DIRS}49 ${TRUST_STORE_INCLUDE_DIRS}
50 ${GLIB_INCLUDE_DIRS}
50)51)
5152
52set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/SecurityPrivacy)53set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/SecurityPrivacy)
@@ -54,6 +55,7 @@
54 uss-accountsservice55 uss-accountsservice
55 ${ACCOUNTSSERVICE_LDFLAGS}56 ${ACCOUNTSSERVICE_LDFLAGS}
56 ${TRUST_STORE_LDFLAGS}57 ${TRUST_STORE_LDFLAGS}
58 ${GLIB_LDFLAGS}
57)59)
58install(TARGETS UbuntuSecurityPrivacyPanel UbuntuSecurityPrivacyHelper DESTINATION ${PLUG_DIR})60install(TARGETS UbuntuSecurityPrivacyPanel UbuntuSecurityPrivacyHelper DESTINATION ${PLUG_DIR})
59install(FILES qmldir DESTINATION ${PLUG_DIR})61install(FILES qmldir DESTINATION ${PLUG_DIR})
6062
=== modified file 'plugins/security-privacy/trust-store-model.cpp'
--- plugins/security-privacy/trust-store-model.cpp 2014-09-04 14:04:22 +0000
+++ plugins/security-privacy/trust-store-model.cpp 2014-09-29 11:03:33 +0000
@@ -25,12 +25,13 @@
25#include <QList>25#include <QList>
26#include <QMap>26#include <QMap>
27#include <QSet>27#include <QSet>
28#include <QSettings>
29#include <QStandardPaths>28#include <QStandardPaths>
3029
31#include <core/trust/resolve.h>30#include <core/trust/resolve.h>
32#include <core/trust/store.h>31#include <core/trust/store.h>
3332
33#include <glib.h>
34
34class Application35class Application
35{36{
36public:37public:
@@ -39,12 +40,41 @@
39 void setId(const QString &id) {40 void setId(const QString &id) {
40 this->id = id;41 this->id = id;
4142
43 GKeyFile *desktopInfo = g_key_file_new();
42 QString desktopFilename = resolveDesktopFilename(id);44 QString desktopFilename = resolveDesktopFilename(id);
43 QSettings desktopFile(desktopFilename, QSettings::IniFormat);45
44 desktopFile.beginGroup("Desktop Entry");46 gboolean loaded = g_key_file_load_from_file(desktopInfo,
45 displayName = desktopFile.value("Name").toString();47 desktopFilename.toUtf8().data(),
46 iconName = resolveIcon(desktopFile.value("Icon").toString(),48 G_KEY_FILE_NONE,
47 desktopFile.value("Path").toString());49 nullptr);
50
51 if (!loaded) {
52 g_warning("Couldn't parse the desktop: %s", desktopFilename.toUtf8().data());
53 g_key_file_free(desktopInfo);
54 return;
55 }
56
57 gchar *name = g_key_file_get_locale_string(desktopInfo,
58 G_KEY_FILE_DESKTOP_GROUP,
59 G_KEY_FILE_DESKTOP_KEY_NAME,
60 nullptr,
61 nullptr);
62 displayName = QString::fromUtf8(name);
63
64 gchar *icon = g_key_file_get_string(desktopInfo,
65 G_KEY_FILE_DESKTOP_GROUP,
66 G_KEY_FILE_DESKTOP_KEY_ICON,
67 nullptr);
68 gchar *path = g_key_file_get_string(desktopInfo,
69 G_KEY_FILE_DESKTOP_GROUP,
70 G_KEY_FILE_DESKTOP_KEY_PATH,
71 nullptr);
72 iconName = resolveIcon(QString::fromUtf8(icon),
73 QString::fromUtf8(path));
74 g_free(name);
75 g_free(icon);
76 g_free(path);
77 g_key_file_free(desktopInfo);
48 }78 }
4979
50 QString resolveDesktopFilename(const QString &id) {80 QString resolveDesktopFilename(const QString &id) {
5181
=== modified file 'tests/plugins/security-privacy/CMakeLists.txt'
--- tests/plugins/security-privacy/CMakeLists.txt 2014-08-18 07:50:41 +0000
+++ tests/plugins/security-privacy/CMakeLists.txt 2014-09-29 11:03:33 +0000
@@ -1,11 +1,11 @@
1set(XVFB_CMD xvfb-run -a -s "-screen 0 640x480x24")1set(XVFB_CMD xvfb-run -a -s "-screen 0 640x480x24")
2include_directories(${CMAKE_CURRENT_BINARY_DIR} ../../../plugins/security-privacy)2include_directories(${CMAKE_CURRENT_BINARY_DIR} ../../../plugins/security-privacy ${GLIB_INCLUDE_DIRS})
3add_definitions(-DTESTS)3add_definitions(-DTESTS)
44
5add_executable(tst-trust-store-model5add_executable(tst-trust-store-model
6 tst_trust_store_model.cpp6 tst_trust_store_model.cpp
7 ../../../plugins/security-privacy/trust-store-model.cpp7 ../../../plugins/security-privacy/trust-store-model.cpp
8)8)
99target_link_libraries (tst-trust-store-model ${GLIB_LDFLAGS})
10qt5_use_modules(tst-trust-store-model Core Gui DBus Qml Test)10qt5_use_modules(tst-trust-store-model Core Gui DBus Qml Test)
11add_test(NAME tst-trust-store-model COMMAND ${XVFB_CMD} ${CMAKE_CURRENT_BINARY_DIR}/tst-trust-store-model)11add_test(NAME tst-trust-store-model COMMAND ${XVFB_CMD} ${CMAKE_CURRENT_BINARY_DIR}/tst-trust-store-model)

Subscribers

People subscribed via source and target branches