Commit 9b1cc9f1 authored by Martin Klapetek's avatar Martin Klapetek

[dialer] Split the call contact into number and alias

At some point this needs to be ported to some KPeople contact thing
parent b8a45d87
......@@ -108,7 +108,7 @@ Item {
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
font.pointSize: theme.defaultFont.pointSize * 2
text: dialerUtils.callContactId
text: dialerUtils.callContactAlias
}
PlasmaComponents.Label {
Layout.fillWidth: true
......
......@@ -93,7 +93,8 @@ void CallManager::onCallStateChanged(Tp::CallState state)
qDebug() << "new call state:" << state;
if (d->callChannel->targetContact()) {
d->dialerUtils->setCallContactId(d->callChannel->targetContact()->alias());
d->dialerUtils->setCallContactAlias(d->callChannel->targetContact()->alias());
d->dialerUtils->setCallContactNumber(d->callChannel->targetContact()->id());
}
switch (state) {
......
......@@ -34,7 +34,7 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
m_missedCalls(0),
m_simAccount(simAccount),
m_callDuration(0),
m_callContactId(QString())
m_callContactAlias(QString())
{
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
......@@ -96,16 +96,29 @@ void DialerUtils::setCallDuration(uint duration)
Q_EMIT callDurationChanged();
}
QString DialerUtils::callContactId() const
QString DialerUtils::callContactAlias() const
{
return m_callContactId;
return m_callContactAlias;
}
void DialerUtils::setCallContactId(const QString &contactId)
void DialerUtils::setCallContactAlias(const QString &contactAlias)
{
if (m_callContactId != contactId) {
m_callContactId = contactId;
Q_EMIT callContactIdChanged();
if (m_callContactAlias != contactAlias) {
m_callContactAlias = contactAlias;
Q_EMIT callContactAliasChanged();
}
}
QString DialerUtils::callContactNumber() const
{
return m_callContactNumber;
}
void DialerUtils::setCallContactNumber(const QString &contactNumber)
{
if (m_callContactNumber != contactNumber) {
m_callContactNumber = contactNumber;
Q_EMIT callContactNumberChanged();
}
}
......
......@@ -30,7 +30,9 @@ 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);
Q_PROPERTY(QString callContactAlias READ callContactAlias NOTIFY callContactAliasChanged);
Q_PROPERTY(QString callContactNumber READ callContactNumber NOTIFY callContactNumberChanged);
public:
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0);
......@@ -42,8 +44,11 @@ public:
uint callDuration() const;
void setCallDuration(uint duration);
QString callContactId() const;
void setCallContactId(const QString &contactId);
QString callContactAlias() const;
void setCallContactAlias(const QString &contactAlias);
QString callContactNumber() const;
void setCallContactNumber(const QString &contactNumber);
Q_INVOKABLE void resetMissedCalls();
Q_INVOKABLE void dial(const QString &number);
......@@ -52,7 +57,8 @@ Q_SIGNALS:
void missedCallsActionTriggered();
void callStateChanged();
void callDurationChanged();
void callContactIdChanged();
void callContactAliasChanged();
void callContactNumberChanged();
void acceptCall();
void rejectCall();
void hangUp();
......@@ -63,7 +69,8 @@ private:
int m_missedCalls;
QString m_callState;
Tp::AccountPtr m_simAccount;
QString m_callContactId;
QString m_callContactAlias;
QString m_callContactNumber;
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