mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
[dialer] Make the history work
This commit is contained in:
parent
9b1cc9f1b0
commit
5eefb274e8
6 changed files with 18 additions and 4 deletions
|
|
@ -26,7 +26,6 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
function secondsToTimeString(seconds) {
|
function secondsToTimeString(seconds) {
|
||||||
seconds = Math.floor(seconds/1000)
|
|
||||||
var h = Math.floor(seconds / 3600);
|
var h = Math.floor(seconds / 3600);
|
||||||
var m = Math.floor((seconds - (h * 3600)) / 60);
|
var m = Math.floor((seconds - (h * 3600)) / 60);
|
||||||
var s = seconds - h * 3600 - m * 60;
|
var s = seconds - h * 3600 - m * 60;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ Item {
|
||||||
text: "Name (todo)"
|
text: "Name (todo)"
|
||||||
}
|
}
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
text: i18n("Number: %1", model.number)
|
text: model.number
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ ApplicationWindow {
|
||||||
onMissedCallsActionTriggered: {
|
onMissedCallsActionTriggered: {
|
||||||
root.visible = true;
|
root.visible = true;
|
||||||
}
|
}
|
||||||
|
onCallEnded: {
|
||||||
|
insertCallInHistory(callContactNumber, callDuration, incomingCall ? 1 : 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dia
|
||||||
connect(d->callChannel.data(), &Tp::CallChannel::invalidated, this, [=]() {
|
connect(d->callChannel.data(), &Tp::CallChannel::invalidated, this, [=]() {
|
||||||
qDebug() << "Channel invalidated";
|
qDebug() << "Channel invalidated";
|
||||||
d->dialerUtils->setCallState("idle");
|
d->dialerUtils->setCallState("idle");
|
||||||
|
d->dialerUtils->emitCallEnded();
|
||||||
});
|
});
|
||||||
|
|
||||||
d->ringingNotification = nullptr;
|
d->ringingNotification = nullptr;
|
||||||
|
|
@ -197,7 +198,6 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
d->callTimer->stop();
|
d->callTimer->stop();
|
||||||
d->callTimer->deleteLater();
|
d->callTimer->deleteLater();
|
||||||
d->callTimer = nullptr;
|
d->callTimer = nullptr;
|
||||||
d->dialerUtils->setCallDuration(0);
|
|
||||||
}
|
}
|
||||||
//if we requested the call, make sure we have a window to show the error (if any)
|
//if we requested the call, make sure we have a window to show the error (if any)
|
||||||
// if (d->callChannel->isRequested()) {
|
// if (d->callChannel->isRequested()) {
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,15 @@ void DialerUtils::setCallContactNumber(const QString &contactNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialerUtils::emitCallEnded()
|
||||||
|
{
|
||||||
|
qDebug() << "Call ended:" << m_callContactNumber << m_callDuration;
|
||||||
|
Q_EMIT callEnded(m_callContactNumber, m_callDuration, true);
|
||||||
|
m_callDuration = 0;
|
||||||
|
m_callContactNumber = QString();
|
||||||
|
m_callContactAlias = QString();
|
||||||
|
}
|
||||||
|
|
||||||
void DialerUtils::resetMissedCalls()
|
void DialerUtils::resetMissedCalls()
|
||||||
{
|
{
|
||||||
m_missedCalls = 0;
|
m_missedCalls = 0;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ public:
|
||||||
QString callContactNumber() const;
|
QString callContactNumber() const;
|
||||||
void setCallContactNumber(const QString &contactNumber);
|
void setCallContactNumber(const QString &contactNumber);
|
||||||
|
|
||||||
|
void emitCallEnded();
|
||||||
|
|
||||||
Q_INVOKABLE void resetMissedCalls();
|
Q_INVOKABLE void resetMissedCalls();
|
||||||
Q_INVOKABLE void dial(const QString &number);
|
Q_INVOKABLE void dial(const QString &number);
|
||||||
|
|
||||||
|
|
@ -62,6 +64,7 @@ Q_SIGNALS:
|
||||||
void acceptCall();
|
void acceptCall();
|
||||||
void rejectCall();
|
void rejectCall();
|
||||||
void hangUp();
|
void hangUp();
|
||||||
|
void callEnded(const QString &callContactNumber, uint callDuration, bool incomingCall);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer <KNotification> m_callsNotification;
|
QPointer <KNotification> m_callsNotification;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue