本文整理汇总了C++中QDBusPendingCallWatcher::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingCallWatcher::deleteLater方法的具体用法?C++ QDBusPendingCallWatcher::deleteLater怎么用?C++ QDBusPendingCallWatcher::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingCallWatcher
的用法示例。
在下文中一共展示了QDBusPendingCallWatcher::deleteLater方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkConnection
void Mpris::checkConnection()
{
if (m_valid) {
QDBusConnection::sessionBus().disconnect(m_service, mprisPath, dbusPropertiesInterface,
QStringLiteral("PropertiesChanged"),
this, SLOT(propertiesChanged(QString, QMap<QString, QVariant>, QStringList)));
}
DBusInterface iface(dbusService, QStringLiteral("/"), dbusService);
if (!iface.isValid()) {
return;
}
QDBusPendingCall call = iface.asyncCall(QStringLiteral("ListNames"));
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call);
watcher->connect(watcher, &QDBusPendingCallWatcher::finished, [this](QDBusPendingCallWatcher *watcher) {
watcher->deleteLater();
QDBusPendingReply<QStringList> reply = *watcher;
if (reply.isError()) {
qDebug("Failed to get the list of DBus services.");
} else {
QStringList services = reply.value();
checkServices(services);
}
});
}
示例2: randomUserIcon
void AccountsWorker::randomUserIcon(User *user)
{
QDBusPendingCall call = m_accountsInter->RandUserIcon();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, [=] {
if (!call.isError()) {
QDBusReply<QString> reply = call.reply();
user->setCurrentAvatar(reply.value());
}
watcher->deleteLater();
});
}
示例3: listSeats
PendingSeats* SeatTracker::listSeats()
{
PendingSeats *ps = new PendingSeats;
auto pendingReply = m_managerIface->ListSeats();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply);
connect(watcher, &QDBusPendingCallWatcher::finished, ps, [=]() {
QDBusPendingReply<NamedSeatPathList> reply = *watcher;
watcher->deleteLater();
QList<PendingSeat*> seatsToLoad;
foreach(const NamedSeatPath &seat, reply.value()) {
seatsToLoad << Seat::seatFromPath(seat.path);
}
ps->setPendingItems(seatsToLoad);
});
示例4: listSessions
PendingSessions* SessionTracker::listSessions()
{
PendingSessions *ps = new PendingSessions;
auto pendingReply = m_managerIface->ListSessions();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply);
connect(watcher, &QDBusPendingCallWatcher::finished, ps, [=]() {
QDBusPendingReply<SessionInfoList> reply = *watcher;
watcher->deleteLater();
QList<PendingSession*> sessionsToLoad;
foreach(const SessionInfo &sessionInfo, reply.value()) {
sessionsToLoad << Session::sessionFromPath(sessionInfo.sessionPath);
}
ps->setPendingItems(sessionsToLoad);
});
示例5: setNopasswdLogin
void AccountsWorker::setNopasswdLogin(User *user, const bool nopasswdLogin)
{
AccountsUser *userInter = m_userInters[user];
Q_ASSERT(userInter);
Q_EMIT requestFrameAutoHide(false);
QDBusPendingCall call = userInter->EnableNoPasswdLogin(nopasswdLogin);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=] {
if (call.isError()) {
Q_EMIT user->nopasswdLoginChanged(user->nopasswdLogin());
}
Q_EMIT requestFrameAutoHide(true);
watcher->deleteLater();
});
}
示例6: setFullname
void AccountsWorker::setFullname(User *user, const QString &fullname)
{
AccountsUser *ui = m_userInters[user];
Q_ASSERT(ui);
Q_EMIT requestFrameAutoHide(false);
QDBusPendingCall call = ui->SetFullName(fullname);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=] {
if (!call.isError()) {
Q_EMIT accountFullNameChangeFinished();
}
Q_EMIT requestFrameAutoHide(true);
watcher->deleteLater();
});
}
示例7: setAutoLogin
void AccountsWorker::setAutoLogin(User *user, const bool autoLogin)
{
AccountsUser *ui = m_userInters[user];
Q_ASSERT(ui);
// because this operate need root permission, we must wait for finished and refersh result
Q_EMIT requestFrameAutoHide(false);
QDBusPendingCall call = ui->SetAutomaticLogin(autoLogin);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=] {
if (call.isError()) {
Q_EMIT user->autoLoginChanged(user->autoLogin());
}
Q_EMIT requestFrameAutoHide(true);
watcher->deleteLater();
});
}
示例8: checkServices
void Mpris::checkServices(const QStringList &services)
{
DBusInterface iface(dbusService, QStringLiteral("/"), dbusService);
foreach (QString service, services) {
QDBusPendingCall call = iface.asyncCall(QStringLiteral("GetConnectionUnixProcessID"), service);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call);
watcher->connect(watcher, &QDBusPendingCallWatcher::finished, [this, service](QDBusPendingCallWatcher *watcher) {
watcher->deleteLater();
QDBusPendingReply<quint32> reply = *watcher;
if (reply.isError()) {
qDebug("Unable to get the pid of service %s.", qPrintable(service));
} else {
quint32 p = reply.value();
if (p == m_pid) {
checkService(service);
}
}
});
}
示例9: distUpgrade
void Frame::distUpgrade()
{
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(m_dbusJobManagerInter->DistUpgrade(), this);
connect(watcher, &QDBusPendingCallWatcher::finished, [this, watcher] {
const QDBusPendingReply<QDBusObjectPath> &reply = *watcher;
if (reply.isError()) {
qDebug() << reply.error().message();
qDebug() << "Quiting the program due to last error.";
qApp->quit();
}
const QDBusObjectPath &path = reply.value();
qDebug() << "distupgrade, getting job path " << path.path();
qDebug() << "start upgrade job: " << path.path() << reply.error();
DBusUpdateJob *job = new DBusUpdateJob("com.deepin.lastore", path.path(), QDBusConnection::systemBus(), this);
connect(job, &DBusUpdateJob::ProgressChanged, [this, job] {
const double progress = job->progress();
qDebug() << "job progress updated: " << progress;
updateProgress(job->progress());
});
connect(job, &DBusUpdateJob::StatusChanged, [this, job] {
const QString status = job->status();
qDebug() << "job status changed: " << status;
if (status == "succeed" || status == "success" || status == "end" || status.isEmpty()) {
// give lastore daemon some time to take care of its business.
QTimer::singleShot(1000, this, SLOT(tryReboot()));
}
if (status == "failed") {
// Failed to upgrade, quit the application.
qApp->quit();
}
});
watcher->deleteLater();
});
}
示例10: QStringLiteral
SnorePlugin::Freedesktop::Freedesktop()
{
m_interface = new org::freedesktop::Notifications(QStringLiteral("org.freedesktop.Notifications"),
QStringLiteral("/org/freedesktop/Notifications"),
QDBusConnection::sessionBus(), this);
QDBusPendingReply<QStringList> reply = m_interface->GetCapabilities();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, [reply, watcher, this]() {
m_supportsRichtext = reply.value().contains(QStringLiteral("body-markup"));
watcher->deleteLater();
});
connect(this, &Freedesktop::enabledChanged, [this](bool enabled) {
if (enabled) {
connect(m_interface, &org::freedesktop::Notifications::ActionInvoked, this, &Freedesktop::slotActionInvoked);
connect(m_interface, &org::freedesktop::Notifications::NotificationClosed, this , &Freedesktop::slotNotificationClosed);
} else {
disconnect(m_interface, &org::freedesktop::Notifications::ActionInvoked, this, &Freedesktop::slotActionInvoked);
disconnect(m_interface, &org::freedesktop::Notifications::NotificationClosed, this , &Freedesktop::slotNotificationClosed);
}
});
}
示例11: dumpPlasmaLayout
void LnfLogic::dumpPlasmaLayout(const QString &pluginName)
{
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.plasmashell", "/PlasmaShell",
"org.kde.PlasmaShell", "dumpCurrentLayoutJS");
QDBusPendingCall pcall = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished,
this, [=](QDBusPendingCallWatcher *watcher) {
const QDBusMessage &msg = watcher->reply();
watcher->deleteLater();
if (watcher->isError()) {
emit messageRequested(ErrorLevel::Error, i18n("Cannot retrieve the current Plasma layout."));
return;
}
const QString layout = msg.arguments().first().toString();
QDir themeDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QLatin1Literal("/plasma/look-and-feel/") % pluginName);
if (!themeDir.mkpath("contents/layouts")) {
qWarning() << "Impossible to create the layouts directory in the look and feel package";
emit messageRequested(ErrorLevel::Error, i18n("Impossible to create the layouts directory in the look and feel package"));
return;
}
QFile layoutFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QLatin1Literal("/plasma/look-and-feel/") % pluginName % QLatin1Literal("/contents/layouts/org.kde.plasma.desktop-layout.js"));
if (layoutFile.open(QIODevice::WriteOnly)) {
layoutFile.write(layout.toUtf8());
layoutFile.close();
} else {
qWarning() << "Impossible to write to org.kde.plasma.desktop-layout.js";
emit messageRequested(ErrorLevel::Error, i18n("Impossible to write to org.kde.plasma.desktop-layout.js"));
return;
}
emit messageRequested(ErrorLevel::Info, i18n("Plasma Layout successfully duplicated"));
});
}
示例12: QDBusPendingCallWatcher
void NetworkManager::ActiveConnectionPrivate::recheckProperties()
{
Q_Q(ActiveConnection);
/*
* Workaround: Re-check connection state before we watch changes in case it gets changed too quickly
* BUG:352326
*/
QStringList properties;
const QDBusObjectPath ip4ConfigObjectPath = iface.ip4Config();
const QDBusObjectPath ip6ConfigObjectPath = iface.ip6Config();
const QDBusObjectPath dhcp4ConfigObjectPath = iface.dhcp4Config();
const QDBusObjectPath dhcp6ConfigObjectPath = iface.dhcp6Config();
if (state != NetworkManager::ActiveConnectionPrivate::convertActiveConnectionState(iface.state())) {
properties << QLatin1String("State");
}
if (!ip4ConfigObjectPath.path().isNull() && ip4ConfigObjectPath.path() != ipV4ConfigPath) {
properties << QLatin1String("Ip4Config");
}
if (!ip6ConfigObjectPath.path().isNull() && ip6ConfigObjectPath.path() != ipV6ConfigPath) {
properties << QLatin1String("Ip6Config");
}
if (!dhcp4ConfigObjectPath.path().isNull() && dhcp4ConfigObjectPath.path() != dhcp4ConfigPath) {
properties << QLatin1String("Dhcp4Config");
}
if (!dhcp6ConfigObjectPath.path().isNull() && dhcp6ConfigObjectPath.path() != dhcp6ConfigPath) {
properties << QLatin1String("Dhcp6Config");
}
Q_FOREACH (const QString &property, properties) {
QDBusMessage message = QDBusMessage::createMethodCall(NetworkManager::NetworkManagerPrivate::DBUS_SERVICE,
NetworkManager::NetworkManagerPrivate::DBUS_DAEMON_PATH,
NetworkManager::NetworkManagerPrivate::FDO_DBUS_PROPERTIES,
QLatin1String("Get"));
message << iface.staticInterfaceName() << property;
QDBusPendingCall pendingCall = QDBusConnection::systemBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall, this);
connect(watcher, &QDBusPendingCallWatcher::finished, [watcher, q, this, property] () {
watcher->deleteLater();
if (property == QLatin1String("State")) {
state = NetworkManager::ActiveConnectionPrivate::convertActiveConnectionState(iface.state());
Q_EMIT q->stateChanged(state);
}
if (property == QLatin1String("Ip4Config")) {
ipV4ConfigPath = iface.ip4Config().path();
Q_EMIT q->ipV4ConfigChanged();
} else if (property == QLatin1String("Ip6Config")) {
ipV6ConfigPath = iface.ip6Config().path();
Q_EMIT q->ipV6ConfigChanged();
} else if (property == QLatin1String("Dhcp4Config")) {
dhcp4ConfigPath = iface.dhcp4Config().path();
Q_EMIT q->dhcp4ConfigChanged();
} else if (property == QLatin1String("Dhcp6Config")) {
dhcp6ConfigPath = iface.dhcp6Config().path();
Q_EMIT q->dhcp6ConfigChanged();
}
});
}