| Home · All Classes · All Namespaces · Modules · Functions · Files

protocols/protocols.cpp
#include "protocols.h"
#include "_gen/protocols.moc.hpp"
#include <TelepathyQt/Debug>
#include <TelepathyQt/ConnectionManager>
#include <TelepathyQt/PendingStringList>
#include <QCoreApplication>
#include <QDebug>
Protocols::Protocols()
: cmWrappersFinished(0)
{
qDebug() << "Listing names";
connect(ConnectionManager::listNames(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onListNamesFinished(Tp::PendingOperation *)));
}
Protocols::~Protocols()
{
}
void Protocols::onListNamesFinished(PendingOperation *op)
{
if (op->isError()) {
qWarning() << "Error listing connection manager names -" <<
op->errorName() << ": " << op->errorMessage();
return;
}
PendingStringList *ps = qobject_cast<PendingStringList *>(op);
qDebug() << "Supported CMs:" << ps->result();
foreach (const QString &cmName, ps->result()) {
CMWrapper *cmWrapper = new CMWrapper(cmName, this);
mCMWrappers.append(cmWrapper);
connect(cmWrapper,
SIGNAL(finished()),
SLOT(onCMWrapperFinished()));
}
}
void Protocols::onCMWrapperFinished()
{
if (++cmWrappersFinished == mCMWrappers.size()) {
QCoreApplication::quit();
}
}