[dialer] Split the call contact into number and alias

At some point this needs to be ported to some KPeople contact thing
This commit is contained in:
Martin Klapetek 2015-06-29 19:53:49 +02:00
parent b8a45d8755
commit 9b1cc9f1b0
4 changed files with 35 additions and 14 deletions

View file

@ -108,7 +108,7 @@ Item {
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
font.pointSize: theme.defaultFont.pointSize * 2 font.pointSize: theme.defaultFont.pointSize * 2
text: dialerUtils.callContactId text: dialerUtils.callContactAlias
} }
PlasmaComponents.Label { PlasmaComponents.Label {
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -93,7 +93,8 @@ void CallManager::onCallStateChanged(Tp::CallState state)
qDebug() << "new call state:" << state; qDebug() << "new call state:" << state;
if (d->callChannel->targetContact()) { 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) { switch (state) {

View file

@ -34,7 +34,7 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
m_missedCalls(0), m_missedCalls(0),
m_simAccount(simAccount), m_simAccount(simAccount),
m_callDuration(0), m_callDuration(0),
m_callContactId(QString()) m_callContactAlias(QString())
{ {
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore); Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
@ -96,16 +96,29 @@ void DialerUtils::setCallDuration(uint duration)
Q_EMIT callDurationChanged(); 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) { if (m_callContactAlias != contactAlias) {
m_callContactId = contactId; m_callContactAlias = contactAlias;
Q_EMIT callContactIdChanged(); 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();
} }
} }

View file

@ -30,7 +30,9 @@ class DialerUtils : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString callState READ callState NOTIFY callStateChanged); Q_PROPERTY(QString callState READ callState NOTIFY callStateChanged);
Q_PROPERTY(uint callDuration READ callDuration NOTIFY callDurationChanged); 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: public:
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0); DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0);
@ -42,8 +44,11 @@ public:
uint callDuration() const; uint callDuration() const;
void setCallDuration(uint duration); void setCallDuration(uint duration);
QString callContactId() const; QString callContactAlias() const;
void setCallContactId(const QString &contactId); void setCallContactAlias(const QString &contactAlias);
QString callContactNumber() const;
void setCallContactNumber(const QString &contactNumber);
Q_INVOKABLE void resetMissedCalls(); Q_INVOKABLE void resetMissedCalls();
Q_INVOKABLE void dial(const QString &number); Q_INVOKABLE void dial(const QString &number);
@ -52,7 +57,8 @@ Q_SIGNALS:
void missedCallsActionTriggered(); void missedCallsActionTriggered();
void callStateChanged(); void callStateChanged();
void callDurationChanged(); void callDurationChanged();
void callContactIdChanged(); void callContactAliasChanged();
void callContactNumberChanged();
void acceptCall(); void acceptCall();
void rejectCall(); void rejectCall();
void hangUp(); void hangUp();
@ -63,7 +69,8 @@ private:
int m_missedCalls; int m_missedCalls;
QString m_callState; QString m_callState;
Tp::AccountPtr m_simAccount; Tp::AccountPtr m_simAccount;
QString m_callContactId; QString m_callContactAlias;
QString m_callContactNumber;
uint m_callDuration; uint m_callDuration;
}; };