You're missing factories in your code. You need to set them before creating the account manager, basically you tell Telepathy what features you want from it(see main-widget.cpp:192 in kde-telepathy-contactlist)<div><br>
</div><div>--Marty<br>
<br><br><div class="gmail_quote">2011/6/17 Marc Mauri Alloza <span dir="ltr"><<a href="mailto:marcmaurialloza@gmail.com">marcmaurialloza@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br><br>I'm in SoK and my mentor asked my to write a chat application. I'm trying to write an app that lists the accounts, it compiles but it doesn't work i think dbus is not doing his job.<br><br>Here is the code:<br>
<br>main.cpp:<br><br>#include <QApplication><br>#include "prova.hpp"<br><br>int main(int argc, char *argv[] )<br>{ <br> QApplication app(argc, argv);<br> <br> MyClass MC();<br> <br> return app.exec();<br>
}<br><br>prova.hpp:<br><br>#ifndef PROVA_HPP<br>#define PROVA_HPP<br><br>#include <QObject><br>#include <TelepathyQt4/AccountManager><br><br>class MyClass : public QObject<br> {<br> Q_OBJECT<br><br> public:<br>
MyClass(QObject *parent = 0);<br> ~MyClass() { }<br><br> private Q_SLOTS:<br> void onAccountManagerReady(Tp::PendingOperation*);<br><br> private:<br> Tp::AccountManagerPtr mAM;<br> };<br><br>#endif<br><br>
prova.cpp:<br><br>#ifndef PROVA_CPP<br>#define PROVA_CPP<br><br>#include <QDebug><br>#include <TelepathyQt4/AccountManager><br>#include <TelepathyQt4/PendingOperation><br>#include <TelepathyQt4/PendingReady><br>
#include "prova.hpp"<br><br><br> MyClass::MyClass(QObject *parent)<br> : QObject(parent), mAM(Tp::AccountManager::create())<br> {<br> <br> connect(mAM->becomeReady(),<br> SIGNAL(finished(Tp::PendingOperation*)),<br>
SLOT(onAccountManagerReady(Tp::PendingOperation*)));<br> }<br><br> void MyClass::onAccountManagerReady(Tp::PendingOperation *op)<br> {<br> if (op->isError()) {<br> qWarning() << "Account manager cannot become ready:" <<<br>
op->errorName() << "-" << op->errorMessage();<br> return;<br> }<br><br> // AccountManager is now ready<br> qDebug() << "All accounts:";<br> <br>
<br> foreach (const Tp::AccountPtr &acc, mAM->allAccounts()) {<br> qDebug() << " path:" << acc->objectPath();<br> }<br> }<br> <br>#endif<br><br>Maybe it's problem in telepathy's instalation. I'm in archlinux 64bit.<br>
<br>Thank you.<br><br>
<br>_______________________________________________<br>
KDE-Telepathy mailing list<br>
<a href="mailto:KDE-Telepathy@kde.org">KDE-Telepathy@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-telepathy" target="_blank">https://mail.kde.org/mailman/listinfo/kde-telepathy</a><br>
<br></blockquote></div><br></div>