Merge lp:~pete-woods/libqtdbusmock/new-templates-in-common-package into lp:libqtdbusmock
- new-templates-in-common-package
- Merge into trunk
Proposed by
Pete Woods
Status: | Merged |
---|---|
Approved by: | Pete Woods |
Approved revision: | 52 |
Merged at revision: | 48 |
Proposed branch: | lp:~pete-woods/libqtdbusmock/new-templates-in-common-package |
Merge into: | lp:libqtdbusmock |
Diff against target: |
399 lines (+288/-2) 10 files modified
CMakeLists.txt (+1/-0) debian/changelog (+8/-0) debian/control (+12/-1) debian/libqtdbusmock1-common.install (+1/-0) debian/libqtdbusmock1.symbols (+2/-0) src/libqtdbusmock/DBusMock.cpp (+28/-1) src/libqtdbusmock/DBusMock.h (+4/-0) templates/CMakeLists.txt (+8/-0) templates/org.freedesktop.hostname1.py (+53/-0) templates/org.freedesktop.login1.py (+171/-0) |
To merge this branch: | bzr merge lp:~pete-woods/libqtdbusmock/new-templates-in-common-package |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xavi Garcia (community) | Approve | ||
Review via email: mp+319972@code.launchpad.net |
Commit message
Add new templates to new -common package
Description of the change
Add new templates to new -common package
To post a comment you must log in.
- 49. By Pete Woods
-
Remove duplicate property entry
- 50. By Pete Woods
-
Remove multiarch and shlibs depends
- 51. By Pete Woods
-
Fix Xavi's review comment
- 52. By Pete Woods
-
Improve changelog message
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 2016-12-12 12:02:52 +0000 | |||
3 | +++ CMakeLists.txt 2017-03-16 10:30:45 +0000 | |||
4 | @@ -59,6 +59,7 @@ | |||
5 | 59 | 59 | ||
6 | 60 | add_subdirectory("src") | 60 | add_subdirectory("src") |
7 | 61 | add_subdirectory("data") | 61 | add_subdirectory("data") |
8 | 62 | add_subdirectory("templates") | ||
9 | 62 | 63 | ||
10 | 63 | enable_testing() | 64 | enable_testing() |
11 | 64 | add_subdirectory(tests) | 65 | add_subdirectory(tests) |
12 | 65 | 66 | ||
13 | === modified file 'debian/changelog' | |||
14 | --- debian/changelog 2017-01-06 10:44:45 +0000 | |||
15 | +++ debian/changelog 2017-03-16 10:30:45 +0000 | |||
16 | @@ -1,3 +1,11 @@ | |||
17 | 1 | libqtdbusmock (0.7-0ubuntu1) UNRELEASED; urgency=medium | ||
18 | 2 | |||
19 | 3 | * Add hostname1 and login1 templates to new binary package | ||
20 | 4 | libqtdbusmock1-common. | ||
21 | 5 | * Search /usr/share/libqtdbusmock/templates for templates. | ||
22 | 6 | |||
23 | 7 | -- Pete <pete.woods@canonical.com> Wed, 15 Mar 2017 18:17:19 +0000 | ||
24 | 8 | |||
25 | 1 | libqtdbusmock (0.6+17.04.20170106-0ubuntu1) zesty; urgency=medium | 9 | libqtdbusmock (0.6+17.04.20170106-0ubuntu1) zesty; urgency=medium |
26 | 2 | 10 | ||
27 | 3 | * Compatibility with unversioned cmake-extras modules (LP: #1563573) | 11 | * Compatibility with unversioned cmake-extras modules (LP: #1563573) |
28 | 4 | 12 | ||
29 | === modified file 'debian/control' | |||
30 | --- debian/control 2016-12-12 12:02:52 +0000 | |||
31 | +++ debian/control 2017-03-16 10:30:45 +0000 | |||
32 | @@ -12,7 +12,7 @@ | |||
33 | 12 | pkg-config, | 12 | pkg-config, |
34 | 13 | python3-dbusmock (>= 0.16), | 13 | python3-dbusmock (>= 0.16), |
35 | 14 | qtbase5-dev, | 14 | qtbase5-dev, |
37 | 15 | Standards-Version: 3.9.4 | 15 | Standards-Version: 3.9.7 |
38 | 16 | Homepage: https://launchpad.net/libqtdbustest | 16 | Homepage: https://launchpad.net/libqtdbustest |
39 | 17 | # If you aren't a member of ~unity-team but need to upload packaging changes, | 17 | # If you aren't a member of ~unity-team but need to upload packaging changes, |
40 | 18 | # just go ahead. ~unity-team will notice and sync up the code again. | 18 | # just go ahead. ~unity-team will notice and sync up the code again. |
41 | @@ -24,6 +24,7 @@ | |||
42 | 24 | Multi-Arch: same | 24 | Multi-Arch: same |
43 | 25 | Pre-Depends: ${misc:Pre-Depends}, | 25 | Pre-Depends: ${misc:Pre-Depends}, |
44 | 26 | Depends: python3-dbusmock (>= 0.16), | 26 | Depends: python3-dbusmock (>= 0.16), |
45 | 27 | libqtdbusmock1-common (= ${binary:Version}), | ||
46 | 27 | ${misc:Depends}, | 28 | ${misc:Depends}, |
47 | 28 | ${shlibs:Depends}, | 29 | ${shlibs:Depends}, |
48 | 29 | Description: Library for mocking DBus interactions using Qt | 30 | Description: Library for mocking DBus interactions using Qt |
49 | @@ -41,3 +42,13 @@ | |||
50 | 41 | A simple library for mocking DBus services with a Qt API | 42 | A simple library for mocking DBus services with a Qt API |
51 | 42 | . | 43 | . |
52 | 43 | This package contains files that are needed to build. | 44 | This package contains files that are needed to build. |
53 | 45 | |||
54 | 46 | Package: libqtdbusmock1-common | ||
55 | 47 | Section: libs | ||
56 | 48 | Architecture: all | ||
57 | 49 | Pre-Depends: ${misc:Pre-Depends}, | ||
58 | 50 | Depends: ${misc:Depends}, | ||
59 | 51 | Description: Library for mocking DBus interactions using Qt | ||
60 | 52 | A simple library for mocking DBus services with a Qt API | ||
61 | 53 | . | ||
62 | 54 | This package contains extra dbusmock templates. | ||
63 | 44 | 55 | ||
64 | === added file 'debian/libqtdbusmock1-common.install' | |||
65 | --- debian/libqtdbusmock1-common.install 1970-01-01 00:00:00 +0000 | |||
66 | +++ debian/libqtdbusmock1-common.install 2017-03-16 10:30:45 +0000 | |||
67 | @@ -0,0 +1,1 @@ | |||
68 | 1 | usr/share | ||
69 | 0 | 2 | ||
70 | === modified file 'debian/libqtdbusmock1.symbols' | |||
71 | --- debian/libqtdbusmock1.symbols 2016-12-06 12:09:09 +0000 | |||
72 | +++ debian/libqtdbusmock1.symbols 2017-03-16 10:30:45 +0000 | |||
73 | @@ -47,6 +47,8 @@ | |||
74 | 47 | (c++)"QtDBusMock::DBusMock::registerURfkill(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 | 47 | (c++)"QtDBusMock::DBusMock::registerURfkill(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 |
75 | 48 | (c++)"QtDBusMock::DBusMock::registerTemplate(QString const&, QString const&, QMap<QString, QVariant> const&, QDBusConnection::BusType)@Base" 0.5+15.10.20151009 | 48 | (c++)"QtDBusMock::DBusMock::registerTemplate(QString const&, QString const&, QMap<QString, QVariant> const&, QDBusConnection::BusType)@Base" 0.5+15.10.20151009 |
76 | 49 | (c++)"QtDBusMock::DBusMock::registerTimeDate(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 | 49 | (c++)"QtDBusMock::DBusMock::registerTimeDate(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 |
77 | 50 | (c++)"QtDBusMock::DBusMock::registerLogin1(QMap<QString, QVariant> const&)@Base" 0replaceme | ||
78 | 51 | (c++)"QtDBusMock::DBusMock::registerHostname1(QMap<QString, QVariant> const&)@Base" 0replaceme | ||
79 | 50 | (c++)"QtDBusMock::DBusMock::registerPolicyKit(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 | 52 | (c++)"QtDBusMock::DBusMock::registerPolicyKit(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 |
80 | 51 | (c++)"QtDBusMock::DBusMock::registerNetworkManager(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 | 53 | (c++)"QtDBusMock::DBusMock::registerNetworkManager(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 |
81 | 52 | (c++)"QtDBusMock::DBusMock::registerGnomeScreensaver(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 | 54 | (c++)"QtDBusMock::DBusMock::registerGnomeScreensaver(QMap<QString, QVariant> const&)@Base" 0.5+15.10.20151009 |
82 | 53 | 55 | ||
83 | === modified file 'src/libqtdbusmock/DBusMock.cpp' | |||
84 | --- src/libqtdbusmock/DBusMock.cpp 2016-11-25 13:35:18 +0000 | |||
85 | +++ src/libqtdbusmock/DBusMock.cpp 2017-03-16 10:30:45 +0000 | |||
86 | @@ -20,7 +20,9 @@ | |||
87 | 20 | #include <libqtdbustest/QProcessDBusService.h> | 20 | #include <libqtdbustest/QProcessDBusService.h> |
88 | 21 | 21 | ||
89 | 22 | #include <NetworkManager.h> | 22 | #include <NetworkManager.h> |
90 | 23 | #include <QFile> | ||
91 | 23 | #include <QJsonDocument> | 24 | #include <QJsonDocument> |
92 | 25 | #include <QStandardPaths> | ||
93 | 24 | 26 | ||
94 | 25 | using namespace QtDBusTest; | 27 | using namespace QtDBusTest; |
95 | 26 | 28 | ||
96 | @@ -84,7 +86,22 @@ | |||
97 | 84 | QDBusConnection::BusType busType) { | 86 | QDBusConnection::BusType busType) { |
98 | 85 | QStringList arguments; | 87 | QStringList arguments; |
99 | 86 | arguments << "-m" << "dbusmock"; | 88 | arguments << "-m" << "dbusmock"; |
101 | 87 | arguments << "--template" << templateName; | 89 | |
102 | 90 | bool found = false; | ||
103 | 91 | if (!templateName.contains(QDir::separator())) { | ||
104 | 92 | auto dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); | ||
105 | 93 | for (const auto & dir : dirs) { | ||
106 | 94 | auto path = QDir(QDir(QDir(dir).filePath("libqtdbusmock")).filePath("templates")).filePath(templateName + ".py"); | ||
107 | 95 | if (QFileInfo::exists(path)) { | ||
108 | 96 | arguments << "--template" << path; | ||
109 | 97 | found = true; | ||
110 | 98 | break; | ||
111 | 99 | } | ||
112 | 100 | } | ||
113 | 101 | } | ||
114 | 102 | if (!found) { | ||
115 | 103 | arguments << "--template" << templateName; | ||
116 | 104 | } | ||
117 | 88 | 105 | ||
118 | 89 | if (!parameters.isEmpty()) | 106 | if (!parameters.isEmpty()) |
119 | 90 | { | 107 | { |
120 | @@ -155,6 +172,16 @@ | |||
121 | 155 | QDBusConnection::SystemBus); | 172 | QDBusConnection::SystemBus); |
122 | 156 | } | 173 | } |
123 | 157 | 174 | ||
124 | 175 | void DBusMock::registerHostname1(const QVariantMap& parameters) { | ||
125 | 176 | registerTemplate("org.freedesktop.hostname1", "org.freedesktop.hostname1", parameters, | ||
126 | 177 | QDBusConnection::SystemBus); | ||
127 | 178 | } | ||
128 | 179 | |||
129 | 180 | void DBusMock::registerLogin1(const QVariantMap& parameters) { | ||
130 | 181 | registerTemplate("org.freedesktop.login1", "org.freedesktop.login1", parameters, | ||
131 | 182 | QDBusConnection::SystemBus); | ||
132 | 183 | } | ||
133 | 184 | |||
134 | 158 | void DBusMock::registerURfkill() { | 185 | void DBusMock::registerURfkill() { |
135 | 159 | registerURfkill(QVariantMap()); | 186 | registerURfkill(QVariantMap()); |
136 | 160 | } | 187 | } |
137 | 161 | 188 | ||
138 | === modified file 'src/libqtdbusmock/DBusMock.h' | |||
139 | --- src/libqtdbusmock/DBusMock.h 2016-11-25 13:35:18 +0000 | |||
140 | +++ src/libqtdbusmock/DBusMock.h 2017-03-16 10:30:45 +0000 | |||
141 | @@ -77,6 +77,10 @@ | |||
142 | 77 | 77 | ||
143 | 78 | virtual void registerTimeDate(const QVariantMap& parameters = QVariantMap()); | 78 | virtual void registerTimeDate(const QVariantMap& parameters = QVariantMap()); |
144 | 79 | 79 | ||
145 | 80 | virtual void registerHostname1(const QVariantMap& parameters = QVariantMap()); | ||
146 | 81 | |||
147 | 82 | virtual void registerLogin1(const QVariantMap& parameters = QVariantMap()); | ||
148 | 83 | |||
149 | 80 | virtual void registerURfkill(); | 84 | virtual void registerURfkill(); |
150 | 81 | 85 | ||
151 | 82 | virtual void registerURfkill(const QVariantMap& parameters); | 86 | virtual void registerURfkill(const QVariantMap& parameters); |
152 | 83 | 87 | ||
153 | === added directory 'templates' | |||
154 | === added file 'templates/CMakeLists.txt' | |||
155 | --- templates/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
156 | +++ templates/CMakeLists.txt 2017-03-16 10:30:45 +0000 | |||
157 | @@ -0,0 +1,8 @@ | |||
158 | 1 | |||
159 | 2 | install( | ||
160 | 3 | FILES | ||
161 | 4 | "org.freedesktop.hostname1.py" | ||
162 | 5 | "org.freedesktop.login1.py" | ||
163 | 6 | DESTINATION | ||
164 | 7 | "${CMAKE_INSTALL_DATADIR}/libqtdbusmock/templates/" | ||
165 | 8 | ) | ||
166 | 0 | 9 | ||
167 | === added file 'templates/org.freedesktop.hostname1.py' | |||
168 | --- templates/org.freedesktop.hostname1.py 1970-01-01 00:00:00 +0000 | |||
169 | +++ templates/org.freedesktop.hostname1.py 2017-03-16 10:30:45 +0000 | |||
170 | @@ -0,0 +1,53 @@ | |||
171 | 1 | '''Hostname1 mock template | ||
172 | 2 | ''' | ||
173 | 3 | |||
174 | 4 | # This program is free software; you can redistribute it and/or modify it under | ||
175 | 5 | # the terms of the GNU Lesser General Public License as published by the Free | ||
176 | 6 | # Software Foundation; either version 3 of the License, or (at your option) any | ||
177 | 7 | # later version. See http://www.gnu.org/copyleft/lgpl.html for the full text | ||
178 | 8 | # of the license. | ||
179 | 9 | |||
180 | 10 | __author__ = 'Pete Woods' | ||
181 | 11 | __email__ = 'pete.woods@canonical.com' | ||
182 | 12 | __copyright__ = '(c) 2016 Canonical Ltd.' | ||
183 | 13 | __license__ = 'LGPL 3+' | ||
184 | 14 | |||
185 | 15 | import dbus | ||
186 | 16 | import uuid | ||
187 | 17 | import binascii | ||
188 | 18 | |||
189 | 19 | from dbusmock import MOCK_IFACE | ||
190 | 20 | import dbusmock | ||
191 | 21 | |||
192 | 22 | |||
193 | 23 | BUS_NAME = 'org.freedesktop.hostname1' | ||
194 | 24 | MAIN_IFACE = 'org.freedesktop.hostname1' | ||
195 | 25 | MAIN_OBJ = '/org/freedesktop/hostname1' | ||
196 | 26 | SYSTEM_BUS = True | ||
197 | 27 | |||
198 | 28 | |||
199 | 29 | def load(mock, parameters): | ||
200 | 30 | mock.AddProperties(MAIN_IFACE, { | ||
201 | 31 | 'Hostname': parameters.get('Hostname', 'my-computer'), | ||
202 | 32 | 'StaticHostname': parameters.get('StaticHostname', 'ubuntu'), | ||
203 | 33 | 'PrettyHostname': parameters.get('PrettyHostname', ''), | ||
204 | 34 | 'IconName': parameters.get('IconName', 'computer-vm'), # e.g. "computer-laptop", "computer-desktop" | ||
205 | 35 | 'Chassis': parameters.get('Chassis', 'vm'), # currently defined set: "desktop", "laptop", "server", "tablet", "handset", "vm" and "container" | ||
206 | 36 | 'Deployment': parameters.get('Deployment', ''), | ||
207 | 37 | 'Location': parameters.get('Location', ''), | ||
208 | 38 | 'KernelName': parameters.get('KernelName', 'Linux'), | ||
209 | 39 | 'KernelRelease': parameters.get('KernelRelease', '4.4.0-53-generic'), | ||
210 | 40 | 'KernelVersion': parameters.get('KernelVersion', '#74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016'), | ||
211 | 41 | 'OperatingSystemPrettyName': parameters.get('OperatingSystemPrettyName', 'Ubuntu 16.04.1 LTS'), | ||
212 | 42 | 'OperatingSystemCPEName': parameters.get('OperatingSystemCPEName', ''), | ||
213 | 43 | }) | ||
214 | 44 | |||
215 | 45 | mock.AddMethods(MAIN_IFACE, [ | ||
216 | 46 | ('SetHostname', 'sb', '', "ret = self.Set('%s', 'Hostname', args[0])" % MAIN_IFACE), | ||
217 | 47 | ('SetStaticHostname', 'sb', '', "ret = self.Set('%s', 'StaticHostname', args[0])" % MAIN_IFACE), | ||
218 | 48 | ('SetPrettyHostname', 'sb', '', "ret = self.Set('%s', 'PrettyHostname', args[0])" % MAIN_IFACE), | ||
219 | 49 | ('SetIconName', 'sb', '', "ret = self.Set('%s', 'IconName', args[0])" % MAIN_IFACE), | ||
220 | 50 | ('SetChassis', 'sb', '', "ret = self.Set('%s', 'Chassis', args[0])" % MAIN_IFACE), | ||
221 | 51 | ('SetDeployment', 'sb', '', "ret = self.Set('%s', 'Deployment', args[0])" % MAIN_IFACE), | ||
222 | 52 | ('SetLocation', 'sb', '', "ret = self.Set('%s', 'Location', args[0])" % MAIN_IFACE), | ||
223 | 53 | ]) | ||
224 | 0 | 54 | ||
225 | === added file 'templates/org.freedesktop.login1.py' | |||
226 | --- templates/org.freedesktop.login1.py 1970-01-01 00:00:00 +0000 | |||
227 | +++ templates/org.freedesktop.login1.py 2017-03-16 10:30:45 +0000 | |||
228 | @@ -0,0 +1,171 @@ | |||
229 | 1 | '''Login1 mock template | ||
230 | 2 | ''' | ||
231 | 3 | |||
232 | 4 | # This program is free software; you can redistribute it and/or modify it under | ||
233 | 5 | # the terms of the GNU Lesser General Public License as published by the Free | ||
234 | 6 | # Software Foundation; either version 3 of the License, or (at your option) any | ||
235 | 7 | # later version. See http://www.gnu.org/copyleft/lgpl.html for the full text | ||
236 | 8 | # of the license. | ||
237 | 9 | |||
238 | 10 | __author__ = 'Pete Woods' | ||
239 | 11 | __email__ = 'pete.woods@canonical.com' | ||
240 | 12 | __copyright__ = '(c) 2017 Canonical Ltd.' | ||
241 | 13 | __license__ = 'LGPL 3+' | ||
242 | 14 | |||
243 | 15 | import dbus | ||
244 | 16 | import uuid | ||
245 | 17 | import binascii | ||
246 | 18 | |||
247 | 19 | from dbusmock import MOCK_IFACE | ||
248 | 20 | import dbusmock | ||
249 | 21 | |||
250 | 22 | |||
251 | 23 | BUS_NAME = 'org.freedesktop.login1' | ||
252 | 24 | MAIN_IFACE = 'org.freedesktop.login1.Manager' | ||
253 | 25 | MAIN_OBJ = '/org/freedesktop/login1' | ||
254 | 26 | SYSTEM_BUS = True | ||
255 | 27 | |||
256 | 28 | SEAT_IFACE = 'org.freedesktop.login1.Seat' | ||
257 | 29 | SEAT_PATH = '/org/freedesktop/login1/seat/' | ||
258 | 30 | |||
259 | 31 | def load(mock, parameters): | ||
260 | 32 | mock.seats = {} | ||
261 | 33 | |||
262 | 34 | add_seat(mock, parameters.get('DefaultSeat', {}), True) | ||
263 | 35 | |||
264 | 36 | mock.list_seats = list_seats | ||
265 | 37 | mock.get_seat = get_seat | ||
266 | 38 | |||
267 | 39 | mock.AddProperties(MAIN_IFACE, { | ||
268 | 40 | 'EnableWallMessages': parameters.get('EnableWallMessages', False), | ||
269 | 41 | 'WallMessage': parameters.get('WallMessage', ''), | ||
270 | 42 | 'NAutoVTs': parameters.get('NAutoVTs', dbus.UInt32(6)), | ||
271 | 43 | 'KillOnlyUsers': parameters.get('KillOnlyUsers', dbus.Array([], signature='s')), | ||
272 | 44 | 'KillExcludeUsers': parameters.get('KillExcludeUsers', dbus.Array(['root'], signature='s')), | ||
273 | 45 | 'KillUserProcesses': parameters.get('KillUserProcesses', False), | ||
274 | 46 | 'RebootToFirmwareSetup': parameters.get('RebootToFirmwareSetup', False), | ||
275 | 47 | 'IdleHint': parameters.get('IdleHint', False), | ||
276 | 48 | 'IdleSinceHint': parameters.get('IdleSinceHint', dbus.UInt64(1489580452083866)), | ||
277 | 49 | 'IdleSinceHintMonotonic': parameters.get('IdleSinceHintMonotonic', dbus.UInt64(8134597164)), | ||
278 | 50 | 'BlockInhibited': parameters.get('BlockInhibited', 'handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch'), | ||
279 | 51 | 'DelayInhibited': parameters.get('DelayInhibited', 'sleep'), | ||
280 | 52 | 'InhibitDelayMaxUSec': parameters.get('InhibitDelayMaxUSec', dbus.UInt64(5000000)), | ||
281 | 53 | 'HandlePowerKey': parameters.get('HandlePowerKey', 'poweroff'), | ||
282 | 54 | 'HandleSuspendKey': parameters.get('HandleSuspendKey', 'suspend'), | ||
283 | 55 | 'HandleHibernateKey': parameters.get('HandleHibernateKey', 'hibernate'), | ||
284 | 56 | 'HandleLidSwitch': parameters.get('HandleLidSwitch', 'suspend'), | ||
285 | 57 | 'HandleLidSwitchDocked': parameters.get('HandleLidSwitchDocked', 'ignore'), | ||
286 | 58 | 'HoldoffTimeoutUSec': parameters.get('HoldoffTimeoutUSec', dbus.UInt64(30000000)), | ||
287 | 59 | 'IdleAction': parameters.get('IdleAction', 'ignore'), | ||
288 | 60 | 'IdleActionUSec': parameters.get('IdleActionUSec', dbus.UInt64(1800000000)), | ||
289 | 61 | 'PreparingForShutdown': parameters.get('PreparingForShutdown', False), | ||
290 | 62 | 'PreparingForSleep': parameters.get('PreparingForSleep', False), | ||
291 | 63 | 'ScheduledShutdown': parameters.get('ScheduledShutdown', dbus.Struct(('', 0), signature='st')), | ||
292 | 64 | 'Docked': parameters.get('Docked', False), | ||
293 | 65 | }) | ||
294 | 66 | |||
295 | 67 | mock.AddMethods(MAIN_IFACE, [ | ||
296 | 68 | ('GetSession', 's', 'o', "ret = dbus.ObjectPath('/')"), | ||
297 | 69 | ('GetSessionByPID', 'u', 'o', "ret = dbus.ObjectPath('/')"), | ||
298 | 70 | ('GetUser', 'u', 'o', "ret = dbus.ObjectPath('/')"), | ||
299 | 71 | ('GetUserByPID', 'u', 'o', "ret = dbus.ObjectPath('/')"), | ||
300 | 72 | ('GetSeat', 's', 'o', "ret = self.get_seat(self, args[0])"), | ||
301 | 73 | |||
302 | 74 | ('ListSessions', '', 'a(susso)', ""), | ||
303 | 75 | ('ListUsers', '', 'a(uso)', ""), | ||
304 | 76 | ('ListSeats', '', 'a(so)', "ret = self.list_seats(self)"), | ||
305 | 77 | ('ListInhibitors', '', 'a(ssssuu)', ""), | ||
306 | 78 | |||
307 | 79 | ('CreateSession', 'uusssssussbssa(sv)', 'soshusub', ""), | ||
308 | 80 | ('ReleaseSession', 's', '', ""), | ||
309 | 81 | ('ActivateSession', 's', '', ""), | ||
310 | 82 | ('ActivateSessionOnSeat', 'ss', '', ""), | ||
311 | 83 | ('LockSession', 's', '', ""), | ||
312 | 84 | ('UnlockSession', 's', '', ""), | ||
313 | 85 | ('LockSessions', '', '', ""), | ||
314 | 86 | ('UnlockSessions', '', '', ""), | ||
315 | 87 | ('KillSession', 'ssi', '', ""), | ||
316 | 88 | ('KillUser', 'ui', '', ""), | ||
317 | 89 | ('TerminateSession', 's', '', ""), | ||
318 | 90 | ('TerminateUser', 'u', '', ""), | ||
319 | 91 | ('TerminateSeat', 's', '', ""), | ||
320 | 92 | ('SetUserLinger', 'ubb', '', ""), | ||
321 | 93 | ('AttachDevice', 'ssb', '', ""), | ||
322 | 94 | ('FlushDevices', 'b', '', ""), | ||
323 | 95 | ('PowerOff', 'b', '', ""), | ||
324 | 96 | ('Reboot', 'b', '', ""), | ||
325 | 97 | ('Suspend', 'b', '', ""), | ||
326 | 98 | ('Hibernate', 'b', '', ""), | ||
327 | 99 | ('HybridSleep', 'b', '', ""), | ||
328 | 100 | ('CanPowerOff', '', 's', "ret = ''"), | ||
329 | 101 | ('CanReboot', '', 's', "ret = ''"), | ||
330 | 102 | ('CanSuspend', '', 's', "ret = ''"), | ||
331 | 103 | ('CanHibernate', '', 's', "ret = ''"), | ||
332 | 104 | ('CanHybridSleep', '', 's', "ret = ''"), | ||
333 | 105 | ('ScheduleShutdown', 'st', '', ""), | ||
334 | 106 | ('CancelScheduledShutdown', '', 'b', "ret = False"), | ||
335 | 107 | ('Inhibit', 'ssss', 'h', "ret = ?"), | ||
336 | 108 | ('CanRebootToFirmwareSetup', '', 's', "ret = ''"), | ||
337 | 109 | ('SetRebootToFirmwareSetup', 'b', '', ""), | ||
338 | 110 | ('SetWallMessage', 'sb', '', ""), | ||
339 | 111 | ]) | ||
340 | 112 | |||
341 | 113 | def add_seat(self, properties, is_self): | ||
342 | 114 | # find a new name | ||
343 | 115 | count = 0 | ||
344 | 116 | while True: | ||
345 | 117 | id = 'seat%d' % count | ||
346 | 118 | if id not in self.seats: | ||
347 | 119 | break | ||
348 | 120 | count += 1 | ||
349 | 121 | |||
350 | 122 | path = dbus.ObjectPath(SEAT_PATH + id) | ||
351 | 123 | |||
352 | 124 | seat_props = { | ||
353 | 125 | 'Id': id, | ||
354 | 126 | 'ActiveSession': properties.get('ActiveSession', dbus.Struct(('c2', '/org/freedesktop/login1/session/c2'), signature='so')), | ||
355 | 127 | 'CanMultiSession': properties.get('CanMultiSession', True), | ||
356 | 128 | 'CanTTY': properties.get('CanTTY', True), | ||
357 | 129 | 'CanGraphical': properties.get('CanGraphical', True), | ||
358 | 130 | 'Sessions': properties.get('Sessions', dbus.Array([('c2', '/org/freedesktop/login1/session/c2')], signature='(so)')), | ||
359 | 131 | 'IdleHint': properties.get('IdleHint', False), | ||
360 | 132 | 'IdleSinceHint': properties.get('IdleSinceHint', dbus.UInt64(1489590854604069)), | ||
361 | 133 | 'IdleSinceHintMonotonic': properties.get('IdleSinceHintMonotonic', dbus.UInt64(18537117367)), | ||
362 | 134 | } | ||
363 | 135 | |||
364 | 136 | seat_methods = [ | ||
365 | 137 | ('Terminate', '', '', ""), | ||
366 | 138 | ('ActivateSession', 's', '', ""), | ||
367 | 139 | ('SwitchTo', 'u', '', ""), | ||
368 | 140 | ('SwitchToNext', '', '', ""), | ||
369 | 141 | ('SwitchToPrevious', '', '', ""), | ||
370 | 142 | ] | ||
371 | 143 | |||
372 | 144 | self.seats[id] = self.AddObject(path, | ||
373 | 145 | SEAT_IFACE, | ||
374 | 146 | seat_props, | ||
375 | 147 | seat_methods) | ||
376 | 148 | |||
377 | 149 | if is_self: | ||
378 | 150 | self_path = dbus.ObjectPath(SEAT_PATH + 'self') | ||
379 | 151 | try: | ||
380 | 152 | self.RemoveObject(self_path) | ||
381 | 153 | except dbus.exceptions.DBusException: | ||
382 | 154 | pass | ||
383 | 155 | self.AddObject(self_path, | ||
384 | 156 | SEAT_IFACE, | ||
385 | 157 | seat_props, | ||
386 | 158 | seat_methods) | ||
387 | 159 | |||
388 | 160 | return path | ||
389 | 161 | |||
390 | 162 | def get_seat(self, id): | ||
391 | 163 | if id in self.seats: | ||
392 | 164 | return SEAT_PATH + id | ||
393 | 165 | raise dbus.exceptions.DBusException() | ||
394 | 166 | |||
395 | 167 | def list_seats(self): | ||
396 | 168 | result = dbus.Array([], signature='(so)') | ||
397 | 169 | for id in self.seats: | ||
398 | 170 | result.append((id, SEAT_PATH + id)) | ||
399 | 171 | return result |
Looks good to me, thanks!
Just 1 ultra ultra ultra minor thing that is not going to block approving this:
In...
#include <NetworkManager.h>
90 #include <QJsonDocument>
91 +#include <QFile>
92 +#include <QStandardPaths>
QFile should go before QJsonDocument if we follow alphabetical order.