本文整理汇总了C++中QDBusMessage::errorName方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage::errorName方法的具体用法?C++ QDBusMessage::errorName怎么用?C++ QDBusMessage::errorName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusMessage
的用法示例。
在下文中一共展示了QDBusMessage::errorName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: code
/*!
\internal
Constructs a QDBusError from a QDBusMessage.
*/
QDBusError::QDBusError(const QDBusMessage &qdmsg)
: code(NoError)
{
if (qdmsg.type() != QDBusMessage::ErrorMessage)
return;
code = ::get(qdmsg.errorName().toUtf8().constData());
nm = qdmsg.errorName();
msg = qdmsg.errorMessage();
}
示例2: resumeDone
void HalSuspendJob::resumeDone(const QDBusMessage &reply)
{
if (reply.type() == QDBusMessage::ErrorMessage)
{
// We ignore the NoReply error, since we can timeout anyway
// if the computer is suspended for too long.
if (reply.errorName() != "org.freedesktop.DBus.Error.NoReply")
{
setError(1);
setErrorText(reply.errorName()+": "+reply.arguments().at(0).toString());
}
}
emitResult();
}
示例3: LockPhone
void SIMLockService::LockPhone()
{
//dbus-send --system --type=method_call
//--dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open
//string:"com.nokia.mce"
//string:"/com/nokia/mce/request"
//string:"com.nokia.mce.request"
//string:"devlock_callback"
//uint32:'3'
QDBusMessage reply = LockInterface->call("devlock_open",
"com.nokia.mce",
"/com/nokia/mce/request",
"com.nokia.mce.request",
"devlock_callback", (quint32)3);
if(reply.type() == QDBusMessage::ErrorMessage)
qDebug() << "Failed to lock phone:" << reply.errorName() << reply.errorMessage();
if(reply.arguments()[0].toBool() == true)
qDebug() << "Phone locked";
else
qDebug() << "Phone failed to lock";
}
示例4: dbusGetProperty
/************************************************
Helper func
************************************************/
bool dbusGetProperty(const QString &service,
const QString &path,
const QString &interface,
const QDBusConnection &connection,
const QString & property
)
{
QDBusInterface dbus(service, path, interface, connection);
if (!dbus.isValid())
{
qWarning() << "dbusGetProperty: QDBusInterface is invalid" << service << path << interface << property;
// Notification::notify(QObject::tr("LXQt Power Manager"),
// "lxqt-logo.png",
// QObject::tr("Power Manager Error"),
// QObject::tr("QDBusInterface is invalid")+ "\n\n" + service +" " + path +" " + interface +" " + property);
return false;
}
QDBusMessage msg = dbus.call("Get", dbus.interface(), property);
if (!msg.errorName().isEmpty())
{
printDBusMsg(msg);
// Notification::notify(QObject::tr("LXQt Power Manager"),
// "lxqt-logo.png",
// QObject::tr("Power Manager Error (Get Property)"),
// msg.errorName() + "\n\n" + msg.errorMessage());
}
return !msg.arguments().isEmpty() &&
msg.arguments().first().value<QDBusVariant>().variant().toBool();
}
示例5: printDBusMsg
/************************************************
Helper func
************************************************/
void printDBusMsg(const QDBusMessage &msg)
{
qWarning() << "** Dbus error **************************";
qWarning() << "Error name " << msg.errorName();
qWarning() << "Error msg " << msg.errorMessage();
qWarning() << "****************************************";
}
示例6: disconnectDevice
void NetworkDevice::disconnectDevice()
{
QDBusMessage query = m_networkDeviceInterface->call("Disconnect");
if(query.type() != QDBusMessage::ReplyMessage)
qCWarning(dcNetworkManager()) << query.errorName() << query.errorMessage();
}
示例7: dbusCall
/************************************************
Helper func
Just like dbusCall(), except that systemd
returns a string instead of a bool, and it takes
an "interactivity boolean" as an argument.
************************************************/
static bool dbusCallSystemd(const QString &service,
const QString &path,
const QString &interface,
const QDBusConnection &connection,
const QString &method,
bool needBoolArg,
PowerProvider::DbusErrorCheck errorCheck = PowerProvider::CheckDBUS
)
{
QDBusInterface dbus(service, path, interface, connection);
if (!dbus.isValid())
{
qWarning() << "dbusCall: QDBusInterface is invalid" << service << path << interface << method;
if (errorCheck == PowerProvider::CheckDBUS)
{
Notification::notify(
QObject::tr("Power Manager Error"),
QObject::tr("QDBusInterface is invalid")+ "\n\n" + service + " " + path + " " + interface + " " + method,
"lxqt-logo.png");
}
return false;
}
QDBusMessage msg = dbus.call(method, needBoolArg ? QVariant(true) : QVariant());
if (!msg.errorName().isEmpty())
{
printDBusMsg(msg);
if (errorCheck == PowerProvider::CheckDBUS)
{
Notification::notify(
QObject::tr("Power Manager Error (D-BUS call)"),
msg.errorName() + "\n\n" + msg.errorMessage(),
"lxqt-logo.png");
}
}
// If the method no returns value, we believe that it was successful.
if (msg.arguments().isEmpty() || msg.arguments().first().isNull())
return true;
QString response = msg.arguments().first().toString();
qDebug() << "systemd:" << method << "=" << response;
return response == "yes" || response == "challenge";
}
示例8: processReply
//
// Function to process the reply from a dbus call.
QDBusMessage::MessageType shared::processReply(const QDBusMessage& reply)
{
if (reply.type() != QDBusMessage::ReplyMessage) {
QMessageBox::warning(0,
QString(TranslateStrings::cmtr("cmst") + qApp->translate("processReply", " Warning") ),
qApp->translate("processReply",
"<center><b>We received a DBUS reply message indicating an error.</b></center>"
"<br><br>Error Name: %1<br><br>Error Message: %2")
.arg(reply.errorName())
.arg(TranslateStrings::cmtr(reply.errorMessage())) );
} // if reply is something other than a normal reply message
return reply.type();
}
示例9: tLog
/**
* Handle the DBus reply triggered by FdoNotifyPlugin::nowPlaying
*/
void
FdoNotifyPlugin::dbusPlayingReplyReceived( QDBusPendingCallWatcher* watcher )
{
QDBusMessage reply = watcher->reply();
watcher->deleteLater();
if ( reply.type() == QDBusMessage::ErrorMessage )
{
tLog(LOGVERBOSE) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage();
return;
}
const QVariantList& list = reply.arguments();
if ( !list.isEmpty() )
m_nowPlayingId = list.first().toInt();
}
示例10: debugVariantList
QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
{
dbg.nospace() << "QDBusMessage(type=" << msg.type()
<< ", service=" << msg.service();
if (msg.type() == QDBusMessage::MethodCallMessage ||
msg.type() == QDBusMessage::SignalMessage)
dbg.nospace() << ", path=" << msg.path()
<< ", interface=" << msg.interface()
<< ", member=" << msg.member();
if (msg.type() == QDBusMessage::ErrorMessage)
dbg.nospace() << ", error name=" << msg.errorName()
<< ", error message=" << msg.errorMessage();
dbg.nospace() << ", signature=" << msg.signature()
<< ", contents=(";
debugVariantList(dbg, msg.arguments());
dbg.nospace() << ") )";
return dbg.space();
}
示例11: callFinishedSlot
void QuickDBusReply::callFinishedSlot(QDBusPendingCallWatcher *call)
{
Q_ASSERT(call);
setWaiting(false);
QDBusMessage msg = call->reply();
if (msg.type() == QDBusMessage::ReplyMessage) {
setValues(msg.arguments());
} else {
setValid(false);
setErrorName(msg.errorName());
setErrorString(msg.errorMessage());
}
call->deleteLater();
}
示例12: startCamera
void Camera::startCamera()
{
QDBusConnection bus = QDBusConnection::sessionBus();
bus.connect("com.nokia.maemo.CameraService",
"/",
"com.nokia.maemo.meegotouch.CameraInterface",
"captureCanceled",
this, SLOT(captureCanceled(QString)));
bus.connect("com.nokia.maemo.CameraService",
"/",
"com.nokia.maemo.meegotouch.CameraInterface",
"captureCompleted",
this, SLOT(captureCompleted(QString,QString)));
QDBusMessage message = QDBusMessage::createMethodCall(
"com.nokia.maemo.CameraService",
"/",
"com.nokia.maemo.meegotouch.CameraInterface",
"showCamera");
QList<QVariant> args;
args << (uint)0 << "" << "still-capture" << true;
message.setArguments(args);
QDBusMessage reply = bus.call(message);
if (reply.type() == QDBusMessage::ErrorMessage) {
qDebug() << Q_FUNC_INFO << "reply.type == errormessage; name=" << reply.errorName() << "; message=" << reply.errorMessage();
bus.disconnect("com.nokia.maemo.CameraService",
"/",
"com.nokia.maemo.meegotouch.CameraInterface",
"captureCanceled",
this, SLOT(captureCanceled(QString)));
bus.disconnect("com.nokia.maemo.CameraService",
"/",
"com.nokia.maemo.meegotouch.CameraInterface",
"captureCompleted",
this, SLOT(captureCompleted(QString,QString)));
if (m_lastEcId)
this->callback(m_lastEcId, "");
}
}
示例13: RegisterFinished
void GnomeGlobalShortcutBackend::RegisterFinished(
QDBusPendingCallWatcher* watcher) {
#ifdef QT_DBUS_LIB
QDBusMessage reply = watcher->reply();
watcher->deleteLater();
if (reply.type() == QDBusMessage::ErrorMessage) {
qLog(Warning) << "Failed to grab media keys" << reply.errorName()
<< reply.errorMessage();
return;
}
connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString, QString)), this,
SLOT(GnomeMediaKeyPressed(QString, QString)));
is_connected_ = true;
qLog(Debug) << "registered";
#endif // QT_DBUS_LIB
}
示例14: qDebug
void
Mp3tunesAmarokClient::harmonyDownloadReady( const Mp3tunesHarmonyDownload &download )
{
qDebug() << "Got message about ready: " << download.trackTitle() << " by " << download.artistName() << " on " << download. albumTitle();
QString name = "org.kde.amarok";
QDBusMessage m = QDBusMessage::createMethodCall( name,
"/Mp3tunesHarmonyHandler",
"",
"emitDownloadReady" );
QList<QVariant> args;
args.append( download.serialize() );
m.setArguments(args);
QDBusMessage response = QDBusConnection::sessionBus().call( m );
if( response.type() == QDBusMessage::ErrorMessage )
{
qDebug() << "Got ERROR response harmonyDownloadReady";
qDebug() << response.errorName() << ": " << response.errorMessage();
}
}
示例15: QString
void Mp3tunesAmarokClient::dbusEmitMessage( const QString &message, const QString ¶m = QString() )
{
QString name = "org.kde.amarok";
QDBusMessage m = QDBusMessage::createMethodCall( name,
"/Mp3tunesHarmonyHandler",
"",
message );
if( !param.isEmpty() )
{
QList<QVariant> args;
args.append( param );
m.setArguments(args);
}
QDBusMessage response = QDBusConnection::sessionBus().call( m );
if( response.type() == QDBusMessage::ErrorMessage )
{
qDebug() << "Got ERROR response " << message;
qDebug() << response.errorName() << ": " << response.errorMessage();
}
}