diff --git a/shell/contents/components/DialerButton.qml b/shell/contents/components/DialerButton.qml index e3803d91..d266d8c9 100644 --- a/shell/contents/components/DialerButton.qml +++ b/shell/contents/components/DialerButton.qml @@ -9,11 +9,16 @@ Text { color: dialer.textColor font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2) property alias sub: longHold.text + property var callback MouseArea { anchors.fill: parent onClicked: { - addNumber(parent.text); + if (callback) { + callback(); + } else { + addNumber(parent.text); + } } onPressAndHold: { diff --git a/shell/contents/defaults b/shell/contents/defaults index eb563795..c5458f35 100644 --- a/shell/contents/defaults +++ b/shell/contents/defaults @@ -7,3 +7,5 @@ ToolBox= [Desktop][ContainmentActions] +[plasmarc][Theme] +name=breeze-dark diff --git a/shell/contents/views/Desktop.qml b/shell/contents/views/Desktop.qml index 02022d23..455de3e3 100644 --- a/shell/contents/views/Desktop.qml +++ b/shell/contents/views/Desktop.qml @@ -25,6 +25,7 @@ import org.kde.plasma.shell 2.0 as Shell import org.kde.satellite.components 0.1 as SatelliteComponents import org.kde.plasma.components 2.0 as PlasmaComponents import org.nemomobile.voicecall 1.0 +import MeeGo.QOfono 0.2 import "../components" Item { @@ -85,6 +86,41 @@ Item { } } + OfonoManager { + id: ofonoManager + } + + property OfonoSimManager simManager: ofonoSimManager + OfonoSimManager { + id: ofonoSimManager + } + + OfonoNetworkRegistration { + id: netreg + modemPath: ofonoManager.modems.count? ofonoManager.modems[0] : "" + function updateStrengthIcon() { + if (netreg.strength >= 100) { + strengthIcon.source = "network-mobile-100"; + } else if (netreg.strength >= 80) { + strengthIcon.source = "network-mobile-80"; + } else if (netreg.strength >= 60) { + strengthIcon.source = "network-mobile-60"; + } else if (netreg.strength >= 40) { + strengthIcon.source = "network-mobile-40"; + } else if (netreg.strength >= 20) { + strengthIcon.source = "network-mobile-20"; + } else { + strengthIcon.source = "network-mobile-0"; + } + } + + onStrengthChanged: { + console.log("Strength changed to " + netreg.strength) + updateStrengthIcon() + } + Component.onCompleted: updateStrengthIcon() + } + property VoiceCallManager manager: VoiceCallManager { id: manager @@ -180,6 +216,16 @@ Item { } } + Pin { + anchors { + left: parent.left + top: statusPanel.bottom + right: parent.right + bottom: parent.bottom + } + z: 20 + } + Dialer { id: dialer anchors { @@ -229,6 +275,24 @@ Item { interval: 500 } + PlasmaCore.IconItem { + id: strengthIcon + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + } + width: units.iconSizes.small + height: width + } + Text { + anchors { + left: strengthIcon.right + verticalCenter: parent.verticalCenter + } + text: netreg.strength + "% " + (netreg.name ? netreg.name : "No Provider") + color: "white" + font.pixelSize: height / 2 + } Text { id: clock anchors.fill: parent @@ -309,14 +373,7 @@ Item { SatelliteStripe { id: stripe z: 1 -PlasmaComponents.Button { - z: 999 - text: "bah" - onClicked: { - dialer.state = "incoming" - dialer.open() - } -} + PlasmaCore.Svg { id: stripeIcons imagePath: Qt.resolvedUrl("../images/homescreenicons.svg") @@ -332,6 +389,8 @@ PlasmaComponents.Button { svg: stripeIcons elementId: "phone" callback: function() { + //TODO remove + dialer.state = "disconnected" dialer.open() } } diff --git a/shell/contents/views/Pin.qml b/shell/contents/views/Pin.qml new file mode 100644 index 00000000..4d15ac8d --- /dev/null +++ b/shell/contents/views/Pin.qml @@ -0,0 +1,128 @@ +/* + * Copyright 2014 Aaron Seigo + * Copyright 2014 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import org.kde.plasma.core 2.0 as PlasmaCore +import MeeGo.QOfono 0.2 +import "../components" + +Rectangle { + id: pinScreen + color: "black" + opacity: 0.8 + visible: simManager.pinRequired != OfonoSimManager.NoPin + + property color textColor: "white" + property OfonoSimManager simManager: homescreen.simManager + + function addNumber(number) { + pinLabel.text = pinLabel.text + number + } + + MouseArea { + anchors.fill: parent + } + + Connections { + target: simManager + onEnterPinComplete: { + print("Enter Pin complete: " + error + " " + errorString) + } + } + + ColumnLayout { + id: dialPadArea + + anchors { + fill: parent + margins: 20 + } + Text { + Layout.fillWidth: true + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + font.pixelSize: theme.defaultFont.pixelSize + color: textColor + 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); + } + } + } + Text { + Layout.fillWidth: true + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + font.pixelSize: theme.defaultFont.pixelSize + color: textColor + text: i18n("%1 attempts left", simManager.pinRetries); + } + + Text { + id: pinLabel + Layout.fillWidth: true + horizontalAlignment: Qt.AlignRight + verticalAlignment: Qt.AlignVCenter + font.pixelSize: one.font.pixelSize + color: textColor + } + + Grid { + id: pad + columns: 3 + spacing: 0 + property int buttonHeight: height / 5 + + Layout.fillWidth: true + Layout.fillHeight: true + + DialerButton { id: one; text: "1" } + DialerButton { text: "2" } + DialerButton { text: "3" } + + DialerButton { text: "4" } + DialerButton { text: "5" } + DialerButton { text: "6" } + + DialerButton { text: "7" } + DialerButton { text: "8" } + DialerButton { text: "9" } + + DialerButton { text: "*"; } + DialerButton { text: "0"; sub: "+"; } + DialerButton { + text: "#" + callback: function () { + simManager.enterPin(simManager.pinRequired, pinLabel.text) + + for (var i in simManager.pinRetries) { + print("Retries object status:" + i + " " + simManager.pinRetries[i]); + } + } + } + } + } +}