Commit 68f16bae authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Remove KCM Init Phase 2

It is unused and we have better means of daemon autostart than this.

Differential Revision: https://phabricator.kde.org/D27071
parent ac64bc35
...@@ -76,7 +76,7 @@ will be loaded later. [More information about kded modules could be ...@@ -76,7 +76,7 @@ will be loaded later. [More information about kded modules could be
found in kdelibs/kded/HOWTO] found in kdelibs/kded/HOWTO]
Startkde also launches kcminit, which performs initialization done by kcontrol 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 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 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 process (and those should probably actually use kstartupconfig in startkde
...@@ -105,9 +105,8 @@ saving (usually logout). ...@@ -105,9 +105,8 @@ saving (usually logout).
By this time KDE session is considered to be more or less ready and 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). 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 It also tells klauncher to perform autostart phase 2, kded to load all
remaining autoload (i.e. kded phase 2) modules, kcminit to execute remaining autoload (i.e. kded phase 2) modules, and it itself executes
kcminit phase 2 (kcontrol modules that do initialization that can wait, the user Autostart folder.
like launching daemons) and it itself executes the user Autostart folder.
Technical note: There's a reason why kded modules and items in autostart 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, default to the latest phase. Before you explicitly use a different phase,
......
...@@ -131,6 +131,10 @@ void KCMInit::runModules( int phase ) ...@@ -131,6 +131,10 @@ void KCMInit::runModules( int phase )
if( vphase.isValid() ) if( vphase.isValid() )
libphase = vphase.toInt(); libphase = vphase.toInt();
if (libphase > 1) {
libphase = 1;
}
if( phase != -1 && libphase != phase ) if( phase != -1 && libphase != phase )
continue; continue;
...@@ -193,7 +197,7 @@ KCMInit::KCMInit( const QCommandLineParser& args ) ...@@ -193,7 +197,7 @@ KCMInit::KCMInit( const QCommandLineParser& args )
QDBusConnection::sessionBus().registerObject(QStringLiteral("/kcminit"), this, QDBusConnection::ExportScriptableContents); QDBusConnection::sessionBus().registerObject(QStringLiteral("/kcminit"), this, QDBusConnection::ExportScriptableContents);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kcminit")); QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.kcminit"));
qApp->exec(); // wait for runPhase1() and runPhase2() qApp->exec(); // wait for runPhase1()
} }
else else
runModules( -1 ); // all phases runModules( -1 ); // all phases
...@@ -207,12 +211,7 @@ KCMInit::~KCMInit() ...@@ -207,12 +211,7 @@ KCMInit::~KCMInit()
void KCMInit::runPhase1() void KCMInit::runPhase1()
{ {
runModules( 1 ); runModules( 1 );
} qApp->exit(0);
void KCMInit::runPhase2()
{
runModules( 2 );
qApp->exit( 0 );
} }
extern "C" Q_DECL_EXPORT int kdemain(int argc, char *argv[]) extern "C" Q_DECL_EXPORT int kdemain(int argc, char *argv[])
......
...@@ -32,7 +32,6 @@ class KCMInit : public QObject ...@@ -32,7 +32,6 @@ class KCMInit : public QObject
Q_CLASSINFO("D-Bus Interface", "org.kde.KCMInit") Q_CLASSINFO("D-Bus Interface", "org.kde.KCMInit")
public Q_SLOTS: //dbus public Q_SLOTS: //dbus
Q_SCRIPTABLE void runPhase1(); Q_SCRIPTABLE void runPhase1();
Q_SCRIPTABLE void runPhase2();
public: public:
explicit KCMInit( const QCommandLineParser& args ); explicit KCMInit( const QCommandLineParser& args );
~KCMInit() override; ~KCMInit() override;
......
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
void start() override { void start() override {
qCDebug(PLASMA_SESSION) << "Phase 0"; qCDebug(PLASMA_SESSION) << "Phase 0";
addSubjob(new AutoStartAppsJob(m_autostart, 0)); addSubjob(new AutoStartAppsJob(m_autostart, 0));
addSubjob(new KCMInitJob(1)); addSubjob(new KCMInitJob());
addSubjob(new SleepJob()); addSubjob(new SleepJob());
} }
}; };
...@@ -127,7 +127,6 @@ public: ...@@ -127,7 +127,6 @@ public:
qCDebug(PLASMA_SESSION) << "Phase 2"; qCDebug(PLASMA_SESSION) << "Phase 2";
addSubjob(new AutoStartAppsJob(m_autostart, 2)); addSubjob(new AutoStartAppsJob(m_autostart, 2));
addSubjob(new KDEDInitJob()); addSubjob(new KDEDInitJob());
addSubjob(new KCMInitJob(2));
runUserAutostart(); runUserAutostart();
} }
}; };
...@@ -255,8 +254,8 @@ void Startup::updateLaunchEnv(const QString &key, const QString &value) ...@@ -255,8 +254,8 @@ void Startup::updateLaunchEnv(const QString &key, const QString &value)
qputenv(key.toLatin1(), value.toLatin1()); qputenv(key.toLatin1(), value.toLatin1());
} }
KCMInitJob::KCMInitJob(int phase) KCMInitJob::KCMInitJob()
:m_phase(phase) : KJob()
{ {
} }
...@@ -266,12 +265,7 @@ void KCMInitJob::start() { ...@@ -266,12 +265,7 @@ void KCMInitJob::start() {
QDBusConnection::sessionBus()); QDBusConnection::sessionBus());
kcminit.setTimeout(10 * 1000); kcminit.setTimeout(10 * 1000);
QDBusPendingReply<void> pending; QDBusPendingReply<void> pending = kcminit.runPhase1();
if (m_phase == 1) {
pending = kcminit.runPhase1();
} else {
pending = kcminit.runPhase2();
}
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();}); connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();});
connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater); connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater);
......
...@@ -56,10 +56,8 @@ class KCMInitJob: public KJob ...@@ -56,10 +56,8 @@ class KCMInitJob: public KJob
{ {
Q_OBJECT Q_OBJECT
public: public:
KCMInitJob(int phase); KCMInitJob();
void start() override; void start() override;
private:
int m_phase;
}; };
class KDEDInitJob: public KJob class KDEDInitJob: public KJob
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment