Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/startup.cpp
Show First 20 Lines • Show All 226 Lines • ▼ Show 20 Line(s) | |||||
227 | } | 227 | } | ||
228 | 228 | | |||
229 | KCMInitJob::KCMInitJob(int phase) | 229 | KCMInitJob::KCMInitJob(int phase) | ||
230 | :m_phase(phase) | 230 | :m_phase(phase) | ||
231 | { | 231 | { | ||
232 | } | 232 | } | ||
233 | 233 | | |||
234 | void KCMInitJob::start() { | 234 | void KCMInitJob::start() { | ||
235 | //FIXME - replace all this with just a DBus call with a timeout and make kcminit delay the reply till it's done | | |||
236 | | ||||
237 | auto kcminitSignals = new QDBusInterface( QStringLiteral( "org.kde.kcminit"), | | |||
238 | QStringLiteral( "/kcminit" ), | | |||
239 | QStringLiteral( "org.kde.KCMInit" ), | | |||
240 | QDBusConnection::sessionBus(), this ); | | |||
241 | if( !kcminitSignals->isValid()) { | | |||
242 | qCWarning(KSMSERVER) << "kcminit not running? If we are running with mobile profile or in another platform other than X11 this is normal."; | | |||
243 | QTimer::singleShot(0, this, &KCMInitJob::done); | | |||
244 | return; | | |||
245 | } | | |||
246 | if (m_phase == 1) { | | |||
247 | connect( kcminitSignals, SIGNAL(phase1Done()), this, SLOT(done())); | | |||
248 | } else { | | |||
249 | connect( kcminitSignals, SIGNAL(phase2Done()), this, SLOT(done())); | | |||
250 | } | | |||
251 | QTimer::singleShot( 10000, this, &KCMInitJob::done); // protection | | |||
252 | | ||||
253 | org::kde::KCMInit kcminit(QStringLiteral("org.kde.kcminit"), | 235 | org::kde::KCMInit kcminit(QStringLiteral("org.kde.kcminit"), | ||
254 | QStringLiteral("/kcminit"), | 236 | QStringLiteral("/kcminit"), | ||
255 | QDBusConnection::sessionBus()); | 237 | QDBusConnection::sessionBus()); | ||
238 | kcminit.setTimeout(10 * 1000); | ||||
256 | 239 | | |||
240 | QDBusPendingReply<void> pending; | ||||
257 | if (m_phase == 1) { | 241 | if (m_phase == 1) { | ||
258 | kcminit.runPhase1(); | 242 | pending = kcminit.runPhase1(); | ||
259 | } else { | 243 | } else { | ||
260 | kcminit.runPhase2(); | 244 | pending = kcminit.runPhase2(); | ||
261 | } | 245 | } | ||
262 | } | 246 | QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this); | ||
263 | 247 | connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();}); | |||
264 | void KCMInitJob::done() | 248 | connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater); | ||
265 | { | | |||
266 | emitResult(); | | |||
267 | } | 249 | } | ||
268 | 250 | | |||
269 | KDEDInitJob::KDEDInitJob() | 251 | KDEDInitJob::KDEDInitJob() | ||
270 | { | 252 | { | ||
271 | } | 253 | } | ||
272 | 254 | | |||
273 | void KDEDInitJob::start() { | 255 | void KDEDInitJob::start() { | ||
274 | qCDebug(KSMSERVER()); | 256 | qCDebug(KSMSERVER()); | ||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |