mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 09:48:50 +00:00
[dialer] Add contact info to the call page
This commit is contained in:
parent
3e68d4589f
commit
b3af84b4a6
4 changed files with 27 additions and 2 deletions
|
|
@ -109,7 +109,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: ofonoWrapper.lineId
|
text: dialerUtils.callContactId
|
||||||
}
|
}
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -120,7 +120,7 @@ Item {
|
||||||
if (!ofonoWrapper.hasActiveCall) {
|
if (!ofonoWrapper.hasActiveCall) {
|
||||||
return '';
|
return '';
|
||||||
//STATUS_DIALING
|
//STATUS_DIALING
|
||||||
} else if (ofonoWrapper.status == "dialing") {
|
} else if (dialerUtils.status == "dialing") {
|
||||||
return i18n("Calling...");
|
return i18n("Calling...");
|
||||||
} else if (dialerUtils.duration > 0) {
|
} else if (dialerUtils.duration > 0) {
|
||||||
return secondsToTimeString(ofonoWrapper.duration);
|
return secondsToTimeString(ofonoWrapper.duration);
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,10 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
{
|
{
|
||||||
qDebug() << "new call state:" << state;
|
qDebug() << "new call state:" << state;
|
||||||
|
|
||||||
|
if (d->callChannel->targetContact()) {
|
||||||
|
d->dialerUtils->setCallContactId(d->callChannel->targetContact()->alias());
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Tp::CallStatePendingInitiator:
|
case Tp::CallStatePendingInitiator:
|
||||||
Q_ASSERT(d->callChannel->isRequested());
|
Q_ASSERT(d->callChannel->isRequested());
|
||||||
|
|
|
||||||
|
|
@ -34,6 +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())
|
||||||
{
|
{
|
||||||
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
|
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
|
||||||
|
|
||||||
|
|
@ -94,6 +95,19 @@ void DialerUtils::setCallDuration(uint duration)
|
||||||
Q_EMIT callDurationChanged();
|
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()
|
void DialerUtils::resetMissedCalls()
|
||||||
{
|
{
|
||||||
m_missedCalls = 0;
|
m_missedCalls = 0;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ 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);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0);
|
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = 0);
|
||||||
|
|
@ -40,6 +41,10 @@ public:
|
||||||
|
|
||||||
uint callDuration() const;
|
uint callDuration() const;
|
||||||
void setCallDuration(uint duration);
|
void setCallDuration(uint duration);
|
||||||
|
|
||||||
|
QString callContactId() const;
|
||||||
|
void setCallContactId(const QString &contactId);
|
||||||
|
|
||||||
Q_INVOKABLE void resetMissedCalls();
|
Q_INVOKABLE void resetMissedCalls();
|
||||||
Q_INVOKABLE void dial(const QString &number);
|
Q_INVOKABLE void dial(const QString &number);
|
||||||
|
|
||||||
|
|
@ -47,6 +52,7 @@ Q_SIGNALS:
|
||||||
void missedCallsActionTriggered();
|
void missedCallsActionTriggered();
|
||||||
void callStateChanged();
|
void callStateChanged();
|
||||||
void callDurationChanged();
|
void callDurationChanged();
|
||||||
|
void callContactIdChanged();
|
||||||
void acceptCall();
|
void acceptCall();
|
||||||
void rejectCall();
|
void rejectCall();
|
||||||
void hangUp();
|
void hangUp();
|
||||||
|
|
@ -57,6 +63,7 @@ private:
|
||||||
int m_missedCalls;
|
int m_missedCalls;
|
||||||
QString m_callState;
|
QString m_callState;
|
||||||
Tp::AccountPtr m_simAccount;
|
Tp::AccountPtr m_simAccount;
|
||||||
|
QString m_callContactId;
|
||||||
uint m_callDuration;
|
uint m_callDuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue