DBus is ignoring me?

Marc Mauri Alloza marcmaurialloza at gmail.com
Fri Jun 17 14:20:23 CEST 2011


Hello,

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.

Here is the code:

main.cpp:

#include <QApplication>
#include "prova.hpp"

int main(int argc, char *argv[] )
{
    QApplication app(argc, argv);

    MyClass MC();

    return app.exec();
}

prova.hpp:

#ifndef PROVA_HPP
#define PROVA_HPP

#include <QObject>
#include <TelepathyQt4/AccountManager>

class MyClass : public QObject
 {
     Q_OBJECT

 public:
     MyClass(QObject *parent = 0);
     ~MyClass() { }

 private Q_SLOTS:
     void onAccountManagerReady(Tp::PendingOperation*);

 private:
     Tp::AccountManagerPtr mAM;
 };

#endif

prova.cpp:

#ifndef PROVA_CPP
#define PROVA_CPP

#include <QDebug>
#include <TelepathyQt4/AccountManager>
#include <TelepathyQt4/PendingOperation>
#include <TelepathyQt4/PendingReady>
#include "prova.hpp"


 MyClass::MyClass(QObject *parent)
     : QObject(parent), mAM(Tp::AccountManager::create())
 {

     connect(mAM->becomeReady(),
             SIGNAL(finished(Tp::PendingOperation*)),
             SLOT(onAccountManagerReady(Tp::PendingOperation*)));
 }

 void MyClass::onAccountManagerReady(Tp::PendingOperation *op)
 {
     if (op->isError()) {
         qWarning() << "Account manager cannot become ready:" <<
             op->errorName() << "-" << op->errorMessage();
         return;
     }

     // AccountManager is now ready
     qDebug() << "All accounts:";


     foreach (const Tp::AccountPtr &acc, mAM->allAccounts()) {
         qDebug() << " path:" << acc->objectPath();
     }
 }

#endif

Maybe it's problem in telepathy's instalation. I'm in archlinux 64bit.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-telepathy/attachments/20110617/cb26128e/attachment.htm 


More information about the KDE-Telepathy mailing list