Merge lp:~ken-vandine/libqofono/0.90 into lp:~phablet-team/libqofono/ubuntu
- 0.90
- Merge into ubuntu
Proposed by
Ken VanDine
Status: | Merged |
---|---|
Approved by: | Jonas G. Drange |
Approved revision: | 216 |
Merged at revision: | 215 |
Proposed branch: | lp:~ken-vandine/libqofono/0.90 |
Merge into: | lp:~phablet-team/libqofono/ubuntu |
Diff against target: |
1866 lines (+948/-124) 28 files modified
debian/changelog (+6/-0) debian/patches/connman-resetcontexts.patch (+12/-12) debian/patches/context-preferred.patch (+12/-12) debian/patches/mtk_settings_binding.patch (+28/-28) plugin/plugin.pro (+4/-2) plugin/qofonodeclarativeplugin.cpp (+3/-1) plugin/qofonosimlistmodel.cpp (+281/-0) plugin/qofonosimlistmodel.h (+91/-0) rpm/libqofono-qt5.spec (+2/-2) src/qofonoconnectioncontext.cpp (+17/-19) src/qofonomanager.cpp (+35/-6) src/qofonomanager.h (+3/-1) src/qofonomessagemanager.cpp (+1/-1) src/qofonomodem.cpp (+54/-3) src/qofonomodem.h (+8/-1) src/qofonomodeminterface.cpp (+30/-4) src/qofonomodeminterface.h (+7/-2) src/qofononetworkregistration.cpp (+1/-1) src/qofonoobject.cpp (+40/-15) src/qofonoobject.h (+10/-0) src/qofonosimmanager.cpp (+8/-0) src/qofonosimmanager.h (+12/-1) src/qofonosimwatcher.cpp (+200/-0) src/qofonosimwatcher.h (+49/-0) src/qofonoutils_p.h (+13/-1) src/qofonovoicecallmanager.cpp (+18/-7) src/src.pro (+2/-4) src/version.pri (+1/-1) |
To merge this branch: | bzr merge lp:~ken-vandine/libqofono/0.90 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jonas G. Drange (community) | Approve | ||
Review via email: mp+289965@code.launchpad.net |
Commit message
New upstream release 0.90
Description of the change
New upstream release 0.90
To post a comment you must log in.
lp:~ken-vandine/libqofono/0.90
updated
- 216. By Ken VanDine
-
refreshed patches
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2016-01-27 14:19:53 +0000 |
3 | +++ debian/changelog 2016-03-23 19:33:02 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | +libqofono (0.90-0ubuntu1) UNRELEASED; urgency=medium |
6 | + |
7 | + * New upstream release |
8 | + |
9 | + -- Ken VanDine <ken.vandine@canonical.com> Wed, 23 Mar 2016 15:13:06 -0400 |
10 | + |
11 | libqofono (0.82+16.04.20160127-0ubuntu1) xenial; urgency=medium |
12 | |
13 | * Make ofono dependency optional (LP: #1521142) |
14 | |
15 | === modified file 'debian/patches/connman-resetcontexts.patch' |
16 | --- debian/patches/connman-resetcontexts.patch 2015-09-11 12:09:56 +0000 |
17 | +++ debian/patches/connman-resetcontexts.patch 2016-03-23 19:33:02 +0000 |
18 | @@ -1,7 +1,7 @@ |
19 | -Index: libqofono-0.79/src/dbus/ofono_connection_manager.xml |
20 | +Index: libqofono-ubuntu/src/dbus/ofono_connection_manager.xml |
21 | =================================================================== |
22 | ---- libqofono-0.79.orig/src/dbus/ofono_connection_manager.xml |
23 | -+++ libqofono-0.79/src/dbus/ofono_connection_manager.xml |
24 | +--- libqofono-ubuntu.orig/src/dbus/ofono_connection_manager.xml |
25 | ++++ libqofono-ubuntu/src/dbus/ofono_connection_manager.xml |
26 | @@ -18,6 +18,7 @@ |
27 | <arg type="o" direction="in"/> |
28 | </method> |
29 | @@ -10,10 +10,10 @@ |
30 | <method name="GetContexts"> |
31 | <arg type="a(oa{sv})" direction="out"/> |
32 | <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ObjectPathPropertiesList"/> |
33 | -Index: libqofono-0.79/src/qofonoconnectionmanager.cpp |
34 | +Index: libqofono-ubuntu/src/qofonoconnectionmanager.cpp |
35 | =================================================================== |
36 | ---- libqofono-0.79.orig/src/qofonoconnectionmanager.cpp |
37 | -+++ libqofono-0.79/src/qofonoconnectionmanager.cpp |
38 | +--- libqofono-ubuntu.orig/src/qofonoconnectionmanager.cpp |
39 | ++++ libqofono-ubuntu/src/qofonoconnectionmanager.cpp |
40 | @@ -143,6 +143,21 @@ void QOfonoConnectionManager::removeCont |
41 | } |
42 | } |
43 | @@ -36,10 +36,10 @@ |
44 | bool QOfonoConnectionManager::attached() const |
45 | { |
46 | return getBool("Attached"); |
47 | -Index: libqofono-0.79/src/qofonoconnectionmanager.h |
48 | +Index: libqofono-ubuntu/src/qofonoconnectionmanager.h |
49 | =================================================================== |
50 | ---- libqofono-0.79.orig/src/qofonoconnectionmanager.h |
51 | -+++ libqofono-0.79/src/qofonoconnectionmanager.h |
52 | +--- libqofono-ubuntu.orig/src/qofonoconnectionmanager.h |
53 | ++++ libqofono-ubuntu/src/qofonoconnectionmanager.h |
54 | @@ -79,6 +79,7 @@ public slots: |
55 | void deactivateAll(); |
56 | void addContext(const QString &type); |
57 | @@ -48,10 +48,10 @@ |
58 | |
59 | private slots: |
60 | void onAddContextFinished(QDBusPendingCallWatcher *watch); |
61 | -Index: libqofono-0.79/test/auto/tests/tst_qofonoconnman.cpp |
62 | +Index: libqofono-ubuntu/test/auto/tests/tst_qofonoconnman.cpp |
63 | =================================================================== |
64 | ---- libqofono-0.79.orig/test/auto/tests/tst_qofonoconnman.cpp |
65 | -+++ libqofono-0.79/test/auto/tests/tst_qofonoconnman.cpp |
66 | +--- libqofono-ubuntu.orig/test/auto/tests/tst_qofonoconnman.cpp |
67 | ++++ libqofono-ubuntu/test/auto/tests/tst_qofonoconnman.cpp |
68 | @@ -107,8 +107,45 @@ private slots: |
69 | QCOMPARE(rem.count(), 0); |
70 | } |
71 | |
72 | === modified file 'debian/patches/context-preferred.patch' |
73 | --- debian/patches/context-preferred.patch 2015-09-11 12:09:56 +0000 |
74 | +++ debian/patches/context-preferred.patch 2016-03-23 19:33:02 +0000 |
75 | @@ -1,8 +1,8 @@ |
76 | -Index: libqofono-0.79/src/qofonoconnectioncontext.cpp |
77 | +Index: libqofono-ubuntu/src/qofonoconnectioncontext.cpp |
78 | =================================================================== |
79 | ---- libqofono-0.79.orig/src/qofonoconnectioncontext.cpp |
80 | -+++ libqofono-0.79/src/qofonoconnectioncontext.cpp |
81 | -@@ -118,6 +118,8 @@ void QOfonoConnectionContext::propertyCh |
82 | +--- libqofono-ubuntu.orig/src/qofonoconnectioncontext.cpp |
83 | ++++ libqofono-ubuntu/src/qofonoconnectioncontext.cpp |
84 | +@@ -117,6 +117,8 @@ void QOfonoConnectionContext::propertyCh |
85 | SUPER::propertyChanged(property, value); |
86 | if (property == QLatin1String("Active")) { |
87 | Q_EMIT activeChanged(value.value<bool>()); |
88 | @@ -11,7 +11,7 @@ |
89 | } else if (property == QLatin1String("Name")) { |
90 | Q_EMIT nameChanged(value.value<QString>()); |
91 | } else if (property == QLatin1String("AccessPointName")) { |
92 | -@@ -148,6 +150,11 @@ bool QOfonoConnectionContext::active() c |
93 | +@@ -147,6 +149,11 @@ bool QOfonoConnectionContext::active() c |
94 | return getBool("Active"); |
95 | } |
96 | |
97 | @@ -23,7 +23,7 @@ |
98 | QString QOfonoConnectionContext::accessPointName() const |
99 | { |
100 | return getString("AccessPointName"); |
101 | -@@ -212,6 +219,11 @@ void QOfonoConnectionContext::setActive( |
102 | +@@ -211,6 +218,11 @@ void QOfonoConnectionContext::setActive( |
103 | setProperty("Active", value); |
104 | } |
105 | |
106 | @@ -35,10 +35,10 @@ |
107 | void QOfonoConnectionContext::setAccessPointName(const QString &value) |
108 | { |
109 | setProperty("AccessPointName", value); |
110 | -Index: libqofono-0.79/src/qofonoconnectioncontext.h |
111 | +Index: libqofono-ubuntu/src/qofonoconnectioncontext.h |
112 | =================================================================== |
113 | ---- libqofono-0.79.orig/src/qofonoconnectioncontext.h |
114 | -+++ libqofono-0.79/src/qofonoconnectioncontext.h |
115 | +--- libqofono-ubuntu.orig/src/qofonoconnectioncontext.h |
116 | ++++ libqofono-ubuntu/src/qofonoconnectioncontext.h |
117 | @@ -28,6 +28,7 @@ class QOFONOSHARED_EXPORT QOfonoConnecti |
118 | { |
119 | Q_OBJECT |
120 | @@ -65,10 +65,10 @@ |
121 | void provisioningChanged(bool provisioning); |
122 | void accessPointNameChanged(const QString &apn); |
123 | void nameChanged(const QString &name); |
124 | -Index: libqofono-0.79/test/auto/tests/tst_qofonoconnmancontext.cpp |
125 | +Index: libqofono-ubuntu/test/auto/tests/tst_qofonoconnmancontext.cpp |
126 | =================================================================== |
127 | ---- libqofono-0.79.orig/test/auto/tests/tst_qofonoconnmancontext.cpp |
128 | -+++ libqofono-0.79/test/auto/tests/tst_qofonoconnmancontext.cpp |
129 | +--- libqofono-ubuntu.orig/test/auto/tests/tst_qofonoconnmancontext.cpp |
130 | ++++ libqofono-ubuntu/test/auto/tests/tst_qofonoconnmancontext.cpp |
131 | @@ -61,6 +61,7 @@ private slots: |
132 | QTRY_COMPARE(context->isValid(), true); |
133 | |
134 | |
135 | === modified file 'debian/patches/mtk_settings_binding.patch' |
136 | --- debian/patches/mtk_settings_binding.patch 2015-09-11 12:09:56 +0000 |
137 | +++ debian/patches/mtk_settings_binding.patch 2016-03-23 19:33:02 +0000 |
138 | @@ -5,10 +5,10 @@ |
139 | add mtk (mediatek) settings binding which allows consumer |
140 | to set which modem to allow 3G communication |
141 | |
142 | -Index: libqofono-0.79/plugin/qofonodeclarativeplugin.cpp |
143 | +Index: libqofono-ubuntu/plugin/qofonodeclarativeplugin.cpp |
144 | =================================================================== |
145 | ---- libqofono-0.79.orig/plugin/qofonodeclarativeplugin.cpp |
146 | -+++ libqofono-0.79/plugin/qofonodeclarativeplugin.cpp |
147 | +--- libqofono-ubuntu.orig/plugin/qofonodeclarativeplugin.cpp |
148 | ++++ libqofono-ubuntu/plugin/qofonodeclarativeplugin.cpp |
149 | @@ -34,6 +34,7 @@ |
150 | #include "qofonomessage.h" |
151 | #include "qofonomessagemanager.h" |
152 | @@ -17,7 +17,7 @@ |
153 | |
154 | #include "qofonosimmanager.h" |
155 | |
156 | -@@ -86,6 +87,7 @@ void QOfonoDeclarativePlugin::registerTy |
157 | +@@ -87,6 +88,7 @@ void QOfonoDeclarativePlugin::registerTy |
158 | qmlRegisterType<QOfonoMessage>(uri,major,minor,"OfonoMessage"); |
159 | qmlRegisterType<QOfonoMessageManager>(uri,major,minor,"OfonoMessageManager"); |
160 | qmlRegisterType<QOfonoMessageWaiting>(uri,major,minor,"OfonoMessageWaiting"); |
161 | @@ -25,10 +25,10 @@ |
162 | |
163 | qmlRegisterType<QOfonoSimManager>(uri,major,minor,"OfonoSimManager"); |
164 | |
165 | -Index: libqofono-0.79/src/dbus/ofono_mtk_settings.xml |
166 | +Index: libqofono-ubuntu/src/dbus/ofono_mtk_settings.xml |
167 | =================================================================== |
168 | --- /dev/null |
169 | -+++ libqofono-0.79/src/dbus/ofono_mtk_settings.xml |
170 | ++++ libqofono-ubuntu/src/dbus/ofono_mtk_settings.xml |
171 | @@ -0,0 +1,18 @@ |
172 | +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" |
173 | +"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
174 | @@ -48,10 +48,10 @@ |
175 | + </signal> |
176 | +</interface> |
177 | +</node> |
178 | -Index: libqofono-0.79/src/dbus/ofonomtksettings.cpp |
179 | +Index: libqofono-ubuntu/src/dbus/ofonomtksettings.cpp |
180 | =================================================================== |
181 | --- /dev/null |
182 | -+++ libqofono-0.79/src/dbus/ofonomtksettings.cpp |
183 | ++++ libqofono-ubuntu/src/dbus/ofonomtksettings.cpp |
184 | @@ -0,0 +1,26 @@ |
185 | +/* |
186 | + * This file was generated by qdbusxml2cpp version 0.8 |
187 | @@ -79,10 +79,10 @@ |
188 | +{ |
189 | +} |
190 | + |
191 | -Index: libqofono-0.79/src/dbus/ofonomtksettings.h |
192 | +Index: libqofono-ubuntu/src/dbus/ofonomtksettings.h |
193 | =================================================================== |
194 | --- /dev/null |
195 | -+++ libqofono-0.79/src/dbus/ofonomtksettings.h |
196 | ++++ libqofono-ubuntu/src/dbus/ofonomtksettings.h |
197 | @@ -0,0 +1,56 @@ |
198 | +/* |
199 | + * This file was generated by qdbusxml2cpp version 0.8 |
200 | @@ -140,10 +140,10 @@ |
201 | +}; |
202 | + |
203 | +#endif |
204 | -Index: libqofono-0.79/src/qofonomtksettings.cpp |
205 | +Index: libqofono-ubuntu/src/qofonomtksettings.cpp |
206 | =================================================================== |
207 | --- /dev/null |
208 | -+++ libqofono-0.79/src/qofonomtksettings.cpp |
209 | ++++ libqofono-ubuntu/src/qofonomtksettings.cpp |
210 | @@ -0,0 +1,121 @@ |
211 | +/**************************************************************************** |
212 | +** |
213 | @@ -266,10 +266,10 @@ |
214 | +{ |
215 | + return d_ptr->mtkSettings->isValid(); |
216 | +} |
217 | -Index: libqofono-0.79/src/qofonomtksettings.h |
218 | +Index: libqofono-ubuntu/src/qofonomtksettings.h |
219 | =================================================================== |
220 | --- /dev/null |
221 | -+++ libqofono-0.79/src/qofonomtksettings.h |
222 | ++++ libqofono-ubuntu/src/qofonomtksettings.h |
223 | @@ -0,0 +1,61 @@ |
224 | +/**************************************************************************** |
225 | +** |
226 | @@ -332,10 +332,10 @@ |
227 | +}; |
228 | + |
229 | +#endif // QOFONOMtkSettings_H |
230 | -Index: libqofono-0.79/src/src.pro |
231 | +Index: libqofono-ubuntu/src/src.pro |
232 | =================================================================== |
233 | ---- libqofono-0.79.orig/src/src.pro |
234 | -+++ libqofono-0.79/src/src.pro |
235 | +--- libqofono-ubuntu.orig/src/src.pro |
236 | ++++ libqofono-ubuntu/src/src.pro |
237 | @@ -48,6 +48,7 @@ XML_FILES += \ |
238 | dbus/ofono_message_manager.xml \ |
239 | dbus/ofono_messagewaiting.xml \ |
240 | @@ -344,22 +344,22 @@ |
241 | dbus/ofono_network_operator.xml \ |
242 | dbus/ofono_network_registration.xml \ |
243 | dbus/ofono_phonebook.xml \ |
244 | -@@ -95,6 +96,7 @@ SOURCES += \ |
245 | +@@ -93,6 +94,7 @@ SOURCES += \ |
246 | qofonomessage.cpp \ |
247 | qofonomessagemanager.cpp \ |
248 | qofonomessagewaiting.cpp \ |
249 | + qofonomtksettings.cpp \ |
250 | qofonosimmanager.cpp \ |
251 | + qofonosimwatcher.cpp \ |
252 | qofonophonebook.cpp \ |
253 | - qofonopositioningrequestagent.cpp \ |
254 | -@@ -134,6 +136,7 @@ PUBLIC_HEADERS += \ |
255 | +@@ -133,6 +135,7 @@ PUBLIC_HEADERS += \ |
256 | qofonomessage.h \ |
257 | qofonomessagemanager.h \ |
258 | qofonomessagewaiting.h \ |
259 | + qofonomtksettings.h \ |
260 | qofonosimmanager.h \ |
261 | + qofonosimwatcher.h \ |
262 | qofonophonebook.h \ |
263 | - qofonopositioningrequestagent.h \ |
264 | @@ -261,6 +264,11 @@ ofono_modem.files = dbus/ofono_modem.xml |
265 | ofono_modem.header_flags = -N -c OfonoModem |
266 | ofono_modem.source_flags = -N -c OfonoModem |
267 | @@ -372,10 +372,10 @@ |
268 | DBUS_INTERFACES += ofono_network_operator |
269 | ofono_network_operator.files = dbus/ofono_network_operator.xml |
270 | ofono_network_operator.header_flags = -N -c OfonoNetworkOperator |
271 | -Index: libqofono-0.79/test/auto/tests/tests.pro |
272 | +Index: libqofono-ubuntu/test/auto/tests/tests.pro |
273 | =================================================================== |
274 | ---- libqofono-0.79.orig/test/auto/tests/tests.pro |
275 | -+++ libqofono-0.79/test/auto/tests/tests.pro |
276 | +--- libqofono-ubuntu.orig/test/auto/tests/tests.pro |
277 | ++++ libqofono-ubuntu/test/auto/tests/tests.pro |
278 | @@ -11,6 +11,7 @@ SUBDIRS += \ |
279 | tst_qofonosimmanager.pro \ |
280 | tst_qofonomessagewaiting.pro \ |
281 | @@ -384,10 +384,10 @@ |
282 | tst_qofonoradiosettings.pro \ |
283 | tst_qofonocallbarring.pro \ |
284 | tst_qofonocallforwarding.pro \ |
285 | -Index: libqofono-0.79/test/auto/tests/tst_qofonomtksettings.cpp |
286 | +Index: libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.cpp |
287 | =================================================================== |
288 | --- /dev/null |
289 | -+++ libqofono-0.79/test/auto/tests/tst_qofonomtksettings.cpp |
290 | ++++ libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.cpp |
291 | @@ -0,0 +1,61 @@ |
292 | +/* |
293 | + * |
294 | @@ -450,10 +450,10 @@ |
295 | + |
296 | +QTEST_MAIN(TestQOfonoMtkSettings) |
297 | +#include "tst_qofonomtksettings.moc" |
298 | -Index: libqofono-0.79/test/auto/tests/tst_qofonomtksettings.pro |
299 | +Index: libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.pro |
300 | =================================================================== |
301 | --- /dev/null |
302 | -+++ libqofono-0.79/test/auto/tests/tst_qofonomtksettings.pro |
303 | ++++ libqofono-ubuntu/test/auto/tests/tst_qofonomtksettings.pro |
304 | @@ -0,0 +1,2 @@ |
305 | +include(testcase.pri) |
306 | +SOURCES += tst_qofonomtksettings.cpp |
307 | |
308 | === modified file 'plugin/plugin.pro' |
309 | --- plugin/plugin.pro 2014-12-09 11:12:09 +0000 |
310 | +++ plugin/plugin.pro 2016-03-23 19:33:02 +0000 |
311 | @@ -19,11 +19,13 @@ |
312 | |
313 | SOURCES = \ |
314 | qofonodeclarativeplugin.cpp \ |
315 | - qofononetworkoperatorlistmodel.cpp |
316 | + qofononetworkoperatorlistmodel.cpp \ |
317 | + qofonosimlistmodel.cpp |
318 | |
319 | HEADERS = \ |
320 | qofonodeclarativeplugin.h \ |
321 | - qofononetworkoperatorlistmodel.h |
322 | + qofononetworkoperatorlistmodel.h \ |
323 | + qofonosimlistmodel.h |
324 | |
325 | INCLUDEPATH += ../src |
326 | |
327 | |
328 | === modified file 'plugin/qofonodeclarativeplugin.cpp' |
329 | --- plugin/qofonodeclarativeplugin.cpp 2014-12-09 11:12:09 +0000 |
330 | +++ plugin/qofonodeclarativeplugin.cpp 2016-03-23 19:33:02 +0000 |
331 | @@ -1,6 +1,6 @@ |
332 | /**************************************************************************** |
333 | ** |
334 | -** Copyright (C) 2013-2014 Jolla Ltd. |
335 | +** Copyright (C) 2013-2015 Jolla Ltd. |
336 | ** Contact: lorn.potter@jollamobile.com |
337 | ** |
338 | ** GNU Lesser General Public License Usage |
339 | @@ -61,6 +61,7 @@ |
340 | #include "qofonolocationreporting.h" |
341 | |
342 | #include "qofononetworkoperatorlistmodel.h" |
343 | +#include "qofonosimlistmodel.h" |
344 | |
345 | void QOfonoDeclarativePlugin::registerTypes(const char *uri, int major, int minor) |
346 | { |
347 | @@ -111,6 +112,7 @@ |
348 | qmlRegisterType<QOfonoLocationReporting>(uri,major,minor,"OfonoLocationReporting"); |
349 | |
350 | qmlRegisterType<QOfonoNetworkOperatorListModel>(uri,major,minor,"OfonoNetworkOperatorListModel"); |
351 | + qmlRegisterType<QOfonoSimListModel>(uri,major,minor,"OfonoSimListModel"); |
352 | } |
353 | |
354 | void QOfonoDeclarativePlugin::registerTypes(const char *uri) |
355 | |
356 | === added file 'plugin/qofonosimlistmodel.cpp' |
357 | --- plugin/qofonosimlistmodel.cpp 1970-01-01 00:00:00 +0000 |
358 | +++ plugin/qofonosimlistmodel.cpp 2016-03-23 19:33:02 +0000 |
359 | @@ -0,0 +1,281 @@ |
360 | +/**************************************************************************** |
361 | +** |
362 | +** Copyright (C) 2015 Jolla Ltd. |
363 | +** Contact: slava.monich@jolla.com |
364 | +** |
365 | +** GNU Lesser General Public License Usage |
366 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
367 | +** General Public License version 2.1 as published by the Free Software |
368 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
369 | +** packaging of this file. Please review the following information to |
370 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
371 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
372 | +** |
373 | +****************************************************************************/ |
374 | + |
375 | +#include "qofonosimlistmodel.h" |
376 | +#include <QQmlEngine> |
377 | + |
378 | +QOfonoSimListModel::QOfonoSimListModel(QObject *parent) : |
379 | + QAbstractListModel(parent), |
380 | + simWatcher(new QOfonoSimWatcher(this)) |
381 | +{ |
382 | + simWatcher->setRequireSubscriberIdentity(true); |
383 | + simList = simWatcher->presentSimList(); |
384 | + connect(simWatcher, |
385 | + SIGNAL(validChanged()), |
386 | + SIGNAL(validChanged())); |
387 | + connect(simWatcher, |
388 | + SIGNAL(presentSimListChanged()), |
389 | + SLOT(onPresentSimListChanged())); |
390 | +} |
391 | + |
392 | +bool QOfonoSimListModel::valid() const |
393 | +{ |
394 | + return simWatcher->isValid(); |
395 | +} |
396 | + |
397 | +int QOfonoSimListModel::count() const |
398 | +{ |
399 | + return simList.count(); |
400 | +} |
401 | + |
402 | +bool QOfonoSimListModel::requireSubscriberIdentity() const |
403 | +{ |
404 | + return simWatcher->requireSubscriberIdentity(); |
405 | +} |
406 | + |
407 | +void QOfonoSimListModel::setRequireSubscriberIdentity(bool require) |
408 | +{ |
409 | + if (simWatcher->requireSubscriberIdentity() != require) { |
410 | + simWatcher->setRequireSubscriberIdentity(require); |
411 | + Q_EMIT requireSubscriberIdentityChanged(); |
412 | + } |
413 | +} |
414 | + |
415 | +QHash<int,QByteArray> QOfonoSimListModel::roleNames() const |
416 | +{ |
417 | + QHash<int, QByteArray> roles; |
418 | + roles[PathRole] = "path"; |
419 | + roles[SubscriberIdentityRole] = "subscriberIdentity"; |
420 | + roles[MobileCountryCodeRole] = "mobileCountryCode"; |
421 | + roles[MobileNetworkCodeRole] = "mobileNetworkCode"; |
422 | + roles[ServiceProviderNameRole] = "serviceProviderName"; |
423 | + roles[SubscriberNumbersRole] = "subscriberNumbers"; |
424 | + roles[ServiceNumbersRole] = "serviceNumbers"; |
425 | + roles[PinRequiredRole] = "pinRequired"; |
426 | + roles[LockedPinsRole] = "lockedPins"; |
427 | + roles[CardIdentifierRole] = "cardIdentifier"; |
428 | + roles[PreferredLanguagesRole] = "preferredLanguages"; |
429 | + roles[PinRetriesRole] = "pinRetries"; |
430 | + roles[FixedDialingRole] = "fixedDialing"; |
431 | + roles[BarredDialingRole] = "barredDialing"; |
432 | + return roles; |
433 | +} |
434 | + |
435 | +int QOfonoSimListModel::rowCount(const QModelIndex&) const |
436 | +{ |
437 | + return simList.count(); |
438 | +} |
439 | + |
440 | +QVariant QOfonoSimListModel::data(const QModelIndex& index, int role) const |
441 | +{ |
442 | + const int row = index.row(); |
443 | + if (row >= 0 && row < simList.count()) { |
444 | + const QOfonoSimManager* sim = simList.at(row).data(); |
445 | + switch (role) { |
446 | + case PathRole: return sim->modemPath(); |
447 | + case SubscriberIdentityRole: return sim->subscriberIdentity(); |
448 | + case MobileCountryCodeRole: return sim->mobileCountryCode(); |
449 | + case MobileNetworkCodeRole: return sim->mobileNetworkCode(); |
450 | + case ServiceProviderNameRole: return sim->serviceProviderName(); |
451 | + case SubscriberNumbersRole: return sim->subscriberNumbers(); |
452 | + case ServiceNumbersRole: return sim->serviceNumbers(); |
453 | + case PinRequiredRole: return sim->pinRequired(); |
454 | + case LockedPinsRole: return sim->lockedPins(); |
455 | + case CardIdentifierRole: return sim->cardIdentifier(); |
456 | + case PreferredLanguagesRole: return sim->preferredLanguages(); |
457 | + case PinRetriesRole: return sim->pinRetries(); |
458 | + case FixedDialingRole: return sim->fixedDialing(); |
459 | + case BarredDialingRole: return sim->barredDialing(); |
460 | + } |
461 | + } else { |
462 | + qWarning() << index << role; |
463 | + } |
464 | + return QVariant(); |
465 | +} |
466 | + |
467 | +bool QOfonoSimListModel::setData(const QModelIndex& index, const QVariant& value, int role) |
468 | +{ |
469 | + const int row = index.row(); |
470 | + if (row >= 0 && row < simList.count() && role == SubscriberNumbersRole) { |
471 | + simList.at(row)->setSubscriberNumbers(value.toStringList()); |
472 | + return true; |
473 | + } else { |
474 | + qWarning() << index << role; |
475 | + } |
476 | + return false; |
477 | +} |
478 | + |
479 | +int QOfonoSimListModel::indexOf(QOfonoSimManager* sim) |
480 | +{ |
481 | + // We cann't just do simList.indexOf(sim) because that would create temporary |
482 | + // QOfonoSimManager::SharedPointer on stack, pass it to simList.indexOf, and |
483 | + // eventually destroy QOfonoSimManager. |
484 | + const int n = simList.count(); |
485 | + for (int i=0; i<n; i++) { |
486 | + if (simList.at(i).data() == sim) { |
487 | + return i; |
488 | + } |
489 | + } |
490 | + return -1; |
491 | +} |
492 | + |
493 | +void QOfonoSimListModel::simPropertyChanged(Role role) |
494 | +{ |
495 | + int row = indexOf((QOfonoSimManager*)sender()); |
496 | + if (row >= 0) { |
497 | + QModelIndex modelIndex = index(row); |
498 | + QVector<int> roles; |
499 | + roles.append(role); |
500 | + Q_EMIT dataChanged(modelIndex, modelIndex, roles); |
501 | + } |
502 | +} |
503 | + |
504 | +void QOfonoSimListModel::onPresentSimListChanged() |
505 | +{ |
506 | + QList<QOfonoSimManager::SharedPointer> newList = simWatcher->presentSimList(); |
507 | + const bool countHasChanged = simList.count() != simWatcher->presentSimCount(); |
508 | + int i; |
509 | + for (i=simList.count()-1; i>=0; i--) { |
510 | + QOfonoSimManager::SharedPointer sim = simList.at(i); |
511 | + if (!newList.contains(sim)) { |
512 | + beginRemoveRows(QModelIndex(), i, i); |
513 | + sim->disconnect(this); |
514 | + simList.removeAt(i); |
515 | + endRemoveRows(); |
516 | + Q_EMIT simRemoved(sim.data()); |
517 | + } |
518 | + } |
519 | + |
520 | + QList<QOfonoSimManager::SharedPointer> oldList = simList; |
521 | + simList = newList; |
522 | + for (i=0; i<newList.count(); i++) { |
523 | + if (!oldList.contains(newList.at(i))) { |
524 | + QOfonoSimManager* sim = newList.at(i).data(); |
525 | + QQmlEngine::setObjectOwnership(sim, QQmlEngine::CppOwnership); |
526 | + beginInsertRows(QModelIndex(), i, i); |
527 | + sim->disconnect(this); |
528 | + connect(sim, |
529 | + SIGNAL(subscriberIdentityChanged(QString)), |
530 | + SLOT(onSubscriberIdentityChanged())); |
531 | + connect(sim, |
532 | + SIGNAL(mobileCountryCodeChanged(QString)), |
533 | + SLOT(onMobileCountryCodeChanged())); |
534 | + connect(sim, |
535 | + SIGNAL(mobileNetworkCodeChanged(QString)), |
536 | + SLOT(onMobileNetworkCodeChanged())); |
537 | + connect(sim, |
538 | + SIGNAL(serviceProviderNameChanged(QString)), |
539 | + SLOT(onServiceProviderNameChanged())); |
540 | + connect(sim, |
541 | + SIGNAL(subscriberNumbersChanged(QStringList)), |
542 | + SLOT(onSubscriberNumbersChanged())); |
543 | + connect(sim, |
544 | + SIGNAL(serviceNumbersChanged(QVariantMap)), |
545 | + SLOT(onServiceNumbersChanged())); |
546 | + connect(sim, |
547 | + SIGNAL(pinRequiredChanged(int)), |
548 | + SLOT(onPinRequiredChanged())); |
549 | + connect(sim, |
550 | + SIGNAL(lockedPinsChanged(QVariantList)), |
551 | + SLOT(onLockedPinsChanged())); |
552 | + connect(sim, |
553 | + SIGNAL(cardIdentifierChanged(QString)), |
554 | + SLOT(onCardIdentifierChanged())); |
555 | + connect(sim, |
556 | + SIGNAL(preferredLanguagesChanged(QStringList)), |
557 | + SLOT(onPreferredLanguagesChanged())); |
558 | + connect(sim, |
559 | + SIGNAL(pinRetriesChanged(QVariantMap)), |
560 | + SLOT(onPinRetriesChanged())); |
561 | + connect(sim, |
562 | + SIGNAL(fixedDialingChanged(bool)), |
563 | + SLOT(onFixedDialingChanged())); |
564 | + connect(sim, |
565 | + SIGNAL(barredDialingChanged(bool)), |
566 | + SLOT(onBarredDialingChanged())); |
567 | + endInsertRows(); |
568 | + Q_EMIT simAdded(sim); |
569 | + } |
570 | + } |
571 | + |
572 | + if (countHasChanged) { |
573 | + Q_EMIT countChanged(); |
574 | + } |
575 | +} |
576 | + |
577 | +void QOfonoSimListModel::onSubscriberIdentityChanged() |
578 | +{ |
579 | + simPropertyChanged(SubscriberIdentityRole); |
580 | +} |
581 | + |
582 | +void QOfonoSimListModel::onMobileCountryCodeChanged() |
583 | +{ |
584 | + simPropertyChanged(MobileCountryCodeRole); |
585 | +} |
586 | + |
587 | +void QOfonoSimListModel::onMobileNetworkCodeChanged() |
588 | +{ |
589 | + simPropertyChanged(MobileNetworkCodeRole); |
590 | +} |
591 | + |
592 | +void QOfonoSimListModel::onServiceProviderNameChanged() |
593 | +{ |
594 | + simPropertyChanged(ServiceProviderNameRole); |
595 | +} |
596 | + |
597 | +void QOfonoSimListModel::onSubscriberNumbersChanged() |
598 | +{ |
599 | + simPropertyChanged(SubscriberNumbersRole); |
600 | +} |
601 | + |
602 | +void QOfonoSimListModel::onServiceNumbersChanged() |
603 | +{ |
604 | + simPropertyChanged(ServiceNumbersRole); |
605 | +} |
606 | + |
607 | +void QOfonoSimListModel::onPinRequiredChanged() |
608 | +{ |
609 | + simPropertyChanged(PinRequiredRole); |
610 | +} |
611 | + |
612 | +void QOfonoSimListModel::onLockedPinsChanged() |
613 | +{ |
614 | + simPropertyChanged(LockedPinsRole); |
615 | +} |
616 | + |
617 | +void QOfonoSimListModel::onCardIdentifierChanged() |
618 | +{ |
619 | + simPropertyChanged(CardIdentifierRole); |
620 | +} |
621 | + |
622 | +void QOfonoSimListModel::onPreferredLanguagesChanged() |
623 | +{ |
624 | + simPropertyChanged(PreferredLanguagesRole); |
625 | +} |
626 | + |
627 | +void QOfonoSimListModel::onPinRetriesChanged() |
628 | +{ |
629 | + simPropertyChanged(PinRetriesRole); |
630 | +} |
631 | + |
632 | +void QOfonoSimListModel::onFixedDialingChanged() |
633 | +{ |
634 | + simPropertyChanged(FixedDialingRole); |
635 | +} |
636 | + |
637 | +void QOfonoSimListModel::onBarredDialingChanged() |
638 | +{ |
639 | + simPropertyChanged(BarredDialingRole); |
640 | +} |
641 | |
642 | === added file 'plugin/qofonosimlistmodel.h' |
643 | --- plugin/qofonosimlistmodel.h 1970-01-01 00:00:00 +0000 |
644 | +++ plugin/qofonosimlistmodel.h 2016-03-23 19:33:02 +0000 |
645 | @@ -0,0 +1,91 @@ |
646 | +/**************************************************************************** |
647 | +** |
648 | +** Copyright (C) 2015 Jolla Ltd. |
649 | +** Contact: slava.monich@jolla.com |
650 | +** |
651 | +** GNU Lesser General Public License Usage |
652 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
653 | +** General Public License version 2.1 as published by the Free Software |
654 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
655 | +** packaging of this file. Please review the following information to |
656 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
657 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
658 | +** |
659 | +****************************************************************************/ |
660 | + |
661 | +#ifndef QOFONOSIMLISTMODEL_H |
662 | +#define QOFONOSIMLISTMODEL_H |
663 | + |
664 | +#include "qofonosimwatcher.h" |
665 | + |
666 | +class QOfonoSimListModel : public QAbstractListModel { |
667 | + Q_OBJECT |
668 | + Q_PROPERTY(bool valid READ valid NOTIFY validChanged) |
669 | + Q_PROPERTY(int count READ count NOTIFY countChanged) |
670 | + Q_PROPERTY(bool requireSubscriberIdentity READ requireSubscriberIdentity |
671 | + WRITE setRequireSubscriberIdentity NOTIFY requireSubscriberIdentityChanged) |
672 | + |
673 | +public: |
674 | + enum Role { |
675 | + PathRole = Qt::UserRole + 1, |
676 | + SubscriberIdentityRole, |
677 | + MobileCountryCodeRole, |
678 | + MobileNetworkCodeRole, |
679 | + ServiceProviderNameRole, |
680 | + SubscriberNumbersRole, |
681 | + ServiceNumbersRole, |
682 | + PinRequiredRole, |
683 | + LockedPinsRole, |
684 | + CardIdentifierRole, |
685 | + PreferredLanguagesRole, |
686 | + PinRetriesRole, |
687 | + FixedDialingRole, |
688 | + BarredDialingRole |
689 | + }; |
690 | + |
691 | + explicit QOfonoSimListModel(QObject* parent = NULL); |
692 | + |
693 | + bool valid() const; |
694 | + int count() const; |
695 | + bool requireSubscriberIdentity() const; |
696 | + void setRequireSubscriberIdentity(bool require); |
697 | + |
698 | +protected: |
699 | + QHash<int,QByteArray> roleNames() const; |
700 | + int rowCount(const QModelIndex& aParent) const; |
701 | + QVariant data(const QModelIndex& aIndex, int aRole) const; |
702 | + bool setData(const QModelIndex& aIndex, const QVariant& aValue, int aRole); |
703 | + |
704 | +Q_SIGNALS: |
705 | + void validChanged(); |
706 | + void countChanged(); |
707 | + void requireSubscriberIdentityChanged(); |
708 | + void simAdded(QOfonoSimManager* sim); |
709 | + void simRemoved(QOfonoSimManager* sim); |
710 | + |
711 | +private Q_SLOTS: |
712 | + void onPresentSimListChanged(); |
713 | + void onSubscriberIdentityChanged(); |
714 | + void onMobileCountryCodeChanged(); |
715 | + void onMobileNetworkCodeChanged(); |
716 | + void onServiceProviderNameChanged(); |
717 | + void onSubscriberNumbersChanged(); |
718 | + void onServiceNumbersChanged(); |
719 | + void onPinRequiredChanged(); |
720 | + void onLockedPinsChanged(); |
721 | + void onCardIdentifierChanged(); |
722 | + void onPreferredLanguagesChanged(); |
723 | + void onPinRetriesChanged(); |
724 | + void onFixedDialingChanged(); |
725 | + void onBarredDialingChanged(); |
726 | + |
727 | +private: |
728 | + void simPropertyChanged(Role role); |
729 | + int indexOf(QOfonoSimManager* sim); |
730 | + |
731 | +private: |
732 | + QOfonoSimWatcher *simWatcher; |
733 | + QList<QOfonoSimManager::SharedPointer> simList; |
734 | +}; |
735 | + |
736 | +#endif // QOFONOSIMLISTMODEL_H |
737 | |
738 | === modified file 'rpm/libqofono-qt5.spec' |
739 | --- rpm/libqofono-qt5.spec 2015-09-10 12:31:20 +0000 |
740 | +++ rpm/libqofono-qt5.spec 2016-03-23 19:33:02 +0000 |
741 | @@ -1,11 +1,11 @@ |
742 | Name: libqofono-qt5 |
743 | |
744 | Summary: A library of Qt 5 bindings for ofono |
745 | -Version: 0.82 |
746 | +Version: 0.90 |
747 | Release: 1 |
748 | Group: System/Libraries |
749 | License: LGPLv2.1 |
750 | -URL: https://github.com/nemomobile/libqofono |
751 | +URL: https://git.merproject.org/mer-core/libqofono |
752 | Source0: %{name}-%{version}.tar.bz2 |
753 | Requires: qt5-qtcore |
754 | Requires: mobile-broadband-provider-info |
755 | |
756 | === modified file 'src/qofonoconnectioncontext.cpp' |
757 | --- src/qofonoconnectioncontext.cpp 2015-03-23 10:28:42 +0000 |
758 | +++ src/qofonoconnectioncontext.cpp 2016-03-23 19:33:02 +0000 |
759 | @@ -26,8 +26,9 @@ |
760 | { |
761 | public: |
762 | bool provisioning; |
763 | + bool mgrValid; |
764 | QSharedPointer<QOfonoConnectionManager> mgr; |
765 | - Private() : provisioning(false) {} |
766 | + Private() : provisioning(false), mgrValid(false) {} |
767 | ~Private() {} |
768 | }; |
769 | |
770 | @@ -66,38 +67,36 @@ |
771 | void QOfonoConnectionContext::setContextPath(const QString &path) |
772 | { |
773 | if (path != objectPath()) { |
774 | + ValidTracker valid(this); |
775 | QString oldModemPath(modemPath()); |
776 | setObjectPath(path); |
777 | QString newModemPath(modemPath()); |
778 | if (oldModemPath != newModemPath) { |
779 | Private *priv = privateData(); |
780 | - const bool wasValid = isValid(); |
781 | - if (!priv->mgr.isNull()) priv->mgr->disconnect(this); |
782 | - priv->mgr = QOfonoConnectionManager::instance(newModemPath); |
783 | - connect(priv->mgr.data(), SIGNAL(validChanged(bool)), SLOT(onManagerValidChanged(bool))); |
784 | + if (!priv->mgr.isNull()) { |
785 | + priv->mgr->disconnect(this); |
786 | + priv->mgr.reset(); |
787 | + priv->mgrValid = false; |
788 | + } |
789 | + if (!newModemPath.isEmpty()) { |
790 | + priv->mgr = QOfonoConnectionManager::instance(newModemPath); |
791 | + priv->mgrValid = priv->mgr.data()->isValid(); |
792 | + connect(priv->mgr.data(), SIGNAL(validChanged(bool)), |
793 | + this, SLOT(onManagerValidChanged(bool))); |
794 | + } |
795 | Q_EMIT modemPathChanged(newModemPath); |
796 | - const bool valid = isValid(); |
797 | - if (wasValid != valid) { |
798 | - Q_EMIT validChanged(valid); |
799 | - } |
800 | } |
801 | } |
802 | } |
803 | |
804 | void QOfonoConnectionContext::onManagerValidChanged(bool valid) |
805 | { |
806 | + ValidTracker track(this); |
807 | + privateData()->mgrValid = valid; |
808 | if (valid) { |
809 | resetDbusInterface(); |
810 | } else { |
811 | - // setDbusInterface(NULL) won't signal validChanged() because when |
812 | - // it first calls isValid(), it would already return false. But we |
813 | - // know that if SUPER::isValid() is true then this object was valid |
814 | - // before ConnectionManager got invalidated. |
815 | - bool wasValid = SUPER::isValid(); |
816 | setDbusInterface(NULL); |
817 | - if (wasValid) { |
818 | - Q_EMIT validChanged(false); |
819 | - } |
820 | } |
821 | } |
822 | |
823 | @@ -265,8 +264,7 @@ |
824 | |
825 | bool QOfonoConnectionContext::isValid() const |
826 | { |
827 | - Private *priv = privateData(); |
828 | - return !priv->mgr.isNull() && priv->mgr->isValid() && SUPER::isValid(); |
829 | + return privateData()->mgrValid && SUPER::isValid(); |
830 | } |
831 | |
832 | bool QOfonoConnectionContext::provisioning() const |
833 | |
834 | === modified file 'src/qofonomanager.cpp' |
835 | --- src/qofonomanager.cpp 2015-09-07 19:20:37 +0000 |
836 | +++ src/qofonomanager.cpp 2016-03-23 19:33:02 +0000 |
837 | @@ -1,6 +1,6 @@ |
838 | /**************************************************************************** |
839 | ** |
840 | -** Copyright (C) 2013-2015 Jolla Ltd. |
841 | +** Copyright (C) 2013-2016 Jolla Ltd. |
842 | ** Contact: lorn.potter@jollamobile.com |
843 | ** |
844 | ** GNU Lesser General Public License Usage |
845 | @@ -14,6 +14,7 @@ |
846 | ****************************************************************************/ |
847 | |
848 | #include "qofonomanager.h" |
849 | +#include "qofonoutils_p.h" |
850 | #include "ofono_manager_interface.h" |
851 | |
852 | class QOfonoManager::Private |
853 | @@ -24,8 +25,20 @@ |
854 | bool available; |
855 | |
856 | Private() : ofonoManager(NULL), available(false) {} |
857 | + |
858 | + void getModems(QOfonoManager *manager); |
859 | }; |
860 | |
861 | +void QOfonoManager::Private::getModems(QOfonoManager *manager) |
862 | +{ |
863 | + if (ofonoManager) { |
864 | + connect(new QDBusPendingCallWatcher( |
865 | + ofonoManager->GetModems(), ofonoManager), |
866 | + SIGNAL(finished(QDBusPendingCallWatcher*)), manager, |
867 | + SLOT(onGetModemsFinished(QDBusPendingCallWatcher*))); |
868 | + } |
869 | +} |
870 | + |
871 | QOfonoManager::QOfonoManager(QObject *parent) : |
872 | QObject(parent), |
873 | d_ptr(new Private) |
874 | @@ -106,7 +119,15 @@ |
875 | void QOfonoManager::onGetModemsFinished(QDBusPendingCallWatcher* watcher) |
876 | { |
877 | QDBusPendingReply<ObjectPathPropertiesList> reply(*watcher); |
878 | - if (reply.isValid() && !reply.isError()) { |
879 | + watcher->deleteLater(); |
880 | + if (reply.isError()) { |
881 | + if (qofono::isTimeout(reply.error())) { |
882 | + qDebug() << "Retrying GetModems..."; |
883 | + d_ptr->getModems(this); |
884 | + } else { |
885 | + qWarning() << reply.error(); |
886 | + } |
887 | + } else { |
888 | QString prevDefault = defaultModem(); |
889 | QStringList newModems; |
890 | Q_FOREACH(ObjectPathProperties modem, reply.value()) { |
891 | @@ -124,7 +145,6 @@ |
892 | d_ptr->available = true; |
893 | Q_EMIT availableChanged(true); |
894 | } |
895 | - watcher->deleteLater(); |
896 | } |
897 | |
898 | void QOfonoManager::connectToOfono(const QString &) |
899 | @@ -133,15 +153,13 @@ |
900 | OfonoManager* mgr = new OfonoManager("org.ofono", "/", QDBusConnection::systemBus(), this); |
901 | if (mgr->isValid()) { |
902 | d_ptr->ofonoManager = mgr; |
903 | - connect(new QDBusPendingCallWatcher(mgr->GetModems(), mgr), |
904 | - SIGNAL(finished(QDBusPendingCallWatcher*)), |
905 | - SLOT(onGetModemsFinished(QDBusPendingCallWatcher*))); |
906 | connect(mgr, |
907 | SIGNAL(ModemAdded(QDBusObjectPath,QVariantMap)), |
908 | SLOT(onModemAdded(QDBusObjectPath,QVariantMap))); |
909 | connect(mgr, |
910 | SIGNAL(ModemRemoved(QDBusObjectPath)), |
911 | SLOT(onModemRemoved(QDBusObjectPath))); |
912 | + d_ptr->getModems(this); |
913 | } else { |
914 | delete mgr; |
915 | } |
916 | @@ -167,3 +185,14 @@ |
917 | } |
918 | } |
919 | } |
920 | + |
921 | +QSharedPointer<QOfonoManager> QOfonoManager::instance() |
922 | +{ |
923 | + static QWeakPointer<QOfonoManager> sharedInstance; |
924 | + QSharedPointer<QOfonoManager> mgr = sharedInstance; |
925 | + if (mgr.isNull()) { |
926 | + mgr = QSharedPointer<QOfonoManager>::create(); |
927 | + sharedInstance = mgr; |
928 | + } |
929 | + return mgr; |
930 | +} |
931 | |
932 | === modified file 'src/qofonomanager.h' |
933 | --- src/qofonomanager.h 2014-12-09 10:33:45 +0000 |
934 | +++ src/qofonomanager.h 2016-03-23 19:33:02 +0000 |
935 | @@ -1,6 +1,6 @@ |
936 | /**************************************************************************** |
937 | ** |
938 | -** Copyright (C) 2013-2014 Jolla Ltd. |
939 | +** Copyright (C) 2013-2015 Jolla Ltd. |
940 | ** Contact: lorn.potter@jollamobile.com |
941 | ** |
942 | ** GNU Lesser General Public License Usage |
943 | @@ -40,6 +40,8 @@ |
944 | bool available() const; |
945 | bool isValid() const; |
946 | |
947 | + static QSharedPointer<QOfonoManager> instance(); |
948 | + |
949 | Q_SIGNALS: // SIGNALS |
950 | void modemAdded(const QString &modem); |
951 | void modemRemoved(const QString &modem); |
952 | |
953 | === modified file 'src/qofonomessagemanager.cpp' |
954 | --- src/qofonomessagemanager.cpp 2015-01-09 11:35:34 +0000 |
955 | +++ src/qofonomessagemanager.cpp 2016-03-23 19:33:02 +0000 |
956 | @@ -166,13 +166,13 @@ |
957 | qDebug() << reply.error(); |
958 | Q_EMIT reportError(reply.error().message()); |
959 | } else { |
960 | + ValidTracker valid(this); |
961 | ObjectPathPropertiesList list = reply.value(); |
962 | privateData()->initialized = true; |
963 | for (int i=0; i<list.count(); i++) { |
964 | addMessage(list[i].path.path()); |
965 | } |
966 | Q_EMIT messagesFinished(); |
967 | - if (isValid()) validChanged(true); |
968 | } |
969 | } |
970 | |
971 | |
972 | === modified file 'src/qofonomodem.cpp' |
973 | --- src/qofonomodem.cpp 2015-03-02 15:26:35 +0000 |
974 | +++ src/qofonomodem.cpp 2016-03-23 19:33:02 +0000 |
975 | @@ -14,6 +14,7 @@ |
976 | ****************************************************************************/ |
977 | |
978 | #include "qofonomodem.h" |
979 | +#include "qofonomanager.h" |
980 | #include "ofono_modem_interface.h" |
981 | |
982 | #include <QMap> |
983 | @@ -24,9 +25,21 @@ |
984 | |
985 | #define SUPER QOfonoObject |
986 | |
987 | +class QOfonoModem::Private : public SUPER::ExtData |
988 | +{ |
989 | +public: |
990 | + bool modemPathValid; |
991 | + QSharedPointer<QOfonoManager> mgr; |
992 | + Private() : modemPathValid(false), mgr(QOfonoManager::instance()) {} |
993 | +}; |
994 | + |
995 | QOfonoModem::QOfonoModem(QObject *parent) : |
996 | - SUPER(parent) |
997 | + SUPER(new Private, parent) |
998 | { |
999 | + QOfonoManager* mgr = privateData()->mgr.data(); |
1000 | + connect(mgr, SIGNAL(availableChanged(bool)), SLOT(checkModemPathValidity())); |
1001 | + connect(mgr, SIGNAL(modemsChanged(QStringList)), SLOT(checkModemPathValidity())); |
1002 | + checkModemPathValidity(); |
1003 | } |
1004 | |
1005 | QOfonoModem::~QOfonoModem() |
1006 | @@ -40,8 +53,15 @@ |
1007 | |
1008 | void QOfonoModem::objectPathChanged(const QString &path, const QVariantMap *properties) |
1009 | { |
1010 | - SUPER::objectPathChanged(path, properties); |
1011 | Q_EMIT modemPathChanged(path); |
1012 | + if (!checkModemPathValidity()) { |
1013 | + // checkModemPathValidity() didn't do anything because modemPathValid |
1014 | + // flag hasn't changed. If the modem path has changed from one valid |
1015 | + // path to another, D-Bus interface has to be re-initialized. |
1016 | + if (privateData()->modemPathValid) { |
1017 | + resetDbusInterface(properties); |
1018 | + } |
1019 | + } |
1020 | } |
1021 | |
1022 | void QOfonoModem::setModemPath(const QString &path) |
1023 | @@ -172,5 +192,36 @@ |
1024 | |
1025 | bool QOfonoModem::isValid() const |
1026 | { |
1027 | - return SUPER::isValid(); |
1028 | + return SUPER::isValid() && privateData()->modemPathValid; |
1029 | +} |
1030 | + |
1031 | +QOfonoModem::Private* QOfonoModem::privateData() const |
1032 | +{ |
1033 | + return (Private*)SUPER::extData(); |
1034 | +} |
1035 | + |
1036 | +bool QOfonoModem::checkModemPathValidity() |
1037 | +{ |
1038 | + ValidTracker valid(this); |
1039 | + bool modemPathValid; |
1040 | + Private* priv = privateData(); |
1041 | + if (priv->mgr->isValid()) { |
1042 | + QString path = modemPath(); |
1043 | + modemPathValid = !path.isEmpty() && priv->mgr->modems().contains(path); |
1044 | + } else { |
1045 | + modemPathValid = false; |
1046 | + } |
1047 | + if (priv->modemPathValid != modemPathValid) { |
1048 | + priv->modemPathValid = modemPathValid; |
1049 | + if (modemPathValid) { |
1050 | + resetDbusInterface(); |
1051 | + } else { |
1052 | + setDbusInterface(NULL); |
1053 | + } |
1054 | + return true; |
1055 | + } else { |
1056 | + // Return false to indicate that this function didn't do anything |
1057 | + // because modemPathValid hasn't changed |
1058 | + return false; |
1059 | + } |
1060 | } |
1061 | |
1062 | === modified file 'src/qofonomodem.h' |
1063 | --- src/qofonomodem.h 2014-12-09 11:11:37 +0000 |
1064 | +++ src/qofonomodem.h 2016-03-23 19:33:02 +0000 |
1065 | @@ -1,6 +1,6 @@ |
1066 | /**************************************************************************** |
1067 | ** |
1068 | -** Copyright (C) 2013-2014 Jolla Ltd. |
1069 | +** Copyright (C) 2013-2015 Jolla Ltd. |
1070 | ** Contact: lorn.potter@jollamobile.com |
1071 | ** |
1072 | ** GNU Lesser General Public License Usage |
1073 | @@ -93,10 +93,17 @@ |
1074 | void interfacesChanged(const QStringList &interfaces); |
1075 | void modemPathChanged(const QString &path); |
1076 | |
1077 | +private Q_SLOTS: |
1078 | + bool checkModemPathValidity(); |
1079 | + |
1080 | protected: |
1081 | QDBusAbstractInterface *createDbusInterface(const QString &path); |
1082 | void propertyChanged(const QString &key, const QVariant &value); |
1083 | void objectPathChanged(const QString &path, const QVariantMap *properties); |
1084 | + |
1085 | +private: |
1086 | + class Private; |
1087 | + Private* privateData() const; |
1088 | }; |
1089 | |
1090 | #endif // QOFONOMODEM_H |
1091 | |
1092 | === modified file 'src/qofonomodeminterface.cpp' |
1093 | --- src/qofonomodeminterface.cpp 2014-12-09 11:11:37 +0000 |
1094 | +++ src/qofonomodeminterface.cpp 2016-03-23 19:33:02 +0000 |
1095 | @@ -1,6 +1,6 @@ |
1096 | /**************************************************************************** |
1097 | ** |
1098 | -** Copyright (C) 2014 Jolla Ltd. |
1099 | +** Copyright (C) 2014-2015 Jolla Ltd. |
1100 | ** Contact: slava.monich@jolla.com |
1101 | ** |
1102 | ** GNU Lesser General Public License Usage |
1103 | @@ -24,9 +24,10 @@ |
1104 | QString interfaceName; |
1105 | QSharedPointer<QOfonoModem> modem; |
1106 | QOfonoModem::ExtData *ext; |
1107 | + bool modemValid; |
1108 | |
1109 | Private(const QString &iface, QOfonoModem::ExtData *data) : |
1110 | - interfaceName(iface), ext(data) {} |
1111 | + interfaceName(iface), ext(data), modemValid(false) {} |
1112 | ~Private() { delete ext; } |
1113 | }; |
1114 | |
1115 | @@ -64,6 +65,16 @@ |
1116 | setObjectPath(path); |
1117 | } |
1118 | |
1119 | +void QOfonoModemInterface::fixModemPath(const QString &path) |
1120 | +{ |
1121 | + fixObjectPath(path); |
1122 | +} |
1123 | + |
1124 | +bool QOfonoModemInterface::isValid() const |
1125 | +{ |
1126 | + return privateData()->modemValid && SUPER::isValid(); |
1127 | +} |
1128 | + |
1129 | void QOfonoModemInterface::objectPathChanged(const QString &path, const QVariantMap *) |
1130 | { |
1131 | // The base implementation would immediately create the D-Bus interface |
1132 | @@ -72,18 +83,27 @@ |
1133 | // isn't there (see onModemInterfacesChanged below) |
1134 | bool wasReady = isReady(); |
1135 | |
1136 | + ValidTracker track(this); |
1137 | Private *d_ptr = privateData(); |
1138 | if (!d_ptr->modem.isNull()) { |
1139 | - disconnect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), |
1140 | + QOfonoModem *modem = d_ptr->modem.data(); |
1141 | + disconnect(modem, SIGNAL(interfacesChanged(QStringList)), |
1142 | this, SLOT(onModemInterfacesChanged(QStringList))); |
1143 | + disconnect(modem, SIGNAL(validChanged(bool)), |
1144 | + this, SLOT(onModemValidChanged(bool))); |
1145 | + d_ptr->modemValid = false; |
1146 | d_ptr->modem.reset(); |
1147 | } |
1148 | |
1149 | setDbusInterface(NULL, NULL); |
1150 | |
1151 | d_ptr->modem = QOfonoModem::instance(objectPath()); |
1152 | - connect(d_ptr->modem.data(), SIGNAL(interfacesChanged(QStringList)), |
1153 | + QOfonoModem *modem = d_ptr->modem.data(); |
1154 | + connect(modem, SIGNAL(interfacesChanged(QStringList)), |
1155 | this, SLOT(onModemInterfacesChanged(QStringList))); |
1156 | + connect(modem, SIGNAL(validChanged(bool)), |
1157 | + this, SLOT(onModemValidChanged(bool))); |
1158 | + d_ptr->modemValid = modem->isValid(); |
1159 | |
1160 | Q_EMIT modemPathChanged(path); |
1161 | onModemInterfacesChanged(d_ptr->modem->interfaces()); |
1162 | @@ -92,6 +112,12 @@ |
1163 | } |
1164 | } |
1165 | |
1166 | +void QOfonoModemInterface::onModemValidChanged(bool valid) |
1167 | +{ |
1168 | + ValidTracker track(this); |
1169 | + privateData()->modemValid = valid; |
1170 | +} |
1171 | + |
1172 | void QOfonoModemInterface::onModemInterfacesChanged(const QStringList &interfaces) |
1173 | { |
1174 | if (interfaces.contains(privateData()->interfaceName)) { |
1175 | |
1176 | === modified file 'src/qofonomodeminterface.h' |
1177 | --- src/qofonomodeminterface.h 2014-12-09 11:11:37 +0000 |
1178 | +++ src/qofonomodeminterface.h 2016-03-23 19:33:02 +0000 |
1179 | @@ -1,6 +1,6 @@ |
1180 | /**************************************************************************** |
1181 | ** |
1182 | -** Copyright (C) 2014 Jolla Ltd. |
1183 | +** Copyright (C) 2014-2015 Jolla Ltd. |
1184 | ** Contact: slava.monich@jolla.com |
1185 | ** |
1186 | ** GNU Lesser General Public License Usage |
1187 | @@ -39,6 +39,10 @@ |
1188 | |
1189 | bool isReady() const; |
1190 | |
1191 | +public: |
1192 | + bool isValid() const; |
1193 | + void fixModemPath(const QString &path); |
1194 | + |
1195 | Q_SIGNALS: |
1196 | void modemPathChanged(const QString &path); |
1197 | void readyChanged(/* No parameter for historical reasons */); |
1198 | @@ -48,8 +52,9 @@ |
1199 | void updateProperty(const QString &key, const QVariant &value); |
1200 | void objectPathChanged(const QString &path, const QVariantMap *properties); |
1201 | |
1202 | -private slots: |
1203 | +private Q_SLOTS: |
1204 | void onModemInterfacesChanged(const QStringList &interfaces); |
1205 | + void onModemValidChanged(bool valid); |
1206 | |
1207 | private: |
1208 | class Private; |
1209 | |
1210 | === modified file 'src/qofononetworkregistration.cpp' |
1211 | --- src/qofononetworkregistration.cpp 2015-01-09 11:35:34 +0000 |
1212 | +++ src/qofononetworkregistration.cpp 2016-03-23 19:33:02 +0000 |
1213 | @@ -289,9 +289,9 @@ |
1214 | qDebug() << reply.error(); |
1215 | Q_EMIT reportError(reply.error().message()); |
1216 | } else { |
1217 | + ValidTracker valid(this); |
1218 | privateData()->initialized = true; |
1219 | onOperatorsChanged(reply.value()); |
1220 | - if (isValid()) validChanged(true); |
1221 | } |
1222 | } |
1223 | |
1224 | |
1225 | === modified file 'src/qofonoobject.cpp' |
1226 | --- src/qofonoobject.cpp 2015-06-26 01:44:58 +0000 |
1227 | +++ src/qofonoobject.cpp 2016-03-23 19:33:02 +0000 |
1228 | @@ -1,6 +1,6 @@ |
1229 | /**************************************************************************** |
1230 | ** |
1231 | -** Copyright (C) 2014-2015 Jolla Ltd. |
1232 | +** Copyright (C) 2014-2016 Jolla Ltd. |
1233 | ** Contact: slava.monich@jolla.com |
1234 | ** |
1235 | ** GNU Lesser General Public License Usage |
1236 | @@ -23,14 +23,18 @@ |
1237 | QDBusAbstractInterface *interface; |
1238 | bool initialized; |
1239 | bool fixedPath; |
1240 | + bool validMark; |
1241 | + int validMarkCount; |
1242 | QString objectPath; |
1243 | QVariantMap properties; |
1244 | |
1245 | Private(QOfonoObject::ExtData *data) : ext(data), |
1246 | - interface(NULL), initialized(false), fixedPath(false) {} |
1247 | + interface(NULL), initialized(false), fixedPath(false), |
1248 | + validMark(false), validMarkCount(0) {} |
1249 | ~Private() { delete ext; } |
1250 | |
1251 | QDBusPendingCall setProperty(const QString &key, const QVariant &value); |
1252 | + void getProperties(QOfonoObject *obj); |
1253 | |
1254 | class SetPropertyWatcher : public QDBusPendingCallWatcher { |
1255 | public: |
1256 | @@ -45,6 +49,23 @@ |
1257 | { |
1258 | } |
1259 | |
1260 | +QOfonoObject::ValidTracker::ValidTracker(QOfonoObject* obj) : object(obj) |
1261 | +{ |
1262 | + if (!(object->d_ptr->validMarkCount++)) { |
1263 | + object->d_ptr->validMark = obj->isValid(); |
1264 | + } |
1265 | +} |
1266 | + |
1267 | +QOfonoObject::ValidTracker::~ValidTracker() |
1268 | +{ |
1269 | + if (!(--object->d_ptr->validMarkCount)) { |
1270 | + const bool valid = object->isValid(); |
1271 | + if (object->d_ptr->validMark != valid) { |
1272 | + Q_EMIT object->validChanged(valid); |
1273 | + } |
1274 | + } |
1275 | +} |
1276 | + |
1277 | QDBusPendingCall QOfonoObject::Private::setProperty(const QString &key, const QVariant &value) |
1278 | { |
1279 | // Caller checks interface for NULL |
1280 | @@ -53,6 +74,13 @@ |
1281 | return interface->asyncCallWithArgumentList("SetProperty", args); |
1282 | } |
1283 | |
1284 | +void QOfonoObject::Private::getProperties(QOfonoObject *obj) |
1285 | +{ |
1286 | + QObject::connect(new QDBusPendingCallWatcher( |
1287 | + interface->asyncCall("GetProperties"), interface), |
1288 | + SIGNAL(finished(QDBusPendingCallWatcher*)), obj, |
1289 | + SLOT(onGetPropertiesFinished(QDBusPendingCallWatcher*))); |
1290 | +} |
1291 | |
1292 | QOfonoObject::QOfonoObject(QObject *parent) : |
1293 | QObject(parent), |
1294 | @@ -127,7 +155,7 @@ |
1295 | |
1296 | void QOfonoObject::setDbusInterface(QDBusAbstractInterface *iface, const QVariantMap *properties) |
1297 | { |
1298 | - bool wasValid = isValid(); |
1299 | + ValidTracker valid(this); |
1300 | d_ptr->initialized = false; |
1301 | if (d_ptr->interface) { |
1302 | delete d_ptr->interface; |
1303 | @@ -146,19 +174,12 @@ |
1304 | } |
1305 | } else { |
1306 | d_ptr->initialized = false; |
1307 | - connect(new QDBusPendingCallWatcher( |
1308 | - iface->asyncCall("GetProperties"), iface), |
1309 | - SIGNAL(finished(QDBusPendingCallWatcher*)), |
1310 | - SLOT(onGetPropertiesFinished(QDBusPendingCallWatcher*))); |
1311 | + d_ptr->getProperties(this); |
1312 | } |
1313 | connect(iface, |
1314 | SIGNAL(PropertyChanged(QString,QDBusVariant)), |
1315 | SLOT(onPropertyChanged(QString,QDBusVariant))); |
1316 | } |
1317 | - bool valid = isValid(); |
1318 | - if (valid != wasValid) { |
1319 | - Q_EMIT validChanged(valid); |
1320 | - } |
1321 | } |
1322 | |
1323 | void QOfonoObject::dbusInterfaceDropped() |
1324 | @@ -186,16 +207,20 @@ |
1325 | void QOfonoObject::getPropertiesFinished(const QVariantMap &properties, const QDBusError *error) |
1326 | { |
1327 | if (!error) { |
1328 | + ValidTracker valid(this); |
1329 | for (QVariantMap::ConstIterator it = properties.constBegin(); |
1330 | it != properties.constEnd(); ++it) { |
1331 | updateProperty(it.key(), it.value()); |
1332 | } |
1333 | d_ptr->initialized = true; |
1334 | - if (isValid()) { |
1335 | - Q_EMIT validChanged(true); |
1336 | - } |
1337 | + } else if (qofono::isTimeout(*error)) { |
1338 | + // Retry GetProperties call if it times out |
1339 | + qDebug() << "Retrying" |
1340 | + << qPrintable(d_ptr->interface->interface() + ".GetProperties") |
1341 | + << d_ptr->interface->path(); |
1342 | + d_ptr->getProperties(this); |
1343 | } else { |
1344 | - qDebug() << *error; |
1345 | + qWarning() << *error; |
1346 | Q_EMIT reportError(error->message()); |
1347 | } |
1348 | } |
1349 | |
1350 | === modified file 'src/qofonoobject.h' |
1351 | --- src/qofonoobject.h 2015-03-16 19:27:51 +0000 |
1352 | +++ src/qofonoobject.h 2016-03-23 19:33:02 +0000 |
1353 | @@ -23,6 +23,16 @@ |
1354 | Q_OBJECT |
1355 | Q_PROPERTY(bool valid READ isValid NOTIFY validChanged) |
1356 | |
1357 | +protected: |
1358 | + friend class ValidTracker; |
1359 | + class ValidTracker { |
1360 | + private: |
1361 | + QOfonoObject* object; |
1362 | + public: |
1363 | + ValidTracker(QOfonoObject* object); |
1364 | + ~ValidTracker(); |
1365 | + }; |
1366 | + |
1367 | public: |
1368 | class ExtData { |
1369 | public: |
1370 | |
1371 | === modified file 'src/qofonosimmanager.cpp' |
1372 | --- src/qofonosimmanager.cpp 2015-06-03 15:17:19 +0000 |
1373 | +++ src/qofonosimmanager.cpp 2016-03-23 19:33:02 +0000 |
1374 | @@ -22,6 +22,7 @@ |
1375 | static const QString kSubscriberIdentity(QLatin1String("SubscriberIdentity")); |
1376 | static const QString kMobileCountryCode(QLatin1String("MobileCountryCode")); |
1377 | static const QString kMobileNetworkCode(QLatin1String("MobileNetworkCode")); |
1378 | +static const QString kServiceProviderName(QLatin1String("ServiceProviderName")); |
1379 | static const QString kSubscriberNumbers(QLatin1String("SubscriberNumbers")); |
1380 | static const QString kServiceNumbers(QLatin1String("ServiceNumbers")); |
1381 | static const QString kPinRequired(QLatin1String("PinRequired")); |
1382 | @@ -134,6 +135,8 @@ |
1383 | Q_EMIT mobileCountryCodeChanged(value.value<QString>()); |
1384 | } else if (property == kMobileNetworkCode) { |
1385 | Q_EMIT mobileNetworkCodeChanged(value.value<QString>()); |
1386 | + } else if (property == kServiceProviderName) { |
1387 | + Q_EMIT serviceProviderNameChanged(value.value<QString>()); |
1388 | } else if (property == kSubscriberNumbers) { |
1389 | Q_EMIT subscriberNumbersChanged(value.value<QStringList>()); |
1390 | } else if (property == kServiceNumbers) { |
1391 | @@ -175,6 +178,11 @@ |
1392 | return getString(kMobileNetworkCode); |
1393 | } |
1394 | |
1395 | +QString QOfonoSimManager::serviceProviderName() const |
1396 | +{ |
1397 | + return getString(kServiceProviderName); |
1398 | +} |
1399 | + |
1400 | QStringList QOfonoSimManager::subscriberNumbers() const |
1401 | { |
1402 | return getStringList(kSubscriberNumbers); |
1403 | |
1404 | === modified file 'src/qofonosimmanager.h' |
1405 | --- src/qofonosimmanager.h 2014-12-09 11:11:37 +0000 |
1406 | +++ src/qofonosimmanager.h 2016-03-23 19:33:02 +0000 |
1407 | @@ -1,6 +1,6 @@ |
1408 | /**************************************************************************** |
1409 | ** |
1410 | -** Copyright (C) 2013-2014 Jolla Ltd. |
1411 | +** Copyright (C) 2013-2016 Jolla Ltd. |
1412 | ** Contact: lorn.potter@jollamobile.com |
1413 | ** |
1414 | ** GNU Lesser General Public License Usage |
1415 | @@ -33,6 +33,7 @@ |
1416 | Q_PROPERTY(QString subscriberIdentity READ subscriberIdentity NOTIFY subscriberIdentityChanged) |
1417 | Q_PROPERTY(QString mobileCountryCode READ mobileCountryCode NOTIFY mobileCountryCodeChanged) |
1418 | Q_PROPERTY(QString mobileNetworkCode READ mobileNetworkCode NOTIFY mobileNetworkCodeChanged) |
1419 | + Q_PROPERTY(QString serviceProviderName READ serviceProviderName NOTIFY serviceProviderNameChanged) |
1420 | Q_PROPERTY(QStringList subscriberNumbers READ subscriberNumbers WRITE setSubscriberNumbers NOTIFY subscriberNumbersChanged) |
1421 | Q_PROPERTY(QVariantMap serviceNumbers READ serviceNumbers NOTIFY serviceNumbersChanged) |
1422 | Q_PROPERTY(PinType pinRequired READ pinRequired NOTIFY pinRequiredChanged) |
1423 | @@ -44,6 +45,8 @@ |
1424 | Q_PROPERTY(bool barredDialing READ barredDialing NOTIFY barredDialingChanged) |
1425 | |
1426 | public: |
1427 | + class SharedPointer; |
1428 | + |
1429 | enum Error { |
1430 | NoError, |
1431 | NotImplementedError, |
1432 | @@ -82,6 +85,7 @@ |
1433 | QString subscriberIdentity() const; |
1434 | QString mobileCountryCode() const; |
1435 | QString mobileNetworkCode() const; |
1436 | + QString serviceProviderName() const; |
1437 | QStringList subscriberNumbers() const; |
1438 | QVariantMap serviceNumbers() const; // |
1439 | PinType pinRequired() const; |
1440 | @@ -98,6 +102,7 @@ |
1441 | void subscriberIdentityChanged(const QString &imsi); |
1442 | void mobileCountryCodeChanged(const QString &mcc); |
1443 | void mobileNetworkCodeChanged(const QString &mnc); |
1444 | + void serviceProviderNameChanged(const QString &spn); |
1445 | void subscriberNumbersChanged(const QStringList &msisdns); |
1446 | void serviceNumbersChanged(const QVariantMap &sdns); |
1447 | void pinRequiredChanged(int pinType); |
1448 | @@ -147,4 +152,10 @@ |
1449 | void unlockPinCallFinished(QDBusPendingCallWatcher *call); |
1450 | }; |
1451 | |
1452 | +// Unlike the default QSharedPointer, deletes QOfonoSimManager with deleteLater |
1453 | +class QOFONOSHARED_EXPORT QOfonoSimManager::SharedPointer : public QSharedPointer<QOfonoSimManager> { |
1454 | +public: |
1455 | + SharedPointer(QOfonoSimManager * ptr = NULL) : QSharedPointer<QOfonoSimManager>(ptr, &QObject::deleteLater) {} |
1456 | +}; |
1457 | + |
1458 | #endif // QOFONOSimManager_H |
1459 | |
1460 | === added file 'src/qofonosimwatcher.cpp' |
1461 | --- src/qofonosimwatcher.cpp 1970-01-01 00:00:00 +0000 |
1462 | +++ src/qofonosimwatcher.cpp 2016-03-23 19:33:02 +0000 |
1463 | @@ -0,0 +1,200 @@ |
1464 | +/**************************************************************************** |
1465 | +** |
1466 | +** Copyright (C) 2015 Jolla Ltd. |
1467 | +** Contact: slava.monich@jolla.com |
1468 | +** |
1469 | +** GNU Lesser General Public License Usage |
1470 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1471 | +** General Public License version 2.1 as published by the Free Software |
1472 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
1473 | +** packaging of this file. Please review the following information to |
1474 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
1475 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1476 | +** |
1477 | +****************************************************************************/ |
1478 | + |
1479 | +#include "qofonosimwatcher.h" |
1480 | +#include "qofonomanager.h" |
1481 | + |
1482 | +class QOfonoSimWatcher::Private : public QObject { |
1483 | + Q_OBJECT |
1484 | + |
1485 | +public: |
1486 | + Private(QOfonoSimWatcher *parent); |
1487 | + |
1488 | + QOfonoSimWatcher *watcher; |
1489 | + QSharedPointer<QOfonoManager> ofono; |
1490 | + QHash<QString, QOfonoSimManager::SharedPointer> allSims; |
1491 | + QList<QOfonoSimManager::SharedPointer> presentSims; |
1492 | + bool requireSubscriberIdentity; |
1493 | + bool valid; |
1494 | + |
1495 | +public Q_SLOTS: |
1496 | + void onOfonoAvailableChanged(); |
1497 | + void updateValid(); |
1498 | + void updateModems(); |
1499 | + void updateSims(); |
1500 | +}; |
1501 | + |
1502 | +QOfonoSimWatcher::Private::Private(QOfonoSimWatcher *parent) : |
1503 | + watcher(parent), |
1504 | + ofono(QOfonoManager::instance()), |
1505 | + requireSubscriberIdentity(false), |
1506 | + valid(false) |
1507 | +{ |
1508 | + connect(ofono.data(), SIGNAL(availableChanged(bool)), SLOT(onOfonoAvailableChanged())); |
1509 | + connect(ofono.data(), SIGNAL(modemsChanged(QStringList)), SLOT(updateModems())); |
1510 | + if (ofono->available()) { |
1511 | + onOfonoAvailableChanged(); |
1512 | + } |
1513 | +} |
1514 | + |
1515 | +void QOfonoSimWatcher::Private::onOfonoAvailableChanged() |
1516 | +{ |
1517 | + if (ofono->available()) { |
1518 | + updateModems(); |
1519 | + updateValid(); |
1520 | + } else { |
1521 | + updateValid(); |
1522 | + allSims.clear(); |
1523 | + if (!presentSims.isEmpty()) { |
1524 | + presentSims.clear(); |
1525 | + if (watcher) { |
1526 | + Q_EMIT watcher->presentSimListChanged(); |
1527 | + } |
1528 | + if (watcher) { |
1529 | + Q_EMIT watcher->presentSimCountChanged(); |
1530 | + } |
1531 | + } |
1532 | + } |
1533 | +} |
1534 | + |
1535 | +void QOfonoSimWatcher::Private::updateModems() |
1536 | +{ |
1537 | + QStringList oldModems = allSims.keys(); |
1538 | + QStringList newModems = ofono->modems(); |
1539 | + oldModems.sort(); |
1540 | + newModems.sort(); |
1541 | + if (oldModems != newModems) { |
1542 | + const int oldCount = oldModems.count(); |
1543 | + const int newCount = newModems.count(); |
1544 | + int i; |
1545 | + for (i=0; i<oldCount; i++) { |
1546 | + QString path(oldModems.at(i)); |
1547 | + if (!newModems.contains(path)) { |
1548 | + // This modem is no more |
1549 | + allSims.take(path)->disconnect(this); |
1550 | + } |
1551 | + } |
1552 | + for (i=0; i<newCount; i++) { |
1553 | + QString path(newModems.at(i)); |
1554 | + if (!allSims.contains(path)) { |
1555 | + // This is a new modem |
1556 | + QOfonoSimManager *sim = new QOfonoSimManager(); |
1557 | + sim->fixModemPath(path); |
1558 | + connect(sim, SIGNAL(validChanged(bool)), SLOT(updateSims())); |
1559 | + connect(sim, SIGNAL(presenceChanged(bool)), SLOT(updateSims())); |
1560 | + connect(sim, SIGNAL(subscriberIdentityChanged(QString)), SLOT(updateSims())); |
1561 | + allSims.insert(path, QOfonoSimManager::SharedPointer(sim)); |
1562 | + } |
1563 | + } |
1564 | + updateSims(); |
1565 | + } |
1566 | +} |
1567 | + |
1568 | +void QOfonoSimWatcher::Private::updateSims() |
1569 | +{ |
1570 | + QList<QOfonoSimManager::SharedPointer> sims; |
1571 | + QStringList modems = allSims.keys(); |
1572 | + modems.sort(); |
1573 | + int i, n = modems.count(); |
1574 | + for (i=0; i<n; i++) { |
1575 | + QOfonoSimManager::SharedPointer sim = allSims.value(modems.at(i)); |
1576 | + if (sim->isValid() && sim->present() && |
1577 | + (!requireSubscriberIdentity || !sim->subscriberIdentity().isEmpty())) { |
1578 | + sims.append(sim); |
1579 | + } |
1580 | + } |
1581 | + if (sims.count() != presentSims.count()) { |
1582 | + presentSims = sims; |
1583 | + if (watcher) { |
1584 | + Q_EMIT watcher->presentSimListChanged(); |
1585 | + } |
1586 | + if (watcher) { |
1587 | + Q_EMIT watcher->presentSimCountChanged(); |
1588 | + } |
1589 | + } else { |
1590 | + n = sims.count(); |
1591 | + for (i=0; i<n; i++) { |
1592 | + if (sims.at(i).data() != presentSims.at(i).data()) { |
1593 | + presentSims = sims; |
1594 | + if (watcher) { |
1595 | + Q_EMIT watcher->presentSimListChanged(); |
1596 | + } |
1597 | + break; |
1598 | + } |
1599 | + } |
1600 | + } |
1601 | + updateValid(); |
1602 | +} |
1603 | + |
1604 | +void QOfonoSimWatcher::Private::updateValid() |
1605 | +{ |
1606 | + // This object is valid if QOfonoManager and all SIM managers are valid. |
1607 | + bool isValid = ofono->available(); |
1608 | + if (isValid) { |
1609 | + QList<QOfonoSimManager::SharedPointer> sims = allSims.values(); |
1610 | + const int n = sims.count(); |
1611 | + for (int i=0; i<n && isValid; i++) { |
1612 | + isValid = sims.at(i)->isValid(); |
1613 | + } |
1614 | + } |
1615 | + if (valid != isValid) { |
1616 | + valid = isValid; |
1617 | + if (watcher) { |
1618 | + Q_EMIT watcher->validChanged(); |
1619 | + } |
1620 | + } |
1621 | +} |
1622 | + |
1623 | +QOfonoSimWatcher::QOfonoSimWatcher(QObject *parent) : |
1624 | + QObject(parent), |
1625 | + d_ptr(new Private(this)) |
1626 | +{ |
1627 | +} |
1628 | + |
1629 | +QOfonoSimWatcher::~QOfonoSimWatcher() |
1630 | +{ |
1631 | + d_ptr->watcher = NULL; |
1632 | + d_ptr->deleteLater(); |
1633 | +} |
1634 | + |
1635 | +bool QOfonoSimWatcher::isValid() const |
1636 | +{ |
1637 | + return d_ptr->valid; |
1638 | +} |
1639 | + |
1640 | +int QOfonoSimWatcher::presentSimCount() const |
1641 | +{ |
1642 | + return d_ptr->presentSims.count(); |
1643 | +} |
1644 | + |
1645 | +QList<QOfonoSimManager::SharedPointer> QOfonoSimWatcher::presentSimList() const |
1646 | +{ |
1647 | + return d_ptr->presentSims; |
1648 | +} |
1649 | + |
1650 | +bool QOfonoSimWatcher::requireSubscriberIdentity() const |
1651 | +{ |
1652 | + return d_ptr->requireSubscriberIdentity; |
1653 | +} |
1654 | + |
1655 | +void QOfonoSimWatcher::setRequireSubscriberIdentity(bool require) |
1656 | +{ |
1657 | + if (d_ptr->requireSubscriberIdentity != require) { |
1658 | + d_ptr->requireSubscriberIdentity = require; |
1659 | + d_ptr->updateSims(); |
1660 | + } |
1661 | +} |
1662 | + |
1663 | +#include "qofonosimwatcher.moc" |
1664 | |
1665 | === added file 'src/qofonosimwatcher.h' |
1666 | --- src/qofonosimwatcher.h 1970-01-01 00:00:00 +0000 |
1667 | +++ src/qofonosimwatcher.h 2016-03-23 19:33:02 +0000 |
1668 | @@ -0,0 +1,49 @@ |
1669 | +/**************************************************************************** |
1670 | +** |
1671 | +** Copyright (C) 2015 Jolla Ltd. |
1672 | +** Contact: slava.monich@jolla.com |
1673 | +** |
1674 | +** GNU Lesser General Public License Usage |
1675 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
1676 | +** General Public License version 2.1 as published by the Free Software |
1677 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
1678 | +** packaging of this file. Please review the following information to |
1679 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
1680 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1681 | +** |
1682 | +****************************************************************************/ |
1683 | + |
1684 | +#ifndef QOFONOSIMWATCHER_H |
1685 | +#define QOFONOSIMWATCHER_H |
1686 | + |
1687 | +#include "qofono_global.h" |
1688 | +#include "qofonosimmanager.h" |
1689 | + |
1690 | +// Watches present SIM cards |
1691 | +class QOFONOSHARED_EXPORT QOfonoSimWatcher : public QObject |
1692 | +{ |
1693 | + Q_OBJECT |
1694 | + Q_PROPERTY(bool valid READ isValid NOTIFY validChanged) |
1695 | + Q_PROPERTY(int presentSimCount READ presentSimCount NOTIFY presentSimCountChanged) |
1696 | + |
1697 | +public: |
1698 | + explicit QOfonoSimWatcher(QObject *parent = 0); |
1699 | + ~QOfonoSimWatcher(); |
1700 | + |
1701 | + bool isValid() const; |
1702 | + bool requireSubscriberIdentity() const; |
1703 | + void setRequireSubscriberIdentity(bool require); |
1704 | + int presentSimCount() const; |
1705 | + QList<QOfonoSimManager::SharedPointer> presentSimList() const; |
1706 | + |
1707 | +Q_SIGNALS: |
1708 | + void validChanged(); |
1709 | + void presentSimCountChanged(); |
1710 | + void presentSimListChanged(); |
1711 | + |
1712 | +private: |
1713 | + class Private; |
1714 | + Private* d_ptr; |
1715 | +}; |
1716 | + |
1717 | +#endif // QOFONOSIMWATCHER_H |
1718 | |
1719 | === modified file 'src/qofonoutils_p.h' |
1720 | --- src/qofonoutils_p.h 2014-05-23 10:00:21 +0000 |
1721 | +++ src/qofonoutils_p.h 2016-03-23 19:33:02 +0000 |
1722 | @@ -1,6 +1,6 @@ |
1723 | /**************************************************************************** |
1724 | ** |
1725 | -** Copyright (C) 2014 Jolla Ltd. |
1726 | +** Copyright (C) 2014-2016 Jolla Ltd. |
1727 | ** Contact: lorn.potter@jollamobile.com |
1728 | ** |
1729 | ** GNU Lesser General Public License Usage |
1730 | @@ -36,6 +36,18 @@ |
1731 | return v1 == v2; |
1732 | } |
1733 | |
1734 | +inline bool isTimeout(const QDBusError &error) |
1735 | +{ |
1736 | + switch (error.type()) { |
1737 | + case QDBusError::NoReply: |
1738 | + case QDBusError::Timeout: |
1739 | + case QDBusError::TimedOut: |
1740 | + return true; |
1741 | + default: |
1742 | + return false; |
1743 | + } |
1744 | +} |
1745 | + |
1746 | } |
1747 | |
1748 | #endif // QOFONOUTILS_P_H |
1749 | |
1750 | === modified file 'src/qofonovoicecallmanager.cpp' |
1751 | --- src/qofonovoicecallmanager.cpp 2015-01-09 11:35:34 +0000 |
1752 | +++ src/qofonovoicecallmanager.cpp 2016-03-23 19:33:02 +0000 |
1753 | @@ -1,6 +1,6 @@ |
1754 | /***************************************************`************************* |
1755 | ** |
1756 | -** Copyright (C) 2013-2015 Jolla Ltd. |
1757 | +** Copyright (C) 2013-2016 Jolla Ltd. |
1758 | ** Contact: lorn.potter@jollamobile.com |
1759 | ** |
1760 | ** GNU Lesser General Public License Usage |
1761 | @@ -14,6 +14,7 @@ |
1762 | ****************************************************************************/ |
1763 | |
1764 | #include "qofonovoicecallmanager.h" |
1765 | +#include "qofonoutils_p.h" |
1766 | #include "ofono_voicecallmanager_interface.h" |
1767 | |
1768 | #define SUPER QOfonoModemInterface |
1769 | @@ -27,6 +28,12 @@ |
1770 | |
1771 | Private() : initialized(false) {} |
1772 | |
1773 | + static void getCalls(QOfonoVoiceCallManager *parent, OfonoVoiceCallManager* iface) { |
1774 | + connect(new QDBusPendingCallWatcher(iface->GetCalls(), iface), |
1775 | + SIGNAL(finished(QDBusPendingCallWatcher*)), parent, |
1776 | + SLOT(onGetCallsFinished(QDBusPendingCallWatcher*))); |
1777 | + } |
1778 | + |
1779 | class Watcher : public QDBusPendingCallWatcher { |
1780 | public: |
1781 | typedef void (QOfonoVoiceCallManager::*Signal)(bool); |
1782 | @@ -76,9 +83,6 @@ |
1783 | QDBusAbstractInterface *QOfonoVoiceCallManager::createDbusInterface(const QString &path) |
1784 | { |
1785 | OfonoVoiceCallManager* iface = new OfonoVoiceCallManager("org.ofono", path, QDBusConnection::systemBus(), this); |
1786 | - connect(new QDBusPendingCallWatcher(iface->GetCalls(), iface), |
1787 | - SIGNAL(finished(QDBusPendingCallWatcher*)), |
1788 | - SLOT(onGetCallsFinished(QDBusPendingCallWatcher*))); |
1789 | connect(iface, |
1790 | SIGNAL(CallAdded(QDBusObjectPath,QVariantMap)), |
1791 | SLOT(onCallAdded(QDBusObjectPath,QVariantMap))); |
1792 | @@ -87,6 +91,7 @@ |
1793 | SLOT(onCallRemoved(QDBusObjectPath))); |
1794 | connect(iface, SIGNAL(BarringActive(QString)), SIGNAL(barringActive(QString))); |
1795 | connect(iface, SIGNAL(Forwarded(QString)), SIGNAL(forwarded(QString))); |
1796 | + Private::getCalls(this, iface); |
1797 | return iface; |
1798 | } |
1799 | |
1800 | @@ -269,15 +274,21 @@ |
1801 | watch->deleteLater(); |
1802 | QDBusPendingReply<ObjectPathPropertiesList> reply(*watch); |
1803 | if (reply.isError()) { |
1804 | - qDebug() << reply.error(); |
1805 | - Q_EMIT reportError(reply.error().message()); |
1806 | + if (qofono::isTimeout(reply.error())) { |
1807 | + // Retry GetCalls call if it times out |
1808 | + qDebug() << "Retrying GetCalls..."; |
1809 | + Private::getCalls(this, (OfonoVoiceCallManager*)dbusInterface()); |
1810 | + } else { |
1811 | + qDebug() << reply.error(); |
1812 | + Q_EMIT reportError(reply.error().message()); |
1813 | + } |
1814 | } else { |
1815 | + ValidTracker valid(this); |
1816 | ObjectPathPropertiesList list = reply.value(); |
1817 | privateData()->initialized = true; |
1818 | for (int i=0; i<list.count(); i++) { |
1819 | addCall(list[i].path.path()); |
1820 | } |
1821 | - if (isValid()) validChanged(true); |
1822 | } |
1823 | } |
1824 | |
1825 | |
1826 | === modified file 'src/src.pro' |
1827 | --- src/src.pro 2015-01-09 11:35:34 +0000 |
1828 | +++ src/src.pro 2016-03-23 19:33:02 +0000 |
1829 | @@ -66,8 +66,6 @@ |
1830 | qofono.prf \ |
1831 | qofono-qt5.prf |
1832 | |
1833 | -INSTALLS += target |
1834 | - |
1835 | SOURCES += \ |
1836 | qofono.cpp \ |
1837 | qofonodbustypes.cpp \ |
1838 | @@ -96,6 +94,7 @@ |
1839 | qofonomessagemanager.cpp \ |
1840 | qofonomessagewaiting.cpp \ |
1841 | qofonosimmanager.cpp \ |
1842 | + qofonosimwatcher.cpp \ |
1843 | qofonophonebook.cpp \ |
1844 | qofonopositioningrequestagent.cpp \ |
1845 | qofonosmartmessaging.cpp \ |
1846 | @@ -135,6 +134,7 @@ |
1847 | qofonomessagemanager.h \ |
1848 | qofonomessagewaiting.h \ |
1849 | qofonosimmanager.h \ |
1850 | + qofonosimwatcher.h \ |
1851 | qofonophonebook.h \ |
1852 | qofonopositioningrequestagent.h \ |
1853 | qofonosmartmessaging.h \ |
1854 | @@ -333,5 +333,3 @@ |
1855 | |
1856 | |
1857 | INSTALLS += target headers qtconfig xmlfiles pkgconfig |
1858 | - |
1859 | - |
1860 | |
1861 | === modified file 'src/version.pri' |
1862 | --- src/version.pri 2015-09-10 12:31:20 +0000 |
1863 | +++ src/version.pri 2016-03-23 19:33:02 +0000 |
1864 | @@ -1,1 +1,1 @@ |
1865 | -VERSION = 0.82 |
1866 | +VERSION = 0.90 |
LGTM! Thanks.