本文整理汇总了C++中QDBusPendingReply::error方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply::error方法的具体用法?C++ QDBusPendingReply::error怎么用?C++ QDBusPendingReply::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingReply
的用法示例。
在下文中一共展示了QDBusPendingReply::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCallFinished
void PendingConnection::onCallFinished(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QString, QDBusObjectPath> reply = *watcher;
if (!reply.isError()) {
QString busName = reply.argumentAt<0>();
QString objectPath = reply.argumentAt<1>().path();
debug() << "Got reply to ConnectionManager.CreateConnection - bus name:" <<
busName << "- object path:" << objectPath;
PendingReady *readyOp = manager()->connectionFactory()->proxy(busName,
objectPath, manager()->channelFactory(), manager()->contactFactory());
mPriv->connection = ConnectionPtr::qObjectCast(readyOp->proxy());
connect(readyOp,
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onConnectionBuilt(Tp::PendingOperation*)));
} else {
debug().nospace() <<
"CreateConnection failed: " <<
reply.error().name() << ": " << reply.error().message();
setFinishedWithError(reply.error());
}
watcher->deleteLater();
}
示例2: OnAsyncReply
void PowerManagerNux::OnAsyncReply(QDBusPendingCallWatcher *call)
{
if (m_state == request_idle)
{
QDBusPendingReply<> reply = *call;
if(reply.isError())
{
qDebug("D-Bus: Reply: Error: %s", qPrintable(reply.error().message()));
m_state = error;
}
else
{
m_state = idle;
qDebug("D-Bus: PowerManagerInhibitor: Request successful");
if (m_intended_state == busy)
this->setState(1, QString::fromLatin1(""));
}
}
else if (m_state == request_busy)
{
QDBusPendingReply<uint> reply = *call;
if(reply.isError())
{
qDebug("D-Bus: Reply: Error: %s", qPrintable(reply.error().message()));
if (!m_use_gsm)
{
qDebug("D-Bus: Falling back to org.gnome.SessionManager");
m_use_gsm = true;
m_state = idle;
if (m_intended_state == busy)
// XXX
this->setState(1, QString("Busy"));
}
else
{
m_state = error;
}
}
else
{
m_state = busy;
m_cookie = reply.value();
qDebug("D-Bus: PowerManagerInhibitor: Request successful, cookie is %d", m_cookie);
if (m_intended_state == idle)
// XXX
this->setState(0, QString("Iddle"));
}
}
else
{
qDebug("D-Bus: Unexpected reply in state %d", m_state);
m_state = error;
}
call->deleteLater();
}
示例3: onDBusClipboardSetContentsFinished
void QMirClientClipboard::onDBusClipboardSetContentsFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<void> reply = *call;
if (reply.isError()) {
qCritical("QMirClientClipboard - Failed to set the system clipboard contents via D-Bus. %s, %s",
qPrintable(reply.error().name()), qPrintable(reply.error().message()));
// TODO: Might try again later a number of times...
}
call->deleteLater();
}
示例4: sendMessageFinished
void QOfonoMessageManager::sendMessageFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<QDBusObjectPath> reply = *call;
bool ok = true;
if (reply.isError()) {
qWarning() << Q_FUNC_INFO << "failed:" << reply.error();
d_ptr->errorMessage = reply.error().name() + " " + reply.error().message();
ok = false;
}
Q_EMIT sendMessageComplete(ok, reply.value().path());
}
示例5: setProxy
Transaction::InternalError Daemon::setProxy(const QString& http_proxy, const QString& https_proxy, const QString& ftp_proxy, const QString& socks_proxy, const QString& no_proxy, const QString& pac)
{
Q_D(Daemon);
QDBusPendingReply<> r = d->daemon->SetProxy(http_proxy, https_proxy, ftp_proxy, socks_proxy, no_proxy, pac);
r.waitForFinished();
d->lastError = r.error();
if (r.isError()) {
return Transaction::parseError(r.error().name());
} else {
return Transaction::InternalErrorNone;
}
}
示例6: registerFinished
void QOfonoNetworkOperator::registerFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<> reply = *call;
QOfonoNetworkOperator::Error error = NoError;
QString errorString;
if (reply.isError()) {
qWarning() << "QOfonoNetworkOperator::registerOperator() failed:" << reply.error();
error = errorNameToEnum(reply.error().name());
errorString = reply.error().name() + " " + reply.error().message();
}
Q_EMIT registerComplete(error,errorString);
}
示例7: deflectFinished
void QOfonoVoiceCall::deflectFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<> reply = *call;
QOfonoVoiceCall::Error error = NoError;
QString errorString;
if (reply.isError()) {
qWarning() << "QOfonoVoiceCall::deflect() failed:" << reply.error();
error = errorNameToEnum(reply.error().name());
errorString = reply.error().name() + " " + reply.error().message();
}
Q_EMIT deflectComplete(error, errorString);
}
示例8: sendUserReply
void ConnectionAgentPlugin::sendUserReply(const QVariantMap &input)
{
if (!connManagerInterface || !connManagerInterface->isValid()) {
Q_EMIT errorReported("","ConnectionAgent not available");
return;
}
QDBusPendingReply<> reply = connManagerInterface->sendUserReply(input);
reply.waitForFinished();
if (reply.isError()) {
qDebug() << Q_FUNC_INFO << reply.error().message();
Q_EMIT errorReported("",reply.error().message());
}
}
示例9: connectAudioFinished
void QOfonoHandsfreeAudioCard::connectAudioFinished(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<> reply = *call;
QOfonoHandsfreeAudioCard::Error error = NoError;
QString errorString;
if (reply.isError()) {
qWarning() << "QOfonoHandsfreeAudioCard::connectAudio() failed:" << reply.error();
error = errorNameToEnum(reply.error().name());
errorString = reply.error().name() + " " + reply.error().message();
}
emit connectAudioComplete(error, errorString);
}
示例10: resetFinished
void QOfonoCallMeter::resetFinished(QDBusPendingCallWatcher *call)
{
call->deleteLater();
QDBusPendingReply<> reply = *call;
QOfonoCallMeter::Error error = NoError;
QString errorString;
if (reply.isError()) {
qWarning() << "QOfonoCallMeter::reset() failed:" << reply.error();
error = errorNameToEnum(reply.error().name());
errorString = reply.error().name() + " " + reply.error().message();
Q_EMIT resetComplete(error,errorString);
}
}
示例11: onDBusClipboardGetContentsFinished
void QMirClientClipboard::onDBusClipboardGetContentsFinished(QDBusPendingCallWatcher* call)
{
Q_ASSERT(call == mPendingGetContentsCall.data());
QDBusPendingReply<QByteArray> reply = *call;
if (reply.isError()) {
qCritical("QMirClientClipboard - Failed to get system clipboard contents via D-Bus. %s, %s",
qPrintable(reply.error().name()), qPrintable(reply.error().message()));
// TODO: Might try again later a number of times...
} else {
QByteArray serializedMimeData = reply.argumentAt<0>();
updateMimeData(serializedMimeData);
}
call->deleteLater();
}
示例12: getPropertiesAsyncCallback
void NetworkRegistrationWatcher::getPropertiesAsyncCallback(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QVariantMap> reply = *watcher;
if (reply.error().isValid()) {
log_error("DBus call to interface %s function GetProperties of path %s failed: %s",
interface().toStdString().c_str(),
objectPath().toStdString().c_str(),
reply.error().message().toStdString().c_str());
return;
}
QVariantMap map = reply.argumentAt<0>();
foreach (const QString &key, map.keys())
emit propertyChanged(objectPath(), key, map.value(key));
}
示例13: listCachedUsers
/*!
Returns a list of user accounts.
\param systemUsers If true, returns also system users.
*/
UserAccountList AccountsManager::listCachedUsers()
{
Q_D(AccountsManager);
UserAccountList list;
QDBusPendingReply< QList<QDBusObjectPath> > reply = d->interface->ListCachedUsers();
reply.waitForFinished();
if (reply.isError()) {
QDBusError error = reply.error();
qWarning("Couldn't list cached users: %s",
error.errorString(error.type()).toUtf8().constData());
return list;
}
QList<QDBusObjectPath> value = reply.argumentAt<0>();
list.reserve(value.size());
for (int i = 0; i < value.size(); i++) {
const QString path = value.at(i).path();
UserAccount *account = d->usersCache.value(path, Q_NULLPTR);
if (!account) {
account = new UserAccount(path, d->interface->connection());
d->usersCache[path] = account;
}
list.append(account);
}
return list;
}
示例14: connectionActivePropertiesInterface
QNetworkManagerConnectionActive::QNetworkManagerConnectionActive(const QString &activeConnectionObjectPath, QObject *parent)
: QDBusAbstractInterface(QLatin1String(NM_DBUS_SERVICE),
activeConnectionObjectPath,
NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
QDBusConnection::systemBus(), parent)
{
if (!isValid()) {
return;
}
PropertiesDBusInterface connectionActivePropertiesInterface(QLatin1String(NM_DBUS_SERVICE),
activeConnectionObjectPath,
QLatin1String("org.freedesktop.DBus.Properties"),
QDBusConnection::systemBus());
QList<QVariant> argumentList;
argumentList << QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
QDBusPendingReply<QVariantMap> propsReply
= connectionActivePropertiesInterface.callWithArgumentList(QDBus::Block,QLatin1String("GetAll"),
argumentList);
if (!propsReply.isError()) {
propertyMap = propsReply.value();
} else {
qWarning() << propsReply.error().message();
}
QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE),
activeConnectionObjectPath,
QLatin1String(NM_DBUS_INTERFACE_ACTIVE_CONNECTION),
QLatin1String("PropertiesChanged"),
this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
}
示例15: listCachedUsersAsync
/*!
Cached a list of user accounts.
Async unblocking API.
*/
void AccountsManager::listCachedUsersAsync()
{
Q_D(AccountsManager);
QDBusPendingCall call = d->interface->ListCachedUsers();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *w) {
QDBusPendingReply< QList<QDBusObjectPath> > reply = *w;
w->deleteLater();
if (reply.isError()) {
QDBusError error = reply.error();
qWarning("Couldn't list cached users: %s",
error.errorString(error.type()).toUtf8().constData());
} else {
UserAccountList userList;
QList<QDBusObjectPath> value = reply.argumentAt<0>();
userList.reserve(value.size());
for (int i = 0; i < value.size(); i++) {
const QString path = value.at(i).path();
UserAccount *account = d->usersCache.value(path, Q_NULLPTR);
if (!account) {
account = new UserAccount(path, d->interface->connection());
d->usersCache[path] = account;
}
userList.append(account);
}
Q_EMIT listCachedUsersFinished(userList);
}
});
}