Merge lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch into lp:ubuntu-system-settings/rtm-14.09

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 987
Merged at revision: 989
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 871 lines (+413/-98)
18 files modified
debian/control (+1/-1)
plugins/about/PageComponent.qml (+11/-6)
plugins/cellular/CMakeLists.txt (+2/-0)
plugins/cellular/Components/DataMultiSim.qml (+10/-2)
plugins/cellular/Components/MultiSim.qml (+48/-23)
plugins/cellular/Components/RadioSingleSim.qml (+43/-13)
plugins/cellular/Components/Sim.qml (+26/-3)
plugins/cellular/Components/SingleSim.qml (+4/-0)
plugins/cellular/PageComponent.qml (+80/-16)
plugins/cellular/connectivity.cpp (+49/-0)
plugins/cellular/connectivity.h (+35/-0)
plugins/cellular/plugin.cpp (+11/-0)
plugins/cellular/sims.js (+21/-0)
plugins/phone/PageComponent.qml (+4/-14)
plugins/phone/sims.js (+21/-0)
plugins/security-privacy/PageComponent.qml (+8/-19)
plugins/security-privacy/sims.js (+25/-0)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+14/-1)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/rtm-techswitch
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+248811@code.launchpad.net

Commit message

[cellular] using libqofono-0.7 and including functionality for enabling users to change what modem has 3G

Description of the change

