mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +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 {
|
||||
|
||||
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 {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue