Port users of QDBusAbstractInterface::(async)callWithArgumentList() to new variadic (async)Call()
Except in the auto-generated files. Required to add a cast operator from QDBusObjectPath to QVariant, as the variadic call() uses QVariant(arg) instead of QVariant::fromValue(arg). [ChangeLog][QtDBus][QDBusObjectPath] Added explicit cast operator to QVariant. Change-Id: I3f3004f7b9300a6340d27488f5b97981cbab3c24 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
5f1f0fe0b7
commit
80179e3b7e
|
|
@ -166,6 +166,14 @@ void QDBusSignature::doCheck()
|
|||
\sa path()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\since 5.14
|
||||
|
||||
Implicit cast to QVariant. Equivalent to calling
|
||||
QVariant::fromValue() with this object as argument.
|
||||
*/
|
||||
QDBusObjectPath::operator QVariant() const { return QVariant::fromValue(*this); }
|
||||
|
||||
/*!
|
||||
\class QDBusSignature
|
||||
\inmodule QtDBus
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class Q_DBUS_EXPORT QDBusObjectPath
|
||||
{
|
||||
QString m_path;
|
||||
|
|
@ -75,6 +74,8 @@ public:
|
|||
inline QString path() const
|
||||
{ return m_path; }
|
||||
|
||||
operator QVariant() const;
|
||||
|
||||
private:
|
||||
void doCheck();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -92,15 +92,11 @@ public:
|
|||
public Q_SLOTS: // METHODS
|
||||
QDBusPendingReply<QString, QDBusObjectPath> GetMenuForWindow(uint windowId)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(windowId);
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetMenuForWindow"), argumentList);
|
||||
return asyncCall(QStringLiteral("GetMenuForWindow"), windowId);
|
||||
}
|
||||
QDBusReply<QString> GetMenuForWindow(uint windowId, QDBusObjectPath &menuObjectPath)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(windowId);
|
||||
QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetMenuForWindow"), argumentList);
|
||||
QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetMenuForWindow"), windowId);
|
||||
QList<QVariant> arguments = reply.arguments();
|
||||
if (reply.type() == QDBusMessage::ReplyMessage && arguments.count() == 2)
|
||||
menuObjectPath = qdbus_cast<QDBusObjectPath>(arguments.at(1));
|
||||
|
|
@ -109,16 +105,12 @@ public Q_SLOTS: // METHODS
|
|||
|
||||
QDBusPendingReply<> RegisterWindow(uint windowId, const QDBusObjectPath &menuObjectPath)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(windowId) << QVariant::fromValue(menuObjectPath);
|
||||
return asyncCallWithArgumentList(QStringLiteral("RegisterWindow"), argumentList);
|
||||
return asyncCall(QStringLiteral("RegisterWindow"), windowId, menuObjectPath);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> UnregisterWindow(uint windowId)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(windowId);
|
||||
return asyncCallWithArgumentList(QStringLiteral("UnregisterWindow"), argumentList);
|
||||
return asyncCall(QStringLiteral("UnregisterWindow"), windowId);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -95,26 +95,21 @@ public:
|
|||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> closeNotification(uint id)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(id);
|
||||
return asyncCallWithArgumentList(QStringLiteral("CloseNotification"), argumentList);
|
||||
return asyncCall(QStringLiteral("CloseNotification"), id);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QStringList> getCapabilities()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetCapabilities"), argumentList);
|
||||
return asyncCall(QStringLiteral("GetCapabilities"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QString, QString, QString, QString> getServerInformation()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetServerInformation"), argumentList);
|
||||
return asyncCall(QStringLiteral("GetServerInformation"));
|
||||
}
|
||||
inline QDBusReply<QString> getServerInformation(QString &vendor, QString &version, QString &specVersion)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
QDBusMessage reply = callWithArgumentList(QDBus::Block, QStringLiteral("GetServerInformation"), argumentList);
|
||||
QDBusMessage reply = call(QDBus::Block, QStringLiteral("GetServerInformation"));
|
||||
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 4) {
|
||||
vendor = qdbus_cast<QString>(reply.arguments().at(1));
|
||||
version = qdbus_cast<QString>(reply.arguments().at(2));
|
||||
|
|
@ -129,12 +124,7 @@ public Q_SLOTS: // METHODS
|
|||
const QVariantMap &hints, int timeout)
|
||||
{
|
||||
qCDebug(qLcTray) << appName << replacesId << appIcon << summary << body << actions << hints << timeout;
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(appName) << QVariant::fromValue(replacesId) <<
|
||||
QVariant::fromValue(appIcon) << QVariant::fromValue(summary) <<
|
||||
QVariant::fromValue(body) << QVariant::fromValue(actions) <<
|
||||
QVariant::fromValue(hints) << QVariant::fromValue(timeout);
|
||||
return asyncCallWithArgumentList(QStringLiteral("Notify"), argumentList);
|
||||
return asyncCall(QStringLiteral("Notify"), appName, replacesId, appIcon, summary, body, actions, hints, timeout);
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
|
|||
qDBusRegisterMetaType<ConnmanMap>();
|
||||
qDBusRegisterMetaType<ConnmanMapList>();
|
||||
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> props_reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
|
||||
|
||||
QObject::connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||
|
|
@ -106,8 +105,7 @@ QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
|
|||
QLatin1String("TechnologyRemoved"),
|
||||
this,SLOT(technologyRemoved(QDBusObjectPath)));
|
||||
|
||||
QList<QVariant> argumentList2;
|
||||
QDBusPendingReply<ConnmanMapList> serv_reply = asyncCallWithArgumentList(QLatin1String("GetServices"), argumentList2);
|
||||
QDBusPendingReply<ConnmanMapList> serv_reply = asyncCall(QLatin1String("GetServices"));
|
||||
QDBusPendingCallWatcher *watcher2 = new QDBusPendingCallWatcher(serv_reply, this);
|
||||
|
||||
QObject::connect(watcher2,SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||
|
|
@ -289,8 +287,7 @@ QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,Q
|
|||
CONNMAN_SERVICE_INTERFACE,
|
||||
QDBusConnection::systemBus(), parent)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> props_reply = asyncCallWithArgumentList(QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
|
||||
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,7 @@ QOfonoManagerInterface::~QOfonoManagerInterface()
|
|||
QStringList QOfonoManagerInterface::getModems()
|
||||
{
|
||||
if (modemList.isEmpty()) {
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<PathPropertiesList> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetModems"), argumentList);
|
||||
QDBusPendingReply<PathPropertiesList> reply = call(QDBus::Block, QLatin1String("GetModems"));
|
||||
reply.waitForFinished();
|
||||
if (!reply.isError()) {
|
||||
const auto modems = reply.value();
|
||||
|
|
@ -184,8 +183,7 @@ QStringList QOfonoModemInterface::interfaces()
|
|||
QVariantMap QOfonoModemInterface::getProperties()
|
||||
{
|
||||
if (propertiesMap.isEmpty()) {
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> reply = call(QDBus::Block, QLatin1String("GetProperties"));
|
||||
if (!reply.isError()) {
|
||||
propertiesMap = reply.value();
|
||||
}
|
||||
|
|
@ -233,8 +231,7 @@ QVariant QOfonoNetworkRegistrationInterface::getProperty(const QString &property
|
|||
QVariantMap QOfonoNetworkRegistrationInterface::getProperties()
|
||||
{
|
||||
if (propertiesMap.isEmpty()) {
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> reply = call(QDBus::Block, QLatin1String("GetProperties"));
|
||||
reply.waitForFinished();
|
||||
if (!reply.isError()) {
|
||||
propertiesMap = reply.value();
|
||||
|
|
@ -306,8 +303,7 @@ QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &proper
|
|||
QVariantMap &QOfonoDataConnectionManagerInterface::getProperties()
|
||||
{
|
||||
if (propertiesMap.isEmpty()) {
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> reply = call(QDBus::Block, QLatin1String("GetProperties"));
|
||||
if (!reply.isError()) {
|
||||
propertiesMap = reply.value();
|
||||
}
|
||||
|
|
@ -343,8 +339,7 @@ QOfonoConnectionContextInterface::~QOfonoConnectionContextInterface()
|
|||
QVariantMap QOfonoConnectionContextInterface::getProperties()
|
||||
{
|
||||
if (propertiesMap.isEmpty()) {
|
||||
QList<QVariant> argumentList;
|
||||
QDBusPendingReply<QVariantMap> reply = callWithArgumentList(QDBus::Block, QLatin1String("GetProperties"), argumentList);
|
||||
QDBusPendingReply<QVariantMap> reply = call(QDBus::Block, QLatin1String("GetProperties"));
|
||||
if (!reply.isError()) {
|
||||
propertiesMap = reply.value();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue