Commit 96a595f1 authored by David Edmundson's avatar David Edmundson

[ksmserver] Rewrite Startup

Summary:
The code is effectively 3 startup phases each of which has some parallel
methods that need to be complete before moving onto the next phase.

The old code had a tonne of methods all of which tracking what state
we're in and trying to start the next method in the chain handling
things out of order.

This simplifies everything into 3 composite kjobs. A lot more classes,
but each one tiny with the flow more readable.

Code should be effectively the same. The startup sound is moved ever so
slightly earlier to be when phase 2 starts rather than just after
kcminit2 finishes (midway through the old phase 2), but no significant
behavioural changes here.

Test Plan: Logged in with session restore and without

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: apol, broulik, anthonyfieroni, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D16231
parent 248dadf4
......@@ -267,6 +267,7 @@ private:
int sockets[2];
friend bool readFromPipe(int pipe);
friend class RestoreSessionJob;
friend class Startup;
};
......
This diff is collapsed.
#pragma once
#include <QObject>
#include <QDBusInterface>
#include <KJob>
#include "autostart.h"
class KProcess;
class KSMServer;
class KCompositeJob;
class Startup : public QObject
{
Q_OBJECT
public:
Startup(KSMServer *parent);
void upAndRunning( const QString& msg );
private Q_SLOTS:
void runUserAutostart();
bool migrateKDE4Autostart(const QString &autostartFolder);
void autoStart0();
void autoStart1();
void autoStart2();
void autoStart0Done();
void autoStart1Done();
void autoStart2Done();
void kcmPhase1Done();
void kcmPhase2Done();
// ksplash interface
void finishStartup();
void slotAutoStart();
void secondKDEDPhaseLoaded();
void kcmPhase1Timeout();
void kcmPhase2Timeout();
private:
void autoStart(int phase);
private:
AutoStart m_autoStart;
KSMServer *ksmserver = nullptr;
enum State
{
Waiting, AutoStart0, KcmInitPhase1, AutoStart1, FinishingStartup, // startup
};
State state;
};
class KCMInitJob: public KJob
{
Q_OBJECT
public:
KCMInitJob(int phase);
void start() override;
public Q_SLOTS:
void done();
private:
int m_phase;
};
class KDEDInitJob: public KJob
{
Q_OBJECT
public:
KDEDInitJob();
void start() override;
};
bool waitAutoStart2 = true;
bool waitKcmInit2 = true;
QDBusInterface* kcminitSignals = nullptr;
class AutoStartAppsJob: public KJob
{
Q_OBJECT
public:
AutoStartAppsJob(int phase);
void start() override;
private:
AutoStart m_autoStart;
};
class RestoreSessionJob: public KJob
{
Q_OBJECT
public:
RestoreSessionJob(KSMServer *ksmserver);
void start() override;
private:
KSMServer *m_ksmserver;
};
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