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
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 @@ saving (usually logout).
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,
......
......@@ -131,6 +131,10 @@ void KCMInit::runModules( int phase )
if( vphase.isValid() )
libphase = vphase.toInt();
if (libphase > 1) {
libphase = 1;
}
if( phase != -1 && libphase != phase )
continue;
......@@ -193,7 +197,7 @@ KCMInit::KCMInit( const QCommandLineParser& args )
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 @@ KCMInit::~KCMInit()
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[])
......
......@@ -32,7 +32,6 @@ class KCMInit : public QObject
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;
......
......@@ -97,7 +97,7 @@ public:
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 @@ public:
qCDebug(PLASMA_SESSION) << "Phase 2";
addSubjob(new AutoStartAppsJob(m_autostart, 2));
addSubjob(new KDEDInitJob());
addSubjob(new KCMInitJob(2));
runUserAutostart();
}
};
......@@ -255,8 +254,8 @@ void Startup::updateLaunchEnv(const QString &key, const QString &value)
qputenv(key.toLatin1(), value.toLatin1());
}
KCMInitJob::KCMInitJob(int phase)
:m_phase(phase)
KCMInitJob::KCMInitJob()
: KJob()
{
}
......@@ -266,12 +265,7 @@ void KCMInitJob::start() {
QDBusConnection::sessionBus());
kcminit.setTimeout(10 * 1000);
QDBusPendingReply<void> pending;
if (m_phase == 1) {
pending = kcminit.runPhase1();
} else {
pending = kcminit.runPhase2();
}
QDBusPendingReply<void> pending = kcminit.runPhase1();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this]() {emitResult();});
connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater);
......
......@@ -56,10 +56,8 @@ class KCMInitJob: public KJob
{
Q_OBJECT
public:
KCMInitJob(int phase);
KCMInitJob();
void start() override;
private:
int m_phase;
};
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