Commit 5eefb274 authored by Martin Klapetek's avatar Martin Klapetek

[dialer] Make the history work

parent 9b1cc9f1
......@@ -26,7 +26,6 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
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;
......@@ -105,4 +104,4 @@ Item {
}
}
}
}
\ No newline at end of file
}
......@@ -102,7 +102,7 @@ Item {
text: "Name (todo)"
}
PlasmaComponents.Label {
text: i18n("Number: %1", model.number)
text: model.number
Layout.fillWidth: true
}
}
......
......@@ -47,6 +47,9 @@ ApplicationWindow {
onMissedCallsActionTriggered: {
root.visible = true;
}
onCallEnded: {
insertCallInHistory(callContactNumber, callDuration, incomingCall ? 1 : 2);
}
}
onVisibleChanged: {
......
......@@ -56,6 +56,7 @@ CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dia
connect(d->callChannel.data(), &Tp::CallChannel::invalidated, this, [=]() {
qDebug() << "Channel invalidated";
d->dialerUtils->setCallState("idle");
d->dialerUtils->emitCallEnded();
});
d->ringingNotification = nullptr;
......@@ -197,7 +198,6 @@ void CallManager::onCallStateChanged(Tp::CallState state)
d->callTimer->stop();
d->callTimer->deleteLater();
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 (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()
{
m_missedCalls = 0;
......
......@@ -50,6 +50,8 @@ public:
QString callContactNumber() const;
void setCallContactNumber(const QString &contactNumber);
void emitCallEnded();
Q_INVOKABLE void resetMissedCalls();
Q_INVOKABLE void dial(const QString &number);
......@@ -62,6 +64,7 @@ Q_SIGNALS:
void acceptCall();
void rejectCall();
void hangUp();
void callEnded(const QString &callContactNumber, uint callDuration, bool incomingCall);
private:
QPointer <KNotification> m_callsNotification;
......
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