[dialer] Promote the Tp::Channel class var to Tp::CallChannel

This commit is contained in:
Martin Klapetek 2015-06-18 15:32:06 +00:00
parent eb176a4099
commit e1f27cebb0
2 changed files with 5 additions and 6 deletions

View file

@ -25,7 +25,6 @@
#include <TelepathyQt/PendingReady> #include <TelepathyQt/PendingReady>
#include <TelepathyQt/PendingContacts> #include <TelepathyQt/PendingContacts>
#include <TelepathyQt/TextChannel> #include <TelepathyQt/TextChannel>
#include <TelepathyQt/CallChannel>
#include <TelepathyQt/Types> #include <TelepathyQt/Types>
#include <TelepathyQt/ContactManager> #include <TelepathyQt/ContactManager>
@ -72,7 +71,7 @@ void TpCaller::dial(const QString &number)
return; return;
} }
m_callChannel = pendingChannel->channel(); m_callChannel = Tp::CallChannelPtr(qobject_cast<Tp::CallChannel*>(pendingChannel->channel().data()));
Q_EMIT callInProgressChanged(); Q_EMIT callInProgressChanged();
}); });
}); });
@ -89,13 +88,13 @@ void TpCaller::hangUp()
qDebug() << "About to hangup" << m_callChannel << m_callChannel->isValid() << m_callChannel->connection(); qDebug() << "About to hangup" << m_callChannel << m_callChannel->isValid() << m_callChannel->connection();
if (m_callChannel && m_callChannel->isValid() && m_callChannel->connection()) { if (m_callChannel && m_callChannel->isValid() && m_callChannel->connection()) {
qDebug() << "Hanging up"; qDebug() << "Hanging up";
Tp::PendingOperation *op = qobject_cast<Tp::CallChannel*>(m_callChannel.data())->hangup(); Tp::PendingOperation *op = m_callChannel->hangup();
connect(op, &Tp::PendingOperation::finished, [=]() { connect(op, &Tp::PendingOperation::finished, [=]() {
if (op->isError()) { if (op->isError()) {
qWarning() << "Unable to hang up:" << op->errorMessage(); qWarning() << "Unable to hang up:" << op->errorMessage();
} }
qDebug() << "Channel close request complete"; qDebug() << "Channel close request complete";
Q_EMIT callInProgressChanged(); m_callChannel->requestClose();
}); });
} }
} }

View file

@ -21,7 +21,7 @@
#include <QObject> #include <QObject>
#include <TelepathyQt/Account> #include <TelepathyQt/Account>
#include <TelepathyQt/Channel> #include <TelepathyQt/CallChannel>
class TpCaller : public QObject class TpCaller : public QObject
{ {
@ -40,7 +40,7 @@ Q_SIGNALS:
private: private:
Tp::AccountPtr m_simAccount; Tp::AccountPtr m_simAccount;
Tp::ChannelPtr m_callChannel; Tp::CallChannelPtr m_callChannel;
}; };
#endif // TPCALLER_H #endif // TPCALLER_H