mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
port the existing dialer in a standalone app
is qml-only at the moment, but may need to be a c++ half-daemon in order to be always running and show the "ringning" ui at the right moment
This commit is contained in:
parent
b720bbcb5c
commit
013d99a493
7 changed files with 1036 additions and 0 deletions
|
|
@ -37,6 +37,9 @@ plasma_install_package(look-and-feel org.kde.satellite.phone look-and-feel)
|
|||
plasma_install_package(shell org.kde.satellite.phone shells)
|
||||
install(DIRECTORY wallpaper/ DESTINATION "${WALLPAPER_INSTALL_DIR}/org.kde.satellite.lockers")
|
||||
|
||||
kpackage_install_package(dialer org.kde.phone.dialer genericqml)
|
||||
install(FILES dialer/metadata.desktop DESTINATION "${XDG_APPS_INSTALL_DIR}/org.kde.phone.dialer.desktop")
|
||||
|
||||
install(DIRECTORY compositor/
|
||||
DESTINATION ${DATA_INSTALL_DIR}/greenisland/org.kde.satellite.compositor.phone
|
||||
PATTERN .svn EXCLUDE
|
||||
|
|
|
|||
563
dialer/contents/ui/Desktop.qml
Normal file
563
dialer/contents/ui/Desktop.qml
Normal file
|
|
@ -0,0 +1,563 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2012 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* 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 QtGraphicalEffects 1.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
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.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
||||
import org.nemomobile.voicecall 1.0
|
||||
import org.kde.kquickcontrolsaddons 2.0
|
||||
import MeeGo.QOfono 0.2
|
||||
import "../components"
|
||||
|
||||
Item {
|
||||
id: homescreen
|
||||
width: 1080
|
||||
height: 1920
|
||||
|
||||
property Item containment;
|
||||
property Item wallpaper;
|
||||
property var pendingRemovals: [];
|
||||
property int notificationId: 0;
|
||||
property int buttonHeight: width/4
|
||||
|
||||
/*
|
||||
Notificadtion data object has the following properties:
|
||||
appIcon
|
||||
image
|
||||
appName
|
||||
summary
|
||||
body
|
||||
isPersistent
|
||||
expireTimeout
|
||||
urgency
|
||||
appRealName
|
||||
configurable
|
||||
*/
|
||||
function addNotification(source, data, actions) {
|
||||
// Do not show duplicated notifications
|
||||
// Remove notifications that are sent again (odd, but true)
|
||||
for (var i = 0; i < notificationsModel.count; ++i) {
|
||||
var tmp = notificationsModel.get(i);
|
||||
var matches = (tmp.appName == data.appName &&
|
||||
tmp.summary == data.summary &&
|
||||
tmp.body == data.body);
|
||||
var sameSource = tmp.source == source;
|
||||
|
||||
if (sameSource && matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sameSource || matches) {
|
||||
notificationsModel.remove(i)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data["id"] = ++notificationId;
|
||||
data["source"] = source;
|
||||
if (data["summary"].length < 1) {
|
||||
data["summary"] = data["body"];
|
||||
data["body"] = '';
|
||||
}
|
||||
data["actions"] = actions;
|
||||
|
||||
notificationsModel.insert(0, data);
|
||||
if (!data["isPersistent"]) {
|
||||
pendingRemovals.push(notificationId);
|
||||
pendingTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
property OfonoSimManager simManager: ofonoSimManager
|
||||
OfonoSimManager {
|
||||
id: ofonoSimManager
|
||||
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
||||
}
|
||||
|
||||
OfonoNetworkRegistration {
|
||||
id: netreg
|
||||
Component.onCompleted: {
|
||||
netreg.scan()
|
||||
updateStrengthIcon()
|
||||
}
|
||||
|
||||
onNetworkOperatorsChanged : {
|
||||
console.log("operators :"+netreg.currentOperator["Name"].toString())
|
||||
}
|
||||
modemPath: ofonoManager.modems.length ? 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()
|
||||
}
|
||||
}
|
||||
|
||||
OfonoNetworkOperator {
|
||||
id: netop
|
||||
}
|
||||
|
||||
property VoiceCallManager manager: VoiceCallManager {
|
||||
id: manager
|
||||
|
||||
onActiveVoiceCallChanged: {
|
||||
if (activeVoiceCall) {
|
||||
dialerOverlay.open();
|
||||
//main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId);
|
||||
dialerOverlay.item.numberEntryText = activeVoiceCall.lineId;
|
||||
|
||||
} else {
|
||||
dialerOverlay.close();
|
||||
dialerOverlay.item.numberEntryText = '';
|
||||
|
||||
//main.activeVoiceCallPerson = null;
|
||||
}
|
||||
}
|
||||
|
||||
onError: {
|
||||
console.log('*** QML *** VCM ERROR: ' + message);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pendingTimer
|
||||
interval: 5000
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
for (var i = 0; i < pendingRemovals.length; ++i) {
|
||||
var id = pendingRemovals[i];
|
||||
for (var j = 0; j < notificationsModel.count; ++j) {
|
||||
if (notificationsModel.get(j).id == id) {
|
||||
notificationsModel.remove(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
pendingRemovals = [];
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
z: 1
|
||||
color: Qt.rgba(0, 0, 0, 0.9 * (Math.min(applications.contentY + homescreen.height, homescreen.height) / homescreen.height))
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: timeSource
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 60 * 1000
|
||||
}
|
||||
PlasmaCore.DataSource {
|
||||
id: notificationsSource
|
||||
|
||||
engine: "notifications"
|
||||
interval: 0
|
||||
|
||||
onSourceAdded: {
|
||||
connectSource(source);
|
||||
}
|
||||
|
||||
onSourceRemoved: {
|
||||
for (var i = 0; i < notificationsModel.count; ++i) {
|
||||
if (notificationsModel.get(i) == source) {
|
||||
notificationsModel.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onNewData: {
|
||||
var actions = new Array()
|
||||
if (data["actions"] && data["actions"].length % 2 == 0) {
|
||||
for (var i = 0; i < data["actions"].length; i += 2) {
|
||||
var action = new Object();
|
||||
action["id"] = data["actions"][i];
|
||||
action["text"] = data["actions"][i+1];
|
||||
actions.push(action);
|
||||
}
|
||||
}
|
||||
|
||||
homescreen.addNotification(
|
||||
sourceName,
|
||||
data,
|
||||
actions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: notificationsModel
|
||||
|
||||
ListElement {
|
||||
appIcon: "call-start"
|
||||
summary: "Missed call from Joe"
|
||||
body: "Called at 8:42 from +41 56 373 37 31"
|
||||
}
|
||||
ListElement {
|
||||
appIcon: "im-google"
|
||||
summary: "July: Hey! Are you around?"
|
||||
}
|
||||
ListElement {
|
||||
appIcon: "im-google"
|
||||
summary: "July: Hello?"
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: dialerOverlay
|
||||
function open() {
|
||||
source = Qt.resolvedUrl("Dialer.qml")
|
||||
dialerOverlay.item.open();
|
||||
}
|
||||
function close() {
|
||||
dialerOverlay.item.close();
|
||||
}
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: statusPanel.bottom
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
z: 20
|
||||
}
|
||||
Loader {
|
||||
id: pinOverlay
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: statusPanel.bottom
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
z: 21
|
||||
source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
|
||||
}
|
||||
|
||||
PlasmaCore.ColorScope {
|
||||
id: statusPanel
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
height: units.iconSizes.small
|
||||
z: 2
|
||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, 0.9)
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: strengthIcon
|
||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
width: units.iconSizes.small
|
||||
height: width
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
anchors {
|
||||
left: strengthIcon.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: netreg.strength + "% " + netreg.name
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
font.pixelSize: parent.height / 2
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
id: clock
|
||||
anchors.fill: parent
|
||||
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: height / 2
|
||||
}
|
||||
MouseArea {
|
||||
property int oldMouseY: 0
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: !dialerOverlay.item.visible
|
||||
onPressed: {
|
||||
oldMouseY = mouse.y;
|
||||
slidingPanel.visible = true;
|
||||
}
|
||||
onPositionChanged: {
|
||||
slidingPanel.offset = slidingPanel.offset + (mouse.y - oldMouseY);
|
||||
oldMouseY = mouse.y;
|
||||
}
|
||||
onReleased: slidingPanel.updateState();
|
||||
}
|
||||
|
||||
|
||||
PlasmaWorkspace.BatteryIcon {
|
||||
id: batteryIcon
|
||||
anchors {
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
width: units.iconSizes.small
|
||||
height: width
|
||||
hasBattery: pmSource.data["Battery"]["Has Battery"]
|
||||
batteryType: "Phone"
|
||||
percent: pmSource.data["Battery0"] ? pmSource.data["Battery0"]["Percent"] : 0
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: pmSource
|
||||
engine: "powermanagement"
|
||||
connectedSources: sources
|
||||
onSourceAdded: {
|
||||
disconnectSource(source);
|
||||
connectSource(source);
|
||||
}
|
||||
onSourceRemoved: {
|
||||
disconnectSource(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SlidingPanel {
|
||||
id: slidingPanel
|
||||
width: homescreen.width
|
||||
height: homescreen.height
|
||||
}
|
||||
|
||||
|
||||
PlasmaCore.ColorScope {
|
||||
z: 1
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
|
||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||
|
||||
SatelliteComponents.ApplicationListModel {
|
||||
id: appListModel
|
||||
}
|
||||
|
||||
GridView {
|
||||
id: applications
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
z: 1
|
||||
cellWidth: homescreen.buttonHeight
|
||||
cellHeight: cellWidth
|
||||
model: appListModel
|
||||
snapMode: GridView.SnapToRow
|
||||
clip: true
|
||||
header: MouseArea {
|
||||
z: 999
|
||||
width: homescreen.width
|
||||
height: homescreen.height - units.iconSizes.medium
|
||||
|
||||
onPressAndHold: {
|
||||
containment.action("configure").trigger();
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: bigClock
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: parent.top
|
||||
bottom: notificationView.top
|
||||
}
|
||||
text: Qt.formatTime(timeSource.data.Local.DateTime, "hh:mm")
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pointSize: 40
|
||||
style: Text.Raised
|
||||
styleColor: "black"
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: notificationView
|
||||
spacing: units.smallSpacing
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottomMargin: stripe.height * 2
|
||||
}
|
||||
height: parent.height / 3
|
||||
interactive: false
|
||||
|
||||
z: 1
|
||||
verticalLayoutDirection: ListView.BottomToTop
|
||||
model: notificationsModel
|
||||
|
||||
add: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
from: notificationView.width
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
NumberAnimation {
|
||||
properties: "x"
|
||||
to: notificationView.width
|
||||
duration: 500
|
||||
}
|
||||
NumberAnimation {
|
||||
properties: "opacity"
|
||||
to: 0
|
||||
duration: 500
|
||||
}
|
||||
}
|
||||
|
||||
removeDisplaced: Transition {
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 600 }
|
||||
NumberAnimation { properties: "x,y"; duration: 100 }
|
||||
}
|
||||
}
|
||||
|
||||
delegate: NotificationStripe {}
|
||||
|
||||
}
|
||||
SatelliteStripe {
|
||||
id: stripe
|
||||
z: 99
|
||||
y: Math.max(applications.contentY + parent.height, parent.height - height)
|
||||
|
||||
PlasmaCore.Svg {
|
||||
id: stripeIcons
|
||||
imagePath: Qt.resolvedUrl("../images/homescreenicons.svg")
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
property int columns: 4
|
||||
property alias buttonHeight: stripe.height
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: phoneIcon
|
||||
svg: stripeIcons
|
||||
elementId: "phone"
|
||||
callback: function() {
|
||||
dialerOverlay.open()
|
||||
}
|
||||
}
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: messagingIcon
|
||||
svg: stripeIcons
|
||||
elementId: "messaging"
|
||||
callback: function() { console.log("Start messaging") }
|
||||
}
|
||||
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: emailIcon
|
||||
svg: stripeIcons
|
||||
elementId: "email"
|
||||
callback: function() { console.log("Start email") }
|
||||
}
|
||||
|
||||
|
||||
HomeLauncherSvg {
|
||||
id: webIcon
|
||||
svg: stripeIcons
|
||||
elementId: "web"
|
||||
callback: function() { console.log("Start web") }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: HomeLauncher {}
|
||||
Component.onCompleted : { console.log("WTF " + width) }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
//configure the view behavior
|
||||
if (desktop) {
|
||||
desktop.width = width;
|
||||
desktop.height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
251
dialer/contents/ui/Dialer.qml
Normal file
251
dialer/contents/ui/Dialer.qml
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* 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 org.nemomobile.voicecall 1.0
|
||||
|
||||
Item {
|
||||
id: dialer
|
||||
|
||||
state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected"
|
||||
property color textColor: "white"
|
||||
property bool calling: false // needs to be connected to a system service
|
||||
property bool enableButtons: calling
|
||||
property alias numberEntryText: status.text
|
||||
property VoiceCallManager manager: root.manager
|
||||
|
||||
property string providerId: manager.providers.id(0)
|
||||
|
||||
function addNumber(number) {
|
||||
status.text = status.text + number
|
||||
}
|
||||
|
||||
function call() {
|
||||
if (!calling) {
|
||||
console.log("Calling: " + status.text);
|
||||
dialer.calling = true;
|
||||
manager.dial(providerId, status.text);
|
||||
|
||||
} else {
|
||||
console.log("Hanging up: " + status.text);
|
||||
status.text = '';
|
||||
dialer.calling = false;
|
||||
var call = manager.activeVoiceCall;
|
||||
if (call) {
|
||||
call.hangup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fromContacts() {
|
||||
console.log("Should get from contacts!");
|
||||
status.text = "+41 76 555 5555"
|
||||
}
|
||||
|
||||
function secondsToTimeString(seconds) {
|
||||
seconds = Math.floor(seconds/1000)
|
||||
var h = Math.floor(seconds / 3600);
|
||||
var m = Math.floor((seconds - (h * 3600)) / 60);
|
||||
var s = seconds - h * 3600 - m * 60;
|
||||
if(h < 10) h = '0' + h;
|
||||
if(m < 10) m = '0' + m;
|
||||
if(s < 10) s = '0' + s;
|
||||
return '' + h + ':' + m + ':' + s;
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { properties: "opacity"; duration: 100 }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: dialPadArea
|
||||
visible: dialer.state == "disconnected"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
Text {
|
||||
id: status
|
||||
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
|
||||
|
||||
height: parent.height - status.height
|
||||
width: parent.width
|
||||
|
||||
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: "#" }
|
||||
|
||||
DialerIconButton {
|
||||
source: "im-user"
|
||||
callback: fromContacts
|
||||
}
|
||||
DialerIconButton {
|
||||
id: callButton
|
||||
source: dialer.calling ? "call-stop" : "call-start"
|
||||
callback: call
|
||||
}
|
||||
DialerIconButton {
|
||||
source: "edit-clear"
|
||||
callback: function() {
|
||||
if (status.text.length > 0) {
|
||||
status.text = status.text.substr(0, status.text.length - 1);
|
||||
} else {
|
||||
dialer.calling = true;
|
||||
dialer.calling = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: activeCallUi
|
||||
spacing: 10
|
||||
visible: dialer.state != "disconnected"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.minimumHeight: parent.height/2
|
||||
Rectangle {
|
||||
height: Math.min(parent.width, parent.height)
|
||||
width: height
|
||||
radius: 5
|
||||
anchors.centerIn: parent
|
||||
PlasmaCore.IconItem {
|
||||
anchors {
|
||||
fill: parent
|
||||
centerIn: parent
|
||||
margins: 20
|
||||
}
|
||||
source: "im-user"
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: one.font.pixelSize
|
||||
color: textColor
|
||||
text: manager.activeVoiceCall ? manager.activeVoiceCall.lineId : ""
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: theme.smallestFont.pixelSize
|
||||
color: textColor
|
||||
text: manager.activeVoiceCall ? secondsToTimeString(manager.activeVoiceCall.duration) : ''
|
||||
}
|
||||
RowLayout {
|
||||
height: parent.height / 3
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
DialerIconButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
source: dialer.state == "incoming" ? "call-start" : (manager.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high")
|
||||
Rectangle {
|
||||
z: -1
|
||||
color: dialer.state == "incoming" ? "green" : "white"
|
||||
opacity: 0.5
|
||||
radius: 5
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
callback: function () {
|
||||
if (dialer.state == "incoming") {
|
||||
if (manager.activeVoiceCall) {
|
||||
manager.activeVoiceCall.answer();
|
||||
}
|
||||
} else {
|
||||
manager.isMicrophoneMuted = !manager.isMicrophoneMuted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DialerIconButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
source: "call-stop"
|
||||
Rectangle {
|
||||
z: -1
|
||||
color: "red"
|
||||
opacity: 0.5
|
||||
radius: 5
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
callback: function () {
|
||||
if (manager.activeVoiceCall) {
|
||||
manager.activeVoiceCall.hangup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
dialer/contents/ui/DialerButton.qml
Normal file
48
dialer/contents/ui/DialerButton.qml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Text {
|
||||
width: parent.width / parent.columns
|
||||
height: parent.buttonHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
color: dialer.textColor
|
||||
font.pixelSize: Math.floor((width - (units.largeSpacing)) / 2)
|
||||
property alias sub: longHold.text
|
||||
property var callback
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (longHold.visible) {
|
||||
addNumber(longHold.text);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: longHold
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
visible: text.length > 0
|
||||
opacity: 0.7
|
||||
|
||||
font.pixelSize: parent.pixelSize * .8
|
||||
color: parent.color
|
||||
}
|
||||
}
|
||||
37
dialer/contents/ui/DialerIconButton.qml
Normal file
37
dialer/contents/ui/DialerIconButton.qml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import QtQuick 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
width: parent.width / parent.columns
|
||||
height: parent.buttonHeight
|
||||
property var callback
|
||||
property string text
|
||||
property string sub
|
||||
property alias source: icon.source
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (parent.sub.length > 0) {
|
||||
addNumber(parent.sub);
|
||||
} else {
|
||||
addNumber(parent.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
114
dialer/contents/ui/main.qml
Normal file
114
dialer/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* 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 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.Controls 1.3
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.nemomobile.voicecall 1.0
|
||||
import MeeGo.QOfono 0.2
|
||||
|
||||
ApplicationWindow {
|
||||
id: root
|
||||
width: 600
|
||||
height: 800
|
||||
visible: true
|
||||
color: Qt.rgba(0, 0, 0, 0.9)
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
property OfonoSimManager simManager: ofonoSimManager
|
||||
OfonoSimManager {
|
||||
id: ofonoSimManager
|
||||
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
|
||||
}
|
||||
|
||||
OfonoNetworkRegistration {
|
||||
id: netreg
|
||||
Component.onCompleted: {
|
||||
netreg.scan()
|
||||
}
|
||||
|
||||
onNetworkOperatorsChanged : {
|
||||
console.log("operators :"+netreg.currentOperator["Name"].toString())
|
||||
}
|
||||
modemPath: ofonoManager.modems.length ? ofonoManager.modems[0] : ""
|
||||
}
|
||||
|
||||
OfonoNetworkOperator {
|
||||
id: netop
|
||||
}
|
||||
|
||||
property VoiceCallManager manager: VoiceCallManager {
|
||||
id: manager
|
||||
|
||||
onActiveVoiceCallChanged: {
|
||||
if (activeVoiceCall) {
|
||||
//main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId);
|
||||
dialerOverlay.item.numberEntryText = activeVoiceCall.lineId;
|
||||
|
||||
} else {
|
||||
dialerOverlay.item.numberEntryText = '';
|
||||
|
||||
//main.activeVoiceCallPerson = null;
|
||||
}
|
||||
}
|
||||
|
||||
onError: {
|
||||
console.log('*** QML *** VCM ERROR: ' + message);
|
||||
}
|
||||
}
|
||||
Dialer {
|
||||
id: dialerOverlay
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
20
dialer/metadata.desktop
Normal file
20
dialer/metadata.desktop
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[Desktop Entry]
|
||||
Comment=Plasma phone dialer
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Phone
|
||||
Type=Application
|
||||
Icon=call-start
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Category=Communications
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.dialer
|
||||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-KDE-ServiceTypes=KPackage/Generic
|
||||
Exec=kpackagelauncherqml -a org.kde.phone.dialer
|
||||
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
Loading…
Reference in a new issue