本文整理汇总了C++中QDBusPendingReply::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply::isValid方法的具体用法?C++ QDBusPendingReply::isValid怎么用?C++ QDBusPendingReply::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingReply
的用法示例。
在下文中一共展示了QDBusPendingReply::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call_returned
void request_watcher_t::call_returned(QDBusPendingCallWatcher *w)
{
log_debug() ;
log_assert(w==this->w, "oops, somethig is really wrong with qdbus...") ;
QDBusPendingReply<bool> reply = *w ;
bool ok = reply.isValid() and reply.value() ;
abstract_io_state_t *next = machine->state_dlg_user ;
if (ok)
log_notice("Voland acknowledge received, moving %d event(s) to DLG_USER", events.size()) ;
else
{
string err = reply.isValid() ? "false returned" : reply.error().message().toStdString() ;
log_error("Voland call 'create' failed, message: '%s'", err.c_str()) ;
log_notice("moving %d event(s) to DLG_WAIT", events.size()) ;
next = machine->state_dlg_wait ;
}
for(set<event_t*>::const_iterator it=events.begin(); it!=events.end(); ++it)
next->go_to(*it) ;
if (events.size()>0)
machine->process_transition_queue() ;
// Don't need the watcher any more
delete this ;
}
示例2: findEventsTest
void LogTest::findEventsTest()
{
QZeitgeist::DataModel::Event event;
QZeitgeist::DataModel::EventList events;
// Set the template to search for.
event.setActor("app://firefox.desktop");
event.setSubjects(QZeitgeist::DataModel::SubjectList());
// Add to the event list.
events << event;
// Query for all events since Epoch.
QZeitgeist::DataModel::TimeRange timeRange =
QZeitgeist::DataModel::TimeRange::timeRangeToNow();
// Search on Zeitgeist.
QDBusPendingReply<QZeitgeist::DataModel::EventList> reply =
m_log->findEvents(timeRange, events,
QZeitgeist::Log::Any, 10,
QZeitgeist::Log::MostRecentEvents);
// Block and wait for reply.
reply.waitForFinished();
// Check if the return is valid.
QVERIFY (reply.isValid() == true);
// Check if the return is not empty
QVERIFY (reply.value().size() > 0);
// Check if the id is 0;
for (uint i = 0; i < reply.value().size(); ++i)
QVERIFY(reply.value()[i].id() != 0);
}
示例3: retrieveNotificationId
void CReporterNotificationPrivate::retrieveNotificationId()
{
if (callWatcher == 0)
return;
callWatcher->waitForFinished();
QDBusPendingReply<quint32> reply = *callWatcher;
callWatcher->deleteLater();
callWatcher = 0;
if (reply.isValid()) {
id = reply.argumentAt<0>();
if (id == 0) {
// Notification didn't exist, create a new one.
sendDBusNotify();
retrieveNotificationId();
return;
}
qDebug() << __PRETTY_FUNCTION__
<< "Create notification with id: " << id;
} else if (reply.isError()) {
QDBusError error = reply.error();
qDebug() << __PRETTY_FUNCTION__ << "Failed to create notification: "
<< error.name() << " - " << error.message();
}
}
示例4: updateStatus
void PowerDevilRunner::updateStatus()
{
// Profiles and their icons
{
KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig);
// Request profiles to the daemon
QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
"org.kde.Solid.PowerManagement", "availableProfiles");
QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call);
reply.waitForFinished();
if (!reply.isValid()) {
kDebug() << "Error contacting the daemon!";
return;
}
m_availableProfiles = reply.value();
if (m_availableProfiles.isEmpty()) {
kDebug() << "No available profiles!";
return;
}
for (StringStringMap::const_iterator i = m_availableProfiles.constBegin(); i != m_availableProfiles.constEnd(); ++i) {
KConfigGroup settings(profilesConfig, i.key());
if (settings.readEntry< QString >("icon", QString()).isEmpty()) {
m_profileIcon[i.key()] = "preferences-system-power-management";
} else {
m_profileIcon[i.key()] = settings.readEntry< QString >("icon", QString());
}
}
}
updateSyntaxes();
}
示例5: abortSync
void OOPClientPlugin::abortSync( Sync::SyncStatus aStatus )
{
FUNCTION_CALL_TRACE;
QDBusPendingReply<void> reply = iOopPluginIface->abortSync( (uchar)aStatus );
reply.waitForFinished();
if( !reply.isValid() )
LOG_WARNING( "Invalid reply for connectivityStateChanged from plugin" );
}
示例6: resume
void OOPServerPlugin::resume()
{
FUNCTION_CALL_TRACE;
QDBusPendingReply<bool> reply = iOopPluginIface->resume();
reply.waitForFinished();
if( !reply.isValid() )
LOG_WARNING( "Invalid reply for resume from plugin" );
}
示例7: connectivityStateChanged
void OOPClientPlugin::connectivityStateChanged( Sync::ConnectivityType aType,
bool aState )
{
FUNCTION_CALL_TRACE;
QDBusPendingReply<void> reply = iOopPluginIface->connectivityStateChanged( aType, aState );
reply.waitForFinished();
if( !reply.isValid() )
LOG_WARNING( "Invalid reply for connectivityStateChanged from plugin" );
}
示例8: canAuthorize
Daemon::Authorize Daemon::canAuthorize(const QString &actionId)
{
Q_D(Daemon);
QDBusPendingReply<uint> reply = d->daemon->CanAuthorize(actionId);
reply.waitForFinished();
d->lastError = reply.error();
if (reply.isValid()) {
return static_cast<Daemon::Authorize>(reply.value());
}
return Daemon::AuthorizeUnknown;
}
示例9: getTid
QDBusObjectPath Daemon::getTid()
{
Q_D(Daemon);
QDBusPendingReply<QDBusObjectPath> reply = d->daemon->CreateTransaction();
reply.waitForFinished();
d->lastError = reply.error();
if (reply.isValid()) {
return reply.value();
}
return QDBusObjectPath();
}
示例10: getTimeSinceAction
uint Daemon::getTimeSinceAction(Transaction::Role role)
{
Q_D(Daemon);
QDBusPendingReply<uint> reply = d->daemon->GetTimeSinceAction(role);
reply.waitForFinished();
d->lastError = reply.error();
if (reply.isValid()) {
return reply.value();
}
return 0u;
}
示例11:
QList<QDBusObjectPath> Daemon::getTransactionList()
{
Q_D(Daemon);
QDBusPendingReply<QList<QDBusObjectPath> > reply = d->daemon->GetTransactionList();
reply.waitForFinished();
d->lastError = reply.error();
if (reply.isValid()) {
return reply.value();
}
return QList<QDBusObjectPath>();
}
示例12: init
bool OOPClientPlugin::init()
{
FUNCTION_CALL_TRACE;
QDBusPendingReply<bool> reply = iOopPluginIface->init();
reply.waitForFinished();
if( !reply.isValid() ) {
LOG_WARNING( "Invalid reply for init from plugin" );
return false;
}
return reply.value();
}
示例13: callFinished
void KGetRunner::callFinished(QDBusPendingCallWatcher* call)
{
QDBusPendingReply<> reply = *call;
// TODO Remove the check for QDBusError::NoReply when NewTransferDialog is fixed to show asynchronously.
if(!reply.isValid() && (reply.error().type() != QDBusError::NoReply)) {
// Send a notification about the error to the user.
KNotification::event(KNotification::Error,
i18n("<p>KGet Runner could not communicate with KGet.</p><p style=\"font-size: small;\">Response from DBus:<br/>%1</p>", reply.error().message()),
KIcon("dialog-warning").pixmap(KIconLoader::SizeSmall)/*, 0, KNotification::Persistant*/);
}
}
示例14: cleanUp
bool OOPServerPlugin::cleanUp()
{
FUNCTION_CALL_TRACE;
QDBusPendingReply<bool> reply = iOopPluginIface->cleanUp();
reply.waitForFinished();
if( !reply.isValid() ) {
LOG_WARNING( "Invalid reply for cleanUp from plugin" );
return false;
}
return reply.value();
}
示例15: onPasswordProvided
void ConferenceAuthOp::onPasswordProvided(QDBusPendingCallWatcher *watcher)
{
QDBusPendingReply<bool> reply = *watcher;
if (!reply.isValid() || reply.count() < 1) {
return;
}
if (reply.argumentAt<0>()) {
m_walletInterface->setEntry(m_account,m_channel->targetId(), m_password);
setFinished();
} else {
qDebug() << "Password was incorrect, enter again";
passwordDialog();
}
}