Changeset View
Changeset View
Standalone View
Standalone View
startkde/plasma-session/startup.cpp
Show First 20 Lines • Show All 411 Lines • ▼ Show 20 Line(s) | 391 | QTimer::singleShot(0, this, [=]() { | |||
---|---|---|---|---|---|
412 | } while (true); | 412 | } while (true); | ||
413 | }); | 413 | }); | ||
414 | } | 414 | } | ||
415 | 415 | | |||
416 | 416 | | |||
417 | StartServiceJob::StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId): | 417 | StartServiceJob::StartServiceJob(const QString &process, const QStringList &args, const QString &serviceId): | ||
418 | KJob(), | 418 | KJob(), | ||
419 | m_process(process), | 419 | m_process(process), | ||
420 | m_args(args) | 420 | m_args(args), | ||
421 | m_serviceId(serviceId) | ||||
421 | { | 422 | { | ||
422 | auto watcher = new QDBusServiceWatcher(serviceId, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); | 423 | auto watcher = new QDBusServiceWatcher(serviceId, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); | ||
423 | connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &StartServiceJob::emitResult); | 424 | connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &StartServiceJob::emitResult); | ||
424 | } | 425 | } | ||
425 | 426 | | |||
426 | void StartServiceJob::start() | 427 | void StartServiceJob::start() | ||
427 | { | 428 | { | ||
429 | if (QDBusConnection::sessionBus().interface()->isServiceRegistered(m_serviceId)) { | ||||
broulik: Could probably use an `m_service.isEmpty()` check since it will still needlessly do a… | |||||
All usages of this class (which is just the 1 case to start ksmserver!) have a name passed. Without a name it wouldn't ever finish. davidedmundson: All usages of this class (which is just the 1 case to start ksmserver!) have a name passed. | |||||
430 | qCDebug(PLASMA_SESSION) << m_process << "already running"; | ||||
431 | emitResult(); | ||||
432 | return; | ||||
433 | } | ||||
434 | qCDebug(PLASMA_SESSION) << "Starting " << m_process << m_args; | ||||
428 | QProcess::startDetached(m_process, m_args); | 435 | QProcess::startDetached(m_process, m_args); | ||
429 | } | 436 | } | ||
430 | 437 | | |||
431 | 438 | | |||
432 | #include "startup.moc" | 439 | #include "startup.moc" |
Could probably use an m_service.isEmpty() check since it will still needlessly do a NameHasOwner call