Commit b3af84b4 authored by Martin Klapetek's avatar Martin Klapetek

[dialer] Add contact info to the call page

parent 3e68d458
......@@ -109,7 +109,7 @@ Item {
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
font.pointSize: theme.defaultFont.pointSize * 2
text: ofonoWrapper.lineId
text: dialerUtils.callContactId
}
PlasmaComponents.Label {
Layout.fillWidth: true
......@@ -120,7 +120,7 @@ Item {
if (!ofonoWrapper.hasActiveCall) {
return '';
//STATUS_DIALING
} else if (ofonoWrapper.status == "dialing") {
} else if (dialerUtils.status == "dialing") {
return i18n("Calling...");
} else if (dialerUtils.duration > 0) {
return secondsToTimeString(ofonoWrapper.duration);
......
......@@ -92,6 +92,10 @@ void CallManager::onCallStateChanged(Tp::CallState state)
{
qDebug() << "new call state:" << state;
if (d->callChannel->targetContact()) {
d->dialerUtils->setCallContactId(d->callChannel->targetContact()->alias());
}
switch (state) {
case Tp::CallStatePendingInitiator:
Q_ASSERT(d->callChannel->isRequested());
......
......@@ -34,6 +34,7 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
m_missedCalls(0),
m_simAccount(simAccount),
m_callDuration(0),
m_callContactId(QString())
{
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
......@@ -94,6 +95,19 @@ void DialerUtils::setCallDuration(uint duration)
Q_EMIT callDurationChanged();
}
QString DialerUtils::callContactId() const
{
return m_callContactId;
}
void DialerUtils::setCallContactId(const QString &contactId)
{
if (m_callContactId != contactId) {
m_callContactId = contactId;
Q_EMIT callContactIdChanged();
}
}
void DialerUtils::resetMissedCalls()
{
m_missedCalls = 0;
......
......@@ -30,6 +30,7 @@ class DialerUtils : public QObject
Q_OBJECT
Q_PROPERTY(QString callState READ callState NOTIFY callStateChanged);
Q_PROPERTY(uint callDuration READ callDuration NOTIFY callDurationChanged);
Q_PROPERTY(QString callContactId READ callContactId NOTIFY callContactIdChanged);
public:
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0);
......@@ -40,6 +41,10 @@ public:
uint callDuration() const;
void setCallDuration(uint duration);
QString callContactId() const;
void setCallContactId(const QString &contactId);
Q_INVOKABLE void resetMissedCalls();
Q_INVOKABLE void dial(const QString &number);
......@@ -47,6 +52,7 @@ Q_SIGNALS:
void missedCallsActionTriggered();
void callStateChanged();
void callDurationChanged();
void callContactIdChanged();
void acceptCall();
void rejectCall();
void hangUp();
......@@ -57,6 +63,7 @@ private:
int m_missedCalls;
QString m_callState;
Tp::AccountPtr m_simAccount;
QString m_callContactId;
uint m_callDuration;
};
......
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