本文整理汇总了C++中QDBusPendingCallWatcher::waitForFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingCallWatcher::waitForFinished方法的具体用法?C++ QDBusPendingCallWatcher::waitForFinished怎么用?C++ QDBusPendingCallWatcher::waitForFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingCallWatcher
的用法示例。
在下文中一共展示了QDBusPendingCallWatcher::waitForFinished方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openUrl
bool QFlatpakServices::openUrl(const QUrl &url)
{
qCDebug(QFlatpakPlatformServices) << "Open url: " << url;
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"),
QLatin1String("org.freedesktop.portal.OpenURI"),
QLatin1String("OpenURI"));
// TODO get parent window id??
QString parentWindowId = QLatin1String("x11:")/* + QString::number(parent->winId())*/;
QVariantMap options; // TODO: handle "writable" option
message << parentWindowId << url.toDisplayString() << options;
QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);
watcher->waitForFinished(); // TODO sorry for a blocking call, but we cannot do it asynchronous here
QDBusPendingReply<QDBusObjectPath> reply = *watcher;
if (reply.isError()) {
qCDebug(QFlatpakPlatformServices) << "Couldn't get reply";
return false;
}
return true;
}
示例2: qCritical
CallProxy::CallProxy(const QString &callPath)
: org::ofono::VoiceCall(OFONO_SERVICE,
callPath,
QDBusConnection::systemBus()),
m_lineid(QString()),
m_state(QString()),
m_startTime(QDateTime()),
m_reason(QString()),
m_connected(false),
m_multiparty(false)
{
TRACE;
if (!org::ofono::VoiceCall::isValid()) {
qCritical() << QString("Failed to connect to %1 for call %2:\n\t%3")
.arg(staticInterfaceName())
.arg(callPath)
.arg(lastError().message());
} else {
QDBusPendingReply<QVariantMap> reply;
QDBusPendingCallWatcher *watcher;
reply = GetProperties();
watcher = new QDBusPendingCallWatcher(reply);
// Force this to be sync to ensure we have initial properties
watcher->waitForFinished();
getPropertiesFinished(watcher);
if (isValid()) {
connect(this,
SIGNAL(PropertyChanged(const QString&,const QDBusVariant&)),
SLOT(propertyChanged(const QString&,const QDBusVariant&)));
connect(this, SIGNAL(DisconnectReason(const QString&)),
SLOT(disconnectReason(const QString&)));
} else {
qCritical() << QString("Invalid CallProxy instance: state == %1")
.arg(m_state);
}
}
示例3: qFatal
ManagerProxy::ManagerProxy(const QString &service,
const QString &path,
const QDBusConnection &connection,
QObject *parent)
: org::ofono::Manager(service, path, connection, parent),
m_modemPath (""),
m_modem(0),
m_network(0),
m_callManager(0),
m_volumeManager(0),
m_voicemail(0)
{
if (gManager)
qFatal("ManagerProxy: There can be only one!");
if (!isValid()) {
qDebug() << "Failed to connect to Ofono: \n\t" << lastError().message();
} else {
QDBusPendingReply<QArrayOfPathProperties> reply;
QDBusPendingCallWatcher * watcher;
reply = GetModems();
watcher = new QDBusPendingCallWatcher(reply);
// Force this to be sync to ensure we have initial properties
watcher->waitForFinished();
managerDBusGetModemsDone(watcher);
connect(this,
SIGNAL(ModemAdded(const QDBusObjectPath&, const QVariantMap&)),
SLOT(modemAdded(const QDBusObjectPath&, const QVariantMap&)));
connect(this,
SIGNAL(ModemRemoved(const QDBusObjectPath&)),
SLOT(modemRemoved(const QDBusObjectPath&)));
}
gManager = this;
}