Home · Modules · All Classes · All Namespaces
protocols/cm-wrapper.cpp
#include "cm-wrapper.h"
#include "_gen/cm-wrapper.moc.hpp"
#include <TelepathyQt/Debug>
#include <TelepathyQt/ConnectionManager>
#include <TelepathyQt/PendingReady>
#include <QDebug>
CMWrapper::CMWrapper(const QString &cmName, QObject *parent)
: QObject(parent),
mCM(ConnectionManager::create(cmName))
{
connect(mCM->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onCMReady(Tp::PendingOperation *)));
}
CMWrapper::~CMWrapper()
{
}
ConnectionManagerPtr CMWrapper::cm() const
{
return mCM;
}
void CMWrapper::onCMReady(PendingOperation *op)
{
if (op->isError()) {
qWarning() << "CM" << mCM->name() << "cannot become ready -" <<
op->errorName() << ": " << op->errorMessage();
return;
}
qDebug() << "CM" << mCM->name() << "ready!";
qDebug() << "Supported protocols:";
foreach (const QString &protocol, mCM->supportedProtocols()) {
qDebug() << "\t" << protocol;
}
emit finished();
}