Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is this DBus signal connection code correct?
Forum Updated to NodeBB v4.3 + New Features

Is this DBus signal connection code correct?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    notgary
    wrote on 30 Jun 2012, 14:40 last edited by
    #1

    This is my first time using DBus so I'm not entirely sure if I'm going about this the right way. I'm attempting to connect the the Ubuntu One DBus service and obtain login credentials for my app, however the slots I've connected to the DBus return signals detailed "here":https://one.ubuntu.com/developer/account_admin/auth/ubuntu#other-languages never seem to be firing, despite a positive result being returned during the connection.

    Before I start looking for errors in the details relating to this specific service, could someone please tell me if this code would even work in the first place, or if I'm done something wrong here?

    @class UbuntuOneDBus : public QObject
    {
    Q_OBJECT

    QString busName;
    QString path;
    QString interface;
    QString method;
    QString signature;

    void connectReturnSignals();

    private slots:
    void credentialsFound();
    void credentialsNotFound();
    void credentialsError();

    public:
    UbuntuOneDBus();

    bool init();
    };@

    @UbuntuOneDBus::UbuntuOneDBus()
    {
    busName = "com.ubuntuone.Credentials";
    path = "/credentials";
    interface = "com.ubuntuone.CredentialsManagement";
    method = "register";
    signature = "a{ss}";

    connectReturnSignals();
    }

    bool UbuntuOneDBus::init()
    {
    QDBusMessage message = QDBusMessage::createMethodCall( busName, path, interface, method );
    QDBusConnection::sessionBus().send( message );
    }

    void UbuntuOneDBus::connectReturnSignals()
    {
    QDBusConnection::sessionBus().connect( busName, path, interface, "CredentialsFound", this, SLOT( credentialsFound() ) );
    QDBusConnection::sessionBus().connect( busName, path, interface, "CredentialsNotFound", this, SLOT( credentialsNotFound() ) );
    QDBusConnection::sessionBus().connect( busName, path, interface, "CredentialsError", this, SLOT( credentialsError() ) );
    }

    void UbuntuOneDBus::credentialsFound()
    {
    qDebug() << "Credentials found";
    }

    void UbuntuOneDBus::credentialsNotFound()
    {
    std::cout << "Credentials not found" << std::endl;
    }

    void UbuntuOneDBus::credentialsError()
    {
    std::cout << "Credentials error" << std::endl;
    }@

    1 Reply Last reply
    0
    • N Offline
      N Offline
      notgary
      wrote on 2 Jul 2012, 13:22 last edited by
      #2

      Just a quick bump. Does anyone have any idea what it is I'm doing wrong?

      1 Reply Last reply
      0

      1/2

      30 Jun 2012, 14:40

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved