Changeset View
Changeset View
Standalone View
Standalone View
kcm/qml/ConfigurationDialog.qml
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 40 | Rectangle { | |||
---|---|---|---|---|---|
44 | color: baseColor | 44 | color: baseColor | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | Kirigami.FormLayout { | 47 | Kirigami.FormLayout { | ||
48 | anchors.left: parent.left | 48 | anchors.left: parent.left | ||
49 | anchors.right: parent.right | 49 | anchors.right: parent.right | ||
50 | anchors.topMargin: units.gridUnit | 50 | anchors.topMargin: units.gridUnit | ||
51 | 51 | | |||
52 | Kirigami.Heading { | ||||
53 | id: generalLabel | ||||
54 | level: 2 | ||||
55 | text: i18n("General") | ||||
56 | } | ||||
57 | | ||||
52 | QQC2.CheckBox { | 58 | QQC2.CheckBox { | ||
53 | id: unlockModem | 59 | id: unlockModem | ||
54 | text: i18n("Ask for PIN on modem detection") | 60 | text: i18n("Ask for PIN on modem detection") | ||
55 | onClicked: okButton.enabled = true | 61 | onClicked: configurationChanged() | ||
56 | Component.onCompleted: checked = configuration.unlockModemOnDetection | 62 | Component.onCompleted: checked = configuration.unlockModemOnDetection | ||
57 | } | 63 | } | ||
58 | 64 | | |||
59 | QQC2.CheckBox { | 65 | QQC2.CheckBox { | ||
60 | id: manageVirtualConnections | 66 | id: manageVirtualConnections | ||
61 | text: i18n("Show virtual connections") | 67 | text: i18n("Show virtual connections") | ||
62 | onClicked: okButton.enabled = true | 68 | onClicked: configurationChanged() | ||
63 | Component.onCompleted: checked = configuration.manageVirtualConnections | 69 | Component.onCompleted: checked = configuration.manageVirtualConnections | ||
64 | } | 70 | } | ||
71 | | ||||
72 | Kirigami.Heading { | ||||
73 | id: hotspotLabel | ||||
74 | level: 2 | ||||
75 | text: i18n("Hotspot") | ||||
76 | Component.onCompleted: visible = handler.hotspotSupported | ||||
77 | } | ||||
78 | | ||||
79 | QQC2.TextField { | ||||
80 | id: hotspotName | ||||
81 | Kirigami.FormData.label: i18n("Hotspot name:") | ||||
82 | onTextChanged: configurationChanged() | ||||
83 | Component.onCompleted: { | ||||
84 | text = configuration.hotspotName | ||||
85 | visible = handler.hotspotSupported | ||||
86 | } | ||||
87 | } | ||||
88 | | ||||
89 | QQC2.TextField { | ||||
90 | id: hotspotPassword | ||||
91 | Kirigami.FormData.label: i18n("Hotspot password:") | ||||
92 | validator: RegExpValidator { | ||||
93 | regExp: if (useApMode) { | ||||
94 | /^$|^(?:.{8,64}){1}$/ | ||||
95 | } else { | ||||
96 | /^$|^(?:.{5}|[0-9a-fA-F]{10}|.{13}|[0-9a-fA-F]{26}){1}$/ | ||||
97 | } | ||||
98 | } | ||||
99 | | ||||
100 | onAcceptableInputChanged: configurationChanged() | ||||
101 | | ||||
102 | Component.onCompleted: { | ||||
103 | text = configuration.hotspotPassword | ||||
104 | visible = handler.hotspotSupported | ||||
105 | } | ||||
106 | } | ||||
65 | } | 107 | } | ||
66 | 108 | | |||
67 | Row { | 109 | Row { | ||
68 | id: buttonRow | 110 | id: buttonRow | ||
69 | anchors { | 111 | anchors { | ||
70 | bottom: parent.bottom | 112 | bottom: parent.bottom | ||
71 | right: parent.right | 113 | right: parent.right | ||
72 | margins: units.smallSpacing | 114 | margins: units.smallSpacing | ||
Show All 16 Lines | 128 | QQC2.Button { | |||
89 | 131 | | |||
90 | onClicked: { | 132 | onClicked: { | ||
91 | configurationDialog.close() | 133 | configurationDialog.close() | ||
92 | } | 134 | } | ||
93 | } | 135 | } | ||
94 | } | 136 | } | ||
95 | } | 137 | } | ||
96 | 138 | | |||
139 | function configurationChanged() { | ||||
140 | if (handler.hotspotSupported) { | ||||
141 | okButton.enabled = hotspotPassword.acceptableInput && hotspotName.text | ||||
142 | } else { | ||||
143 | okButton.enabled = true | ||||
144 | } | ||||
145 | } | ||||
146 | | ||||
97 | onVisibleChanged: { | 147 | onVisibleChanged: { | ||
98 | if (visible) { | 148 | if (visible) { | ||
99 | unlockModem.checked = configuration.unlockModemOnDetection | 149 | unlockModem.checked = configuration.unlockModemOnDetection | ||
100 | manageVirtualConnections.checked = configuration.manageVirtualConnections | 150 | manageVirtualConnections.checked = configuration.manageVirtualConnections | ||
151 | hotspotName.text = configuration.hotspotName | ||||
152 | hotspotPassword.text = configuration.hotspotPassword | ||||
101 | } | 153 | } | ||
102 | } | 154 | } | ||
103 | 155 | | |||
104 | onAccepted: { | 156 | onAccepted: { | ||
105 | configuration.unlockModemOnDetection = unlockModem.checked | 157 | configuration.unlockModemOnDetection = unlockModem.checked | ||
106 | configuration.manageVirtualConnections = manageVirtualConnections.checked | 158 | configuration.manageVirtualConnections = manageVirtualConnections.checked | ||
159 | configuration.hotspotName = hotspotName.text | ||||
160 | configuration.hotspotPassword = hotspotPassword.text | ||||
107 | } | 161 | } | ||
108 | } | 162 | } | ||
109 | 163 | |