DBus is ignoring me?

David Edmundson david at davidedmundson.co.uk
Fri Jun 17 14:28:37 CEST 2011


That looks like it should work to me.

I assume you mean you get no output.
Do you definitely have some accounts? Check in the accounts KCM.

Add more debug lines, check it's running your MyClass constructor and
put a qDbug at the top of onAccountManagerReady.

As for Martin's comment, that will be very useful later, but it still
won't help your current code.

@Martin there is no AccountManagerFactory. There can't be as it loads
all the other factories.

2011/6/17 Marc Mauri Alloza <marcmaurialloza at gmail.com>:
> 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.
>
>
> _______________________________________________
> KDE-Telepathy mailing list
> KDE-Telepathy at kde.org
> https://mail.kde.org/mailman/listinfo/kde-telepathy
>
>


More information about the KDE-Telepathy mailing list