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 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?
int main()
{
UbuntuOneDBus *u1Dbus = new UbuntuOneDBus;
if( u1Dbus->init() ){
qDebug() << "Message queued";
}
}
UbuntuOneDBus::UbuntuOneDBus()
{
service = "com.ubuntuone.Credentials";
path = "/credentials";
interface = "com.ubuntuone.CredentialsManagement";
method = "register";
signature = "a{ss} (Dict of {String, String})";
connectReturnSignals();
}
bool UbuntuOneDBus::init()
{
QDBusMessage message = QDBusMessage::createMethodCall( service,
path,
interface,
method );
bool queued = QDBusConnection::sessionBus().send( message );
return queued;
}
void UbuntuOneDBus::connectReturnSignals()
{
bool connectionSuccessful = false;
connectionSuccessful = QDBusConnection::sessionBus().connect( service,
path,
interface,
"CredentialsFound",
"a{ss} (Dict of {String, String})",
this,
SLOT( credentialsFound() ) );
if( ! connectionSuccessful ) qDebug() << "Connection to DBus::CredentialsFound signal failed";
connectionSuccessful = QDBusConnection::systemBus().connect( service,
path,
interface,
"CredentialsNotFound",
"(nothing)",
this,
SLOT( credentialsNotFound() ) );
if( ! connectionSuccessful ) qDebug() << "Connection to DBus::CredentialsNotFound signal failed";
connectionSuccessful = QDBusConnection::systemBus().connect( service,
path,
interface,
"CredentialsError",
"a{ss} (Dict of {String, String})",
this,
SLOT( credential
if( ! connectionSuccessful ) qDebug() << "Connection to DBus::CredentialsError signal failed";
}
void UbuntuOneDBus::credentialsFound()
{
std::cout << "Credentials found" << std::endl;
}
void UbuntuOneDBus::credentialsNotFound()
{
std::cout << "Credentials not found" << std::endl;
}
void UbuntuOneDBus::credentialsError()
{
std::cout << "Credentials error" << std::endl;
}