本文整理汇总了C++中QDBusReply::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusReply::isValid方法的具体用法?C++ QDBusReply::isValid怎么用?C++ QDBusReply::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusReply
的用法示例。
在下文中一共展示了QDBusReply::isValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attachToOtherInstance
bool SingleApplication::attachToOtherInstance() {
QDBusInterface iface(SERVICE_NAME, "/", "", QDBusConnection::sessionBus());
if (!iface.isValid())
return false;
QDBusReply<void> reply = iface.call("receive", QDir::currentPath(), QApplication::arguments());
if (reply.isValid())
return true;
qDebug() << "Call to SingleApplication::receive() failed: " << reply.error().message();
return false;
}
示例2: detect
int KTorrentDbusInterface::detect()
{
QDBusReply<QStringList> reply = QDBusConnection::sessionBus().interface()->registeredServiceNames();
if (!reply.isValid()) /* something fishy with dbus, it won't work */
return 0;
foreach (QString name, reply.value())
if (name == "org.ktorrent.ktorrent") /* ktorrent is running */
return 100;
return 1; /* dbus works, ktorrent may be closed */
}
示例3: dismissEvent
bool tst_Events::dismissEvent(const uint cookie)
{
Maemo::Timed::Interface timedIface;
QDBusReply<bool> dialogResponseReply = timedIface.dialog_response_sync(cookie, -2);
if (!dialogResponseReply.isValid()) {
qWarning() << "Dismissing event" << cookie << "failed, DBus error"
<< dialogResponseReply.error().message();
return false;
}
bool retval = dialogResponseReply;
return retval;
}
示例4: stream
QGeoPositionInfo& DBusComm::requestLastKnownPosition(bool satelliteMethodOnly)
{
QDBusReply<QByteArray> reply;
reply = positioningdProxy->call("latestPosition", satelliteMethodOnly);
static QGeoPositionInfo update;
if (reply.isValid()) {
// cout << "requestLastKnownPosition(): received update\n";
QByteArray message = reply.value();
QDataStream stream(message);
stream >> update;
} else {
示例5: cancel
void Transaction::cancel()
{
Q_D(Transaction);
if (d->destroyed) {
return;
}
QDBusReply<void> r = d->p->Cancel();
if (!r.isValid()) {
d->error = Util::errorFromString(r.error().message());
}
}
示例6: pid
int pid()
{
Maemo::Timed::Interface ifc ;
QDBusReply<int> reply = ifc.pid_sync() ;
if(!reply.isValid())
{
qDebug() << "pid call failed" << ifc.lastError() ;
return 1 ;
}
cout << "server pid=" << reply.value() << endl ;
return 0 ;
}
示例7: reg
// Figure out which devices we should allow a user to write to.
void
PlatformUdisks::findDevices()
{
int i = 0;
if (!udiskEnabled())
{
QMessageBox msgBox;
msgBox.setText(QObject::tr("You don't have UDisks support."));
msgBox.exec();
return;
}
// First get the list of disks
QDBusConnection connection = QDBusConnection::systemBus();
QDBusMessage message;
message = QDBusMessage::createMethodCall("org.freedesktop.UDisks", "/org/freedesktop/UDisks", "org.freedesktop.UDisks", "EnumerateDevices");
QDBusReply<QList<QDBusObjectPath> > reply = connection.call(message);
if (!reply.isValid())
{
qDebug() << "Failure: " << reply.error();
return;
}
QList<QDBusObjectPath> list = reply.value();
QStringList devList;
QRegExp reg("[0-9]+$");
// Ignore partition slices
for (i = 0; i < list.size(); ++i)
if (!list.at(i).path().contains(reg))
devList << list.at(i).path();
QStringList diskList;
// Safe mode (the default) only handles USB devices
if (!mUnsafe)
{
for (i = 0; i < devList.size(); ++i)
if (isUSB(devList.at(i)))
diskList << devList.at(i);
}
else
{
diskList = devList;
}
for (i = 0; i < diskList.size(); ++i)
{
getNewDevice(diskList.at(i));
}
return;
}
示例8: method1
void method1()
{
qDebug() << "Method 1:";
QDBusReply<QStringList> reply = QDBusConnection::sessionBus().interface()->registeredServiceNames();
if (!reply.isValid()) {
qDebug() << "Error:" << reply.error().message();
exit(1);
}
foreach (QString name, reply.value())
qDebug() << name;
}
示例9: connectSerial
QString BluetoothDevice::connectSerial()
{
if(isProfileSupported(BluetoothProfiles::spp))
{
QDBusInterface interface("org.bluez",m_device->path(),"org.bluez.Serial",QDBusConnection::systemBus());
QDBusReply<QString> reply = interface.call(QDBus::AutoDetect, "Connect","spp");
if(reply.isValid()) return reply;
else qDebug()<<"Error connecting spp profile: "<<reply.error().message();
}
return "";
}
示例10: smsNumberToActiveService
void PeopleApplication::smsNumberToActiveService(const QString& number){
// hard-coded details of the MeeGo SMS application
QDBusInterface sms("com.meego.sms", "/", "com.meego.sms");
if (!sms.isValid()) {
qWarning() << "Composing SMS to" << number << "- could not find SMS app";
return;
}
QDBusReply<void> reply = sms.call(QDBus::BlockWithGui, "showdialogpage", number);
if (!reply.isValid())
qWarning() << "Composing SMS to" << number << "failed:" <<
reply.error().message();
}
示例11: updateProxyScout
void KSaveIOConfig::updateProxyScout(QWidget * parent)
{
// Inform the proxyscout kded module about changes if we cannot update,
// ioslaves inform the end user...
QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/proxyscout"), QStringLiteral("org.kde.KPAC.ProxyScout"));
QDBusReply<void> reply = kded.call(QStringLiteral("reset"));
if (!reply.isValid())
{
KMessageBox::information (parent,
i18n("You have to restart KDE for these changes to take effect."),
i18nc("@title:window", "Update Failed"));
}
}
示例12: ping_pong
int ping_pong()
{
Maemo::Timed::Interface ifc ;
QDBusReply<QString> reply = ifc.ping_sync() ;
if(!reply.isValid())
{
qDebug() << "ping call failed" << ifc.lastError() ;
return 1 ;
}
QString pong = reply.value() ;
cout << "---" << endl << pong.toStdString() << "---" << endl ;
return 0 ;
}
示例13: parse_data
int parse_data(const char *text)
{
Maemo::Timed::Interface ifc ;
QDBusReply<QString> reply = ifc.parse_sync(QString(text)) ;
if(!reply.isValid())
{
qDebug() << "parse call failed" << ifc.lastError() ;
return 1 ;
}
QString plain = reply.value() ;
cout << "---" << endl << plain.toStdString() << "---" << endl ;
return 0 ;
}
示例14: editResource
void ResourceView::editResource()
{
bool ok = false;
ResourceItem *item = currentItem();
if ( !item ) {
return;
}
ResourceCalendar *resource = item->resource();
if ( item->isSubresource() ) {
if ( resource->type() == "imap" ) {
QString identifier = item->resourceIdentifier();
const QString newResourceName =
KInputDialog::getText( i18n( "Rename Calendar Folder" ),
i18n( "Please enter a new name for the calendar folder" ),
item->text(0),
&ok, this );
if ( !ok ) {
return;
}
QDBusConnection bus = QDBusConnection::sessionBus();
QDBusInterface *interface =
new QDBusInterface( "org.kde.kmail",
"/Groupware",
"org.kde.kmail.groupware",
bus,
this );
QDBusReply<int> reply =
interface->call( "changeResourceUIName", identifier, newResourceName );
if ( !reply.isValid() ) {
kDebug() << "DBUS Call changeResourceUIName() failed ";
}
} else {
const QString subResourceName = resource->labelForSubresource( item->resourceIdentifier() );
KMessageBox::sorry( this,
i18n ( "<qt>Cannot edit the calendar folder <b>%1</b>.</qt>",
subResourceName ) );
}
} else {
QPointer<KRES::ConfigDialog> dlg =
new KRES::ConfigDialog( this, QString( "calendar" ), resource );
if ( dlg->exec() ) {
item->setText( 0, resource->resourceName() );
mCalendar->resourceManager()->change( resource );
}
delete dlg;
}
emitResourcesChanged();
}
示例15: dbus
bool X11ScreenModeChecker::isScreensaverActive()
{
// org.freedesktop.ScreenSaver
{
QDBusInterface dbus(
"org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver",
QDBusConnection::sessionBus());
if (dbus.isValid())
{
QDBusReply<bool> reply = dbus.call("GetActive");
if (reply.isValid() && reply.value())
return true;
}
}
// org.kde.screensaver
{
QDBusInterface dbus(
"org.kde.screensaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus());
if (dbus.isValid())
{
QDBusReply<bool> reply = dbus.call("GetActive");
if (reply.isValid() && reply.value())
return true;
}
}
// org.gnome.ScreenSaver
{
QDBusInterface dbus("org.gnome.ScreenSaver", "/", "org.gnome.ScreenSaver", QDBusConnection::sessionBus());
if (dbus.isValid())
{
QDBusReply<bool> reply = dbus.call("GetActive");
if (reply.isValid() && reply.value())
return true;
}
}
return false;
}