本文整理汇总了C++中QDBusReply::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusReply::value方法的具体用法?C++ QDBusReply::value怎么用?C++ QDBusReply::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusReply
的用法示例。
在下文中一共展示了QDBusReply::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_current_titlebar_right_qt
QString SessionDispatcher::get_current_titlebar_right_qt() {
QDBusReply<QString> reply = sessioniface->call("get_current_titlebar_right");
return reply.value();
}
示例2: getSettings
QNmSettingsMap QNetworkManagerSettingsConnection::getSettings()
{
QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call(QLatin1String("GetSettings"));
d->settingsMap = rep.value();
return d->settingsMap;
}
示例3: startScan
void QWifiManagerPrivateUnix::startScan() {
if (wirelessDevice != NULL) {
updateAccessPoints();
return;
}
QDBusInterface networkManager(NM_DBUS_SERVICE, NM_DBUS_PATH,
NM_DBUS_INTERFACE, QDBusConnection::systemBus());
if (!networkManager.isValid()) {
emit scanFinished(QWifiManager::ERROR_NO_NM);
return;
}
QDBusReply<QList<QDBusObjectPath> > devices = networkManager.call(
"GetDevices");
if (!devices.isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
bool foundWifi = false;
foreach (const QDBusObjectPath& connection, devices.value()) {
//qDebug() << connection.path();
QDBusInterface device(NM_DBUS_SERVICE, connection.path(),
NM_DBUS_INTERFACE_DEVICE, QDBusConnection::systemBus());
if (!device.isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
QVariant deviceType = device.property("DeviceType");
if (!deviceType.isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
//qDebug() << deviceType.toUInt();
if (deviceType.toUInt() == NM_DEVICE_TYPE_WIFI) {
foundWifi = true;
QVariant deviceState = device.property("State");
if (!deviceState.isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
if (deviceState.toUInt() <= NM_DEVICE_STATE_UNAVAILABLE)
continue; // we are only interested in enabled wifi devices
wirelessDevice = new QDBusInterface(NM_DBUS_SERVICE,
connection.path(), NM_DBUS_INTERFACE_DEVICE_WIRELESS,
QDBusConnection::systemBus());
if (!wirelessDevice->isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
QDBusConnection::systemBus().connect(NM_DBUS_SERVICE,
connection.path(), NM_DBUS_INTERFACE_DEVICE_WIRELESS,
"AccessPointAdded", this, SLOT(updateAccessPoints()));
QDBusConnection::systemBus().connect(NM_DBUS_SERVICE,
connection.path(), NM_DBUS_INTERFACE_DEVICE_WIRELESS,
"AccessPointRemoved", this, SLOT(updateAccessPoints()));
QDBusConnection::systemBus().connect(NM_DBUS_SERVICE,
connection.path(), NM_DBUS_INTERFACE_DEVICE_WIRELESS,
"PropertiesChanged", this, SLOT(updateAccessPoints()));
QDBusReply<QList<QDBusObjectPath> > accessPoints =
wirelessDevice->call("GetAccessPoints");
if (!accessPoints.isValid()) {
emit scanFinished(QWifiManager::ERROR);
return;
}
clearPreviousScanResults();
foreach (const QDBusObjectPath& connection, accessPoints.value()) {
//qDebug() << connection.path();
QDBusInterface accessPoint(NM_DBUS_SERVICE, connection.path(),
NM_DBUS_INTERFACE_ACCESS_POINT,
QDBusConnection::systemBus());
QVariant mac = accessPoint.property("HwAddress");
QVariant ssid = accessPoint.property("Ssid");
QVariant frequency = accessPoint.property("Frequency");
QVariant strengh = accessPoint.property("Strength");
QVariant capabilitiesWPA = accessPoint.property("WpaFlags");
QVariant capabilitiesRSN = accessPoint.property("RsnFlags");
QVariant flags = accessPoint.property("Flags");
if (!ssid.isValid() || !mac.isValid() || !frequency.isValid()
|| !strengh.isValid() || !capabilitiesRSN.isValid()
|| !capabilitiesWPA.isValid() || !flags.isValid() ) {
emit scanFinished(QWifiManager::ERROR);
return;
}
unsigned int capabilities = capabilitiesWPA.toUInt()
| capabilitiesRSN.toUInt() | flags.toUInt();
QString enc;
if (capabilities
& (NM_802_11_AP_SEC_PAIR_TKIP
| NM_802_11_AP_SEC_PAIR_CCMP
| NM_802_11_AP_SEC_GROUP_TKIP
| NM_802_11_AP_SEC_GROUP_CCMP
| NM_802_11_AP_SEC_KEY_MGMT_PSK
| NM_802_11_AP_SEC_KEY_MGMT_802_1X))
enc = QWifiManager::PSK;
else if (capabilities
//.........这里部分代码省略.........
示例4: updateContactData
void ContactsKopete::updateContactData(const QString & contact)
{
if (d->noOnlineContacts) {
load(true);
return;
}
// Retrieving contact name
QDBusReply < QString > contactName = d->interface->getDisplayName(contact);
if (!contactName.isValid()) {
return;
}
QDBusReply < QVariantMap > contactProperties = d->interface->contactProperties(contact);
if (!contactProperties.isValid() || contactProperties.value().size() == 0) {
return;
}
QDBusReply < bool > contactOnline = d->interface->isContactOnline(contact);
if (!contactOnline.isValid()) {
return;
}
QString avatarPath = contactProperties.value().value("picture").toString();
avatarPath = KUrl(avatarPath).toLocalFile();
if (avatarPath.isEmpty()) {
avatarPath = "user-online";
}
kDebug() << "avatarPath" << avatarPath;
QString status = contactProperties.value().value("status_message").toString();
if (status.isEmpty()) {
status = contactProperties.value().value("status").toString();
}
int index;
for (index = 0; index < size(); index++) {
if (itemAt(index).data == contact) {
break;
}
}
if (index >= size()) {
// we don't have this contact in the list
if (contactOnline.value()) {
add(
contactProperties.value().value("display_name").toString(),
status,
KIcon(avatarPath),
contact);
}
} else {
// we already have this contact
if (contactOnline.value()) {
// we are updating the contact
set(index,
contactProperties.value().value("display_name").toString(),
status,
KIcon(avatarPath),
contact);
} else {
// we are removing the contact from the list
removeAt(index);
if (size() == 0) {
d->noOnlineContacts = true;
add(i18n("No online contacts"), "", KIcon("user-offline"), QVariant());
}
}
}
}
示例5:
QList <QDBusObjectPath> QNetworkManagerInterfaceDeviceWireless::getAccessPoints()
{
QDBusReply<QList<QDBusObjectPath> > reply = d->connectionInterface->call(QLatin1String("GetAccessPoints"));
return reply.value();
}
示例6: setupUi
void LancelotAppletConfig::setupUi(QWidget * widget)
{
Ui::LancelotAppletConfigBase::setupUi(widget);
qbgIcons = new QButtonGroup(widget);
qbgIcons->addButton(radioShowCategories);
qbgIcons->addButton(radioShowMenuIconOnly);
qbgMenuActivation = new QButtonGroup(widget);
qbgMenuActivation->addButton(radioActivationHover);
qbgMenuActivation->addButton(radioActivationClick);
connect(radioShowCategories, SIGNAL(clicked()),
this, SLOT(updateCard()));
connect(radioShowMenuIconOnly, SIGNAL(clicked()),
this, SLOT(updateCard()));
connect(listIcons, SIGNAL(itemClicked(QListWidgetItem*)),
this, SLOT(iconItemClicked()));
org::kde::lancelot::App lancelot(
"org.kde.lancelot", "/Lancelot",
QDBusConnection::sessionBus()
);
QDBusReply<QStringList> replyIDs = lancelot.sectionIDs();
QDBusReply<QStringList> replyNames = lancelot.sectionNames();
QDBusReply<QStringList> replyIcons = lancelot.sectionIcons();
// showing icons
QListWidgetItem * item;
item = new QListWidgetItem(
KIcon("lancelot-start"), i18n("Lancelot"), listIcons);
icons["lancelot-start"] = item;
item = new QListWidgetItem(
KIcon("kde"), i18n("KDE Logo"), listIcons);
icons["kde"] = item;
item = new QListWidgetItem(
KIcon("start-here"), i18n("Start here"), listIcons);
icons["start-here"] = item;
item = new QListWidgetItem(
KIcon("unknown"), i18nc("Choose a custom icon", "Custom"), listIcons);
icons["custom"] = item;
// showing categs
if (!replyIDs.isValid() || !replyNames.isValid() || !replyIcons.isValid()) {
// Error connecting to Lancelot via d-bus
// setFailedToLaunch(true);
return;
}
for (int i = 0; i < replyIDs.value().size(); i++) {
QListWidgetItem * item = new QListWidgetItem(
KIcon(replyIcons.value().at(i)), replyNames.value().at(i));
item->setData(Qt::UserRole, replyIDs.value().at(i));
categories[replyIDs.value().at(i)] = item;
listSections->addItem(item);
item->setSelected(true);
}
connect(radioActivationClick, SIGNAL(clicked(bool)), this, SIGNAL(settingChanged()));
connect(radioActivationHover, SIGNAL(clicked(bool)), this, SIGNAL(settingChanged()));
connect(radioShowCategories, SIGNAL(clicked(bool)), this, SIGNAL(settingChanged()));
connect(radioShowMenuIconOnly, SIGNAL(clicked(bool)), this, SIGNAL(settingChanged()));
connect(listIcons, SIGNAL(itemClicked(QListWidgetItem*)), this, SIGNAL(settingChanged()));
}
示例7: qDBusReplyToScriptValue
QScriptValue qDBusReplyToScriptValue(QScriptEngine *eng, const QDBusReply<T> &reply)
{
return QScriptValue(eng, reply.value());
}
示例8: get_sound_theme_qt
QString SessionDispatcher::get_sound_theme_qt() {
QDBusReply<QString> reply = sessioniface->call("get_sound_theme");
return reply.value();
}
示例9: statExecutable
/**
* This method gets problems from abrtd.
* When @p allProblems is @c true, gets problems from all users.
*
* @param allProblems show problems from all users?
*
* @return List of problems
*/
QList<ProblemData*>* Dbus::getProblems(bool allProblems)
{
//get reply from dbus
QDBusReply<QStringList> reply = d->m_dInterface->call(allProblems ? "GetAllProblems" : "GetProblems");
if (reply.isValid()) {
//attributes for problems
QStringList* stats = new QStringList();
const QString statExecutable("executable");
const QString statTime("time");
const QString statCount("count");
const QString statReported_to("reported_to");
const QString statPkg_name("pkg_name");
const QString statPackage("package");
const QString statType("type");
const QString statReason("reason");
stats->append(statExecutable);
stats->append(statTime);
stats->append(statPkg_name);
stats->append(statCount);
stats->append(statReported_to);
stats->append(statPackage);
stats->append(statType);
stats->append(statReason);
QStringList stringList = reply.value();
QList<ProblemData*>* list = new QList<ProblemData*>();
ProblemData* item;
for (int i = 0; i < stringList.size(); ++i) {
//calling method GetInfo via dbus
QDBusReply<QMap<QString, QString> > replyInfo = d->m_dInterface->call("GetInfo", stringList.at(i), *stats);
if (replyInfo.isValid()) {
//set all attributes
item = new ProblemData();
item->setId(stringList.at(i));
item->setExecutable(replyInfo.value().value(statExecutable));
item->setPkg_name(replyInfo.value().value(statPkg_name));
item->setCount(replyInfo.value().value(statCount));
item->setTime(replyInfo.value().value(statTime));
item->setPackage(replyInfo.value().value(statPackage));
item->setReported_to(replyInfo.value().value(statReported_to));
item->setType(replyInfo.value().value(statType));
item->setReason(replyInfo.value().value(statReason));
list->append(item);
//sort by date, new on top
//lambda abstraction, c++11
qSort(list->begin(), list->end(),
[](ProblemData * left, ProblemData * right) {
return left->time() > right->time();
});
} else {
kDebug() << qPrintable("replyInfo failed: " + replyInfo.error().message());
}
}
delete(stats);
return list;
} else {
kError() << "Call failed: " << qPrintable(reply.error().message());
return NULL;
}
}
示例10: get_login_music_enable_qt
bool SessionDispatcher::get_login_music_enable_qt() {
QDBusReply<bool> reply = sessioniface->call("get_login_music_enable");
return reply.value();
}
示例11: get_input_feedback_sounds_enable_qt
bool SessionDispatcher::get_input_feedback_sounds_enable_qt() {
QDBusReply<bool> reply = sessioniface->call("get_input_feedback_sounds_enable");
return reply.value();
}
示例12: get_sound_event_enable_qt
/*-----------------------------sound of beauty-----------------------------*/
bool SessionDispatcher::get_sound_event_enable_qt() {
QDBusReply<bool> reply = sessioniface->call("get_sound_event_enable");
return reply.value();
}
示例13: main
int main(int argc, char **argv)
{
KAboutData about("syanot", 0, ki18n("Syanot"), version, ki18n(description),
KAboutData::License_GPL, ki18n("(C) 2007 Gael de Chalendar"), KLocalizedString(), 0, "[email protected]");
about.addAuthor( ki18n("Gael de Chalendar"), KLocalizedString(), "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[URL]", ki18n( "Dot graph to open" ));
options.add("comparewith file", ki18n("URL of a file containing an analysis to compare the main analysis with"));
options.add("utterances list", ki18n("List of utterances ids to display"));
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
// see if we are starting with session management
if (app.isSessionRestored())
{
RESTORE(Syanot);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
Syanot *widget = 0;
if ( args->count() == 0 )
{
widget = new Syanot();
new SyanotAdaptor(widget);
QDBusConnection::sessionBus().registerObject("/Syanot", widget);
widget->show();
}
else
{
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered( "org.kde.syanot" );
bool instanceExists = reply.value();
for (int i = 0; i < args->count(); i++ )
{
if (instanceExists
&& (KMessageBox::questionYesNo(0,
i18n("There is already a Syanot window opened. What's your choice ?"),
i18n("Opening in new window confirmation"),
KGuiItem("Open in the existing one"),
KGuiItem("Open in new window"),
"openInNewWindowMode" ) == KMessageBox::Yes) )
{
QByteArray tosenddata;
QDataStream arg(&tosenddata, QIODevice::WriteOnly);
QString strarg = args->arg(i);
KUrl url;
if (strarg.left(1) == "/")
url = KUrl(strarg);
else url = KUrl(QDir::currentPath() + '/' + strarg);
arg << url;
QDBusInterface iface("org.kde.syanot", "/Syanot", "", QDBusConnection::sessionBus());
if (iface.isValid())
{
if (args->isSet("utterances"))
{
QDBusReply<void> reply = iface.call("slotSetUtterances", args->getOption("utterances"));
if (reply.isValid())
{
kDebug() << "Reply was valid" << endl;
}
else
{
kError() << "Call failed: " << reply.error().message() << endl;
return 1;
}
}
QDBusReply<void> reply = iface.call("openUrl", url.pathOrUrl());
if (reply.isValid())
{
kDebug() << "Reply was valid" << endl;
}
else
{
kError() << "Call failed: " << reply.error().message() << endl;
return 1;
}
if (args->isSet("comparewith"))
{
QString strarg = args->getOption("comparewith");
KUrl url;
if (strarg.left(1) == "/")
url = KUrl(strarg);
else url = KUrl(QDir::currentPath() + '/' + strarg);
reply = iface.call("openSecondaryUrl", url.pathOrUrl());
if (reply.isValid())
{
kDebug() << "Reply was valid" << endl;
}
else
{
kError() << "Call failed: " << reply.error().message() << endl;
return 1;
}
return 0;
//.........这里部分代码省略.........
示例14: init
void Bluetooth::init()
{
QRegExp rx("dun|rfcomm?|nap");
if (rx.indexIn(mService) < 0) {
KMessageBox::sorry(0, i18n("We support 'dun' and 'nap' services only."));
kapp->quit();
return;
}
// kDebug(KDE_DEFAULT_DEBUG_AREA) << "Bdaddr == " << mBdaddr;
/*
* Find default bluetooth adapter registered in BlueZ.
*/
QDBusInterface bluez(QLatin1String("org.bluez"), QLatin1String("/"),
QLatin1String("org.bluez.Manager"), QDBusConnection::systemBus());
if (!bluez.isValid()) {
KMessageBox::error(0, i18n("Could not contact bluetooth manager (BlueZ)."));
kapp->quit();
return;
}
// kDebug(KDE_DEFAULT_DEBUG_AREA) << "Querying default adapter";
QDBusReply<QDBusObjectPath> adapterPath = bluez.call(QLatin1String("DefaultAdapter"));
if (!adapterPath.isValid()) {
KMessageBox::error(0, i18n("Default bluetooth adapter not found: %1", adapterPath.error().message()));
kapp->quit();
return;
}
// kDebug(KDE_DEFAULT_DEBUG_AREA) << "Default adapter path is " << adapterPath.value().path();
/*
* Find device path registered in BlueZ.
*/
QDBusInterface adapter(QLatin1String("org.bluez"), adapterPath.value().path(),
QLatin1String("org.bluez.Adapter"), QDBusConnection::systemBus());
QDBusReply<QDBusObjectPath> devicePath = adapter.call(QLatin1String("FindDevice"), mBdaddr);
if (!devicePath.isValid()) {
kWarning(KDE_DEFAULT_DEBUG_AREA) << mBdaddr << " is not registered in default bluetooth adapter, it may be in another adapter.";
kWarning(KDE_DEFAULT_DEBUG_AREA) << mBdaddr << " waiting for it to be registered in ModemManager";
QTimer::singleShot(60000, kapp, SLOT(quit()));
return;
}
mDevicePath = devicePath.value().path();
kDebug(KDE_DEFAULT_DEBUG_AREA) << "Device path for " << mBdaddr << " is " << mDevicePath;
/*
* Find name registered in BlueZ.
*/
// get device properties
QDBusInterface device(QLatin1String("org.bluez"), mDevicePath,
QLatin1String("org.bluez.Device"), QDBusConnection::systemBus());
QDBusReply<QMap<QString, QVariant> > deviceProperties = device.call(QLatin1String("GetProperties"));
if (!deviceProperties.isValid()) {
return;
}
QMap<QString, QVariant> properties = deviceProperties.value();
// kDebug(KDE_DEFAULT_DEBUG_AREA) << "Device properties == " << properties;
if (properties.contains("Name")) {
kDebug(KDE_DEFAULT_DEBUG_AREA) << "Name for" << mBdaddr << "is" << properties["Name"].toString();
mDeviceName = properties["Name"].toString();
}
/*
* Check if phone supports the requested service.
*/
bool dun = false, nap = false;
if (properties.contains("UUIDs")) {
foreach (const QString &u, properties["UUIDs"].toStringList()) {
QUuid uuid(u);
if (uuid.data1 == 0x1103) {
dun = true;
} else if (uuid.data1 == 0x1116) {
nap = true;
}
}
}
示例15: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
bool isRunning = false;
if( QDBusConnection::sessionBus().registerService( "org.vokoscreen.screencast" ) )
{
isRunning = false;
}
else
{
isRunning = true;
}
QStringList arguments = QApplication::instance()->arguments();
for( int i = 1; i < arguments.count(); ++i )
{
if ( ( arguments[ 1 ] == "--help" ) or
( arguments[ 1 ] == "-help" ) or
( arguments[ 1 ] == "-h" ) or
( arguments[ 1 ] == "-?" ) )
{
qDebug( " " );
qDebug() << "Usage: vokoscreen [method] [arg]";
qDebug( " " );
qDebug() << "Hint:";
qDebug() << " vokoscreen must running, bevor call method.";
qDebug( " " );
qDebug( "Methods:" );
QvkDbus *vkDbus = new QvkDbus();
qDebug().noquote() << " " << vkDbus->showAllMethods();
qDebug( " " );
return close( 0 );
}
}
if ( ( isRunning == false ) and
( QApplication::instance()->arguments().count() > 1 ) )
{
qDebug() << "Please start vokoscreen first, without a method.";
return 0;
}
// DBus option arguments
QDBusReply<QString> reply;
QDBusConnection bus = QDBusConnection::sessionBus();
QDBusInterface dbus_iface("org.vokoscreen.screencast", "/gui",
"org.vokoscreen.gui", bus);
if ( ( isRunning == true ) and ( QApplication::instance()->arguments().count() > 1 ) )
{
QvkDbus *vkDbus = new QvkDbus();
QString string = vkDbus->showAllMethods();
if ( string.contains( QApplication::instance()->arguments().at( 1 ) ) == false )
{
QString string = QApplication::instance()->arguments().at( 1 );
std::cout << "Error:" << " " << string.toStdString() << " " << "is not a method" << std::endl;
}
if ( QApplication::instance()->arguments().count() == 2 )
{
reply = dbus_iface.call( QApplication::instance()->arguments().at( 1 ) );
}
if ( QApplication::instance()->arguments().count() == 3 )
{
reply = dbus_iface.call( QApplication::instance()->arguments().at( 1 ),
QApplication::instance()->arguments().at( 2 ));
}
// vokoscreens Ausgabe wird mit qDebug auf stderr ausgegeben
// std::cout gibt die Ausgabe auf stdout aus, und somit kann in einem script die Ausgabe
// in eine Variable geleitet werden.
std::cout << reply.value().toStdString() << std::endl;
goto stop;
}
{
QTranslator * qtTranslator = new QTranslator();
qtTranslator->load( "qt_" + QLocale::system().name(), QLibraryInfo::location( QLibraryInfo::TranslationsPath ) );
app.installTranslator( qtTranslator );
QTranslator translator;
translator.load( "vokoscreen_" + QLocale::system().name(), ":/language" );
app.installTranslator( &translator );
}
if( isRunning == false )
{
screencast *foo = new screencast();
foo->show();
return app.exec();
}
else
{
//.........这里部分代码省略.........