#include "roster-window.h"
#include "_gen/roster-window.moc.hpp"
#include "roster-widget.h"
#include <TelepathyQt/Types>
#include <TelepathyQt/ChannelFactory>
#include <TelepathyQt/Connection>
#include <TelepathyQt/ConnectionFactory>
#include <TelepathyQt/ContactFactory>
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/PendingReady>
#include <QDebug>
RosterWindow::RosterWindow(const QString &accountName, QWidget *parent)
: QMainWindow(parent)
{
setWindowTitle(QLatin1String("Roster"));
setupGui();
QDBusConnection::sessionBus());
connectionFactory, channelFactory, contactFactory);
resize(240, 320);
}
RosterWindow::~RosterWindow()
{
}
void RosterWindow::setupGui()
{
mRoster = new RosterWidget();
setCentralWidget(mRoster);
}
{
qWarning() << "Account cannot become ready - " <<
QCoreApplication::exit(1);
return;
}
qDebug() << "Account ready";
connect(mAccount.data(),
SIGNAL(connectionChanged(Tp::ConnectionPtr)),
SLOT(onAccountConnectionChanged(Tp::ConnectionPtr)));
if (mAccount->connection().isNull()) {
qDebug() << "The account given has no Connection. Please set it online to continue.";
}
onAccountConnectionChanged(mAccount->connection());
}
void RosterWindow::onAccountConnectionChanged(const ConnectionPtr &conn)
{
if (conn) {
mRoster->setConnection(conn);
} else {
mRoster->unsetConnection();
}
}