本文整理汇总了C++中QDBusReply::error方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusReply::error方法的具体用法?C++ QDBusReply::error怎么用?C++ QDBusReply::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusReply
的用法示例。
在下文中一共展示了QDBusReply::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerAgent
bool QBluetoothPasskeyAgent_Private::registerAgent(const QString &localAdapter,
const QString &addr)
{
QString bluezAdapter = "/org/bluez";
if (!localAdapter.isNull()) {
bluezAdapter.append("/");
bluezAdapter.append(localAdapter);
}
QDBusInterface *iface = new QDBusInterface("org.bluez",
bluezAdapter,
"org.bluez.Security",
QDBusConnection::systemBus());
if (!iface->isValid())
return false;
QString bluezMethod;
QVariantList args;
QString path = m_name;
path.prepend('/');
args << path;
if (addr.isNull()) {
bluezMethod = "RegisterDefaultPasskeyAgent";
}
else {
bluezMethod = "RegisterPasskeyAgent";
args << addr;
}
QDBusReply<void> reply = iface->callWithArgumentList(QDBus::Block,
bluezMethod, args);
if (!reply.isValid()) {
handleError(reply.error());
return false;
}
return true;
}
示例2: if
lastfm::LNetworkConnectionMonitor::LNetworkConnectionMonitor( QObject* parent ) :
NetworkConnectionMonitor( parent )
{
m_nmInterface = new QDBusInterface( NM_DBUS_SERVICE,
NM_DBUS_PATH,
NM_DBUS_INTERFACE,
QDBusConnection::systemBus(),
this );
if ( !m_nmInterface->isValid() )
{
qDebug() << "Unable to watch network state changes via D-Bus.";
return;
}
//get current connection state
QDBusReply<uint> reply = m_nmInterface->call( QDBus::AutoDetect, "state" );
if ( reply.isValid() )
{
if ( reply.value() == NM_STATE_CONNECTED_GLOBAL )
{
setConnected( true );
}
else if ( reply.value() == NM_STATE_DISCONNECTED || reply.value() == NM_STATE_ASLEEP )
{
setConnected( false );
}
}
else
{
qDebug() << "Error: " << reply.error();
}
//connect network manager signals
m_nmInterface->connection().connect( NM_DBUS_SERVICE,
NM_DBUS_PATH,
NM_DBUS_INTERFACE,
"StateChanged",
this,
SLOT( onStateChange( uint ) )
);
}
示例3: QObject
XesamCollectionBuilder::XesamCollectionBuilder( Collections::SqlCollection *collection )
: QObject( collection )
, m_collection( collection )
{
DEBUG_BLOCK
m_xesam = new OrgFreedesktopXesamSearchInterface( "org.freedesktop.xesam.searcher",
"/org/freedesktop/xesam/searcher/main",
QDBusConnection::sessionBus() );
if( m_xesam->isValid() )
{
connect( m_xesam, SIGNAL( HitsAdded( QString , int ) ), SLOT( slotHitsAdded( QString, int ) ) );
connect( m_xesam, SIGNAL( HitsModified( QString, QList<int> ) ), SLOT( slotHitsModified( QString, QList<int> ) ) );
connect( m_xesam, SIGNAL( HitsRemoved( QString, QList<int> ) ), SLOT( slotHitsRemoved( QString, QList<int> ) ) );
QDBusReply<QString> sessionId = m_xesam->NewSession();
if( !sessionId.isValid() )
{
debug() << "Could not acquire Xesam session, aborting. error was: " << sessionId.error();
return;
//TODO error handling
}
m_session = sessionId.value();
if( !setupXesam() )
{
debug() << "Warning, could not setup xesam correctly";
}
QDBusReply<QString> search = m_xesam->NewSearch( m_session, generateXesamQuery() );
if( search.isValid() )
{
m_search = search.value();
m_xesam->StartSearch( m_search );
}
else
{
debug() << "Invalid response for NewSearch";
}
}
else
{
//TODO display warning about unavailable xesam daemon
}
}
示例4: composeEmail
void PeopleApplication::composeEmail(const QString& address)
{
qDebug() << "PeopleApplication::composeEmail attempting email:" << address;
if(QDBusConnection::sessionBus().interface()->isServiceRegistered("com.meego.email")){
qDebug() << "PeopleApplication::composeEmail email is registered";
emailToActiveService(address);
return;
}else{
qDebug() << "PeopleApplication::composeEmail email is NOT registered";
QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService("com.meego.email");
if (!reply.isValid()){
qWarning() << "Starting Email failed:" << reply.error().message();
}else{
qDebug() << "PeopleApplication::composeEmail saving address to email on registration";
m_emailPending = true;
m_email = address;
}
}
}
示例5: callNumber
void PeopleApplication::callNumber(const QString& number)
{
qDebug() << "PeopleApplication::callNumber attempting call to:" << number;
if(QDBusConnection::sessionBus().interface()->isServiceRegistered("com.meego.dialer")){
qDebug() << "PeopleApplication::callNumber dialer is registered";
callNumberToActiveService(number);
return;
}else{
qDebug() << "PeopleApplication::callNumber dialer is NOT registered";
QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService("com.meego.dialer");
if (!reply.isValid()){
qWarning() << "Starting Dialer failed:" << reply.error().message();
}else{
qDebug() << "PeopleApplication::callNumber saving number to call on registration";
m_callPending = true;
m_number = number;
}
}
}
示例6: composeSMS
void PeopleApplication::composeSMS(const QString& number)
{
qDebug() << "Attempting to compose SMS to" << number;
if(QDBusConnection::sessionBus().interface()->isServiceRegistered("com.meego.sms")){
qDebug() << "PeopleApplication::composeSMS SMS is registered";
smsNumberToActiveService(number);
return;
}else{
qDebug() << "PeopleApplication::composeSMS SMS is NOT registered";
QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService("com.meego.sms");
if (!reply.isValid()){
qWarning() << "Starting SMS failed:" << reply.error().message();
}else{
qDebug() << "PeopleApplication::composeSMS saving number to text on registration";
m_smsPending = true;
m_smsNumber = number;
}
}
}
示例7: replaceEvent
bool tst_Events::replaceEvent(const uint oldCookie, const qint64 timestamp,
const int dueInSeconds, uint &cookie)
{
Maemo::Timed::Event event = createEvent(timestamp, dueInSeconds);
// Open a connection to timed and replace the event
Maemo::Timed::Interface timedIface;
if (!timedIface.isValid()) {
qWarning() << "Invalid timed interface:" << timedIface.lastError().message();
return false;
}
QDBusReply<uint> reply = timedIface.replace_event_sync(event, oldCookie);
if (!reply.isValid()) {
qWarning() << "Replace event failed: %1" << reply.error().message();
return false;
}
cookie = reply.value();
return true;
}
示例8: allDevices
QStringList HalManager::allDevices()
{
if (d->cacheSynced)
{
return d->devicesCache;
}
QDBusReply<QStringList> reply = d->manager.call("GetAllDevices");
if (!reply.isValid())
{
qWarning() << Q_FUNC_INFO << " error: " << reply.error().name() << endl;
return QStringList();
}
d->devicesCache = reply;
d->cacheSynced = true;
return reply;
}
示例9: main
int main( int argc, char *argv[] )
{
KAboutData aboutData("kwalletsync", 0, ki18n("kwalletsync"), "version");
KComponentData componentData(&aboutData);
QApplication app( argc, argv );
// force name with D-BUS
QDBusReply<QDBusConnectionInterface::RegisterServiceReply> reply
= QDBusConnection::sessionBus().interface()->registerService( "org.kde.kwalletsync",
QDBusConnectionInterface::ReplaceExistingService );
if ( !reply.isValid() )
{
_out << "D-BUS name request returned " << reply.error().name() << endl;
}
openWallet();
return 0;
}
示例10: QObject
SystemMonitor::SystemMonitor(QObject *parent) :
QObject(parent)
{
connect(&m_settings, SIGNAL(updateIntervalChanged(int)), SLOT(updateIntervalChanged(int)));
//Timer instead of dbus connection
m_updateTimer.setTimerType(Qt::VeryCoarseTimer);
connect(&m_updateTimer, SIGNAL(timeout()), SIGNAL(dataUpdated()));
updateIntervalChanged(m_settings.updateInterval);
m_updateTimer.start();
/*
qDebug() << "Connect to dataUpdate event" <<
//TODO: enable if dbus connection will be available
QDBusConnection::sessionBus().connect(
SYSMON_DBUS_SERVICE, SYSMON_DBUS_PATH, SYSMON_DBUS_IFACE,
"dataUpdated", this, SIGNAL(dataUpdated())
);
*/
//systemd connection
systemd = new QDBusInterface("org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
QDBusConnection::sessionBus(), this);
systemd->call("Subscribe");
QDBusReply<QDBusObjectPath> unit = systemd->call("LoadUnit", SYSMON_SYSTEMD_UNIT);
if (unit.isValid()) {
unitPath = unit.value();
getUnitProperties();
QDBusConnection::sessionBus().connect(
"org.freedesktop.systemd1", unitPath.path(),
"org.freedesktop.DBus.Properties", "PropertiesChanged",
this, SLOT(onPropertiesChanged(QString,QMap<QString,QVariant>,QStringList)));
} else {
qWarning() << unit.error().message();
}
}
示例11: telepathyResponse
void SailfishPlatform::telepathyResponse(const QString &account, const QString &contact, const QString &text) const
{
QDBusObjectPath acct(account);
QVariantMap arg1,arg2;
arg1.insert("message-type",0);
arg2.insert("content-type",QString("text/plain"));
arg2.insert("content",text);
QDBusReply<QString> res = QDBusConnection::sessionBus().call(
QDBusMessage::createMethodCall("org.freedesktop.Telepathy.ChannelDispatcher",
"/org/freedesktop/Telepathy/ChannelDispatcher",
"org.freedesktop.Telepathy.ChannelDispatcher.Interface.Messages.DRAFT", "SendMessage")
<< qVariantFromValue(acct) << contact << qVariantFromValue(QList<QVariantMap>({arg1,arg2})) << (quint32)0);
if (res.isValid()) {
if (res.value().isEmpty()) {
qWarning() << "Unable to send response from" << account << "to" << contact << "with" << text;
} else
qDebug() << "Sent message under uuid" << res.value();
} else {
qWarning() << res.error().message();
}
}
示例12: imToActiveService
void PeopleApplication::imToActiveService(const QString& account){
QStringList list = account.split(":");
if(list.count() != 3)
return;
QString accountPath = list.at(2);
QString accountUri = list.at(0);
//index=1 is nickname, not used here
// hard-coded details of the MeeGo IM application
QDBusInterface im("com.meego.meego_handset_chat", "/com/meego/meego_handset_chat", "com.meego.meego_handset_chat");
if (!im.isValid()) {
qWarning() << "Composing IM to path: " <<accountPath << " accountUri: " << accountUri << "- could not find IM app";
return;
}
QDBusReply<void> reply = im.call(QDBus::BlockWithGui, "showDialogPageForContact", accountPath , accountUri);
if (!reply.isValid())
qWarning() << "Composing IM to path: " <<accountPath << " accountUri: " << accountUri << "failed:" ;
reply.error().message();
}
示例13: QObject
ServiceControl::ServiceControl(QObject *parent) : QObject(parent),
systemd(new QDBusInterface("org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
QDBusConnection::sessionBus(), this))
{
systemd->call("Subscribe");
QDBusReply<QDBusObjectPath> unit = systemd->call("LoadUnit", ROCKPOOLD_SYSTEMD_UNIT);
if (unit.isValid()) {
unitPath = unit.value();
getUnitProperties();
QDBusConnection::sessionBus().connect(
"org.freedesktop.systemd1", unitPath.path(),
"org.freedesktop.DBus.Properties", "PropertiesChanged",
this, SLOT(onPropertiesChanged(QString,QMap<QString,QVariant>,QStringList)));
} else {
qWarning() << unit.error().message();
}
}
示例14: openAndClose
int openAndClose()
{
QDBusInterface service("org.kde.kwalletd", "/modules/kwalletd");
if (!service.isValid()) {
_out << "Constructed service is invalid!" << endl;
return 1;
}
QDBusReply<int> h = service.call(QDBus::Block, "open", _kdewallet, (qlonglong)0, "kwalletnoautoclose");
if (!h.isValid() || h.value() < 0) {
_out << "Opening the wallet failed!" << endl;
_out << "Error: " << h.error().message() << endl;
return 1;
} else {
_out << "Wallet opened." << endl;
}
_out << "closing the wallet" << endl;
QDBusReply<int> r = service.call(QDBus::Block, "close", h.value(), false, "kwalletnoautoclose");
return r;
}
示例15: if
LNetworkConnectionMonitor::LNetworkConnectionMonitor( QObject* parent ) :
NetworkConnectionMonitor( parent )
{
m_nmInterface = new QDBusInterface( QString( "org.freedesktop.NetworkManager" ),
QString( "/org/freedesktop/NetworkManager" ),
QString( "org.freedesktop.NetworkManager" ),
QDBusConnection::systemBus(),
this );
//get current connection state
QDBusInterface* dbusInterface = new QDBusInterface( QString( "org.freedesktop.NetworkManager" ),
QString( "/org/freedesktop/NetworkManager" ),
QString( "org.freedesktop.DBus.Properties" ),
QDBusConnection::systemBus(),
this );
QDBusReply<QVariant> reply = dbusInterface->call( "Get", "org.freedesktop.NetworkManager", "state" );
if ( reply.isValid() )
{
if ( reply.value() == Connected )
{
setConnected( true );
}
else if ( reply.value() == Disconnected )
{
setConnected( false );
}
}
else
{
qDebug() << "Error: " << reply.error();
}
delete dbusInterface;
//connect network manager signals
connect( m_nmInterface, SIGNAL( StateChange( uint ) ), this, SLOT( onStateChange( uint ) ) );
}