本文整理汇总了C++中QDBusPendingReply类的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply类的具体用法?C++ QDBusPendingReply怎么用?C++ QDBusPendingReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDBusPendingReply类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moduleLoadCallFinished
void KAccounts::moduleLoadCallFinished(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<bool> reply = *watcher;
bool loaded;
if (reply.isError()) {
loaded = false;
} else {
loaded = reply.value();
}
if (!loaded) {
qWarning() << "Unable to start the kded module, things may (and most probably will) misbehave";
}
}
示例2: qout
void SsuCli::optMode(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);
// TODO: allow setting meaningful names instead of numbers
if (opt.count() == 2){
QStringList modeList;
int deviceMode = ssu.deviceMode();
if ((deviceMode & Ssu::DisableRepoManager) == Ssu::DisableRepoManager)
modeList.append("DisableRepoManager");
if ((deviceMode & Ssu::RndMode) == Ssu::RndMode)
modeList.append("RndMode");
if ((deviceMode & Ssu::ReleaseMode) == Ssu::ReleaseMode)
modeList.append("ReleaseMode");
if ((deviceMode & Ssu::LenientMode) == Ssu::LenientMode)
modeList.append("LenientMode");
if ((deviceMode & Ssu::UpdateMode) == Ssu::UpdateMode)
modeList.append("UpdateMode");
qout << "Device mode is: " << ssu.deviceMode()
<< " (" << modeList.join(" | ") << ")" << endl;
if ((deviceMode & Ssu::RndMode) == Ssu::RndMode &&
(deviceMode & Ssu::ReleaseMode) == Ssu::ReleaseMode)
qout << "Both Release and RnD mode set, device is in RnD mode" << endl;
state = Idle;
} else if (opt.count() == 3 && opt.at(2) == "-s"){
qout << ssu.deviceMode();
state = Idle;
} else if (opt.count() == 3){
qout << "Setting device mode from " << ssu.deviceMode()
<< " to " << opt.at(2) << endl;
QDBusPendingReply<> reply = ssuProxy->setDeviceMode(opt.at(2).toInt());
reply.waitForFinished();
if (reply.isError()){
qerr << "DBus call failed, falling back to libssu" << endl;
ssu.setDeviceMode(Ssu::DeviceModeFlags(opt.at(2).toInt()));
SsuRepoManager repoManager;
repoManager.update();
uidWarning();
}
state = Idle;
}
}
示例3: gotDisplayStatus
void MDeviceState::gotDisplayStatus(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QString> reply = *watcher;
if (reply.isError()) {
qDebug() << __func__ << "getting display state failed:"
<< reply.error().message();
goto away;
}
mceDisplayStatusIndSignal(reply);
away:
delete display_call;
display_call = 0;
}
示例4: Q_D
/*!
Deletes the user designated by \a uid.
\param uid The user identifier.
\param removeFiles If true all files owned by the user will be removed.
\return whether the user was deleted successfully.
*/
bool AccountsManager::deleteUser(uid_t uid, bool removeFiles)
{
Q_D(AccountsManager);
QDBusPendingReply<> reply = d->interface->DeleteUser(uid, removeFiles);
if (reply.isError()) {
QDBusError error = reply.error();
qWarning("Couldn't delete user %d: %s", uid,
error.errorString(error.type()).toUtf8().constData());
return false;
}
return true;
}
示例5: qDebug
bool Systemd::SystemdPrivate::enableUnitFiles(const QStringList &files, bool runtime, bool force)
{
qDBusRegisterMetaType<DBusUnitFileChange>();
qDBusRegisterMetaType<DBusUnitFileChangeList>();
QDBusPendingReply<bool, DBusUnitFileChangeList> reply = isdface.EnableUnitFiles(files, runtime, force);
reply.waitForFinished();
if (reply.isError()) {
qDebug() << reply.error().message();
return false;
}
return true;
}
示例6: update
void RazorNotificationPrivate::update()
{
QDBusPendingReply<uint> reply = mInterface->Notify(qAppName(), mId, mIconName, mSummary, mBody, mActions, mHints, mTimeout);
reply.waitForFinished();
if (!reply.isError())
{
mId = reply.value();
}
else
{
if (mHints.contains("urgency") && mHints.value("urgency").toInt() != RazorNotification::UrgencyLow)
QMessageBox::information(0, tr("Notifications Fallback"), mSummary + " \n\n " + mBody);
}
}
示例7: gotTouchScreenLockMode
void MDeviceState::gotTouchScreenLockMode(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<QString> reply = *watcher;
if (reply.isError()) {
qDebug() << __func__ << "getting touch screen lock mode failed:"
<< reply.error().message();
goto away;
}
touchScreenLockMode = reply;
away:
delete tsmode_call;
tsmode_call = 0;
}
示例8: dialogServerProxy
void CReporterPrivacySettingsWidget::gotCoreFilesReply(QDBusPendingCallWatcher *call)
{
if (!waitingForCoreFilesReply)
return;
waitingForCoreFilesReply = false;
QDBusPendingReply<QStringList> fetchReply = *call;
if (fetchReply.isError()) {
// Show error, if failed to communicate with the daemon.
//% "Failed to fetch crash reports from the system."
CReporterInfoBanner::show(qtTrId("qtn_dcp_failed_to_fetch_crash_reports_text"));
call->deleteLater();
return;
}
QStringList files = fetchReply.argumentAt<0>();
if (files.isEmpty()) {
// No unsent crash reports.
//% "This system has not stored crash reports."
CReporterInfoBanner::show(qtTrId("qtn_dcp_no_stored_reports_text"));
call->deleteLater();
return;
}
// Pass files to dialog server for selection.
QVariantList arguments;
arguments << files;
bool openViaNotification = false; // Open the dialog immediately
arguments << openViaNotification;
CReporterDialogServerProxy dialogServerProxy(CReporter::DialogServerServiceName,
CReporter::DialogServerObjectPath, QDBusConnection::sessionBus(), this);
QDBusPendingReply<bool> selectReply =
dialogServerProxy.requestDialog(CReporter::SendSelectedDialogType, arguments);
selectReply.waitForFinished();
if (selectReply.isError()) {
// Show error, if failed to communicate with the daemon.
//% "Dialog request failed."
CReporterInfoBanner::show(qtTrId("qtn_dcp_daemon_communication_error_text."));
call->deleteLater();
return;
}
call->deleteLater();
}
示例9: sizeof
QString QBluetoothSocketPrivate::peerName() const
{
quint64 bdaddr;
if (socketType == QBluetoothServiceInfo::RfcommProtocol) {
sockaddr_rc addr;
socklen_t addrLength = sizeof(addr);
if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
return QString();
convertAddress(addr.rc_bdaddr.b, bdaddr);
} else if (socketType == QBluetoothServiceInfo::L2capProtocol) {
sockaddr_l2 addr;
socklen_t addrLength = sizeof(addr);
if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
return QString();
convertAddress(addr.l2_bdaddr.b, bdaddr);
} else {
qCWarning(QT_BT_BLUEZ) << "peerName() called on socket of unknown type";
return QString();
}
const QString peerAddress = QBluetoothAddress(bdaddr).toString();
const QString localAdapter = localAddress().toString();
if (isBluez5()) {
OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
QStringLiteral("/"),
QDBusConnection::systemBus());
QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
reply.waitForFinished();
if (reply.isError())
return QString();
foreach (const QDBusObjectPath &path, reply.value().keys()) {
const InterfaceList ifaceList = reply.value().value(path);
foreach (const QString &iface, ifaceList.keys()) {
if (iface == QStringLiteral("org.bluez.Device1")) {
if (ifaceList.value(iface).value(QStringLiteral("Address")).toString()
== peerAddress)
return ifaceList.value(iface).value(QStringLiteral("Alias")).toString();
}
}
}
return QString();
} else {
示例10: qDebug
void QOfonoConnectionContext::setContextPath(const QString &idPath)
{
if (idPath != contextPath()) {
if(d_ptr->context) {
delete d_ptr->context;
d_ptr->context = 0;
d_ptr->properties.clear();
}
qDebug() << Q_FUNC_INFO;
d_ptr->context = new OfonoConnectionContext("org.ofono", idPath, QDBusConnection::systemBus(),this);
if (d_ptr->context->isValid()) {
d_ptr->contextPath = idPath;
connect(d_ptr->context,SIGNAL(PropertyChanged(QString,QDBusVariant)),
this,SLOT(propertyChanged(QString,QDBusVariant)));
QDBusPendingReply<QVariantMap> reply;
reply = d_ptr->context->GetProperties();
reply.waitForFinished();
if (reply.isError())
Q_EMIT reportError(reply.error().message());
d_ptr->properties = reply.value();
Q_EMIT contextPathChanged(idPath);
} else {
Q_EMIT reportError("Context is not valid");
qDebug() << Q_FUNC_INFO << "error Context is not valid";
}
QOfonoManager manager;
if (manager.modems().count() > 0) {
QOfonoConnectionManager connManager;
Q_FOREACH (const QString &path, manager.modems()) {
connManager.setModemPath(path);
if (connManager.contexts().contains(idPath)) {
d_ptr->modemPath = path;
Q_EMIT modemPathChanged(path);
break;
}
}
}
/* if (!validateProvisioning()) {
provisionForCurrentNetwork(this->type());
} else {
Q_EMIT reportError("Context provision is not valid");
qDebug() << Q_FUNC_INFO << "error Context provision is not valid";
}
*/
}
示例11: reset
void QMaliitPlatformInputContext::reset()
{
const bool hadPreedit = !d->preedit.isEmpty();
if (hadPreedit && inputMethodAccepted()) {
// ### selection
QInputMethodEvent event;
event.setCommitString(d->preedit);
QGuiApplication::sendEvent(qGuiApp->focusObject(), &event);
d->preedit.clear();
}
QDBusPendingReply<void> reply = d->server->reset();
if (hadPreedit)
reply.waitForFinished();
}
示例12: callFinished
void PlayerActionJob::callFinished(QDBusPendingCallWatcher* watcher)
{
QDBusPendingReply<void> result = *watcher;
watcher->deleteLater();
if (result.isError()) {
// FIXME: try to be a bit cleverer with the error message?
setError(Failed);
setErrorText(result.error().message());
} else {
setError(NoError);
}
emitResult();
}
示例13: 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));
}
示例14: Q_ASSERT
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();
}
示例15: callFinished
void ItemRetrievalJob::callFinished(QDBusPendingCallWatcher *watcher)
{
watcher->deleteLater();
QDBusPendingReply<QString> reply = *watcher;
if (m_active) {
m_active = false;
const QString errorMsg = reply.isError() ? reply.error().message() : reply;
if (!errorMsg.isEmpty()) {
Q_EMIT requestCompleted(m_request, QStringLiteral("Unable to retrieve item from resource: %1").arg(errorMsg));
} else {
Q_EMIT requestCompleted(m_request, QString());
}
}
deleteLater();
}