(included https://code.launchpad.net/~jonas-drange/ubuntu-system-settings/libqofono-0.70-ready/+merge/246371 )

[cellular] using libqofono-0.7 and including functionality for enabling users to change what modem has 3G

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
986. By Jonas G. Drange

fix dep

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
987. By Jonas G. Drange

need u-s-s module for title

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Thanks, looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-01-30 18:36:21 +0000
+++ debian/control 2015-02-09 14:18:57 +0000
@@ -68,7 +68,7 @@
68 qml-module-qtmultimedia | qml-module-qtmultimedia-gles,68 qml-module-qtmultimedia | qml-module-qtmultimedia-gles,
69 qml-module-ubuntu-connectivity,69 qml-module-ubuntu-connectivity,
70 qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1),70 qtdeclarative5-gsettings1.0 (>=0.1+14.10.20140801.1),
71 qtdeclarative5-ofono0.2 (>=0.53),71 qtdeclarative5-ofono0.2 (>=0.70~),
72 qtdeclarative5-systeminfo-plugin,72 qtdeclarative5-systeminfo-plugin,
73 qtdeclarative5-ubuntu-content1,73 qtdeclarative5-ubuntu-content1,
74 qtdeclarative5-ubuntu-settings-components (>> 0.2),74 qtdeclarative5-ubuntu-settings-components (>> 0.2),
7575
=== modified file 'plugins/about/PageComponent.qml'
--- plugins/about/PageComponent.qml 2015-01-16 15:27:56 +0000
+++ plugins/about/PageComponent.qml 2015-02-09 14:18:57 +0000
@@ -33,7 +33,7 @@
3333
34 title: i18n.tr("About this phone")34 title: i18n.tr("About this phone")
35 flickable: scrollWidget35 flickable: scrollWidget
36 property var modemsSorted: manager.modems.slice(0).sort()36 property var modemsSorted: []
3737
38 UbuntuStorageAboutPanel {38 UbuntuStorageAboutPanel {
39 id: backendInfos39 id: backendInfos
@@ -49,11 +49,16 @@
4949
50 OfonoManager {50 OfonoManager {
51 id: manager51 id: manager
52 Component.onCompleted: {52 onModemsChanged: {
53 if (manager.modems.length === 1) {53 root.modemsSorted = modems.slice(0).sort();
54 phoneNumbers.setSource("PhoneNumber.qml", {path: manager.modems[0]})54 if (modems.length === 1) {
55 } else if (manager.modems.length > 1) {55 phoneNumbers.setSource("PhoneNumber.qml", {
56 phoneNumbers.setSource("PhoneNumbers.qml", {paths: modemsSorted})56 path: manager.modems[0]
57 });
58 } else if (modems.length > 1) {
59 phoneNumbers.setSource("PhoneNumbers.qml", {
60 paths: root.modemsSorted
61 });
57 }62 }
58 }63 }
59 }64 }
6065
=== modified file 'plugins/cellular/CMakeLists.txt'
--- plugins/cellular/CMakeLists.txt 2014-12-16 16:22:29 +0000
+++ plugins/cellular/CMakeLists.txt 2015-02-09 14:18:57 +0000
@@ -24,6 +24,8 @@
24 hotspotmanager.h24 hotspotmanager.h
25 ofonoactivator.cpp25 ofonoactivator.cpp
26 ofonoactivator.h26 ofonoactivator.h
27 connectivity.cpp
28 connectivity.h
27 nm_manager_proxy.h29 nm_manager_proxy.h
28 nm_settings_proxy.h30 nm_settings_proxy.h
29 nm_settings_connection_proxy.h31 nm_settings_connection_proxy.h
3032
=== modified file 'plugins/cellular/Components/DataMultiSim.qml'
--- plugins/cellular/Components/DataMultiSim.qml 2014-11-18 20:13:35 +0000
+++ plugins/cellular/Components/DataMultiSim.qml 2015-02-09 14:18:57 +0000
@@ -23,6 +23,8 @@
2323
24Column {24Column {
2525
26 property string prevOnlineModem: parent.prevOnlineModem
27
26 function getNameFromIndex (index) {28 function getNameFromIndex (index) {
27 if (index === 0) {29 if (index === 0) {
28 return i18n.tr("Off");30 return i18n.tr("Off");
@@ -50,8 +52,14 @@
50 objectName: "use" + modelData52 objectName: "use" + modelData
51 text: getNameFromIndex(index)53 text: getNameFromIndex(index)
52 }54 }
53 selectedIndex: [true, sims[0].connMan.powered, sims[1].connMan.powered]55 selectedIndex: {
54 .lastIndexOf(true)56 if (prevOnlineModem) {
57 return model.indexOf(prevOnlineModem);
58 } else {
59 return [true, sims[0].connMan.powered, sims[1].connMan.powered]
60 .lastIndexOf(true);
61 }
62 }
5563
56 onDelegateClicked: {64 onDelegateClicked: {
57 // power all sims on or off65 // power all sims on or off
5866
=== modified file 'plugins/cellular/Components/MultiSim.qml'
--- plugins/cellular/Components/MultiSim.qml 2014-12-16 16:22:29 +0000
+++ plugins/cellular/Components/MultiSim.qml 2015-02-09 14:18:57 +0000
@@ -19,6 +19,7 @@
19*/19*/
20import QtQuick 2.020import QtQuick 2.0
21import GSettings 1.021import GSettings 1.0
22import SystemSettings 1.0
22import Ubuntu.Components 0.123import Ubuntu.Components 0.1
23import Ubuntu.Components.ListItems 0.1 as ListItem24import Ubuntu.Components.ListItems 0.1 as ListItem
2425
@@ -36,14 +37,17 @@
36 return s;37 return s;
37 }38 }
38 property var modems39 property var modems
39 // make settings available to all children of root
40 property var settings: phoneSettings40 property var settings: phoneSettings
41 property string prevOnlineModem: ""
42
43 /* @sim a Sim.qml component containing libqofono bindings
44 @prevOnlineModem path to modem that was online before modem reset */
45 signal umtsModemChanged (var sim, string prevOnlineModem);
4146
42 DataMultiSim {47 DataMultiSim {
43 anchors { left: parent.left; right: parent.right }48 anchors { left: parent.left; right: parent.right }
44 }49 }
4550
46
47 ListItem.SingleValue {51 ListItem.SingleValue {
48 text : i18n.tr("Hotspot disabled because Wi-Fi is off.")52 text : i18n.tr("Hotspot disabled because Wi-Fi is off.")
49 visible: showAllUI && !hotspotItem.visible53 visible: showAllUI && !hotspotItem.visible
@@ -95,13 +99,7 @@
9599
96 ListItem.Divider {}100 ListItem.Divider {}
97101
98 function techToString (tech) {102 SettingsItemTitle { text: i18n.tr("Connection type:") }
99 return {
100 'gsm': i18n.tr("2G only (saves battery)"),
101 'umts': i18n.tr("2G/3G (faster)"),
102 'lte': i18n.tr("2G/3G/4G (faster)")
103 }[tech]
104 }
105103
106 Repeater {104 Repeater {
107 model: sims105 model: sims
@@ -109,27 +107,54 @@
109 ListItem.ItemSelector {107 ListItem.ItemSelector {
110 id: radio108 id: radio
111 property var sim: modelData109 property var sim: modelData
112 property var rSettings: sim.radioSettings110
113 property string techPref: rSettings.technologyPreference
114 property var modemTechs: rSettings.modemTechnologies
115 expanded: true111 expanded: true
116 text: i18n.tr("Connection type:")112 text: sim.title
117 model: modemTechs || []113 model: sim.radioSettings.modemTechnologies
118 delegate: OptionSelectorDelegate {114 delegate: OptionSelectorDelegate {
119 objectName: sim.path + "_radio_" + modelData115 objectName: sim.path + "_radio_" + modelData
120 text: techToString(modelData)116 text: sim.techToString(modelData)
121 }117 }
122 enabled: techPref !== ""118 enabled: sim.radioSettings.technologyPreference !== ""
123 visible: sim.connMan.powered119 selectedIndex: sim.radioSettings.technologyPreference !== "" ?
124 selectedIndex: techPref !== "" ? model.indexOf(techPref) : -1120 model.indexOf(sim.radioSettings.technologyPreference) : -1
125 onDelegateClicked: rSettings.technologyPreference = model[index];121
122 onDelegateClicked: {
123 if (model[index] === 'umts_enable') {
124 sim.radioSettings.technologyPreference = 'umts';
125 umtsModemChanged(sim, poweredSim ? poweredSim.path : "");
126 sim.mtkSettings.has3G = true;
127 } else {
128 sim.radioSettings.technologyPreference = model[index];
129 }
130 }
131
126 Connections {132 Connections {
127 target: rSettings133 target: sim.radioSettings
128 onTechnologyPreferenceChanged: {134 onTechnologyPreferenceChanged: radio.selectedIndex =
129 radio.selectedIndex = modemTechs.indexOf(preference)135 sim.radioSettings.modemTechnologies.indexOf(preference)
136
137 onModemTechnologiesChanged: {
138 if ((technologies.indexOf('umts') === -1)
139 && (sim.mtkSettings.has3G === false)) {
140 radio.model = sim.addUmtsEnableToModel(technologies);
141 } else {
142 radio.model = technologies;
143 }
144 radio.selectedIndex = sim.radioSettings.technologyPreference !== "" ?
145 model.indexOf(sim.radioSettings.technologyPreference) : -1
130 }146 }
131 ignoreUnknownSignals: true147 ignoreUnknownSignals: true
132 }148 }
149
150 Component.onCompleted: {
151 if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1)
152 && (sim.mtkSettings.has3G === false)) {
153 radio.model = sim.addUmtsEnableToModel(sim.radioSettings.modemTechnologies);
154 } else {
155 radio.model = sim.radioSettings.modemTechnologies;
156 }
157 }
133 }158 }
134 }159 }
135160
136161
=== modified file 'plugins/cellular/Components/RadioSingleSim.qml'
--- plugins/cellular/Components/RadioSingleSim.qml 2014-12-16 16:22:29 +0000
+++ plugins/cellular/Components/RadioSingleSim.qml 2015-02-09 14:18:57 +0000
@@ -22,36 +22,66 @@
22import Ubuntu.Components.ListItems 0.1 as ListItem22import Ubuntu.Components.ListItems 0.1 as ListItem
2323
24Column {24Column {
25 id: radioSingleSim
25 height: childrenRect.height26 height: childrenRect.height
2627
27 property bool enabled: sim.radioSettings.technologyPreference !== ""28 property bool enabled: sim.radioSettings.technologyPreference !== ""
2829
29 ListItem.ItemSelector {30 ListItem.ItemSelector {
30 id: selector31 id: selector
31 text: i18n.tr("Connection type:")
32 showDivider: false32 showDivider: false
33 expanded: true33 expanded: true
3434
35 // an empty string is not a valid preference, which means35 // an empty string is not a valid preference, which means
36 // we disregard the interace and disable the selector36 // we disregard the interace and disable the selector
37 enabled: parent.enabled37 enabled: parent.enabled
38 model: sim.radioSettings.modemTechnologies || []38 model: sim.radioSettings.modemTechnologies
39
40 delegate: OptionSelectorDelegate {39 delegate: OptionSelectorDelegate {
41 objectName: sim.path + "_radio_" + modelData40 objectName: sim.path + "_radio_" + modelData
42 text: {41 text: sim.techToString(modelData)
43 return {
44 'gsm': i18n.tr("2G only (saves battery)"),
45 'umts': i18n.tr("2G/3G (faster)"),
46 'lte': i18n.tr("2G/3G/4G (faster)")
47 }[modelData]
48 }
49 showDivider: false42 showDivider: false
50 }43 }
51 selectedIndex: model.length ?44 selectedIndex:
52 model.indexOf(sim.radioSettings.technologyPreference) : -145 sim.radioSettings.technologyPreference !== "" ?
46 model.indexOf(sim.radioSettings.technologyPreference) : -1
47
53 onDelegateClicked: {48 onDelegateClicked: {
54 sim.radioSettings.technologyPreference = model[index];49 if (model[index] === 'umts_enable') {
50 sim.radioSettings.technologyPreference = 'umts';
51 radioSingleSim.parent.umtsModemChanged(sim, sim.connMan.powered ? sim.path : "");
52 sim.mtkSettings.has3G = true;
53 } else {
54 sim.radioSettings.technologyPreference = model[index];
55 }
56 }
57
58 Connections {
59 target: sim.radioSettings
60
61 onTechnologyPreferenceChanged: selector.selectedIndex =
62 sim.radioSettings.modemTechnologies.indexOf(preference)
63
64 onModemTechnologiesChanged: {
65 if ((technologies.indexOf('umts') === -1)
66 && (sim.mtkSettings.has3G === false)) {
67 selector.model = sim.addUmtsEnableToModel(technologies);
68 } else {
69 selector.model = technologies;
70 }
71 selector.selectedIndex = sim.radioSettings.technologyPreference !== "" ?
72 selector.model.indexOf(sim.radioSettings.technologyPreference) : -1
73 }
74 ignoreUnknownSignals: true
75 }
76
77 Component.onCompleted: {
78 if ((sim.radioSettings.modemTechnologies.indexOf('umts') === -1)
79 && (sim.mtkSettings.has3G === false)) {
80 selector.model = sim.addUmtsEnableToModel(
81 sim.radioSettings.modemTechnologies);
82 } else {
83 selector.model = sim.radioSettings.modemTechnologies;
84 }
55 }85 }
56 }86 }
57}87}
5888
=== modified file 'plugins/cellular/Components/Sim.qml'
--- plugins/cellular/Components/Sim.qml 2014-10-07 15:41:44 +0000
+++ plugins/cellular/Components/Sim.qml 2015-02-09 14:18:57 +0000
@@ -27,6 +27,7 @@
27 property alias radioSettings: radioSettings27 property alias radioSettings: radioSettings
28 property alias simMng: simMng28 property alias simMng: simMng
29 property alias connMan: connMan29 property alias connMan: connMan
30 property alias mtkSettings: mtkSettings
3031
31 property alias present: simMng.present32 property alias present: simMng.present
32 property string path33 property string path
@@ -36,14 +37,31 @@
36 return name + (number ? " (" + number + ")" : "");37 return name + (number ? " (" + number + ")" : "");
37 }38 }
3839
40 function techToString (tech) {
41 var strings = {
42 'gsm': i18n.tr("2G only (saves battery)"),
43 'umts': i18n.tr("2G/3G (faster)"),
44 'lte': i18n.tr("2G/3G/4G (faster)")
45 };
46 strings['umts_enable'] = strings['umts'];
47 return strings[tech];
48 }
49
50 // adds umts_enable to an copy of model
51 function addUmtsEnableToModel (model) {
52 var newModel = model.slice(0);
53 newModel.push('umts_enable');
54 return newModel;
55 }
56
39 OfonoModem {57 OfonoModem {
40 id: modem58 id: modem
41 modemPath: path59 modemPath: path
42 onInterfacesChanged: {60 onInterfacesChanged: {
43 if (interfaces.indexOf('org.ofono.ConnectionManager') >= 0) {61 if (interfaces.indexOf('org.ofono.MtkSettings') >= 0) {
44 connMan._valid = true;62 mtkSettings._valid = true;
45 } else {63 } else {
46 connMan._valid = false;64 mtkSettings._valid = false;
47 }65 }
48 }66 }
49 }67 }
@@ -65,6 +83,11 @@
6583
66 OfonoConnMan {84 OfonoConnMan {
67 id: connMan85 id: connMan
86 modemPath: path
87 }
88
89 OfonoMtkSettings {
90 id: mtkSettings
68 property bool _valid: true91 property bool _valid: true
69 modemPath: path92 modemPath: path
70 on_ValidChanged: {93 on_ValidChanged: {
7194
=== modified file 'plugins/cellular/Components/SingleSim.qml'
--- plugins/cellular/Components/SingleSim.qml 2014-12-16 16:22:29 +0000
+++ plugins/cellular/Components/SingleSim.qml 2015-02-09 14:18:57 +0000
@@ -28,6 +28,10 @@
2828
29 property var sim29 property var sim
3030
31 /* @sim a Sim.qml component containing libqofono bindings
32 @prevOnlineModem path to modem that was online before this event */
33 signal umtsModemChanged (var sim, string prevOnlineModem);
34
31 ListItem.Standard {35 ListItem.Standard {
32 id: selector36 id: selector
33 text: i18n.tr("Cellular data:")37 text: i18n.tr("Cellular data:")
3438
=== modified file 'plugins/cellular/PageComponent.qml'
--- plugins/cellular/PageComponent.qml 2014-11-18 20:13:35 +0000
+++ plugins/cellular/PageComponent.qml 2015-02-09 14:18:57 +0000
@@ -20,6 +20,7 @@
2020
21import QtQuick 2.021import QtQuick 2.0
22import SystemSettings 1.022import SystemSettings 1.0
23import Ubuntu.SystemSettings.Cellular 1.0
23import Ubuntu.Components 0.124import Ubuntu.Components 0.1
24import Ubuntu.Components.ListItems 0.1 as ListItem25import Ubuntu.Components.ListItems 0.1 as ListItem
25import MeeGo.QOfono 0.226import MeeGo.QOfono 0.2
@@ -32,11 +33,31 @@
32 title: i18n.tr("Cellular")33 title: i18n.tr("Cellular")
33 objectName: "cellularPage"34 objectName: "cellularPage"
3435
35 property var modemsSorted: manager.modems.slice(0).sort()36 property var modemsSorted: []
36 property int simsLoaded: 037 property int simsLoaded: 0
3738
39 // waiting during modem reboots or for modems to come online
40 property bool waiting: true
41
42 QtObject {
43 id: priv
44 property string prevOnlineModem: ""
45 }
46
38 states: [47 states: [
39 State {48 State {
49 name: "waiting"
50 when: waiting
51 PropertyChanges {
52 target: waitIndicator
53 opacity: 1
54 }
55 PropertyChanges {
56 target: flick
57 opacity: 0
58 }
59 },
60 State {
40 name: "noSim"61 name: "noSim"
41 when: (simsLoaded === 0) || (Sims.getPresentCount() === 0)62 when: (simsLoaded === 0) || (Sims.getPresentCount() === 0)
42 StateChangeScript {63 StateChangeScript {
@@ -47,7 +68,8 @@
47 name: "singleSim"68 name: "singleSim"
48 StateChangeScript {69 StateChangeScript {
49 script: loader.setSource("Components/SingleSim.qml", {70 script: loader.setSource("Components/SingleSim.qml", {
50 sim: Sims.getFirstPresent()71 sim: Sims.getFirstPresent(),
72 prevOnlineModem: priv.prevOnlineModem
51 })73 })
52 }74 }
53 when: simsLoaded && (Sims.getPresentCount() === 1)75 when: simsLoaded && (Sims.getPresentCount() === 1)
@@ -57,7 +79,8 @@
57 StateChangeScript {79 StateChangeScript {
58 script: loader.setSource("Components/MultiSim.qml", {80 script: loader.setSource("Components/MultiSim.qml", {
59 sims: Sims.getAll(),81 sims: Sims.getAll(),
60 modems: modemsSorted82 modems: modemsSorted,
83 prevOnlineModem: priv.prevOnlineModem
61 })84 })
62 }85 }
63 when: simsLoaded && (Sims.getPresentCount() > 1)86 when: simsLoaded && (Sims.getPresentCount() > 1)
@@ -66,19 +89,10 @@
6689
67 OfonoManager {90 OfonoManager {
68 id: manager91 id: manager
69 Component.onCompleted: {92 onModemsChanged: {
70 var component = Qt.createComponent("Components/Sim.qml");93 root.modemsSorted = modems.slice(0).sort();
71 modemsSorted.forEach(function (path) {94 Sims.createQML();
72 var sim = component.createObject(root, {95 root.waiting = false;
73 path: path
74 });
75 if (sim === null) {
76 console.warn('Failed to create Sim qml:',
77 component.errorString());
78 } else {
79 Sims.add(sim);
80 }
81 });
82 }96 }
83 }97 }
8498
@@ -95,12 +109,30 @@
95 }109 }
96 }110 }
97111
112 Item {
113 id: waitIndicator
114 anchors.fill: parent
115 opacity: 0
116
117 ActivityIndicator {
118 anchors.centerIn: parent
119 running: true
120 }
121
122 Behavior on opacity {
123 PropertyAnimation {
124 duration: UbuntuAnimation.SleepyDuration
125 }
126 }
127 }
128
98 Flickable {129 Flickable {
99 id: flick130 id: flick
100 anchors.fill: parent131 anchors.fill: parent
101 contentWidth: parent.width132 contentWidth: parent.width
102 contentHeight: contentItem.childrenRect.height133 contentHeight: contentItem.childrenRect.height
103 boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds134 boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
135
104 Column {136 Column {
105 anchors { left: parent.left; right: parent.right }137 anchors { left: parent.left; right: parent.right }
106 Loader {138 Loader {
@@ -108,5 +140,37 @@
108 anchors { left: parent.left; right: parent.right }140 anchors { left: parent.left; right: parent.right }
109 }141 }
110 }142 }
143
144 Behavior on opacity {
145 PropertyAnimation {
146 duration: UbuntuAnimation.SleepyDuration
147 }
148 }
149
150 Connections {
151 target: loader.item
152
153 onUmtsModemChanged: {
154 var path = sim.path;
155 var e = sim.simMng.presenceChanged;
156
157 function presenceHandler (ispresent) {
158 if (ispresent) {
159 root.waiting = false;
160 Connectivity.unlockAllModems();
161 e.disconnect(presenceHandler);
162 }
163 }
164
165 priv.prevOnlineModem = prevOnlineModem ?
166 prevOnlineModem : "";
167 root.waiting = true;
168
169 /* When the SIM comes back online, set waiting to false:
170 the modem reboot is done.*/
171 sim.simMng.presenceChanged.connect(presenceHandler);
172 }
173 ignoreUnknownSignals: true
174 }
111 }175 }
112}176}
113177
=== added file 'plugins/cellular/connectivity.cpp'
--- plugins/cellular/connectivity.cpp 1970-01-01 00:00:00 +0000
+++ plugins/cellular/connectivity.cpp 2015-02-09 14:18:57 +0000
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * Authors:
5 * Jonas G. Drange <jonas.drange@canonical.com>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 3, as published
9 * by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <QDBusReply>
21#include <QtDebug>
22#include <QDBusInterface>
23#include "connectivity.h"
24
25namespace {
26 const QString conn_service("com.ubuntu.connectivity1");
27 const QString conn_object("/com/ubuntu/connectivity1/Private");
28 const QString conn_interface("com.ubuntu.connectivity1.Private");
29 const QString conn_unlockall_method("UnlockAllModems");
30}
31
32Connectivity::Connectivity(QObject *parent) : QObject(parent)
33{
34}
35
36void Connectivity::unlockAllModems() {
37
38 QDBusInterface connectivityIface (
39 conn_service,
40 conn_object,
41 conn_interface,
42 QDBusConnection::sessionBus(),
43 this);
44
45 auto reply = connectivityIface.call(conn_unlockall_method);
46 if (reply.type() == QDBusMessage::ErrorMessage) {
47 qWarning() << "Failed to unlock modems" << reply.errorMessage();
48 }
49}
050
=== added file 'plugins/cellular/connectivity.h'
--- plugins/cellular/connectivity.h 1970-01-01 00:00:00 +0000
+++ plugins/cellular/connectivity.h 2015-02-09 14:18:57 +0000
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * Authors:
5 * Jonas G. Drange <jonas.drange@canonical.com>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 3, as published
9 * by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CELLULAR_CONNECTIVITY_HELPER
21#define CELLULAR_CONNECTIVITY_HELPER
22
23#include <QObject>
24
25class Connectivity : public QObject {
26 Q_OBJECT
27
28public:
29 explicit Connectivity(QObject *parent = nullptr);
30 ~Connectivity() {};
31
32 Q_INVOKABLE void unlockAllModems();
33};
34
35#endif
036
=== modified file 'plugins/cellular/plugin.cpp'
--- plugins/cellular/plugin.cpp 2014-08-29 14:32:28 +0000
+++ plugins/cellular/plugin.cpp 2015-02-09 14:18:57 +0000
@@ -19,12 +19,23 @@
1919
20#include <QtQml>20#include <QtQml>
21#include <QtQml/QQmlContext>21#include <QtQml/QQmlContext>
22#include "connectivity.h"
22#include "hotspotmanager.h"23#include "hotspotmanager.h"
23#include "ofonoactivator.h"24#include "ofonoactivator.h"
2425
26static QObject *connectivitySingeltonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
27{
28 Q_UNUSED(engine)
29 Q_UNUSED(scriptEngine)
30
31 Connectivity *connectivity = new Connectivity();
32 return connectivity;
33}
34
25void BackendPlugin::registerTypes(const char *uri)35void BackendPlugin::registerTypes(const char *uri)
26{36{
27 Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Cellular"));37 Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Cellular"));
38 qmlRegisterSingletonType<Connectivity>(uri, 1, 0, "Connectivity", connectivitySingeltonProvider);
28 qmlRegisterType<HotspotManager>(uri, 1, 0, "HotspotManager");39 qmlRegisterType<HotspotManager>(uri, 1, 0, "HotspotManager");
29 qmlRegisterType<OfonoActivator>(uri, 1, 0, "OfonoActivator");40 qmlRegisterType<OfonoActivator>(uri, 1, 0, "OfonoActivator");
30}41}
3142
=== modified file 'plugins/cellular/sims.js'
--- plugins/cellular/sims.js 2014-11-18 20:13:35 +0000
+++ plugins/cellular/sims.js 2015-02-09 14:18:57 +0000
@@ -46,3 +46,24 @@
46function getPresentCount () {46function getPresentCount () {
47 return getPresent().length;47 return getPresent().length;
48}48}
49
50function createQML () {
51 var component = Qt.createComponent("Components/Sim.qml");
52
53 sims.forEach(function (sim) {
54 sim.destroy();
55 });
56 sims = [];
57
58 root.modemsSorted.forEach(function (path) {
59 var sim = component.createObject(root, {
60 path: path
61 });
62 if (sim === null) {
63 console.warn('Failed to create Sim qml:',
64 component.errorString());
65 } else {
66 Sims.add(sim);
67 }
68 });
69}
4970
=== modified file 'plugins/phone/PageComponent.qml'
--- plugins/phone/PageComponent.qml 2014-11-10 17:59:34 +0000
+++ plugins/phone/PageComponent.qml 2015-02-09 14:18:57 +0000
@@ -32,7 +32,7 @@
32 title: i18n.tr("Phone")32 title: i18n.tr("Phone")
33 flickable: flick33 flickable: flick
3434
35 property var modemsSorted: manager.modems.slice(0).sort()35 property var modemsSorted: []
36 property var simsLoaded: 036 property var simsLoaded: 0
3737
38 states: [38 states: [
@@ -65,19 +65,9 @@
6565
66 OfonoManager {66 OfonoManager {
67 id: manager67 id: manager
68 Component.onCompleted: {68 onModemsChanged: {
69 // create ofono bindings for all modem paths69 root.modemsSorted = modems.slice(0).sort();
70 var component = Qt.createComponent("Ofono.qml");70 Sims.createQML();
71 modemsSorted.forEach(function (path) {
72 var sim = component.createObject(root, {
73 path: path
74 });
75 if (sim === null) {
76 console.warn('failed to create sim object');
77 } else {
78 Sims.add(sim);
79 }
80 });
81 }71 }
82 }72 }
8373
8474
=== modified file 'plugins/phone/sims.js'
--- plugins/phone/sims.js 2014-10-03 14:08:08 +0000
+++ plugins/phone/sims.js 2015-02-09 14:18:57 +0000
@@ -36,3 +36,24 @@
36function getPresentCount () {36function getPresentCount () {
37 return getPresent().length;37 return getPresent().length;
38}38}
39
40function createQML () {
41 var component = Qt.createComponent("Ofono.qml");
42
43 sims.forEach(function (sim) {
44 sim.destroy();
45 });
46 sims = [];
47
48 root.modemsSorted.forEach(function (path) {
49 var sim = component.createObject(root, {
50 path: path
51 });
52 if (sim === null) {
53 console.warn('Failed to create Sim qml:',
54 component.errorString());
55 } else {
56 Sims.add(sim);
57 }
58 });
59}
3960
=== modified file 'plugins/security-privacy/PageComponent.qml'
--- plugins/security-privacy/PageComponent.qml 2014-11-12 16:28:12 +0000
+++ plugins/security-privacy/PageComponent.qml 2015-02-09 14:18:57 +0000
@@ -39,9 +39,11 @@
3939
40 property alias usePowerd: batteryBackend.powerdRunning40 property alias usePowerd: batteryBackend.powerdRunning
41 property bool lockOnSuspend41 property bool lockOnSuspend
42 property var modemsSorted: manager.modems.slice(0).sort()42 property var modemsSorted: []
43 property var sims43 property var sims: []
44 property int simsPresent: 044 /* glue to something that will emit change events
45 TODO: fix this so that the present count emits events of its own */
46 property int simsPresent: simsLoaded ? Sims.getPresentCount() : 0
45 property int simsLoaded: 047 property int simsLoaded: 0
46 property int simsLocked: {48 property int simsLocked: {
47 var t = 0;49 var t = 0;
@@ -66,23 +68,10 @@
6668
67 OfonoManager {69 OfonoManager {
68 id: manager70 id: manager
69 Component.onCompleted: {71 onModemsChanged: {
70 // create ofono bindings for all modem paths72 root.modemsSorted = modems.slice(0).sort();
71 var component = Qt.createComponent("Ofono.qml");73 Sims.createQML();
72 modemsSorted.forEach(function (path, index) {
73 var sim = component.createObject(root, {
74 path: path,
75 name: phoneSettings.simNames[path] ?
76 phoneSettings.simNames[path] :
77 "SIM " + (index + 1)
78 });
79 if (sim === null)
80 console.warn('failed to create sim object');
81 else
82 Sims.add(sim);
83 });
84 root.sims = Sims.getAll();74 root.sims = Sims.getAll();
85 root.simsPresent = Sims.getPresentCount();
86 }75 }
87 }76 }
8877
8978
=== modified file 'plugins/security-privacy/sims.js'
--- plugins/security-privacy/sims.js 2014-08-27 05:19:24 +0000
+++ plugins/security-privacy/sims.js 2015-02-09 14:18:57 +0000
@@ -32,3 +32,28 @@
32function getPresentCount () {32function getPresentCount () {
33 return getPresent().length;33 return getPresent().length;
34}34}
35
36function createQML () {
37 var component = Qt.createComponent("Ofono.qml");
38
39 sims.forEach(function (sim) {
40 sim.destroy();
41 });
42 sims = [];
43
44 root.modemsSorted.forEach(function (path, index) {
45 var sim = component.createObject(root, {
46 path: path,
47 name: phoneSettings.simNames[path] ?
48 phoneSettings.simNames[path] :
49 "SIM " + (index + 1)
50 });
51 if (sim === null) {
52 console.warn('Failed to create Sim qml:',
53 component.errorString());
54 } else {
55 Sims.add(sim);
56 }
57 });
58}
59
3560
=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-01-29 19:50:34 +0000
+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2015-02-09 14:18:57 +0000
@@ -143,7 +143,7 @@
143143
144 def mock_connection_manager(self, modem):144 def mock_connection_manager(self, modem):
145 modem.AddProperty(CONNMAN_IFACE, 'Powered', dbus.Boolean(1))145 modem.AddProperty(CONNMAN_IFACE, 'Powered', dbus.Boolean(1))
146 modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', False)146 modem.AddProperty(CONNMAN_IFACE, 'RoamingAllowed', dbus.Boolean(0))
147 modem.AddMethods(147 modem.AddMethods(
148 CONNMAN_IFACE,148 CONNMAN_IFACE,
149 [149 [
@@ -156,6 +156,9 @@
156 'self.EmitSignal("IFACE", "PropertyChanged", "sv",\156 'self.EmitSignal("IFACE", "PropertyChanged", "sv",\
157 [args[0], args[1]])'.replace("IFACE", CONNMAN_IFACE)),157 [args[0], args[1]])'.replace("IFACE", CONNMAN_IFACE)),
158 ])158 ])
159 interfaces = modem.GetProperties()['Interfaces']
160 interfaces.append(CONNMAN_IFACE)
161 modem.SetProperty('Interfaces', interfaces)
159162
160 def mock_carriers(self, name):163 def mock_carriers(self, name):
161 self.dbusmock.AddObject(164 self.dbusmock.AddObject(
@@ -208,6 +211,10 @@
208 "PropertyChanged", "sv", [args[0], args[1]])'211 "PropertyChanged", "sv", [args[0], args[1]])'
209 .replace('IFACE', RDO_IFACE)), ])212 .replace('IFACE', RDO_IFACE)), ])
210213
214 interfaces = modem.GetProperties()['Interfaces']
215 interfaces.append(RDO_IFACE)
216 modem.SetProperty('Interfaces', interfaces)
217
211 def mock_call_forwarding(self, modem):218 def mock_call_forwarding(self, modem):
212 modem.AddProperty(219 modem.AddProperty(
213 CALL_FWD_IFACE, 'VoiceUnconditional', '')220 CALL_FWD_IFACE, 'VoiceUnconditional', '')
@@ -220,6 +227,9 @@
220 'self.EmitSignal("IFACE",\227 'self.EmitSignal("IFACE",\
221 "PropertyChanged", "sv", [args[0], args[1]])'228 "PropertyChanged", "sv", [args[0], args[1]])'
222 .replace('IFACE', CALL_FWD_IFACE)), ])229 .replace('IFACE', CALL_FWD_IFACE)), ])
230 interfaces = modem.GetProperties()['Interfaces']
231 interfaces.append(CALL_FWD_IFACE)
232 modem.SetProperty('Interfaces', interfaces)
223233
224 def mock_call_settings(self, modem):234 def mock_call_settings(self, modem):
225 modem.AddProperty(235 modem.AddProperty(
@@ -233,6 +243,9 @@
233 'self.EmitSignal("IFACE",\243 'self.EmitSignal("IFACE",\
234 "PropertyChanged", "sv", [args[0], args[1]])'244 "PropertyChanged", "sv", [args[0], args[1]])'
235 .replace('IFACE', CALL_SETTINGS_IFACE)), ])245 .replace('IFACE', CALL_SETTINGS_IFACE)), ])
246 interfaces = modem.GetProperties()['Interfaces']
247 interfaces.append(CALL_SETTINGS_IFACE)
248 modem.SetProperty('Interfaces', interfaces)
236249
237 def add_sim1(self):250 def add_sim1(self):
238 # create modem_0 proxy251 # create modem_0 proxy

Subscribers

People subscribed via source and target branches