diff --git a/ksmserver/README b/ksmserver/README --- a/ksmserver/README +++ b/ksmserver/README @@ -76,7 +76,7 @@ found in kdelibs/kded/HOWTO] Startkde also launches kcminit, which performs initialization done by kcontrol -modules. There are three kcminit phases, 0, 1 and 2, controlled +modules. There are two kcminit phases, 0, 1, controlled by X-KDE-Init-Phase= in the .desktop file, which defaults to 1. Phase 0 kcminit modules should be only those that really need to be run early in the startup process (and those should probably actually use kstartupconfig in startkde @@ -105,9 +105,8 @@ By this time KDE session is considered to be more or less ready and ksmserver does the knotify startkde event (i.e. plays the login sound). It also tells klauncher to perform autostart phase 2, kded to load all -remaining autoload (i.e. kded phase 2) modules, kcminit to execute -kcminit phase 2 (kcontrol modules that do initialization that can wait, -like launching daemons) and it itself executes the user Autostart folder. +remaining autoload (i.e. kded phase 2) modules, and it itself executes +the user Autostart folder. Technical note: There's a reason why kded modules and items in autostart default to the latest phase. Before you explicitly use a different phase, diff --git a/startkde/kcminit/main.h b/startkde/kcminit/main.h --- a/startkde/kcminit/main.h +++ b/startkde/kcminit/main.h @@ -32,7 +32,6 @@ Q_CLASSINFO("D-Bus Interface", "org.kde.KCMInit") public Q_SLOTS: //dbus Q_SCRIPTABLE void runPhase1(); - Q_SCRIPTABLE void runPhase2(); 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 @@ -131,6 +131,10 @@ if( vphase.isValid() ) libphase = vphase.toInt(); + if (libphase > 1) { + libphase = 1; + } + if( phase != -1 && libphase != phase ) continue; @@ -193,7 +197,7 @@ QDBusConnection::sessionBus().registerObject(QStringLiteral("/kcminit"), this, QDBusConnection::ExportScriptableContents); QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kcminit")); - qApp->exec(); // wait for runPhase1() and runPhase2() + qApp->exec(); // wait for runPhase1() } else runModules( -1 ); // all phases @@ -207,12 +211,7 @@ void KCMInit::runPhase1() { runModules( 1 ); -} - -void KCMInit::runPhase2() -{ - runModules( 2 ); - qApp->exit( 0 ); + qApp->exit(0); } extern "C" Q_DECL_EXPORT int kdemain(int argc, char *argv[]) diff --git a/startkde/plasma-session/startup.h b/startkde/plasma-session/startup.h --- a/startkde/plasma-session/startup.h +++ b/startkde/plasma-session/startup.h @@ -56,10 +56,8 @@ { Q_OBJECT public: - KCMInitJob(int phase); + KCMInitJob(); void start() override; -private: - int m_phase; }; class KDEDInitJob: public KJob diff --git a/startkde/plasma-session/startup.cpp b/startkde/plasma-session/startup.cpp --- a/startkde/plasma-session/startup.cpp +++ b/startkde/plasma-session/startup.cpp @@ -97,7 +97,7 @@ void start() override { qCDebug(PLASMA_SESSION) << "Phase 0"; addSubjob(new AutoStartAppsJob(m_autostart, 0)); - addSubjob(new KCMInitJob(1)); + addSubjob(new KCMInitJob()); addSubjob(new SleepJob()); } }; @@ -127,7 +127,6 @@ qCDebug(PLASMA_SESSION) << "Phase 2"; addSubjob(new AutoStartAppsJob(m_autostart, 2)); addSubjob(new KDEDInitJob()); - addSubjob(new KCMInitJob(2)); runUserAutostart(); } }; @@ -255,8 +254,8 @@ qputenv(key.toLatin1(), value.toLatin1()); } -KCMInitJob::KCMInitJob(int phase) - :m_phase(phase) +KCMInitJob::KCMInitJob() + : KJob() { } @@ -266,12 +265,7 @@ QDBusConnection::sessionBus()); kcminit.setTimeout(10 * 1000); - QDBusPendingReply pending; - if (m_phase == 1) { - pending = kcminit.runPhase1(); - } else { - pending = kcminit.runPhase2(); - } + QDBusPendingReply pending = kcminit.runPhase1(); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();}); connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater);