Commit af61cab2 authored by Martin Klapetek's avatar Martin Klapetek

[dialer] Remove remnants of voicecall

It's not used and the code that has been using it didn't work anyway
parent 0ee74ffd
......@@ -30,8 +30,6 @@ Item {
property string status: dialerUtils.callState
property string providerId: ofonoWrapper.providerId
function secondsToTimeString(seconds) {
var h = Math.floor(seconds / 3600);
var m = Math.floor((seconds - (h * 3600)) / 60);
......@@ -77,7 +75,8 @@ Item {
height: topFlickable.height
callback: function (string) {
ofonoWrapper.sendToneToCall(string);
//TODO
// ofonoWrapper.sendToneToCall(string);
}
}
}
......@@ -133,9 +132,12 @@ Item {
PlasmaComponents.ToolButton {
id: muteButton
flat: false
iconSource: ofonoWrapper.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high"
iconSource: "audio-volume-high"
//TODO
// iconSource: ofonoWrapper.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high"
onClicked: {
ofonoWrapper.isMicrophoneMuted = !ofonoWrapper.isMicrophoneMuted;
//TODO
// ofonoWrapper.isMicrophoneMuted = !ofonoWrapper.isMicrophoneMuted;
}
}
PlasmaComponents.ToolButton {
......
......@@ -29,8 +29,6 @@ Item {
property alias numberEntryText: status.text
property string providerId: ofonoWrapper.providerId
function addNumber(number) {
status.text = status.text + number
}
......@@ -81,10 +79,11 @@ Item {
addNumber(string);
}
pressedCallback: function (string) {
ofonoWrapper.startTone(string);
//TODO
// ofonoWrapper.startTone(string);
}
releasedCallback: function (string) {
ofonoWrapper.stopTone();
// ofonoWrapper.stopTone();
}
}
}
......
/**
* Copyright 2015 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.3
import org.nemomobile.voicecall 1.0
Item {
id: ofonoWrapper
//BEGIN PROPERTIES
property string status: "idle"
//support a single provider for now
property string providerId: voiceCallmanager.providers.id(0)
//was the last call an incoming one?
property bool isIncoming: voiceCallmanager.activeVoiceCall ? voiceCallmanager.activeVoiceCall.isIncoming : false
//is there a call in progress?
property bool hasActiveCall: voiceCallmanager.activeVoiceCall ? true : false
//if there is an active call, to what number?
property string lineId: voiceCallmanager.activeVoiceCall ? voiceCallmanager.activeVoiceCall.lineId : ""
//if there is a call, for how long?
property int duration: voiceCallmanager.activeVoiceCall ? voiceCallmanager.activeVoiceCall.duration : 0
//microphone muted?
property alias isMicrophoneMuted: voiceCallmanager.isMicrophoneMuted
//END PROPERTIES
//BEGIN SIGNAL HANDLERS
Connections {
target: dialerUtils
onMissedCallsActionTriggered: {
root.visible = true;
}
}
onVisibleChanged: {
//reset missed calls if the status is not STATUS_INCOMING when got visible
if (visible && status != 5) {
dialerUtils.resetMissedCalls();
}
}
//END SIGNAL HANDLERS
//BEGIN FUNCTIONS
function call(number) {
if (!voiceCallmanager.activeVoiceCall) {
console.log("Calling: " + providerId + " " + number);
voiceCallmanager.dial(providerId, number);
} else {
console.log("Hanging up: " + voiceCallmanager.activeVoiceCall.lineId);
status.text = '';
var call = voiceCallmanager.activeVoiceCall;
if (call) {
call.hangup();
}
}
}
function answer() {
if (voiceCallmanager.activeVoiceCall) {
voiceCallmanager.activeVoiceCall.answer();
}
}
function hangup() {
if (voiceCallmanager.activeVoiceCall) {
voiceCallmanager.activeVoiceCall.hangup();
}
}
function sendToneToCall(key) {
if (voiceCallmanager.activeVoiceCall) {
voiceCallmanager.activeVoiceCall.sendDtmf(key);
}
}
function startTone(string) {
voiceCallmanager.startDtmfTone(string);
}
function stopTone() {
voiceCallmanager.stopDtmfTone();
}
//END FUNCTIONS
//BEGIN DATABASE
Component.onCompleted: {
//HACK: make sure activeVoiceCall is loaded if already existing
voiceCallmanager.voiceCalls.onVoiceCallsChanged();
voiceCallmanager.onActiveVoiceCallChanged();
}
//END DATABASE
//BEGIN MODELS
VoiceCallManager {
id: voiceCallmanager
property int status: activeVoiceCall ? activeVoiceCall.status : 0
//keep track of the status we were in
property int previousStatus
onStatusChanged: {
//STATUS_INCOMING
if (status == 5) {
wasVisible = root.visible;
root.visible = true;
dialerUtils.notifyRinging();
//Was STATUS_INCOMING now is STATUS_DISCONNECTED: Missed call!
} else if (status == 7 && previousStatus == 5) {
var prettyDate = Qt.formatTime(voiceCallmanager.activeVoiceCall.startedAt, Qt.locale().timeFormat(Locale.ShortFormat));
dialerUtils.notifyMissedCall(voiceCallmanager.activeVoiceCall.lineId, i18n("%1 called at %2", voiceCallmanager.activeVoiceCall.lineId, prettyDate));
root.visible = wasVisible;
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, 0, 0);
//STATUS_DISCONNECTED
} else if (status == 7) {
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, voiceCallmanager.activeVoiceCall.duration, voiceCallmanager.activeVoiceCall.isIncoming ? 1 : 2);
}
//status not STATUS_INCOMING
if (status != 5) {
dialerUtils.stopRinging();
}
previousStatus = status;
switch (status) {
case 1:
ofonoWrapper.status = "active";
break;
case 2:
ofonoWrapper.status = "held";
break;
case 3:
ofonoWrapper.status = "dialing";
break;
case 4:
ofonoWrapper.status = "alerting";
break;
case 5:
ofonoWrapper.status = "incoming";
break;
case 6:
ofonoWrapper.status = "waiting";
break;
case 7:
ofonoWrapper.status = "disconnected";
break;
case 0:
default:
ofonoWrapper.status = "idle";
break;
}
}
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);
}
}
//END MODELS
}
/**
* Copyright 2015 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.3
import Ubuntu.Telephony 0.1
Item {
id: root
//BEGIN PROPERTIES
property string status: "idle"
//support a single provider for now
property string providerId: callManager.providers.id(0)
//was the last call an incoming one?
property bool isIncoming: callManager.foregroundCall ? callManager.foregroundCall.incoming : false
//is there a call in progress?
property bool hasActiveCall: callManager.foregroundCall ? true : false
//if there is an active call, to what number?
property string lineId: callManager.foregroundCall ? callManager.foregroundCall.phoneNumber : ""
//if there is a call, for how long?
property int duration: callManager.foregroundCall ? callManager.foregroundCall.elapsedTime : 0
//microphone muted?
property bool isMicrophoneMuted: callManager.muted
//END PROPERTIES
//BEGIN SIGNAL HANDLERS
Connections {
target: dialerUtils
onMissedCallsActionTriggered: {
root.visible = true;
}
}
onVisibleChanged: {
//reset missed calls if the status is not STATUS_INCOMING when got visible
if (visible && status != 5) {
dialerUtils.resetMissedCalls();
}
}
//END SIGNAL HANDLERS
//BEGIN FUNCTIONS
function call(number) {
if (!callManager.foregroundCall) {
var account = null;
if (telepathyHelper.activeAccounts.length > 0) {
account = telepathyHelper.activeAccounts[0];
} else {
// if no account is active, use any account that can make emergency calls
for (var i in telepathyHelper.accounts) {
if (telepathyHelper.accounts[i].emergencyCallsAvailable) {
account = telepathyHelper.accounts[i];
break;
}
}
}
console.log("Calling: " + number + " " + account.accountId);
callManager.startCall(number, account.accountId);
} else {
console.log("Hanging up: " + callManager.foregroundCall.phoneNumber);
status.text = '';
var call = callManager.foregroundCall;
if (call) {
call.hangup();
}
}
}
function answer() {
if (callManager.foregroundCall) {
//TODO: we'll need an own binding in order to accept calls
callManager.foregroundCall.answer();
}
}
function hangup() {
if (callManager.foregroundCall) {
callManager.foregroundCall.endCall();
}
}
function sendToneToCall(key) {
if (callManager.foregroundCall) {
callManager.foregroundCall.sendDTMF(key);
}
}
function startTone(string) {
callManager.playTone(string);
}
function stopTone() {
//ubuntu call manager can't
}
//END FUNCTIONS
//BEGIN MODELS
Connections {
target: callManager
//keep track of the status we were in
property int previousStatus
onCallsChanged: {
print("AAA")
//STATUS_INCOMING
if (callManager.foregroundCall.ringing || callManager.foregroundCall.incoming) {
wasVisible = root.visible;
root.visible = true;
dialerUtils.notifyRinging();
root.status = "incoming";
//Was STATUS_INCOMING now is STATUS_DISCONNECTED: Missed call!
} else if (!callManager.hasCalls && previousStatus == "incoming") {
var prettyDate = Qt.formatTime(DateTime(), Qt.locale().timeFormat(Locale.ShortFormat));
dialerUtils.notifyMissedCall(callManager.foregroundCall.phoneNumber, i18n("%1 called at %2", callManager.foregroundCall.phoneNumber, prettyDate));
root.visible = wasVisible;
insertCallInHistory(callManager.foregroundCall.phoneNumber, 0, 0);
root.status = "idle";
//STATUS_DISCONNECTED
} else if (!callManager.hasCalls) {
insertCallInHistory(callManager.foregroundCall.phoneNumber, callManager.foregroundCall.duration, callManager.foregroundCall.isIncoming ? 1 : 2);
root.status = "idle";
//STATUS_DIALING
} else if (callManager.foregroundCall.dialing) {
root.status = "dialing";
}
//status not STATUS_INCOMING
if (!callManager.foregroundCall.ringing) {
dialerUtils.stopRinging();
}
previousStatus = root.status;
}
}
//END MODELS
}
......@@ -34,8 +34,6 @@ ApplicationWindow {
//keep track if we were visible when ringing
property bool wasVisible
//support a single provider for now
property string providerId: ofonoWrapper.providerId
//was the last call an incoming one?
property bool isIncoming
......@@ -61,10 +59,8 @@ ApplicationWindow {
}
onVisibleChanged: {
//TODO
//reset missed calls if the status is not STATUS_INCOMING when got visible
if (visible && ofonoWrapper.status != "incoming") {
dialerUtils.resetMissedCalls();
}
}
//END SIGNAL HANDLERS
......@@ -155,10 +151,6 @@ ApplicationWindow {
id: historyModel
}
OfonoWrapper {
id: ofonoWrapper
}
//END MODELS
//BEGIN UI
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment