#include <QStringList>
#include <QDBusPendingReply>
#include <QDBusObjectPath>
+#include <QDBusError>
#include <QDebug>
using namespace org::freedesktop::Telepathy;
QList<QDBusObjectPath> objPathList;
- QDBusInterface *iface = new QDBusInterface(AM_SERVICE,AM_OBJ_PATH,DBUS_PROPS_IFACE,QDBusConnection::sessionBus(),this);
- if (iface->isValid()){
- QDBusReply<QDBusVariant> reply = iface->call(QDBus::AutoDetect,"Get",AM_INTERFACE,"ValidAccounts");
-
- if (reply.isValid()){;
- QDBusVariant validAccounts = reply.value();
- const QVariant var = validAccounts.variant();
- const QDBusArgument arg = var.value<QDBusArgument>();
-
- arg.beginArray();
- while (!arg.atEnd()){
- QDBusObjectPath opath;
- arg >> opath;
- if (opath.path().contains("tel")){
- qDebug() << opath.path();
+ QDBusConnection sessionBus = QDBusConnection::sessionBus();
+
+ if (sessionBus.isConnected()){
+ QDBusInterface *iface = new QDBusInterface(AM_SERVICE,AM_OBJ_PATH,DBUS_PROPS_IFACE,sessionBus,this);
+
+ if (iface->isValid()){
+ QDBusReply<QDBusVariant> reply = iface->call(QDBus::AutoDetect,"Get",AM_INTERFACE,"ValidAccounts");
+
+ if (reply.isValid()){;
+ QDBusVariant validAccounts = reply.value();
+ const QVariant var = validAccounts.variant();
+ const QDBusArgument arg = var.value<QDBusArgument>();
+
+ arg.beginArray();
+ while (!arg.atEnd()){
+ QDBusObjectPath opath;
+ arg >> opath;
+
+ if (opath.path().contains("tel")){
+ qDebug() << opath.path();
+ }
+ objPathList.append(opath);
}
- objPathList.append(opath);
+ arg.endArray();
+ }
+ else{
+ qDebug() << "Error occurred while fetching accounts list "<<reply.error();
}
- arg.endArray();
}
else{
- qDebug() << "Error occurred while fetching accounts list "<<reply.error();
+ QDBusError dbusError = QDBusConnection::sessionBus().lastError();
+ if (dbusError.isValid()) {
+ qDebug () << "DBUS Error - " << dbusError.message();
+ }
+ else{
+ qDebug () << "Debug - Invalid Interface";
+ }
}
}
else{
- qDebug() << "Error occurred while connecting to DBus interface";
+ qDebug() << "Error occurred while connecting to DBus interface";
}
return objPathList;
QList<QDBusObjectPath> accountsList = this->getAllAccounts();
QDBusObjectPath account;
foreach (account,accountsList){
+ qDebug() << account.path();
if (account.path().contains("vicar/tel/vicar")){
vicarAccountExists = true;
break;
accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.Enabled",true);
accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.ConnectAutomatically",true);
accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.RequestedPresence",QVariant::fromValue(presence));
+<<<<<<< HEAD
+ //accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.Service","vicar"); //Required when service can't be determined by the protocol name
+=======
accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.Service","vicar"); //Required when service can't be determined by the protocol name
+>>>>>>> 74800375ecf7f41e290cf7cc7fa9ee8b230be68e
accountPropertiesMap.insert("com.nokia.Account.Interface.Compat.Profile","vicar");
QStringList valuesList;