mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
pin auth finally working
This commit is contained in:
parent
9ee815108d
commit
b9dfc7d768
1 changed files with 128 additions and 120 deletions
|
|
@ -21,152 +21,160 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import MeeGo.QOfono 0.2
|
import MeeGo.QOfono 0.2
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
Rectangle {
|
PlasmaCore.ColorScope {
|
||||||
id: pinScreen
|
id: root
|
||||||
width:1000
|
|
||||||
height:1900
|
anchors.fill: parent
|
||||||
//anchors.fill: parent
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
|
||||||
color: "black"
|
|
||||||
opacity: 0.8
|
|
||||||
visible: simManager.pinRequired != OfonoSimManager.NoPin
|
visible: simManager.pinRequired != OfonoSimManager.NoPin
|
||||||
//visible: true
|
|
||||||
property OfonoSimManager simManager: ofonoSimManager
|
property OfonoSimManager simManager: ofonoSimManager
|
||||||
|
|
||||||
OfonoManager {
|
|
||||||
id: ofonoManager
|
|
||||||
onAvailableChanged: {
|
|
||||||
console.log("Ofono is " + available)
|
|
||||||
}
|
|
||||||
onModemAdded: {
|
|
||||||
console.log("modem added " + modem)
|
|
||||||
}
|
|
||||||
onModemRemoved: console.log("modem removed")
|
|
||||||
}
|
|
||||||
|
|
||||||
OfonoConnMan {
|
|
||||||
id: ofono1
|
|
||||||
Component.onCompleted: {
|
|
||||||
console.log(ofonoManager.modems)
|
|
||||||
}
|
|
||||||
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
|
||||||
}
|
|
||||||
|
|
||||||
OfonoModem {
|
|
||||||
id: modem1
|
|
||||||
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
OfonoContextConnection {
|
|
||||||
id: context1
|
|
||||||
contextPath : ofono1.contexts.length > 0 ? ofono1.contexts[0] : ""
|
|
||||||
Component.onCompleted: {
|
|
||||||
print("Context Active: " + context1.active)
|
|
||||||
}
|
|
||||||
onActiveChanged: {
|
|
||||||
print("Context Active: " + context1.active)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OfonoSimManager {
|
|
||||||
id: ofonoSimManager
|
|
||||||
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
|
||||||
}
|
|
||||||
|
|
||||||
OfonoNetworkOperator {
|
|
||||||
id: netop
|
|
||||||
}
|
|
||||||
|
|
||||||
property color textColor: "white"
|
|
||||||
|
|
||||||
function addNumber(number) {
|
function addNumber(number) {
|
||||||
pinLabel.text = pinLabel.text + number
|
pinLabel.text = pinLabel.text + number
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
Rectangle {
|
||||||
|
id: pinScreen
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
|
||||||
|
color: PlasmaCore.ColorScope.backgroundColor
|
||||||
|
|
||||||
Connections {
|
OfonoManager {
|
||||||
target: simManager
|
id: ofonoManager
|
||||||
onEnterPinComplete: {
|
onAvailableChanged: {
|
||||||
print("Enter Pin complete: " + error + " " + errorString)
|
console.log("Ofono is " + available)
|
||||||
|
}
|
||||||
|
onModemAdded: {
|
||||||
|
console.log("modem added " + modem)
|
||||||
|
}
|
||||||
|
onModemRemoved: console.log("modem removed")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
OfonoConnMan {
|
||||||
id: dialPadArea
|
id: ofono1
|
||||||
|
Component.onCompleted: {
|
||||||
anchors {
|
console.log(ofonoManager.modems)
|
||||||
fill: parent
|
}
|
||||||
margins: 20
|
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
||||||
}
|
}
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
OfonoModem {
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
id: modem1
|
||||||
verticalAlignment: Qt.AlignVCenter
|
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
||||||
font.pixelSize: theme.defaultFont.pixelSize
|
|
||||||
color: textColor
|
}
|
||||||
text: {
|
|
||||||
switch (simManager.pinRequired) {
|
OfonoContextConnection {
|
||||||
case OfonoSimManager.NoPin: return i18n("No pin (error)");
|
id: context1
|
||||||
case OfonoSimManager.SimPin: return i18n("Enter Sim PIN");
|
contextPath : ofono1.contexts.length > 0 ? ofono1.contexts[0] : ""
|
||||||
case OfonoSimManager.SimPin2: return i18n("Enter Sim PIN 2");
|
Component.onCompleted: {
|
||||||
case OfonoSimManager.SimPuk: return i18n("Enter Sim PUK");
|
print("Context Active: " + context1.active)
|
||||||
case OfonoSimManager.SimPuk2: return i18n("Enter Sim PUK 2");
|
}
|
||||||
default: return i18n("Unknown PIN type: %1", simManager.pinRequired);
|
onActiveChanged: {
|
||||||
}
|
print("Context Active: " + context1.active)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
OfonoSimManager {
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
id: ofonoSimManager
|
||||||
verticalAlignment: Qt.AlignVCenter
|
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
||||||
font.pixelSize: theme.defaultFont.pixelSize
|
|
||||||
color: textColor
|
|
||||||
text: /*i18n("%1 attempts left", (simManager.pinRetries ? simManager.pinRetries[simManager.pinRequired] : 0));*/ simManager.pinRetries[simManager.pinRequired] +"--"+ simManager.pinRequired
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
OfonoNetworkOperator {
|
||||||
id: pinLabel
|
id: netop
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: Qt.AlignRight
|
|
||||||
verticalAlignment: Qt.AlignVCenter
|
|
||||||
font.pixelSize: one.font.pixelSize
|
|
||||||
color: textColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Grid {
|
MouseArea {
|
||||||
id: pad
|
anchors.fill: parent
|
||||||
columns: 3
|
}
|
||||||
spacing: 0
|
|
||||||
property int buttonHeight: height / 5
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Connections {
|
||||||
Layout.fillHeight: true
|
target: simManager
|
||||||
|
onEnterPinComplete: {
|
||||||
|
print("Enter Pin complete: " + error + " " + errorString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DialerButton { id: one; text: "1"; color: "white"; }
|
ColumnLayout {
|
||||||
DialerButton { text: "2"; color: "white"; }
|
id: dialPadArea
|
||||||
DialerButton { text: "3"; color: "white"; }
|
|
||||||
|
|
||||||
DialerButton { text: "4"; color: "white"; }
|
anchors {
|
||||||
DialerButton { text: "5"; color: "white"; }
|
fill: parent
|
||||||
DialerButton { text: "6"; color: "white"; }
|
margins: 20
|
||||||
|
}
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
text: {
|
||||||
|
switch (simManager.pinRequired) {
|
||||||
|
case OfonoSimManager.NoPin: return i18n("No pin (error)");
|
||||||
|
case OfonoSimManager.SimPin: return i18n("Enter Sim PIN");
|
||||||
|
case OfonoSimManager.SimPin2: return i18n("Enter Sim PIN 2");
|
||||||
|
case OfonoSimManager.SimPuk: return i18n("Enter Sim PUK");
|
||||||
|
case OfonoSimManager.SimPuk2: return i18n("Enter Sim PUK 2");
|
||||||
|
default: return i18n("Unknown PIN type: %1", simManager.pinRequired);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlasmaComponents.Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
text: simManager.pinRetries && simManager.pinRetries[simManager.pinRequired] ? i18n("%1 attempts left", simManager.pinRetries[simManager.pinRequired]) : "";
|
||||||
|
}
|
||||||
|
|
||||||
DialerButton { text: "7"; color: "white"; }
|
PlasmaComponents.Label {
|
||||||
DialerButton { text: "8"; color: "white"; }
|
id: pinLabel
|
||||||
DialerButton { text: "9"; color: "white"; }
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Qt.AlignRight
|
||||||
|
verticalAlignment: Qt.AlignVCenter
|
||||||
|
font.pixelSize: one.font.pixelSize
|
||||||
|
}
|
||||||
|
|
||||||
DialerButton { text: "*"; color: "white"; }
|
Grid {
|
||||||
DialerButton { text: "0"; sub: "+"; color: "white"; }
|
id: pad
|
||||||
DialerButton {
|
columns: 3
|
||||||
text: "#"
|
spacing: 0
|
||||||
color: "white"
|
property int buttonHeight: height / 5
|
||||||
callback: function () {
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
DialerButton { id: one; text: "1"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "2"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "3"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
|
||||||
|
DialerButton { text: "4"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "5"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "6"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
|
||||||
|
DialerButton { text: "7"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "8"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "9"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
|
||||||
|
DialerButton { text: "*"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton { text: "0"; sub: "+"; color: PlasmaCore.ColorScope.textColor }
|
||||||
|
DialerButton {
|
||||||
|
text: "#"
|
||||||
|
color: PlasmaCore.ColorScope.textColor
|
||||||
|
callback: function () {
|
||||||
|
simManager.enterPin(simManager.pinRequired, pinLabel.text)
|
||||||
|
pinLabel.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PlasmaComponents.Button {
|
||||||
|
anchors {
|
||||||
|
top: pad.bottom
|
||||||
|
horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
text: i18n("Ok")
|
||||||
|
onClicked: {
|
||||||
simManager.enterPin(simManager.pinRequired, pinLabel.text)
|
simManager.enterPin(simManager.pinRequired, pinLabel.text)
|
||||||
pinLabel.text = "";
|
pinLabel.text = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue