Merge lp:~pete-woods/indicator-network/improve-logging into lp:indicator-network
- improve-logging
- Merge into trunk
Proposed by
Pete Woods
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Pete Woods | ||||
Approved revision: | 598 | ||||
Merged at revision: | 600 | ||||
Proposed branch: | lp:~pete-woods/indicator-network/improve-logging | ||||
Merge into: | lp:indicator-network | ||||
Prerequisite: | lp:~unity-api-team/indicator-network/connectivity-api-mobile-data-management | ||||
Diff against target: |
935 lines (+213/-70) 25 files modified
src/agent/KeyringCredentialStore.cpp (+2/-2) src/agent/SecretAgent.cpp (+8/-8) src/agent/agent-main.cpp (+3/-0) src/indicator/main.cpp (+4/-0) src/indicator/nmofono/connection/active-connection-manager.cpp (+1/-1) src/indicator/nmofono/hotspot-manager.cpp (+12/-12) src/indicator/nmofono/kill-switch.cpp (+3/-3) src/indicator/nmofono/manager-impl.cpp (+22/-17) src/indicator/nmofono/vpn/vpn-connection.cpp (+3/-3) src/indicator/nmofono/vpn/vpn-manager.cpp (+1/-1) src/indicator/nmofono/wifi/wifi-link-impl.cpp (+9/-4) src/indicator/nmofono/wwan/modem.cpp (+6/-2) src/indicator/root-state.cpp (+1/-1) src/indicator/vpn-status-notifier.cpp (+1/-1) src/menumodel-cpp/action-group-merger.cpp (+3/-3) src/menumodel-cpp/menu-item.cpp (+1/-1) src/notify-cpp/notification.cpp (+4/-4) src/qpowerd/qpowerd.cpp (+1/-1) src/util/CMakeLists.txt (+1/-0) src/util/logging.cpp (+59/-0) src/util/logging.h (+29/-0) tests/unit/secret-agent/secret-agent-main.cpp (+29/-1) tests/unit/secret-agent/test-secret-agent.cpp (+3/-3) tests/utils/CMakeLists.txt (+3/-2) tests/utils/main.cpp (+4/-0) |
||||
To merge this branch: | bzr merge lp:~pete-woods/indicator-network/improve-logging | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
Antti Kaijanmäki | Pending | ||
PS Jenkins bot | continuous-integration | Pending | |
Review via email: mp+295828@code.launchpad.net |
This proposal supersedes a proposal from 2016-05-25.
Commit message
Improve logging
Description of the change
Improve logging
To post a comment you must log in.
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote : Posted in a previous version of this proposal | # |
review:
Approve
Revision history for this message
Charles Kerr (charlesk) wrote : | # |
Oh, I'm stealing this.
review:
Approve
Revision history for this message
Charles Kerr (charlesk) wrote : | # |
Not a showstopper, but a minor nit this does kick up one new warning when I build:
src/util/
src/util/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/agent/KeyringCredentialStore.cpp' | |||
2 | --- src/agent/KeyringCredentialStore.cpp 2016-02-18 12:37:05 +0000 | |||
3 | +++ src/agent/KeyringCredentialStore.cpp 2016-05-26 16:58:27 +0000 | |||
4 | @@ -80,7 +80,7 @@ | |||
5 | 80 | } | 80 | } |
6 | 81 | g_error_free(error); | 81 | g_error_free(error); |
7 | 82 | } | 82 | } |
9 | 83 | qCritical() << __PRETTY_FUNCTION__ << message; | 83 | qCritical() << message; |
10 | 84 | } | 84 | } |
11 | 85 | } | 85 | } |
12 | 86 | 86 | ||
13 | @@ -146,7 +146,7 @@ | |||
14 | 146 | message = QString::fromUtf8(error->message); | 146 | message = QString::fromUtf8(error->message); |
15 | 147 | } | 147 | } |
16 | 148 | g_error_free(error); | 148 | g_error_free(error); |
18 | 149 | qCritical() << __PRETTY_FUNCTION__ << message; | 149 | qCritical() << message; |
19 | 150 | } | 150 | } |
20 | 151 | } | 151 | } |
21 | 152 | } | 152 | } |
22 | 153 | 153 | ||
23 | === modified file 'src/agent/SecretAgent.cpp' | |||
24 | --- src/agent/SecretAgent.cpp 2016-02-18 12:37:30 +0000 | |||
25 | +++ src/agent/SecretAgent.cpp 2016-05-26 16:58:27 +0000 | |||
26 | @@ -132,7 +132,7 @@ | |||
27 | 132 | NM_SECRET_AGENT_CAPABILITY_NONE); | 132 | NM_SECRET_AGENT_CAPABILITY_NONE); |
28 | 133 | reply.waitForFinished(); | 133 | reply.waitForFinished(); |
29 | 134 | if (reply.isError()) { | 134 | if (reply.isError()) { |
31 | 135 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 135 | qCritical() << reply.error().message(); |
32 | 136 | } | 136 | } |
33 | 137 | } | 137 | } |
34 | 138 | } | 138 | } |
35 | @@ -176,7 +176,7 @@ | |||
36 | 176 | NM_SECRET_AGENT_CAPABILITY_NONE); | 176 | NM_SECRET_AGENT_CAPABILITY_NONE); |
37 | 177 | reply.waitForFinished(); | 177 | reply.waitForFinished(); |
38 | 178 | if (reply.isError()) { | 178 | if (reply.isError()) { |
40 | 179 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 179 | qCritical() << reply.error().message(); |
41 | 180 | } | 180 | } |
42 | 181 | } | 181 | } |
43 | 182 | 182 | ||
44 | @@ -184,7 +184,7 @@ | |||
45 | 184 | auto reply = d->m_agentManager.Unregister(); | 184 | auto reply = d->m_agentManager.Unregister(); |
46 | 185 | reply.waitForFinished(); | 185 | reply.waitForFinished(); |
47 | 186 | if (reply.isError()) { | 186 | if (reply.isError()) { |
49 | 187 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 187 | qCritical() << reply.error().message(); |
50 | 188 | } | 188 | } |
51 | 189 | } | 189 | } |
52 | 190 | 190 | ||
53 | @@ -232,7 +232,7 @@ | |||
54 | 232 | 232 | ||
55 | 233 | setDelayedReply(true); | 233 | setDelayedReply(true); |
56 | 234 | 234 | ||
58 | 235 | qDebug() << __PRETTY_FUNCTION__ << connectionPath.path() << settingName << hints << flags; | 235 | qDebug() << connectionPath.path() << settingName << hints << flags; |
59 | 236 | 236 | ||
60 | 237 | // If we want a WiFi secret, and | 237 | // If we want a WiFi secret, and |
61 | 238 | if (settingName == NM_WIRELESS_SECURITY_SETTING_NAME && | 238 | if (settingName == NM_WIRELESS_SECURITY_SETTING_NAME && |
62 | @@ -241,12 +241,12 @@ | |||
63 | 241 | ((flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW) > 0) || | 241 | ((flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW) > 0) || |
64 | 242 | ((flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED) > 0) | 242 | ((flags & NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED) > 0) |
65 | 243 | )) { | 243 | )) { |
67 | 244 | qDebug() << __PRETTY_FUNCTION__ << "Requesting secret from user"; | 244 | qDebug() << "Requesting secret from user"; |
68 | 245 | d->m_request.reset(new SecretRequest(*this, connection, | 245 | d->m_request.reset(new SecretRequest(*this, connection, |
69 | 246 | connectionPath, settingName, hints, flags, message())); | 246 | connectionPath, settingName, hints, flags, message())); |
70 | 247 | } else if (((flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) || | 247 | } else if (((flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE) || |
71 | 248 | (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED))) { | 248 | (flags == NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED))) { |
73 | 249 | qDebug() << __PRETTY_FUNCTION__ << "Retrieving secret from keyring"; | 249 | qDebug() << "Retrieving secret from keyring"; |
74 | 250 | 250 | ||
75 | 251 | bool isVpn = (settingName == NM_VPN_SETTING_NAME); | 251 | bool isVpn = (settingName == NM_VPN_SETTING_NAME); |
76 | 252 | 252 | ||
77 | @@ -288,7 +288,7 @@ | |||
78 | 288 | d->m_systemConnection.send( | 288 | d->m_systemConnection.send( |
79 | 289 | message().createReply(QVariant::fromValue(newConnection))); | 289 | message().createReply(QVariant::fromValue(newConnection))); |
80 | 290 | } else { | 290 | } else { |
82 | 291 | qDebug() << __PRETTY_FUNCTION__ << "Can't get secrets for this connection"; | 291 | qDebug() << "Can't get secrets for this connection"; |
83 | 292 | d->m_systemConnection.send( | 292 | d->m_systemConnection.send( |
84 | 293 | message().createErrorReply("org.freedesktop.NetworkManager.SecretAgent.NoSecrets", | 293 | message().createErrorReply("org.freedesktop.NetworkManager.SecretAgent.NoSecrets", |
85 | 294 | "No secrets found for this connection.")); | 294 | "No secrets found for this connection.")); |
86 | @@ -301,7 +301,7 @@ | |||
87 | 301 | if (error) { | 301 | if (error) { |
88 | 302 | d->m_systemConnection.send( | 302 | d->m_systemConnection.send( |
89 | 303 | request.message().createErrorReply("org.freedesktop.NetworkManager.SecretAgent.NoSecrets", | 303 | request.message().createErrorReply("org.freedesktop.NetworkManager.SecretAgent.NoSecrets", |
91 | 304 | "No password found for this connection.")); | 304 | "No secrets found for this connection.")); |
92 | 305 | } else { | 305 | } else { |
93 | 306 | d->m_systemConnection.send( | 306 | d->m_systemConnection.send( |
94 | 307 | request.message().createReply( | 307 | request.message().createReply( |
95 | 308 | 308 | ||
96 | === modified file 'src/agent/agent-main.cpp' | |||
97 | --- src/agent/agent-main.cpp 2016-02-15 09:31:38 +0000 | |||
98 | +++ src/agent/agent-main.cpp 2016-05-26 16:58:27 +0000 | |||
99 | @@ -20,6 +20,7 @@ | |||
100 | 20 | #include <notify-cpp/notification-manager.h> | 20 | #include <notify-cpp/notification-manager.h> |
101 | 21 | #include <agent/KeyringCredentialStore.h> | 21 | #include <agent/KeyringCredentialStore.h> |
102 | 22 | #include <agent/SecretAgent.h> | 22 | #include <agent/SecretAgent.h> |
103 | 23 | #include <util/logging.h> | ||
104 | 23 | #include <util/unix-signal-handler.h> | 24 | #include <util/unix-signal-handler.h> |
105 | 24 | #include <dbus-types.h> | 25 | #include <dbus-types.h> |
106 | 25 | 26 | ||
107 | @@ -38,6 +39,8 @@ | |||
108 | 38 | int | 39 | int |
109 | 39 | main(int argc, char **argv) | 40 | main(int argc, char **argv) |
110 | 40 | { | 41 | { |
111 | 42 | qInstallMessageHandler(util::loggingFunction); | ||
112 | 43 | |||
113 | 41 | QCoreApplication app(argc, argv); | 44 | QCoreApplication app(argc, argv); |
114 | 42 | DBusTypes::registerMetaTypes(); | 45 | DBusTypes::registerMetaTypes(); |
115 | 43 | Variant::registerMetaTypes(); | 46 | Variant::registerMetaTypes(); |
116 | 44 | 47 | ||
117 | === modified file 'src/indicator/main.cpp' | |||
118 | --- src/indicator/main.cpp 2015-12-11 14:58:11 +0000 | |||
119 | +++ src/indicator/main.cpp 2016-05-26 16:58:27 +0000 | |||
120 | @@ -18,6 +18,7 @@ | |||
121 | 18 | */ | 18 | */ |
122 | 19 | 19 | ||
123 | 20 | #include <factory.h> | 20 | #include <factory.h> |
124 | 21 | #include <util/logging.h> | ||
125 | 21 | #include <util/unix-signal-handler.h> | 22 | #include <util/unix-signal-handler.h> |
126 | 22 | #include <dbus-types.h> | 23 | #include <dbus-types.h> |
127 | 23 | 24 | ||
128 | @@ -34,9 +35,12 @@ | |||
129 | 34 | using namespace std; | 35 | using namespace std; |
130 | 35 | using namespace connectivity_service; | 36 | using namespace connectivity_service; |
131 | 36 | 37 | ||
132 | 38 | |||
133 | 37 | int | 39 | int |
134 | 38 | main(int argc, char **argv) | 40 | main(int argc, char **argv) |
135 | 39 | { | 41 | { |
136 | 42 | qInstallMessageHandler(util::loggingFunction); | ||
137 | 43 | |||
138 | 40 | QCoreApplication app(argc, argv); | 44 | QCoreApplication app(argc, argv); |
139 | 41 | DBusTypes::registerMetaTypes(); | 45 | DBusTypes::registerMetaTypes(); |
140 | 42 | Variant::registerMetaTypes(); | 46 | Variant::registerMetaTypes(); |
141 | 43 | 47 | ||
142 | === modified file 'src/indicator/nmofono/connection/active-connection-manager.cpp' | |||
143 | --- src/indicator/nmofono/connection/active-connection-manager.cpp 2015-10-06 10:19:30 +0000 | |||
144 | +++ src/indicator/nmofono/connection/active-connection-manager.cpp 2016-05-26 16:58:27 +0000 | |||
145 | @@ -115,7 +115,7 @@ | |||
146 | 115 | reply.waitForFinished(); | 115 | reply.waitForFinished(); |
147 | 116 | if (reply.isError()) | 116 | if (reply.isError()) |
148 | 117 | { | 117 | { |
150 | 118 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message(); | 118 | qWarning() << reply.error().message(); |
151 | 119 | return false; | 119 | return false; |
152 | 120 | } | 120 | } |
153 | 121 | return true; | 121 | return true; |
154 | 122 | 122 | ||
155 | === modified file 'src/indicator/nmofono/hotspot-manager.cpp' | |||
156 | --- src/indicator/nmofono/hotspot-manager.cpp 2016-05-11 16:52:45 +0000 | |||
157 | +++ src/indicator/nmofono/hotspot-manager.cpp 2016-05-26 16:58:27 +0000 | |||
158 | @@ -62,7 +62,7 @@ | |||
159 | 62 | 62 | ||
160 | 63 | void addConnection() | 63 | void addConnection() |
161 | 64 | { | 64 | { |
163 | 65 | qDebug() << __PRETTY_FUNCTION__ << "Adding new hotspot connection"; | 65 | qDebug() << "Adding new hotspot connection"; |
164 | 66 | QVariantDictMap connection = createConnectionSettings(m_ssid, m_password, | 66 | QVariantDictMap connection = createConnectionSettings(m_ssid, m_password, |
165 | 67 | m_mode, m_auth); | 67 | m_mode, m_auth); |
166 | 68 | 68 | ||
167 | @@ -91,7 +91,7 @@ | |||
168 | 91 | 91 | ||
169 | 92 | void updateConnection() | 92 | void updateConnection() |
170 | 93 | { | 93 | { |
172 | 94 | qDebug() << __PRETTY_FUNCTION__ << "Updating hotspot connection"; | 94 | qDebug() << "Updating hotspot connection"; |
173 | 95 | // Get new settings | 95 | // Get new settings |
174 | 96 | QVariantDictMap new_settings = createConnectionSettings(m_ssid, | 96 | QVariantDictMap new_settings = createConnectionSettings(m_ssid, |
175 | 97 | m_password, | 97 | m_password, |
176 | @@ -129,7 +129,7 @@ | |||
177 | 129 | // Wait for connection to activate | 129 | // Wait for connection to activate |
178 | 130 | while (count < 20 && activeConnection.state() != NM_ACTIVE_CONNECTION_STATE_ACTIVATED) | 130 | while (count < 20 && activeConnection.state() != NM_ACTIVE_CONNECTION_STATE_ACTIVATED) |
179 | 131 | { | 131 | { |
181 | 132 | qDebug() << __PRETTY_FUNCTION__ << "Waiting for hotspot to connect"; | 132 | qDebug() << "Waiting for hotspot to connect"; |
182 | 133 | QThread::msleep(100); | 133 | QThread::msleep(100); |
183 | 134 | ++count; | 134 | ++count; |
184 | 135 | } | 135 | } |
185 | @@ -144,11 +144,11 @@ | |||
186 | 144 | { | 144 | { |
187 | 145 | if (!m_hotspot) | 145 | if (!m_hotspot) |
188 | 146 | { | 146 | { |
190 | 147 | qWarning() << __PRETTY_FUNCTION__ << "Could not find a hotspot setup to enable"; | 147 | qWarning() << "Could not find a hotspot setup to enable"; |
191 | 148 | return; | 148 | return; |
192 | 149 | } | 149 | } |
193 | 150 | 150 | ||
195 | 151 | qDebug() << __PRETTY_FUNCTION__ << "Activating hotspot on device" << device.path(); | 151 | qDebug() << "Activating hotspot on device" << device.path(); |
196 | 152 | bool success = activateConnection(device); | 152 | bool success = activateConnection(device); |
197 | 153 | setEnable(success); | 153 | setEnable(success); |
198 | 154 | if (success) | 154 | if (success) |
199 | @@ -332,7 +332,7 @@ | |||
200 | 332 | continue; | 332 | continue; |
201 | 333 | } | 333 | } |
202 | 334 | 334 | ||
204 | 335 | qDebug() << __PRETTY_FUNCTION__ << "Using AP interface " << interface; | 335 | qDebug() << "Using AP interface " << interface; |
205 | 336 | m_device = make_unique<ApDevice>(*path, interface); | 336 | m_device = make_unique<ApDevice>(*path, interface); |
206 | 337 | break; | 337 | break; |
207 | 338 | } | 338 | } |
208 | @@ -350,7 +350,7 @@ | |||
209 | 350 | { | 350 | { |
210 | 351 | QThread::msleep(100); | 351 | QThread::msleep(100); |
211 | 352 | findApDevice(); | 352 | findApDevice(); |
213 | 353 | qDebug() << __PRETTY_FUNCTION__ << "Searching for AP device"; | 353 | qDebug() << "Searching for AP device"; |
214 | 354 | ++count; | 354 | ++count; |
215 | 355 | } | 355 | } |
216 | 356 | } | 356 | } |
217 | @@ -546,7 +546,7 @@ | |||
218 | 546 | { | 546 | { |
219 | 547 | if (!m_hotspot) | 547 | if (!m_hotspot) |
220 | 548 | { | 548 | { |
222 | 549 | qWarning() << __PRETTY_FUNCTION__ << "Could not find a hotspot setup to enable"; | 549 | qWarning() << "Could not find a hotspot setup to enable"; |
223 | 550 | return; | 550 | return; |
224 | 551 | } | 551 | } |
225 | 552 | 552 | ||
226 | @@ -561,12 +561,12 @@ | |||
227 | 561 | 561 | ||
228 | 562 | if (m_device) | 562 | if (m_device) |
229 | 563 | { | 563 | { |
231 | 564 | qDebug() << __PRETTY_FUNCTION__ << "Reactivating hotspot connection on device" << m_device->m_path.path(); | 564 | qDebug() << "Reactivating hotspot connection on device" << m_device->m_path.path(); |
232 | 565 | activateConnection(m_device->m_path); | 565 | activateConnection(m_device->m_path); |
233 | 566 | } | 566 | } |
234 | 567 | else | 567 | else |
235 | 568 | { | 568 | { |
237 | 569 | qWarning() << __PRETTY_FUNCTION__ << "Could not get device when reactivating hotspot connection"; | 569 | qWarning() << "Could not get device when reactivating hotspot connection"; |
238 | 570 | } | 570 | } |
239 | 571 | } | 571 | } |
240 | 572 | 572 | ||
241 | @@ -649,7 +649,7 @@ | |||
242 | 649 | // If the SSID is empty, we report an error. | 649 | // If the SSID is empty, we report an error. |
243 | 650 | if (d->m_ssid.isEmpty()) | 650 | if (d->m_ssid.isEmpty()) |
244 | 651 | { | 651 | { |
246 | 652 | qWarning() << __PRETTY_FUNCTION__ << " SSID was empty"; | 652 | qWarning() << " SSID was empty"; |
247 | 653 | Q_EMIT reportError(1); | 653 | Q_EMIT reportError(1); |
248 | 654 | d->setEnable(false); | 654 | d->setEnable(false); |
249 | 655 | return; | 655 | return; |
250 | @@ -662,7 +662,7 @@ | |||
251 | 662 | 662 | ||
252 | 663 | if (!d->m_device) | 663 | if (!d->m_device) |
253 | 664 | { | 664 | { |
255 | 665 | qWarning() << __PRETTY_FUNCTION__ << "Failed to create AP device"; | 665 | qWarning() << "Failed to create AP device"; |
256 | 666 | Q_EMIT reportError(1); | 666 | Q_EMIT reportError(1); |
257 | 667 | d->setDisconnectWifi(false); | 667 | d->setDisconnectWifi(false); |
258 | 668 | return; | 668 | return; |
259 | 669 | 669 | ||
260 | === modified file 'src/indicator/nmofono/kill-switch.cpp' | |||
261 | --- src/indicator/nmofono/kill-switch.cpp 2015-08-06 11:23:00 +0000 | |||
262 | +++ src/indicator/nmofono/kill-switch.cpp 2016-05-26 16:58:27 +0000 | |||
263 | @@ -118,7 +118,7 @@ | |||
264 | 118 | { | 118 | { |
265 | 119 | if (!block && state() == State::hard_blocked) | 119 | if (!block && state() == State::hard_blocked) |
266 | 120 | { | 120 | { |
268 | 121 | qCritical() << __PRETTY_FUNCTION__ << "Killswitch is hard blocked."; | 121 | qCritical() << "Killswitch is hard blocked."; |
269 | 122 | return; | 122 | return; |
270 | 123 | } | 123 | } |
271 | 124 | 124 | ||
272 | @@ -141,7 +141,7 @@ | |||
273 | 141 | } | 141 | } |
274 | 142 | catch (std::exception &e) | 142 | catch (std::exception &e) |
275 | 143 | { | 143 | { |
277 | 144 | qCritical() << __PRETTY_FUNCTION__ << e.what(); | 144 | qCritical() << e.what(); |
278 | 145 | } | 145 | } |
279 | 146 | } | 146 | } |
280 | 147 | 147 | ||
281 | @@ -163,7 +163,7 @@ | |||
282 | 163 | } | 163 | } |
283 | 164 | catch (std::runtime_error& e) | 164 | catch (std::runtime_error& e) |
284 | 165 | { | 165 | { |
286 | 166 | qWarning() << __PRETTY_FUNCTION__ << ": " << QString::fromStdString(e.what()); | 166 | qWarning() << e.what(); |
287 | 167 | return false; | 167 | return false; |
288 | 168 | } | 168 | } |
289 | 169 | } | 169 | } |
290 | 170 | 170 | ||
291 | === modified file 'src/indicator/nmofono/manager-impl.cpp' | |||
292 | --- src/indicator/nmofono/manager-impl.cpp 2016-05-26 16:58:27 +0000 | |||
293 | +++ src/indicator/nmofono/manager-impl.cpp 2016-05-26 16:58:27 +0000 | |||
294 | @@ -288,6 +288,9 @@ | |||
295 | 288 | auto toAdd = modemPaths; | 288 | auto toAdd = modemPaths; |
296 | 289 | toAdd.subtract(currentModemPaths); | 289 | toAdd.subtract(currentModemPaths); |
297 | 290 | 290 | ||
298 | 291 | if (!toRemove.isEmpty()) { | ||
299 | 292 | qDebug() << "Removing modems" << toRemove; | ||
300 | 293 | } | ||
301 | 291 | for (const auto& path : toRemove) | 294 | for (const auto& path : toRemove) |
302 | 292 | { | 295 | { |
303 | 293 | auto modem = m_ofonoLinks.take(path); | 296 | auto modem = m_ofonoLinks.take(path); |
304 | @@ -301,6 +304,9 @@ | |||
305 | 301 | Q_EMIT p.modemsChanged(); | 304 | Q_EMIT p.modemsChanged(); |
306 | 302 | } | 305 | } |
307 | 303 | 306 | ||
308 | 307 | if (!toAdd.isEmpty()) { | ||
309 | 308 | qDebug() << "Adding modems" << toAdd; | ||
310 | 309 | } | ||
311 | 304 | for (const auto& path : toAdd) | 310 | for (const auto& path : toAdd) |
312 | 305 | { | 311 | { |
313 | 306 | auto modemInterface = make_shared<QOfonoModem>(); | 312 | auto modemInterface = make_shared<QOfonoModem>(); |
314 | @@ -467,6 +473,8 @@ | |||
315 | 467 | void | 473 | void |
316 | 468 | ManagerImpl::setWifiEnabled(bool enabled) | 474 | ManagerImpl::setWifiEnabled(bool enabled) |
317 | 469 | { | 475 | { |
318 | 476 | qDebug() << "Setting WiFi enabled =" << enabled; | ||
319 | 477 | |||
320 | 470 | if (!d->m_hasWifi) | 478 | if (!d->m_hasWifi) |
321 | 471 | { | 479 | { |
322 | 472 | return; | 480 | return; |
323 | @@ -504,6 +512,8 @@ | |||
324 | 504 | void | 512 | void |
325 | 505 | ManagerImpl::setHotspotEnabled(bool enabled) | 513 | ManagerImpl::setHotspotEnabled(bool enabled) |
326 | 506 | { | 514 | { |
327 | 515 | qDebug() << "Setting hotspot enabled =" << enabled; | ||
328 | 516 | |||
329 | 507 | if (d->m_hotspotManager->enabled() == enabled) | 517 | if (d->m_hotspotManager->enabled() == enabled) |
330 | 508 | { | 518 | { |
331 | 509 | return; | 519 | return; |
332 | @@ -511,7 +521,7 @@ | |||
333 | 511 | 521 | ||
334 | 512 | if (enabled && d->m_flightMode) | 522 | if (enabled && d->m_flightMode) |
335 | 513 | { | 523 | { |
337 | 514 | qWarning() << __PRETTY_FUNCTION__ << "Cannot set hotspot enabled when flight mode is on"; | 524 | qWarning() << "Cannot set hotspot enabled when flight mode is on"; |
338 | 515 | return; | 525 | return; |
339 | 516 | } | 526 | } |
340 | 517 | 527 | ||
341 | @@ -530,6 +540,8 @@ | |||
342 | 530 | void | 540 | void |
343 | 531 | ManagerImpl::setFlightMode(bool enabled) | 541 | ManagerImpl::setFlightMode(bool enabled) |
344 | 532 | { | 542 | { |
345 | 543 | qDebug() << "Setting flight mode enabled =" << enabled; | ||
346 | 544 | |||
347 | 533 | if (enabled == d->m_killSwitch->isFlightMode()) | 545 | if (enabled == d->m_killSwitch->isFlightMode()) |
348 | 534 | { | 546 | { |
349 | 535 | return; | 547 | return; |
350 | @@ -567,9 +579,7 @@ | |||
351 | 567 | void | 579 | void |
352 | 568 | ManagerImpl::device_removed(const QDBusObjectPath &path) | 580 | ManagerImpl::device_removed(const QDBusObjectPath &path) |
353 | 569 | { | 581 | { |
357 | 570 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | 582 | qDebug() << "Device Removed:" << path.path(); |
355 | 571 | qDebug() << "Device Removed:" << path.path(); | ||
356 | 572 | #endif | ||
358 | 573 | Link::Ptr toRemove; | 583 | Link::Ptr toRemove; |
359 | 574 | for (auto dev : d->m_nmLinks) | 584 | for (auto dev : d->m_nmLinks) |
360 | 575 | { | 585 | { |
361 | @@ -591,9 +601,7 @@ | |||
362 | 591 | void | 601 | void |
363 | 592 | ManagerImpl::device_added(const QDBusObjectPath &path) | 602 | ManagerImpl::device_added(const QDBusObjectPath &path) |
364 | 593 | { | 603 | { |
365 | 594 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | ||
366 | 595 | qDebug() << "Device Added:" << path.path(); | 604 | qDebug() << "Device Added:" << path.path(); |
367 | 596 | #endif | ||
368 | 597 | for (const auto &dev : d->m_nmLinks) | 605 | for (const auto &dev : d->m_nmLinks) |
369 | 598 | { | 606 | { |
370 | 599 | auto wifiLink = dynamic_pointer_cast<wifi::WifiLinkImpl>(dev); | 607 | auto wifiLink = dynamic_pointer_cast<wifi::WifiLinkImpl>(dev); |
371 | @@ -623,7 +631,7 @@ | |||
372 | 623 | } | 631 | } |
373 | 624 | } | 632 | } |
374 | 625 | } catch (const exception &e) { | 633 | } catch (const exception &e) { |
376 | 626 | qDebug() << __PRETTY_FUNCTION__ << ": failed to create Device proxy for "<< path.path() << ": "; | 634 | qDebug() << ": failed to create Device proxy for "<< path.path() << ": "; |
377 | 627 | qDebug() << "\t" << e.what(); | 635 | qDebug() << "\t" << e.what(); |
378 | 628 | qDebug() << "\tIgnoring."; | 636 | qDebug() << "\tIgnoring."; |
379 | 629 | return; | 637 | return; |
380 | @@ -694,6 +702,7 @@ | |||
381 | 694 | || d->m_unlockDialog->modem() == modem | 702 | || d->m_unlockDialog->modem() == modem |
382 | 695 | || count(d->m_pendingUnlocks.begin(), d->m_pendingUnlocks.end(), modem) != 0) | 703 | || count(d->m_pendingUnlocks.begin(), d->m_pendingUnlocks.end(), modem) != 0) |
383 | 696 | { | 704 | { |
384 | 705 | qDebug() << "Didn't unlock modem because it's already being unlocked or is queued for unlock" << modem->simIdentifier(); | ||
385 | 697 | return; | 706 | return; |
386 | 698 | } | 707 | } |
387 | 699 | 708 | ||
388 | @@ -702,15 +711,18 @@ | |||
389 | 702 | { | 711 | { |
390 | 703 | if (modem->isReadyToUnlock()) | 712 | if (modem->isReadyToUnlock()) |
391 | 704 | { | 713 | { |
392 | 714 | qDebug() << "Unlocking modem" << modem->simIdentifier(); | ||
393 | 705 | d->m_unlockDialog->unlock(modem); | 715 | d->m_unlockDialog->unlock(modem); |
394 | 706 | } | 716 | } |
395 | 707 | else | 717 | else |
396 | 708 | { | 718 | { |
397 | 719 | qDebug() << "Waiting for modem to be ready" << modem->simIdentifier(); | ||
398 | 709 | modem->notifyWhenReadyToUnlock(); | 720 | modem->notifyWhenReadyToUnlock(); |
399 | 710 | } | 721 | } |
400 | 711 | } | 722 | } |
401 | 712 | else | 723 | else |
402 | 713 | { | 724 | { |
403 | 725 | qDebug() << "Queueing modem for unlock" << modem->simIdentifier(); | ||
404 | 714 | d->m_pendingUnlocks.push_back(modem); | 726 | d->m_pendingUnlocks.push_back(modem); |
405 | 715 | } | 727 | } |
406 | 716 | } catch(const exception &e) { | 728 | } catch(const exception &e) { |
407 | @@ -718,21 +730,16 @@ | |||
408 | 718 | // crashed taking the notification server with it. There is no graceful | 730 | // crashed taking the notification server with it. There is no graceful |
409 | 719 | // and reliable way to recover so die and get restarted. | 731 | // and reliable way to recover so die and get restarted. |
410 | 720 | // See also https://bugs.launchpad.net/unity-notifications/+bug/1238990 | 732 | // See also https://bugs.launchpad.net/unity-notifications/+bug/1238990 |
412 | 721 | qWarning() << __PRETTY_FUNCTION__ << " sim unlocking failed: " << QString::fromStdString(e.what()); | 733 | qWarning() << " sim unlocking failed: " << QString::fromStdString(e.what()); |
413 | 722 | } | 734 | } |
414 | 723 | } | 735 | } |
415 | 724 | 736 | ||
416 | 725 | void | 737 | void |
417 | 726 | ManagerImpl::unlockAllModems() | 738 | ManagerImpl::unlockAllModems() |
418 | 727 | { | 739 | { |
422 | 728 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | 740 | qDebug() << "Unlock all modems"; |
420 | 729 | qDebug() << __PRETTY_FUNCTION__; | ||
421 | 730 | #endif | ||
423 | 731 | for (auto& m : d->m_ofonoLinks) | 741 | for (auto& m : d->m_ofonoLinks) |
424 | 732 | { | 742 | { |
425 | 733 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | ||
426 | 734 | qDebug() << "Unlocking " << m->simIdentifier(); | ||
427 | 735 | #endif | ||
428 | 736 | unlockModem(m); | 743 | unlockModem(m); |
429 | 737 | } | 744 | } |
430 | 738 | } | 745 | } |
431 | @@ -740,9 +747,7 @@ | |||
432 | 740 | void | 747 | void |
433 | 741 | ManagerImpl::unlockModemByName(const QString &name) | 748 | ManagerImpl::unlockModemByName(const QString &name) |
434 | 742 | { | 749 | { |
438 | 743 | #ifdef INDICATOR_NETWORK_TRACE_MESSAGES | 750 | qDebug() << "Unlock modem:" << name; |
436 | 744 | qDebug() << __PRETTY_FUNCTION__ ; | ||
437 | 745 | #endif | ||
439 | 746 | auto it = d->m_ofonoLinks.find(name); | 751 | auto it = d->m_ofonoLinks.find(name); |
440 | 747 | if (it != d->m_ofonoLinks.cend()) | 752 | if (it != d->m_ofonoLinks.cend()) |
441 | 748 | { | 753 | { |
442 | 749 | 754 | ||
443 | === modified file 'src/indicator/nmofono/vpn/vpn-connection.cpp' | |||
444 | --- src/indicator/nmofono/vpn/vpn-connection.cpp 2016-03-04 11:03:02 +0000 | |||
445 | +++ src/indicator/nmofono/vpn/vpn-connection.cpp 2016-05-26 16:58:27 +0000 | |||
446 | @@ -206,7 +206,7 @@ | |||
447 | 206 | reply.waitForFinished(); | 206 | reply.waitForFinished(); |
448 | 207 | if (reply.isError()) | 207 | if (reply.isError()) |
449 | 208 | { | 208 | { |
451 | 209 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message() << m_pendingSettings; | 209 | qWarning() << reply.error().message() << m_pendingSettings; |
452 | 210 | } | 210 | } |
453 | 211 | 211 | ||
454 | 212 | m_dirty = false; | 212 | m_dirty = false; |
455 | @@ -237,7 +237,7 @@ | |||
456 | 237 | reply.waitForFinished(); | 237 | reply.waitForFinished(); |
457 | 238 | if (reply.isError()) | 238 | if (reply.isError()) |
458 | 239 | { | 239 | { |
460 | 240 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message(); | 240 | qWarning() << reply.error().message(); |
461 | 241 | return; | 241 | return; |
462 | 242 | } | 242 | } |
463 | 243 | 243 | ||
464 | @@ -261,7 +261,7 @@ | |||
465 | 261 | reply.waitForFinished(); | 261 | reply.waitForFinished(); |
466 | 262 | if (reply.isError()) | 262 | if (reply.isError()) |
467 | 263 | { | 263 | { |
469 | 264 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message(); | 264 | qWarning() << reply.error().message(); |
470 | 265 | return; | 265 | return; |
471 | 266 | } | 266 | } |
472 | 267 | 267 | ||
473 | 268 | 268 | ||
474 | === modified file 'src/indicator/nmofono/vpn/vpn-manager.cpp' | |||
475 | --- src/indicator/nmofono/vpn/vpn-manager.cpp 2016-02-23 09:05:16 +0000 | |||
476 | +++ src/indicator/nmofono/vpn/vpn-manager.cpp 2016-05-26 16:58:27 +0000 | |||
477 | @@ -122,7 +122,7 @@ | |||
478 | 122 | QDBusPendingReply<QDBusObjectPath> reply = *call; | 122 | QDBusPendingReply<QDBusObjectPath> reply = *call; |
479 | 123 | if (reply.isError()) | 123 | if (reply.isError()) |
480 | 124 | { | 124 | { |
482 | 125 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message(); | 125 | qWarning() << reply.error().message(); |
483 | 126 | } | 126 | } |
484 | 127 | call->deleteLater(); | 127 | call->deleteLater(); |
485 | 128 | } | 128 | } |
486 | 129 | 129 | ||
487 | === modified file 'src/indicator/nmofono/wifi/wifi-link-impl.cpp' | |||
488 | --- src/indicator/nmofono/wifi/wifi-link-impl.cpp 2015-10-06 10:19:30 +0000 | |||
489 | +++ src/indicator/nmofono/wifi/wifi-link-impl.cpp 2016-05-26 16:58:27 +0000 | |||
490 | @@ -242,7 +242,7 @@ | |||
491 | 242 | NM_DBUS_SERVICE, path.path(), m_dev->connection()); | 242 | NM_DBUS_SERVICE, path.path(), m_dev->connection()); |
492 | 243 | shap = make_shared<AccessPointImpl>(ap); | 243 | shap = make_shared<AccessPointImpl>(ap); |
493 | 244 | } catch(const exception &e) { | 244 | } catch(const exception &e) { |
495 | 245 | qWarning() << __PRETTY_FUNCTION__ << ": failed to create AccessPoint proxy for "<< path.path() << ": "; | 245 | qWarning() << "Failed to create AccessPoint proxy for "<< path.path() << ": "; |
496 | 246 | qWarning() << "\t" << QString::fromStdString(e.what()); | 246 | qWarning() << "\t" << QString::fromStdString(e.what()); |
497 | 247 | qWarning() << "\tIgnoring."; | 247 | qWarning() << "\tIgnoring."; |
498 | 248 | return; | 248 | return; |
499 | @@ -261,7 +261,7 @@ | |||
500 | 261 | /// @bug dbus-cpp internal logic exploded | 261 | /// @bug dbus-cpp internal logic exploded |
501 | 262 | // If this happens, indicator-network is in an unknown state with no clear way of | 262 | // If this happens, indicator-network is in an unknown state with no clear way of |
502 | 263 | // recovering. The only reasonable way out is a graceful exit. | 263 | // recovering. The only reasonable way out is a graceful exit. |
504 | 264 | cerr << __PRETTY_FUNCTION__ << " Failed to run dbus service: " << e.what() << endl; | 264 | cerr << " Failed to run dbus service: " << e.what() << endl; |
505 | 265 | } | 265 | } |
506 | 266 | } | 266 | } |
507 | 267 | 267 | ||
508 | @@ -278,7 +278,7 @@ | |||
509 | 278 | } | 278 | } |
510 | 279 | } | 279 | } |
511 | 280 | if (!shap) { | 280 | if (!shap) { |
513 | 281 | qWarning() << __PRETTY_FUNCTION__ << ": Tried to remove access point " << path.path() << " that has not been added."; | 281 | qWarning() << "Tried to remove access point " << path.path() << " that has not been added."; |
514 | 282 | return; | 282 | return; |
515 | 283 | } | 283 | } |
516 | 284 | m_rawAccessPoints = list; | 284 | m_rawAccessPoints = list; |
517 | @@ -449,6 +449,8 @@ | |||
518 | 449 | void | 449 | void |
519 | 450 | WifiLinkImpl::connect_to(AccessPoint::Ptr accessPoint) | 450 | WifiLinkImpl::connect_to(AccessPoint::Ptr accessPoint) |
520 | 451 | { | 451 | { |
521 | 452 | qDebug() << "Connecting to:" << accessPoint->ssid(); | ||
522 | 453 | |||
523 | 452 | try { | 454 | try { |
524 | 453 | d->m_connecting = true; | 455 | d->m_connecting = true; |
525 | 454 | QByteArray ssid = accessPoint->raw_ssid(); | 456 | QByteArray ssid = accessPoint->raw_ssid(); |
526 | @@ -479,11 +481,13 @@ | |||
527 | 479 | 481 | ||
528 | 480 | QDBusObjectPath ac("/"); | 482 | QDBusObjectPath ac("/"); |
529 | 481 | if (found) { | 483 | if (found) { |
530 | 484 | qDebug() << "Connecting to known access point"; | ||
531 | 482 | ac = d->m_nm->ActivateConnection(QDBusObjectPath(found->path()), | 485 | ac = d->m_nm->ActivateConnection(QDBusObjectPath(found->path()), |
532 | 483 | QDBusObjectPath(d->m_dev->path()), | 486 | QDBusObjectPath(d->m_dev->path()), |
533 | 484 | accessPoint->object_path()); | 487 | accessPoint->object_path()); |
534 | 485 | } else { | 488 | } else { |
535 | 486 | if (accessPoint->enterprise()) { | 489 | if (accessPoint->enterprise()) { |
536 | 490 | qDebug() << "New connection to enterprise access point"; | ||
537 | 487 | // activate system settings URI | 491 | // activate system settings URI |
538 | 488 | QUrlQuery q; | 492 | QUrlQuery q; |
539 | 489 | q.addQueryItem("ssid", accessPoint->raw_ssid()); | 493 | q.addQueryItem("ssid", accessPoint->raw_ssid()); |
540 | @@ -496,6 +500,7 @@ | |||
541 | 496 | } | 500 | } |
542 | 497 | }); | 501 | }); |
543 | 498 | } else { | 502 | } else { |
544 | 503 | qDebug() << "New connection to regular access point"; | ||
545 | 499 | QVariantDictMap conf; | 504 | QVariantDictMap conf; |
546 | 500 | 505 | ||
547 | 501 | /// @todo getting the ssid multiple times over dbus is stupid. | 506 | /// @todo getting the ssid multiple times over dbus is stupid. |
548 | @@ -519,7 +524,7 @@ | |||
549 | 519 | // @bug default timeout expired: LP(#1361642) | 524 | // @bug default timeout expired: LP(#1361642) |
550 | 520 | // If this happens, indicator-network is in an unknown state with no clear way of | 525 | // If this happens, indicator-network is in an unknown state with no clear way of |
551 | 521 | // recovering. The only reasonable way out is a graceful exit. | 526 | // recovering. The only reasonable way out is a graceful exit. |
553 | 522 | qWarning() << __PRETTY_FUNCTION__ << " Failed to activate connection: " << e.what(); | 527 | qWarning() << " Failed to activate connection: " << e.what(); |
554 | 523 | } | 528 | } |
555 | 524 | } | 529 | } |
556 | 525 | 530 | ||
557 | 526 | 531 | ||
558 | === modified file 'src/indicator/nmofono/wwan/modem.cpp' | |||
559 | --- src/indicator/nmofono/wwan/modem.cpp 2016-05-26 16:58:27 +0000 | |||
560 | +++ src/indicator/nmofono/wwan/modem.cpp 2016-05-26 16:58:27 +0000 | |||
561 | @@ -20,6 +20,7 @@ | |||
562 | 20 | #include <nmofono/wwan/modem.h> | 20 | #include <nmofono/wwan/modem.h> |
563 | 21 | 21 | ||
564 | 22 | #include <ofono/dbus.h> | 22 | #include <ofono/dbus.h> |
565 | 23 | #include <QDebug> | ||
566 | 23 | 24 | ||
567 | 24 | #define slots | 25 | #define slots |
568 | 25 | #include <qofono-qt5/qofonomodem.h> | 26 | #include <qofono-qt5/qofonomodem.h> |
569 | @@ -52,7 +53,7 @@ | |||
570 | 52 | if (str == "roaming") | 53 | if (str == "roaming") |
571 | 53 | return Modem::ModemStatus::roaming; | 54 | return Modem::ModemStatus::roaming; |
572 | 54 | 55 | ||
574 | 55 | qWarning() << __PRETTY_FUNCTION__ << ": Unknown status" << str; | 56 | qWarning() << ": Unknown status" << str; |
575 | 56 | return Modem::ModemStatus::unknown; | 57 | return Modem::ModemStatus::unknown; |
576 | 57 | } | 58 | } |
577 | 58 | 59 | ||
578 | @@ -73,7 +74,7 @@ | |||
579 | 73 | if (str == "lte") | 74 | if (str == "lte") |
580 | 74 | return Modem::Bearer::lte; | 75 | return Modem::Bearer::lte; |
581 | 75 | 76 | ||
583 | 76 | qWarning() << __PRETTY_FUNCTION__ << ": Unknown techonology" << str; | 77 | qWarning() << "Unknown technology" << str; |
584 | 77 | return Modem::Bearer::notAvailable; | 78 | return Modem::Bearer::notAvailable; |
585 | 78 | } | 79 | } |
586 | 79 | } | 80 | } |
587 | @@ -160,6 +161,8 @@ | |||
588 | 160 | 161 | ||
589 | 161 | if (p.isReadyToUnlock() && m_shouldTriggerUnlock) | 162 | if (p.isReadyToUnlock() && m_shouldTriggerUnlock) |
590 | 162 | { | 163 | { |
591 | 164 | |||
592 | 165 | qDebug() << "SIM ready to unlock:" << p.simIdentifier(); | ||
593 | 163 | m_shouldTriggerUnlock = false; | 166 | m_shouldTriggerUnlock = false; |
594 | 164 | Q_EMIT p.readyToUnlock(p.name()); | 167 | Q_EMIT p.readyToUnlock(p.name()); |
595 | 165 | } | 168 | } |
596 | @@ -760,6 +763,7 @@ | |||
597 | 760 | void | 763 | void |
598 | 761 | Modem::notifyWhenReadyToUnlock() | 764 | Modem::notifyWhenReadyToUnlock() |
599 | 762 | { | 765 | { |
600 | 766 | qDebug() << "Notify when ready to unlock" << simIdentifier(); | ||
601 | 763 | d->m_shouldTriggerUnlock = true; | 767 | d->m_shouldTriggerUnlock = true; |
602 | 764 | } | 768 | } |
603 | 765 | 769 | ||
604 | 766 | 770 | ||
605 | === modified file 'src/indicator/root-state.cpp' | |||
606 | --- src/indicator/root-state.cpp 2015-08-14 16:11:08 +0000 | |||
607 | +++ src/indicator/root-state.cpp 2016-05-26 16:58:27 +0000 | |||
608 | @@ -288,7 +288,7 @@ | |||
609 | 288 | try { | 288 | try { |
610 | 289 | state["icon"] = createIcon(m_networkingIcons.first().toStdString()); | 289 | state["icon"] = createIcon(m_networkingIcons.first().toStdString()); |
611 | 290 | } catch (exception &e) { | 290 | } catch (exception &e) { |
613 | 291 | qWarning() << __PRETTY_FUNCTION__ << e.what(); | 291 | qWarning() << e.what(); |
614 | 292 | } | 292 | } |
615 | 293 | 293 | ||
616 | 294 | for (const auto& icon: m_networkingIcons) | 294 | for (const auto& icon: m_networkingIcons) |
617 | 295 | 295 | ||
618 | === modified file 'src/indicator/vpn-status-notifier.cpp' | |||
619 | --- src/indicator/vpn-status-notifier.cpp 2015-12-17 10:41:14 +0000 | |||
620 | +++ src/indicator/vpn-status-notifier.cpp 2016-05-26 16:58:27 +0000 | |||
621 | @@ -64,7 +64,7 @@ | |||
622 | 64 | QString id = activeVpnConnection->activeConnection().id(); | 64 | QString id = activeVpnConnection->activeConnection().id(); |
623 | 65 | QString message = REASON_MAP.value(reason, FAILED_MESSAGE).arg(id); | 65 | QString message = REASON_MAP.value(reason, FAILED_MESSAGE).arg(id); |
624 | 66 | 66 | ||
626 | 67 | qDebug() << __PRETTY_FUNCTION__ << "VPN Connection Failed" << message; | 67 | qDebug() << "VPN Connection Failed" << message; |
627 | 68 | m_notificationManager->notify(_("VPN Connection Failed"), message, "network-vpn", {}, {}, 5)->show(); | 68 | m_notificationManager->notify(_("VPN Connection Failed"), message, "network-vpn", {}, {}, 5)->show(); |
628 | 69 | } | 69 | } |
629 | 70 | } | 70 | } |
630 | 71 | 71 | ||
631 | === modified file 'src/menumodel-cpp/action-group-merger.cpp' | |||
632 | --- src/menumodel-cpp/action-group-merger.cpp 2015-10-06 10:14:57 +0000 | |||
633 | +++ src/menumodel-cpp/action-group-merger.cpp 2016-05-26 16:58:27 +0000 | |||
634 | @@ -30,7 +30,7 @@ | |||
635 | 30 | // then they will override each other in GActionGroup so let's catch that | 30 | // then they will override each other in GActionGroup so let's catch that |
636 | 31 | // early on. | 31 | // early on. |
637 | 32 | if (name_iter->second != action) { | 32 | if (name_iter->second != action) { |
639 | 33 | qWarning() << __PRETTY_FUNCTION__ << ": Conflicting action names. \"" << action->name() << "\""; | 33 | qWarning() << "Conflicting action names. \"" << action->name() << "\""; |
640 | 34 | /// @todo thow something. | 34 | /// @todo thow something. |
641 | 35 | return; | 35 | return; |
642 | 36 | } | 36 | } |
643 | @@ -73,7 +73,7 @@ | |||
644 | 73 | auto iter = m_groups.find(group); | 73 | auto iter = m_groups.find(group); |
645 | 74 | if (iter != m_groups.end()) { | 74 | if (iter != m_groups.end()) { |
646 | 75 | /// @todo throw something. | 75 | /// @todo throw something. |
648 | 76 | std::cerr << __PRETTY_FUNCTION__ << ": Trying to add action group which was already added before." << std::endl; | 76 | qWarning() << "Trying to add action group which was already added before."; |
649 | 77 | return; | 77 | return; |
650 | 78 | } | 78 | } |
651 | 79 | 79 | ||
652 | @@ -91,7 +91,7 @@ | |||
653 | 91 | auto iter = m_groups.find(group); | 91 | auto iter = m_groups.find(group); |
654 | 92 | if (iter == m_groups.end()) { | 92 | if (iter == m_groups.end()) { |
655 | 93 | /// @todo throw something. | 93 | /// @todo throw something. |
657 | 94 | std::cerr << __PRETTY_FUNCTION__ << ": Trying to remove action group which was not added before." << std::endl; | 94 | qWarning() << "Trying to remove action group which was not added before."; |
658 | 95 | return; | 95 | return; |
659 | 96 | } | 96 | } |
660 | 97 | auto connections = m_groups[group]; | 97 | auto connections = m_groups[group]; |
661 | 98 | 98 | ||
662 | === modified file 'src/menumodel-cpp/menu-item.cpp' | |||
663 | --- src/menumodel-cpp/menu-item.cpp 2015-10-06 10:14:57 +0000 | |||
664 | +++ src/menumodel-cpp/menu-item.cpp 2016-05-26 16:58:27 +0000 | |||
665 | @@ -83,7 +83,7 @@ | |||
666 | 83 | auto gicon = shared_ptr<GIcon>(g_icon_new_for_string(m_icon.toUtf8().constData(), &error), GObjectDeleter()); | 83 | auto gicon = shared_ptr<GIcon>(g_icon_new_for_string(m_icon.toUtf8().constData(), &error), GObjectDeleter()); |
667 | 84 | if (error) | 84 | if (error) |
668 | 85 | { | 85 | { |
670 | 86 | qWarning() << __PRETTY_FUNCTION__ << error->message; | 86 | qWarning() << error->message; |
671 | 87 | g_error_free(error); | 87 | g_error_free(error); |
672 | 88 | return; | 88 | return; |
673 | 89 | } | 89 | } |
674 | 90 | 90 | ||
675 | === modified file 'src/notify-cpp/notification.cpp' | |||
676 | --- src/notify-cpp/notification.cpp 2015-12-11 14:58:11 +0000 | |||
677 | +++ src/notify-cpp/notification.cpp 2016-05-26 16:58:27 +0000 | |||
678 | @@ -95,12 +95,12 @@ | |||
679 | 95 | { | 95 | { |
680 | 96 | if (d->m_id > 0 && d->m_open && d->m_expireTimeout <= 0) | 96 | if (d->m_id > 0 && d->m_open && d->m_expireTimeout <= 0) |
681 | 97 | { | 97 | { |
683 | 98 | qDebug() << __PRETTY_FUNCTION__ << "Closing notification:" << d->m_id; | 98 | qDebug() << "Closing notification:" << d->m_id; |
684 | 99 | auto reply = d->m_notificationsInterface->CloseNotification(d->m_id); | 99 | auto reply = d->m_notificationsInterface->CloseNotification(d->m_id); |
685 | 100 | reply.waitForFinished(); | 100 | reply.waitForFinished(); |
686 | 101 | if (reply.isError()) | 101 | if (reply.isError()) |
687 | 102 | { | 102 | { |
689 | 103 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 103 | qCritical() << reply.error().message(); |
690 | 104 | } | 104 | } |
691 | 105 | } | 105 | } |
692 | 106 | } | 106 | } |
693 | @@ -221,7 +221,7 @@ | |||
694 | 221 | reply.waitForFinished(); | 221 | reply.waitForFinished(); |
695 | 222 | if (reply.isError()) | 222 | if (reply.isError()) |
696 | 223 | { | 223 | { |
698 | 224 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 224 | qCritical() << reply.error().message(); |
699 | 225 | } | 225 | } |
700 | 226 | else | 226 | else |
701 | 227 | { | 227 | { |
702 | @@ -241,7 +241,7 @@ | |||
703 | 241 | reply.waitForFinished(); | 241 | reply.waitForFinished(); |
704 | 242 | if (reply.isError()) | 242 | if (reply.isError()) |
705 | 243 | { | 243 | { |
707 | 244 | qCritical() << __PRETTY_FUNCTION__ << reply.error().message(); | 244 | qCritical() << reply.error().message(); |
708 | 245 | } | 245 | } |
709 | 246 | else | 246 | else |
710 | 247 | { | 247 | { |
711 | 248 | 248 | ||
712 | === modified file 'src/qpowerd/qpowerd.cpp' | |||
713 | --- src/qpowerd/qpowerd.cpp 2015-07-28 08:26:51 +0000 | |||
714 | +++ src/qpowerd/qpowerd.cpp 2016-05-26 16:58:27 +0000 | |||
715 | @@ -68,7 +68,7 @@ | |||
716 | 68 | reply.waitForFinished(); | 68 | reply.waitForFinished(); |
717 | 69 | if (reply.isError()) | 69 | if (reply.isError()) |
718 | 70 | { | 70 | { |
720 | 71 | qWarning() << __PRETTY_FUNCTION__ << reply.error().message(); | 71 | qWarning() << reply.error().message(); |
721 | 72 | } | 72 | } |
722 | 73 | else | 73 | else |
723 | 74 | { | 74 | { |
724 | 75 | 75 | ||
725 | === modified file 'src/util/CMakeLists.txt' | |||
726 | --- src/util/CMakeLists.txt 2016-02-15 09:31:38 +0000 | |||
727 | +++ src/util/CMakeLists.txt 2016-05-26 16:58:27 +0000 | |||
728 | @@ -2,6 +2,7 @@ | |||
729 | 2 | 2 | ||
730 | 3 | set(UTIL_SOURCES | 3 | set(UTIL_SOURCES |
731 | 4 | dbus-utils.cpp | 4 | dbus-utils.cpp |
732 | 5 | logging.cpp | ||
733 | 5 | unix-signal-handler.cpp | 6 | unix-signal-handler.cpp |
734 | 6 | ) | 7 | ) |
735 | 7 | 8 | ||
736 | 8 | 9 | ||
737 | === added file 'src/util/logging.cpp' | |||
738 | --- src/util/logging.cpp 1970-01-01 00:00:00 +0000 | |||
739 | +++ src/util/logging.cpp 2016-05-26 16:58:27 +0000 | |||
740 | @@ -0,0 +1,59 @@ | |||
741 | 1 | /* | ||
742 | 2 | * Copyright (C) 2016 Canonical, Ltd. | ||
743 | 3 | * | ||
744 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
745 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
746 | 6 | * by the Free Software Foundation. | ||
747 | 7 | * | ||
748 | 8 | * This program is distributed in the hope that it will be useful, but | ||
749 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
750 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
751 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
752 | 12 | * | ||
753 | 13 | * You should have received a copy of the GNU General Public License along | ||
754 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
755 | 15 | * | ||
756 | 16 | * Author: Pete Woods <pete.woods@canonical.com> | ||
757 | 17 | */ | ||
758 | 18 | |||
759 | 19 | #include <logging.h> | ||
760 | 20 | |||
761 | 21 | namespace util | ||
762 | 22 | { | ||
763 | 23 | void | ||
764 | 24 | loggingFunction (QtMsgType type, const QMessageLogContext &context, | ||
765 | 25 | const QString &msg) | ||
766 | 26 | { | ||
767 | 27 | QByteArray localMsg = msg.toLocal8Bit (); | ||
768 | 28 | switch (type) | ||
769 | 29 | { | ||
770 | 30 | case QtMsgType::QtDebugMsg: | ||
771 | 31 | fprintf (stderr, "Debug: %s (%s:%u, %s)\n", | ||
772 | 32 | localMsg.constData (), context.file, context.line, | ||
773 | 33 | context.function); | ||
774 | 34 | break; | ||
775 | 35 | #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) | ||
776 | 36 | case QtMsgType::QtInfoMsg: | ||
777 | 37 | fprintf (stderr, "Info: %s (%s:%u, %s)\n", | ||
778 | 38 | localMsg.constData (), context.file, context.line, | ||
779 | 39 | context.function); | ||
780 | 40 | break; | ||
781 | 41 | #endif | ||
782 | 42 | case QtMsgType::QtWarningMsg: | ||
783 | 43 | fprintf (stderr, "Warning: %s (%s:%u, %s)\n", | ||
784 | 44 | localMsg.constData (), context.file, context.line, | ||
785 | 45 | context.function); | ||
786 | 46 | break; | ||
787 | 47 | case QtMsgType::QtCriticalMsg: | ||
788 | 48 | fprintf (stderr, "Critical: %s (%s:%u, %s)\n", | ||
789 | 49 | localMsg.constData (), context.file, context.line, | ||
790 | 50 | context.function); | ||
791 | 51 | break; | ||
792 | 52 | case QtMsgType::QtFatalMsg: | ||
793 | 53 | fprintf (stderr, "Fatal: %s (%s:%u, %s)\n", | ||
794 | 54 | localMsg.constData (), context.file, context.line, | ||
795 | 55 | context.function); | ||
796 | 56 | abort (); | ||
797 | 57 | } | ||
798 | 58 | } | ||
799 | 59 | } | ||
800 | 0 | 60 | ||
801 | === added file 'src/util/logging.h' | |||
802 | --- src/util/logging.h 1970-01-01 00:00:00 +0000 | |||
803 | +++ src/util/logging.h 2016-05-26 16:58:27 +0000 | |||
804 | @@ -0,0 +1,29 @@ | |||
805 | 1 | /* | ||
806 | 2 | * Copyright (C) 2016 Canonical, Ltd. | ||
807 | 3 | * | ||
808 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
809 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
810 | 6 | * by the Free Software Foundation. | ||
811 | 7 | * | ||
812 | 8 | * This program is distributed in the hope that it will be useful, but | ||
813 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
814 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
815 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
816 | 12 | * | ||
817 | 13 | * You should have received a copy of the GNU General Public License along | ||
818 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
819 | 15 | * | ||
820 | 16 | * Author: Pete Woods <pete.woods@canonical.com> | ||
821 | 17 | */ | ||
822 | 18 | |||
823 | 19 | #pragma once | ||
824 | 20 | |||
825 | 21 | #include <QMessageLogContext> | ||
826 | 22 | #include <QString> | ||
827 | 23 | |||
828 | 24 | namespace util | ||
829 | 25 | { | ||
830 | 26 | void | ||
831 | 27 | loggingFunction (QtMsgType type, const QMessageLogContext &context, | ||
832 | 28 | const QString &msg); | ||
833 | 29 | } | ||
834 | 0 | 30 | ||
835 | === modified file 'tests/unit/secret-agent/secret-agent-main.cpp' | |||
836 | --- tests/unit/secret-agent/secret-agent-main.cpp 2016-02-15 09:31:38 +0000 | |||
837 | +++ tests/unit/secret-agent/secret-agent-main.cpp 2016-05-26 16:58:27 +0000 | |||
838 | @@ -32,6 +32,34 @@ | |||
839 | 32 | 32 | ||
840 | 33 | using namespace std; | 33 | using namespace std; |
841 | 34 | 34 | ||
842 | 35 | class DummyCredentialStore : public agent::CredentialStore | ||
843 | 36 | { | ||
844 | 37 | public: | ||
845 | 38 | DummyCredentialStore() { | ||
846 | 39 | } | ||
847 | 40 | |||
848 | 41 | ~DummyCredentialStore() { | ||
849 | 42 | } | ||
850 | 43 | |||
851 | 44 | void | ||
852 | 45 | save (const QString&, const QString&, const QString&, const QString&, | ||
853 | 46 | const QString&) | ||
854 | 47 | { | ||
855 | 48 | } | ||
856 | 49 | |||
857 | 50 | QMap<QString, QString> | ||
858 | 51 | get (const QString&, const QString&) | ||
859 | 52 | { | ||
860 | 53 | return QMap<QString, QString> (); | ||
861 | 54 | } | ||
862 | 55 | |||
863 | 56 | void | ||
864 | 57 | clear (const QString&) | ||
865 | 58 | { | ||
866 | 59 | } | ||
867 | 60 | |||
868 | 61 | }; | ||
869 | 62 | |||
870 | 35 | int main(int argc, char *argv[]) { | 63 | int main(int argc, char *argv[]) { |
871 | 36 | QCoreApplication application(argc, argv); | 64 | QCoreApplication application(argc, argv); |
872 | 37 | DBusTypes::registerMetaTypes(); | 65 | DBusTypes::registerMetaTypes(); |
873 | @@ -49,7 +77,7 @@ | |||
874 | 49 | 77 | ||
875 | 50 | auto secretAgent = make_unique<agent::SecretAgent>( | 78 | auto secretAgent = make_unique<agent::SecretAgent>( |
876 | 51 | make_shared<notify::NotificationManager>(GETTEXT_PACKAGE), | 79 | make_shared<notify::NotificationManager>(GETTEXT_PACKAGE), |
878 | 52 | make_shared<agent::KeyringCredentialStore>(), | 80 | make_shared<DummyCredentialStore>(), |
879 | 53 | QDBusConnection::systemBus(), QDBusConnection::sessionBus()); | 81 | QDBusConnection::systemBus(), QDBusConnection::sessionBus()); |
880 | 54 | 82 | ||
881 | 55 | if (argc == 2 && QString("--print-address") == argv[1]) { | 83 | if (argc == 2 && QString("--print-address") == argv[1]) { |
882 | 56 | 84 | ||
883 | === modified file 'tests/unit/secret-agent/test-secret-agent.cpp' | |||
884 | --- tests/unit/secret-agent/test-secret-agent.cpp 2016-02-15 09:31:38 +0000 | |||
885 | +++ tests/unit/secret-agent/test-secret-agent.cpp 2016-05-26 16:58:27 +0000 | |||
886 | @@ -261,9 +261,9 @@ | |||
887 | 261 | reply.waitForFinished(); | 261 | reply.waitForFinished(); |
888 | 262 | 262 | ||
889 | 263 | ASSERT_TRUE(reply.isError()); | 263 | ASSERT_TRUE(reply.isError()); |
893 | 264 | EXPECT_EQ(QDBusError::InternalError, reply.error().type()); | 264 | EXPECT_EQ("org.freedesktop.NetworkManager.SecretAgent.NoSecrets", reply.error().name().toStdString()); |
894 | 265 | EXPECT_EQ("No password found for this connection.", | 265 | EXPECT_EQ("No secrets found for this connection.", |
895 | 266 | reply.error().message()); | 266 | reply.error().message().toStdString()); |
896 | 267 | } | 267 | } |
897 | 268 | 268 | ||
898 | 269 | /* Tests that if we request secrets and then cancel the request | 269 | /* Tests that if we request secrets and then cancel the request |
899 | 270 | 270 | ||
900 | === modified file 'tests/utils/CMakeLists.txt' | |||
901 | --- tests/utils/CMakeLists.txt 2014-08-05 21:16:22 +0000 | |||
902 | +++ tests/utils/CMakeLists.txt 2016-05-26 16:58:27 +0000 | |||
903 | @@ -8,7 +8,8 @@ | |||
904 | 8 | action-utils.cpp | 8 | action-utils.cpp |
905 | 9 | ) | 9 | ) |
906 | 10 | 10 | ||
908 | 11 | qt5_use_modules( | 11 | target_link_libraries( |
909 | 12 | test-utils | 12 | test-utils |
911 | 13 | Core | 13 | Qt5::Core |
912 | 14 | util | ||
913 | 14 | ) | 15 | ) |
914 | 15 | 16 | ||
915 | === modified file 'tests/utils/main.cpp' | |||
916 | --- tests/utils/main.cpp 2016-03-04 11:11:56 +0000 | |||
917 | +++ tests/utils/main.cpp 2016-05-26 16:58:27 +0000 | |||
918 | @@ -25,6 +25,8 @@ | |||
919 | 25 | 25 | ||
920 | 26 | #include <libqtdbusmock/DBusMock.h> | 26 | #include <libqtdbusmock/DBusMock.h> |
921 | 27 | 27 | ||
922 | 28 | #include <util/logging.h> | ||
923 | 29 | |||
924 | 28 | using namespace QtDBusMock; | 30 | using namespace QtDBusMock; |
925 | 29 | 31 | ||
926 | 30 | class Runner: public QObject | 32 | class Runner: public QObject |
927 | @@ -39,6 +41,8 @@ | |||
928 | 39 | 41 | ||
929 | 40 | int main(int argc, char **argv) | 42 | int main(int argc, char **argv) |
930 | 41 | { | 43 | { |
931 | 44 | qInstallMessageHandler(util::loggingFunction); | ||
932 | 45 | |||
933 | 42 | qputenv("LANG", "C.UTF-8"); | 46 | qputenv("LANG", "C.UTF-8"); |
934 | 43 | unsetenv("LC_ALL"); | 47 | unsetenv("LC_ALL"); |
935 | 44 | unsetenv("GDM_LANG"); | 48 | unsetenv("GDM_LANG"); |
LGTM.