mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
[dialer] Make the call direction property actually work
This commit is contained in:
parent
302a68ea7c
commit
8b1a1300cf
4 changed files with 26 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ ApplicationWindow {
|
||||||
root.visible = true;
|
root.visible = true;
|
||||||
}
|
}
|
||||||
onCallEnded: {
|
onCallEnded: {
|
||||||
insertCallInHistory(callContactNumber, callDuration, incomingCall ? 1 : 2);
|
insertCallInHistory(callContactNumber, callDuration, isIncomingCall ? 1 : 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,10 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
d->dialerUtils->setCallContactNumber(d->callChannel->targetContact()->id());
|
d->dialerUtils->setCallContactNumber(d->callChannel->targetContact()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d->callChannel->isValid()) {
|
||||||
|
d->dialerUtils->setIsIncomingCall(!d->callChannel->isRequested());
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Tp::CallStatePendingInitiator:
|
case Tp::CallStatePendingInitiator:
|
||||||
Q_ASSERT(d->callChannel->isRequested());
|
Q_ASSERT(d->callChannel->isRequested());
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,23 @@ void DialerUtils::setCallContactNumber(const QString &contactNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DialerUtils::isIncomingCall() const
|
||||||
|
{
|
||||||
|
return m_isIncomingCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialerUtils::setIsIncomingCall(bool isIncomingCall)
|
||||||
|
{
|
||||||
|
if (m_isIncomingCall != isIncomingCall) {
|
||||||
|
m_isIncomingCall = isIncomingCall;
|
||||||
|
Q_EMIT isIncomingCallChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialerUtils::emitCallEnded()
|
void DialerUtils::emitCallEnded()
|
||||||
{
|
{
|
||||||
qDebug() << "Call ended:" << m_callContactNumber << m_callDuration;
|
qDebug() << "Call ended:" << m_callContactNumber << m_callDuration;
|
||||||
Q_EMIT callEnded(m_callContactNumber, m_callDuration, true);
|
Q_EMIT callEnded(m_callContactNumber, m_callDuration, m_isIncomingCall);
|
||||||
m_callDuration = 0;
|
m_callDuration = 0;
|
||||||
m_callContactNumber = QString();
|
m_callContactNumber = QString();
|
||||||
m_callContactAlias = QString();
|
m_callContactAlias = QString();
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class DialerUtils : public QObject
|
||||||
Q_PROPERTY(uint callDuration READ callDuration NOTIFY callDurationChanged);
|
Q_PROPERTY(uint callDuration READ callDuration NOTIFY callDurationChanged);
|
||||||
Q_PROPERTY(QString callContactAlias READ callContactAlias NOTIFY callContactAliasChanged);
|
Q_PROPERTY(QString callContactAlias READ callContactAlias NOTIFY callContactAliasChanged);
|
||||||
Q_PROPERTY(QString callContactNumber READ callContactNumber NOTIFY callContactNumberChanged);
|
Q_PROPERTY(QString callContactNumber READ callContactNumber NOTIFY callContactNumberChanged);
|
||||||
|
Q_PROPERTY(bool isIncomingCall READ isIncomingCall NOTIFY isIncomingCallChanged);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -50,6 +51,9 @@ public:
|
||||||
QString callContactNumber() const;
|
QString callContactNumber() const;
|
||||||
void setCallContactNumber(const QString &contactNumber);
|
void setCallContactNumber(const QString &contactNumber);
|
||||||
|
|
||||||
|
bool isIncomingCall() const;
|
||||||
|
void setIsIncomingCall(bool isIncomingCall);
|
||||||
|
|
||||||
void emitCallEnded();
|
void emitCallEnded();
|
||||||
|
|
||||||
Q_INVOKABLE void resetMissedCalls();
|
Q_INVOKABLE void resetMissedCalls();
|
||||||
|
|
@ -61,10 +65,11 @@ Q_SIGNALS:
|
||||||
void callDurationChanged();
|
void callDurationChanged();
|
||||||
void callContactAliasChanged();
|
void callContactAliasChanged();
|
||||||
void callContactNumberChanged();
|
void callContactNumberChanged();
|
||||||
|
void isIncomingCallChanged();
|
||||||
void acceptCall();
|
void acceptCall();
|
||||||
void rejectCall();
|
void rejectCall();
|
||||||
void hangUp();
|
void hangUp();
|
||||||
void callEnded(const QString &callContactNumber, uint callDuration, bool incomingCall);
|
void callEnded(const QString &callContactNumber, uint callDuration, bool isIncomingCall);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer <KNotification> m_callsNotification;
|
QPointer <KNotification> m_callsNotification;
|
||||||
|
|
@ -75,6 +80,7 @@ private:
|
||||||
QString m_callContactAlias;
|
QString m_callContactAlias;
|
||||||
QString m_callContactNumber;
|
QString m_callContactNumber;
|
||||||
uint m_callDuration;
|
uint m_callDuration;
|
||||||
|
bool m_isIncomingCall;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue