diff --git a/ksmserver/startup.h b/ksmserver/startup.h --- a/ksmserver/startup.h +++ b/ksmserver/startup.h @@ -53,8 +53,6 @@ public: KCMInitJob(int phase); void start() override; -public Q_SLOTS: - void done(); private: int m_phase; }; diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -232,38 +232,20 @@ } void KCMInitJob::start() { - //FIXME - replace all this with just a DBus call with a timeout and make kcminit delay the reply till it's done - - auto kcminitSignals = new QDBusInterface( QStringLiteral( "org.kde.kcminit"), - QStringLiteral( "/kcminit" ), - QStringLiteral( "org.kde.KCMInit" ), - QDBusConnection::sessionBus(), this ); - if( !kcminitSignals->isValid()) { - qCWarning(KSMSERVER) << "kcminit not running? If we are running with mobile profile or in another platform other than X11 this is normal."; - QTimer::singleShot(0, this, &KCMInitJob::done); - return; - } - if (m_phase == 1) { - connect( kcminitSignals, SIGNAL(phase1Done()), this, SLOT(done())); - } else { - connect( kcminitSignals, SIGNAL(phase2Done()), this, SLOT(done())); - } - QTimer::singleShot( 10000, this, &KCMInitJob::done); // protection - org::kde::KCMInit kcminit(QStringLiteral("org.kde.kcminit"), QStringLiteral("/kcminit"), QDBusConnection::sessionBus()); + kcminit.setTimeout(10 * 1000); + QDBusPendingReply pending; if (m_phase == 1) { - kcminit.runPhase1(); + pending = kcminit.runPhase1(); } else { - kcminit.runPhase2(); + pending = kcminit.runPhase2(); } -} - -void KCMInitJob::done() -{ - emitResult(); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this); + connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();}); + connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater); } KDEDInitJob::KDEDInitJob() diff --git a/startkde/kcminit/main.h b/startkde/kcminit/main.h --- a/startkde/kcminit/main.h +++ b/startkde/kcminit/main.h @@ -34,9 +34,6 @@ public Q_SLOTS: //dbus Q_SCRIPTABLE void runPhase1(); Q_SCRIPTABLE void runPhase2(); - Q_SIGNALS: //dbus signal - Q_SCRIPTABLE void phase1Done(); - Q_SCRIPTABLE void phase2Done(); public: explicit KCMInit( const QCommandLineParser& args ); ~KCMInit() override; diff --git a/startkde/kcminit/main.cpp b/startkde/kcminit/main.cpp --- a/startkde/kcminit/main.cpp +++ b/startkde/kcminit/main.cpp @@ -197,13 +197,11 @@ void KCMInit::runPhase1() { runModules( 1 ); - emit phase1Done(); } void KCMInit::runPhase2() { runModules( 2 ); - emit phase2Done(); qApp->exit( 0 ); }