本文整理汇总了C++中QDBusPendingCallWatcher::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingCallWatcher::setProperty方法的具体用法?C++ QDBusPendingCallWatcher::setProperty怎么用?C++ QDBusPendingCallWatcher::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingCallWatcher
的用法示例。
在下文中一共展示了QDBusPendingCallWatcher::setProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activateConnection
void Handler::activateConnection(const QString& connection, const QString& device, const QString& specificObject)
{
NetworkManager::Connection::Ptr con = NetworkManager::findConnection(connection);
if (!con) {
qCWarning(NM) << "Not possible to activate this connection";
return;
}
if (con->settings()->connectionType() == NetworkManager::ConnectionSettings::Vpn) {
NetworkManager::VpnSetting::Ptr vpnSetting = con->settings()->setting(NetworkManager::Setting::Vpn).staticCast<NetworkManager::VpnSetting>();
if (vpnSetting) {
// qCDebug(NM) << "Checking VPN" << con->name() << "type:" << vpnSetting->serviceType();
#if 0
// get the list of supported VPN service types
const KService::List services = KServiceTypeTrader::self()->query("PlasmaNetworkManagement/VpnUiPlugin",
QString::fromLatin1("[X-NetworkManager-Services]=='%1'").arg(vpnSetting->serviceType()));
if (services.isEmpty()) {
qCWarning(NM) << "VPN" << vpnSetting->serviceType() << "not found, skipping";
KNotification *notification = new KNotification("MissingVpnPlugin", KNotification::CloseOnTimeout, this);
notification->setComponentName("networkmanagement");
notification->setTitle(con->name());
notification->setText(i18n("Missing VPN plugin"));
notification->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(KIconLoader::SizeHuge));
notification->sendEvent();
return;
}
#endif
}
}
#if WITH_MODEMMANAGER_SUPPORT
if (con->settings()->connectionType() == NetworkManager::ConnectionSettings::Gsm) {
NetworkManager::ModemDevice::Ptr nmModemDevice = NetworkManager::findNetworkInterface(device).objectCast<NetworkManager::ModemDevice>();
if (nmModemDevice) {
ModemManager::ModemDevice::Ptr mmModemDevice = ModemManager::findModemDevice(nmModemDevice->udi());
if (mmModemDevice) {
ModemManager::Modem::Ptr modem = mmModemDevice->interface(ModemManager::ModemDevice::ModemInterface).objectCast<ModemManager::Modem>();
NetworkManager::GsmSetting::Ptr gsmSetting = con->settings()->setting(NetworkManager::Setting::Gsm).staticCast<NetworkManager::GsmSetting>();
if (gsmSetting && gsmSetting->pinFlags() == NetworkManager::Setting::NotSaved &&
modem && modem->unlockRequired() > MM_MODEM_LOCK_NONE) {
QDBusInterface managerIface("org.kde.plasmanetworkmanagement", "/org/kde/plasmanetworkmanagement", "org.kde.plasmanetworkmanagement", QDBusConnection::sessionBus(), this);
managerIface.call("unlockModem", mmModemDevice->uni());
connect(modem.data(), &ModemManager::Modem::unlockRequiredChanged, this, &Handler::unlockRequiredChanged);
m_tmpConnectionPath = connection;
m_tmpDevicePath = device;
m_tmpSpecificPath = specificObject;
return;
}
}
}
}
#endif
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::activateConnection(connection, device, specificObject);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", Handler::ActivateConnection);
watcher->setProperty("connection", con->name());
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
示例2: addConnection
void Handler::addConnection(const NMVariantMapMap& map)
{
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addConnection(map);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", AddConnection);
watcher->setProperty("connection", map.value("connection").value("id"));
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
示例3: deactivateConnection
void Handler::deactivateConnection(const QString& connection, const QString& device)
{
NetworkManager::Connection::Ptr con = NetworkManager::findConnection(connection);
if (!con) {
qCWarning(NM) << "Not possible to deactivate this connection";
return;
}
QDBusPendingReply<> reply;
Q_FOREACH (const NetworkManager::ActiveConnection::Ptr & active, NetworkManager::activeConnections()) {
if (active->uuid() == con->uuid() && ((!active->devices().isEmpty() && active->devices().first() == device) ||
active->vpn())) {
if (active->vpn()) {
reply = NetworkManager::deactivateConnection(active->path());
} else {
NetworkManager::Device::Ptr device = NetworkManager::findNetworkInterface(active->devices().first());
if (device) {
reply = device->disconnectInterface();
}
}
}
}
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", Handler::DeactivateConnection);
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
示例4: uuid
void NetworkManager::Connection::secrets(const QString &setting)
{
Q_D(Connection);
QString id = uuid();
QDBusPendingReply<NMVariantMapMap> reply = d->iface.GetSecrets(setting);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("libNetworkManagerQt_id", id);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onSecretsArrived(QDBusPendingCallWatcher*)));
}
示例5: setPendingCall
void DBusAsyncResponse::setPendingCall(QVariant variant)
{
if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter::instance()->extractPendingCall(variant)))
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(*call);
watcher->setProperty("pengingCallVariant", variant);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onCallFinished(QDBusPendingCallWatcher*)));
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), watcher, SLOT(deleteLater()));
connect(&m_timeout, SIGNAL(timeout()), watcher, SLOT(deleteLater()));
m_timeout.start();
};
示例6: setPendingCall
void DBusAsyncResponse::setPendingCall(QVariant variant)
{
if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(DBusResponseWaiter::instance()->extractPendingCall(variant)))
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(*call);
watcher->setProperty("pengingCallVariant", variant);
connect(watcher, &QDBusPendingCallWatcher::finished, this, &DBusAsyncResponse::onCallFinished);
connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater);
connect(&m_timeout, &QTimer::timeout, watcher, &QObject::deleteLater);
m_timeout.start();
}
}
示例7: kwinCallDBus
QScriptValue kwinCallDBus(QScriptContext *context, QScriptEngine *engine)
{
KWin::AbstractScript *script = qobject_cast<KWin::AbstractScript*>(context->callee().data().toQObject());
if (!script) {
context->throwError(QScriptContext::UnknownError, QStringLiteral("Internal Error: script not registered"));
return engine->undefinedValue();
}
if (context->argumentCount() < 4) {
context->throwError(QScriptContext::SyntaxError,
i18nc("Error in KWin Script",
"Invalid number of arguments. At least service, path, interface and method need to be provided"));
return engine->undefinedValue();
}
if (!KWin::validateArgumentType<QString, QString, QString, QString>(context)) {
context->throwError(QScriptContext::SyntaxError,
i18nc("Error in KWin Script",
"Invalid type. Service, path, interface and method need to be string values"));
return engine->undefinedValue();
}
const QString service = context->argument(0).toString();
const QString path = context->argument(1).toString();
const QString interface = context->argument(2).toString();
const QString method = context->argument(3).toString();
int argumentsCount = context->argumentCount();
if (context->argument(argumentsCount-1).isFunction()) {
--argumentsCount;
}
QDBusMessage msg = QDBusMessage::createMethodCall(service, path, interface, method);
QVariantList arguments;
for (int i=4; i<argumentsCount; ++i) {
if (context->argument(i).isArray()) {
QStringList stringArray = engine->fromScriptValue<QStringList>(context->argument(i));
arguments << qVariantFromValue(stringArray);
} else {
arguments << context->argument(i).toVariant();
}
}
if (!arguments.isEmpty()) {
msg.setArguments(arguments);
}
if (argumentsCount == context->argumentCount()) {
// no callback, just fire and forget
QDBusConnection::sessionBus().asyncCall(msg);
} else {
// with a callback
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(msg), script);
watcher->setProperty("callback", script->registerCallback(context->argument(context->argumentCount()-1)));
QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), script, SLOT(slotPendingDBusCall(QDBusPendingCallWatcher*)));
}
return engine->undefinedValue();
}
示例8: addAndActivateConnection
//.........这里部分代码省略.........
ap = wifiDev->findAccessPoint(specificObject);
if (ap) {
break;
}
}
}
if (!ap) {
return;
}
NetworkManager::ConnectionSettings::Ptr settings = NetworkManager::ConnectionSettings::Ptr(new NetworkManager::ConnectionSettings(NetworkManager::ConnectionSettings::Wireless));
settings->setId(ap->ssid());
settings->setUuid(NetworkManager::ConnectionSettings::createNewUuid());
settings->setAutoconnect(true);
#if 0
settings->addToPermissions(KUser().loginName(), QString());
#endif
NetworkManager::WirelessSetting::Ptr wifiSetting = settings->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
wifiSetting->setInitialized(true);
wifiSetting = settings->setting(NetworkManager::Setting::Wireless).dynamicCast<NetworkManager::WirelessSetting>();
wifiSetting->setSsid(ap->ssid().toUtf8());
if (ap->mode() == NetworkManager::AccessPoint::Adhoc) {
wifiSetting->setMode(NetworkManager::WirelessSetting::Adhoc);
}
NetworkManager::WirelessSecuritySetting::Ptr wifiSecurity = settings->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
NetworkManager::WirelessSecurityType securityType = NetworkManager::findBestWirelessSecurity(wifiDev->wirelessCapabilities(), true, (ap->mode() == NetworkManager::AccessPoint::Adhoc), ap->capabilities(), ap->wpaFlags(), ap->rsnFlags());
if (securityType != NetworkManager::NoneSecurity) {
wifiSecurity->setInitialized(true);
wifiSetting->setSecurity("802-11-wireless-security");
}
if (securityType == NetworkManager::Leap ||
securityType == NetworkManager::DynamicWep ||
securityType == NetworkManager::Wpa2Eap ||
securityType == NetworkManager::WpaEap) {
if (securityType == NetworkManager::DynamicWep || securityType == NetworkManager::Leap) {
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::Ieee8021x);
if (securityType == NetworkManager::Leap) {
wifiSecurity->setAuthAlg(NetworkManager::WirelessSecuritySetting::Leap);
}
} else {
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaEap);
}
m_tmpConnectionUuid = settings->uuid();
m_tmpDevicePath = device;
m_tmpSpecificPath = specificObject;
#if 0
QPointer<ConnectionDetailEditor> editor = new ConnectionDetailEditor(settings, true);
editor->show();
KWindowSystem::setState(editor->winId(), NET::KeepAbove);
KWindowSystem::forceActiveWindow(editor->winId());
connect(editor.data(), &ConnectionDetailEditor::accepted,
[editor, this] () {
addConnection(editor->setting());
});
connect(editor.data(), &ConnectionDetailEditor::finished,
[editor] () {
if (editor) {
editor->deleteLater();
}
});
editor->setModal(true);
editor->show();
#endif
} else {
if (securityType == NetworkManager::StaticWep) {
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::Wep);
wifiSecurity->setWepKey0(password);
#if 0
if (KWallet::Wallet::isEnabled()) {
wifiSecurity->setWepKeyFlags(NetworkManager::Setting::AgentOwned);
}
#endif
} else {
if (ap->mode() == NetworkManager::AccessPoint::Adhoc) {
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaNone);
} else {
wifiSecurity->setKeyMgmt(NetworkManager::WirelessSecuritySetting::WpaPsk);
}
wifiSecurity->setPsk(password);
#if 0
if (KWallet::Wallet::isEnabled()) {
wifiSecurity->setPskFlags(NetworkManager::Setting::AgentOwned);
}
#endif
}
QDBusPendingReply<QDBusObjectPath> reply = NetworkManager::addAndActivateConnection(settings->toMap(), device, specificObject);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("action", Handler::AddAndActivateConnection);
watcher->setProperty("connection", settings->name());
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished);
}
settings.clear();
}