diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp --- a/ksmserver/main.cpp +++ b/ksmserver/main.cpp @@ -41,6 +41,7 @@ #include #include #include "server.h" +#include "startup.h" #include #include @@ -311,6 +312,7 @@ } KSMServer *server = new KSMServer( wm, flags); + auto startup = new Startup(server); // for the KDE-already-running check in startkde KSelectionOwner kde_running( "_KDE_RUNNING", 0 ); @@ -336,6 +338,7 @@ server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); else server->startDefaultSession(); + startup->upAndRunning(QStringLiteral( "ksmserver" )); KDBusService service(KDBusService::Unique); diff --git a/ksmserver/server.h b/ksmserver/server.h --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -51,8 +51,6 @@ #include #include -#include "autostart.h" - #define SESSION_PREVIOUS_LOGOUT "saved at previous logout" #define SESSION_BY_USER "saved by user" @@ -117,7 +115,8 @@ KWorkSpace::ShutdownType sdtype, KWorkSpace::ShutdownMode sdmode ); - void launchWM( const QList< QStringList >& wmStartCommands ); +Q_SIGNALS: + void windowManagerLoaded(); public Q_SLOTS: void cleanUp(); @@ -129,26 +128,14 @@ void protectionTimeout(); void timeoutQuit(); void timeoutWMQuit(); - void kcmPhase1Timeout(); - void kcmPhase2Timeout(); - void pendingShutdownTimeout(); - void autoStart0(); - void autoStart1(); - void autoStart2(); - void tryRestoreNext(); + void pendingShutdownTimeout(); void wmProcessChange(); - void autoStart0Done(); - void autoStart1Done(); - void autoStart2Done(); - void kcmPhase1Done(); - void kcmPhase2Done(); void defaultLogout(); void logoutWithoutConfirmation(); void haltWithoutConfirmation(); void rebootWithoutConfirmation(); - void secondKDEDPhaseLoaded(); private: void handlePendingInteractions(); @@ -165,15 +152,14 @@ void killingCompleted(); void createLogoutEffectWidget(); - void runUserAutostart(); - bool migrateKDE4Autostart(const QString &autostartFolder); - void discardSession(); void storeSession(); void startProtection(); void endProtection(); + void launchWM( const QList< QStringList >& wmStartCommands ); + KProcess* startApplication( const QStringList& command, const QString& clientMachine = QString(), const QString& userId = QString(), @@ -195,8 +181,9 @@ WId windowWmClientLeader(WId w); QByteArray windowSessionId(WId w, WId leader); - void finishStartup(); void setupShortcuts(); + void tryRestoreNext(); + void startupDone(); void runShutdownScripts(); @@ -223,18 +210,16 @@ void subSessionClosed(); void subSessionCloseCanceled(); void subSessionOpened(); + void sessionRestored(); private: QList listener; QList clients; - void autoStart(int phase); - void slotAutoStart(); - enum State { Idle, - LaunchingWM, AutoStart0, KcmInitPhase1, AutoStart1, Restoring, FinishingStartup, // startup + LaunchingWM, Restoring, Shutdown, Checkpoint, Killing, KillingWM, WaitingForKNotify, // shutdown ClosingSubSession, KillingSubSession, RestoringSubSession }; @@ -257,17 +242,12 @@ QTimer protectionTimer; QTimer restoreTimer; QString xonCommand; - bool waitAutoStart2; - bool waitKcmInit2; QTimer pendingShutdown; QWidget* logoutEffectWidget; KWorkSpace::ShutdownConfirm pendingShutdown_confirm; KWorkSpace::ShutdownType pendingShutdown_sdtype; KWorkSpace::ShutdownMode pendingShutdown_sdmode; - // ksplash interface - void upAndRunning( const QString& msg ); - // sequential startup int appsToStart; int lastAppStarted; @@ -277,17 +257,17 @@ WindowMap legacyWindows; - QDBusInterface* kcminitSignals; int inhibitCookie; - AutoStart m_autoStart; //subSession stuff QList clientsToKill; QList clientsToSave; int sockets[2]; + friend bool readFromPipe(int pipe); + friend class Startup; }; #endif diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -617,7 +617,6 @@ new KSMServerInterfaceAdaptor( this ); QDBusConnection::sessionBus().registerObject(QStringLiteral("/KSMServer"), this); - kcminitSignals = nullptr; the_server = this; clean = false; @@ -1068,6 +1067,182 @@ } } +/*! Restores the previous session. Ensures the window manager is + running (if specified). + */ +void KSMServer::restoreSession( const QString &sessionName ) +{ + if( state != Idle ) + return; +#ifdef KSMSERVER_STARTUP_DEBUG1 + t.start(); +#endif + state = LaunchingWM; + + qCDebug(KSMSERVER) << "KSMServer::restoreSession " << sessionName; + KSharedConfig::Ptr config = KSharedConfig::openConfig(); + + sessionGroup = QStringLiteral("Session: ") + sessionName; + KConfigGroup configSessionGroup( config, sessionGroup); + + int count = configSessionGroup.readEntry( "count", 0 ); + appsToStart = count; + + // find all commands to launch the wm in the session + QList wmStartCommands; + if ( !wm.isEmpty() ) { + for ( int i = 1; i <= count; i++ ) { + QString n = QString::number(i); + if ( isWM( configSessionGroup.readEntry( QStringLiteral("program")+n, QString())) ) { + wmStartCommands << configSessionGroup.readEntry( QStringLiteral("restartCommand")+n, QStringList() ); + } + } + } + if( wmStartCommands.isEmpty()) // otherwise use the configured default + wmStartCommands << wmCommands; + + launchWM( wmStartCommands ); +} + +void KSMServer::launchWM( const QList< QStringList >& wmStartCommands ) +{ + assert( state == LaunchingWM ); + + if (!(qEnvironmentVariableIsSet("WAYLAND_DISPLAY") || qEnvironmentVariableIsSet("WAYLAND_SOCKET"))) { + // when we have a window manager, we start it first and give + // it some time before launching other processes. Results in a + // visually more appealing startup. + wmProcess = startApplication( wmStartCommands[ 0 ], QString(), QString(), true ); + connect( wmProcess, SIGNAL(error(QProcess::ProcessError)), SLOT(wmProcessChange())); + connect( wmProcess, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(wmProcessChange())); + } + emit windowManagerLoaded(); +} + +void KSMServer::wmProcessChange() +{ + if( state != LaunchingWM ) + { // don't care about the process when not in the wm-launching state anymore + wmProcess = nullptr; + return; + } + if( wmProcess->state() == QProcess::NotRunning ) + { // wm failed to launch for some reason, go with kwin instead + qCWarning(KSMSERVER) << "Window manager" << wm << "failed to launch"; + if( wm == QStringLiteral( KWIN_BIN ) ) + return; // uhoh, kwin itself failed + qCDebug(KSMSERVER) << "Launching KWin"; + wm = QStringLiteral( KWIN_BIN ); + wmCommands = ( QStringList() << QStringLiteral( KWIN_BIN ) ); + // launch it + launchWM( QList< QStringList >() << wmCommands ); + return; + } +} + +/*! + Starts the default session. + + Currently, that's the window manager only (if specified). + */ +void KSMServer::startDefaultSession() +{ + if( state != Idle ) + return; + state = LaunchingWM; +#ifdef KSMSERVER_STARTUP_DEBUG1 + t.start(); +#endif + sessionGroup = QString(); + launchWM( QList< QStringList >() << wmCommands ); +} + +void KSMServer::restoreSubSession( const QString& name ) +{ + sessionGroup = QStringLiteral( "SubSession: " ) + name; + + KConfigGroup configSessionGroup( KSharedConfig::openConfig(), sessionGroup); + int count = configSessionGroup.readEntry( "count", 0 ); + appsToStart = count; + lastAppStarted = 0; + lastIdStarted.clear(); + + state = RestoringSubSession; + tryRestoreNext(); +} + +void KSMServer::clientSetProgram( KSMClient* client ) +{ + if( client->program() == wm ) { + emit windowManagerLoaded(); + } +} + +void KSMServer::clientRegistered( const char* previousId ) +{ + if ( previousId && lastIdStarted == QString::fromLocal8Bit( previousId ) ) + tryRestoreNext(); +} + +void KSMServer::tryRestoreNext() +{ + if( state != Restoring && state != RestoringSubSession ) + return; + restoreTimer.stop(); + KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); + + while ( lastAppStarted < appsToStart ) { + lastAppStarted++; + QString n = QString::number(lastAppStarted); + QString clientId = config.readEntry( QStringLiteral("clientId")+n, QString() ); + bool alreadyStarted = false; + foreach ( KSMClient *c, clients ) { + if ( QString::fromLocal8Bit( c->clientId() ) == clientId ) { + alreadyStarted = true; + break; + } + } + if ( alreadyStarted ) + continue; + + QStringList restartCommand = config.readEntry( QStringLiteral("restartCommand")+n, QStringList() ); + if ( restartCommand.isEmpty() || + (config.readEntry( QStringLiteral("restartStyleHint")+n, 0 ) == SmRestartNever)) { + continue; + } + if ( isWM( config.readEntry( QStringLiteral("program")+n, QString())) ) + continue; // wm already started + if( config.readEntry( QStringLiteral( "wasWm" )+n, false )) + continue; // it was wm before, but not now, don't run it (some have --replace in command :( ) + startApplication( restartCommand, + config.readEntry( QStringLiteral("clientMachine")+n, QString() ), + config.readEntry( QStringLiteral("userId")+n, QString() )); + lastIdStarted = clientId; + if ( !lastIdStarted.isEmpty() ) { + restoreTimer.setSingleShot( true ); + restoreTimer.start( 2000 ); + return; // we get called again from the clientRegistered handler + } + } + + //all done + appsToStart = 0; + lastIdStarted.clear(); + + if (state == Restoring) { + emit sessionRestored(); + } else { //subsession + emit subSessionOpened(); + } + state = Idle; +} + +void KSMServer::startupDone() +{ + state = Idle; +} + + void KSMServer::defaultLogout() { shutdown(KWorkSpace::ShutdownConfirmYes, KWorkSpace::ShutdownTypeDefault, KWorkSpace::ShutdownModeDefault); diff --git a/ksmserver/startup.h b/ksmserver/startup.h new file mode 100644 --- /dev/null +++ b/ksmserver/startup.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include +#include "autostart.h" + +class KProcess; +class KSMServer; + +class Startup : public QObject +{ +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; + + bool waitAutoStart2 = true; + bool waitKcmInit2 = true; + QDBusInterface* kcminitSignals = nullptr; + +}; diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -29,6 +29,9 @@ ******************************************************************/ +#include "startup.h" +#include "server.h" + #include #include #include @@ -147,117 +150,26 @@ }; -/*! Restores the previous session. Ensures the window manager is - running (if specified). - */ -void KSMServer::restoreSession( const QString &sessionName ) -{ - if( state != Idle ) - return; -#ifdef KSMSERVER_STARTUP_DEBUG1 - t.start(); -#endif - state = LaunchingWM; - - qCDebug(KSMSERVER) << "KSMServer::restoreSession " << sessionName; - KSharedConfig::Ptr config = KSharedConfig::openConfig(); - - sessionGroup = QStringLiteral("Session: ") + sessionName; - KConfigGroup configSessionGroup( config, sessionGroup); - - int count = configSessionGroup.readEntry( "count", 0 ); - appsToStart = count; - upAndRunning( QStringLiteral( "ksmserver" ) ); - - // find all commands to launch the wm in the session - QList wmStartCommands; - if ( !wm.isEmpty() ) { - for ( int i = 1; i <= count; i++ ) { - QString n = QString::number(i); - if ( isWM( configSessionGroup.readEntry( QStringLiteral("program")+n, QString())) ) { - wmStartCommands << configSessionGroup.readEntry( QStringLiteral("restartCommand")+n, QStringList() ); - } - } - } - if( wmStartCommands.isEmpty()) // otherwise use the configured default - wmStartCommands << wmCommands; - - launchWM( wmStartCommands ); -} - -/*! - Starts the default session. - - Currently, that's the window manager only (if specified). - */ -void KSMServer::startDefaultSession() +Startup::Startup(KSMServer *parent): + QObject(parent), + ksmserver(parent), + state(Waiting) { - if( state != Idle ) - return; - state = LaunchingWM; -#ifdef KSMSERVER_STARTUP_DEBUG1 - t.start(); -#endif - sessionGroup = QString(); - upAndRunning( QStringLiteral( "ksmserver" ) ); - launchWM( QList< QStringList >() << wmCommands ); + connect(ksmserver, &KSMServer::windowManagerLoaded, this, &Startup::autoStart0); } -void KSMServer::launchWM( const QList< QStringList >& wmStartCommands ) +void Startup::autoStart0() { - assert( state == LaunchingWM ); - - if (!(qEnvironmentVariableIsSet("WAYLAND_DISPLAY") || qEnvironmentVariableIsSet("WAYLAND_SOCKET"))) { - // when we have a window manager, we start it first and give - // it some time before launching other processes. Results in a - // visually more appealing startup. - wmProcess = startApplication( wmStartCommands[ 0 ], QString(), QString(), true ); - connect( wmProcess, SIGNAL(error(QProcess::ProcessError)), SLOT(wmProcessChange())); - connect( wmProcess, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(wmProcessChange())); - } - autoStart0(); -} - -void KSMServer::clientSetProgram( KSMClient* client ) -{ - if( client->program() == wm ) - autoStart0(); -} - -void KSMServer::wmProcessChange() -{ - if( state != LaunchingWM ) - { // don't care about the process when not in the wm-launching state anymore - wmProcess = nullptr; - return; - } - if( wmProcess->state() == QProcess::NotRunning ) - { // wm failed to launch for some reason, go with kwin instead - qCWarning(KSMSERVER) << "Window manager" << wm << "failed to launch"; - if( wm == QStringLiteral( KWIN_BIN ) ) - return; // uhoh, kwin itself failed - qCDebug(KSMSERVER) << "Launching KWin"; - wm = QStringLiteral( KWIN_BIN ); - wmCommands = ( QStringList() << QStringLiteral( KWIN_BIN ) ); - // launch it - launchWM( QList< QStringList >() << wmCommands ); - return; - } -} - -void KSMServer::autoStart0() -{ - if( state != LaunchingWM ) - return; + disconnect(ksmserver, &KSMServer::windowManagerLoaded, this, &Startup::autoStart0); state = AutoStart0; #ifdef KSMSERVER_STARTUP_DEBUG1 qCDebug(KSMSERVER) << t.elapsed(); #endif autoStart(0); } -void KSMServer::autoStart0Done() +void Startup::autoStart0Done() { if( state != AutoStart0 ) return; @@ -275,19 +187,19 @@ qCWarning(KSMSERVER) << "kcminit not running? If we are running with mobile profile or in another platform other than X11 this is normal."; delete kcminitSignals; kcminitSignals = nullptr; - QTimer::singleShot(0, this, &KSMServer::kcmPhase1Done); + QTimer::singleShot(0, this, &Startup::kcmPhase1Done); return; } connect( kcminitSignals, SIGNAL(phase1Done()), SLOT(kcmPhase1Done())); - QTimer::singleShot( 10000, this, &KSMServer::kcmPhase1Timeout); // protection + QTimer::singleShot( 10000, this, &Startup::kcmPhase1Timeout); // protection org::kde::KCMInit kcminit(QStringLiteral("org.kde.kcminit"), QStringLiteral("/kcminit"), QDBusConnection::sessionBus()); kcminit.runPhase1(); } -void KSMServer::kcmPhase1Done() +void Startup::kcmPhase1Done() { if( state != KcmInitPhase1 ) return; @@ -298,15 +210,15 @@ autoStart1(); } -void KSMServer::kcmPhase1Timeout() +void Startup::kcmPhase1Timeout() { if( state != KcmInitPhase1 ) return; qCDebug(KSMSERVER) << "Kcminit phase 1 timeout"; kcmPhase1Done(); } -void KSMServer::autoStart1() +void Startup::autoStart1() { if( state != KcmInitPhase1 ) return; @@ -317,88 +229,32 @@ autoStart(1); } -void KSMServer::autoStart1Done() +void Startup::autoStart1Done() { if( state != AutoStart1 ) return; qCDebug(KSMSERVER) << "Autostart 1 done"; - setupShortcuts(); // done only here, because it needs kglobalaccel :-/ - lastAppStarted = 0; - lastIdStarted.clear(); - state = Restoring; + ksmserver->setupShortcuts(); // done only here, because it needs kglobalaccel :-/ + ksmserver->lastAppStarted = 0; + ksmserver->lastIdStarted.clear(); + ksmserver->state = KSMServer::Restoring; #ifdef KSMSERVER_STARTUP_DEBUG1 qCDebug(KSMSERVER)<< t.elapsed(); #endif - if( defaultSession()) { + if( ksmserver->defaultSession()) { autoStart2(); return; } - tryRestoreNext(); -} - -void KSMServer::clientRegistered( const char* previousId ) -{ - if ( previousId && lastIdStarted == QString::fromLocal8Bit( previousId ) ) - tryRestoreNext(); + ksmserver->tryRestoreNext(); + connect(ksmserver, &KSMServer::sessionRestored, this, &Startup::autoStart2); } -void KSMServer::tryRestoreNext() +void Startup::autoStart2() { - if( state != Restoring && state != RestoringSubSession ) + if( ksmserver->state != KSMServer::Restoring ) return; - restoreTimer.stop(); - KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); - - while ( lastAppStarted < appsToStart ) { - lastAppStarted++; - QString n = QString::number(lastAppStarted); - QString clientId = config.readEntry( QStringLiteral("clientId")+n, QString() ); - bool alreadyStarted = false; - foreach ( KSMClient *c, clients ) { - if ( QString::fromLocal8Bit( c->clientId() ) == clientId ) { - alreadyStarted = true; - break; - } - } - if ( alreadyStarted ) - continue; + ksmserver->startupDone(); - QStringList restartCommand = config.readEntry( QStringLiteral("restartCommand")+n, QStringList() ); - if ( restartCommand.isEmpty() || - (config.readEntry( QStringLiteral("restartStyleHint")+n, 0 ) == SmRestartNever)) { - continue; - } - if ( isWM( config.readEntry( QStringLiteral("program")+n, QString())) ) - continue; // wm already started - if( config.readEntry( QStringLiteral( "wasWm" )+n, false )) - continue; // it was wm before, but not now, don't run it (some have --replace in command :( ) - startApplication( restartCommand, - config.readEntry( QStringLiteral("clientMachine")+n, QString() ), - config.readEntry( QStringLiteral("userId")+n, QString() )); - lastIdStarted = clientId; - if ( !lastIdStarted.isEmpty() ) { - restoreTimer.setSingleShot( true ); - restoreTimer.start( 2000 ); - return; // we get called again from the clientRegistered handler - } - } - - //all done - appsToStart = 0; - lastIdStarted.clear(); - - if (state == Restoring) - autoStart2(); - else { //subsession - state = Idle; - emit subSessionOpened(); - } -} - -void KSMServer::autoStart2() -{ - if( state != Restoring ) - return; state = FinishingStartup; #ifdef KSMSERVER_STARTUP_DEBUG1 qCDebug(KSMSERVER)<< t.elapsed(); @@ -413,40 +269,40 @@ auto pending = kded.asyncCall( QStringLiteral( "loadSecondPhase" ) ); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending, this); - QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &KSMServer::secondKDEDPhaseLoaded); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &Startup::secondKDEDPhaseLoaded); QObject::connect(watcher, &QDBusPendingCallWatcher::finished, watcher, &QObject::deleteLater); runUserAutostart(); if (kcminitSignals) { connect( kcminitSignals, SIGNAL(phase2Done()), SLOT(kcmPhase2Done())); - QTimer::singleShot( 10000, this, &KSMServer::kcmPhase2Timeout); // protection + QTimer::singleShot( 10000, this, &Startup::kcmPhase2Timeout); // protection org::kde::KCMInit kcminit(QStringLiteral("org.kde.kcminit"), QStringLiteral("/kcminit"), QDBusConnection::sessionBus()); kcminit.runPhase2(); } else { - QTimer::singleShot(0, this, &KSMServer::kcmPhase2Done); + QTimer::singleShot(0, this, &Startup::kcmPhase2Done); } } -void KSMServer::secondKDEDPhaseLoaded() +void Startup::secondKDEDPhaseLoaded() { #ifdef KSMSERVER_STARTUP_DEBUG1 qCDebug(KSMSERVER)<< "kded" << t.elapsed(); #endif - if( !defaultSession()) - restoreLegacySession(KSharedConfig::openConfig().data()); + if( !ksmserver->defaultSession()) + ksmserver->restoreLegacySession(KSharedConfig::openConfig().data()); qCDebug(KSMSERVER) << "Starting notification thread"; NotificationThread *loginSound = new NotificationThread(); // Delete the thread when finished connect(loginSound, &NotificationThread::finished, loginSound, &NotificationThread::deleteLater); loginSound->start(); } -void KSMServer::runUserAutostart() +void Startup::runUserAutostart() { // Now let's execute the scripts in the KDE-specific autostart-scripts folder. const QString autostartFolder = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QDir::separator() + QStringLiteral("autostart-scripts"); @@ -482,7 +338,7 @@ } } -bool KSMServer::migrateKDE4Autostart(const QString &autostartFolder) +bool Startup::migrateKDE4Autostart(const QString &autostartFolder) { // Migrate user autostart from kde4 Kdelibs4Migration migration; @@ -518,16 +374,16 @@ return true; } -void KSMServer::autoStart2Done() +void Startup::autoStart2Done() { if( state != FinishingStartup ) return; qCDebug(KSMSERVER) << "Autostart 2 done"; waitAutoStart2 = false; finishStartup(); } -void KSMServer::kcmPhase2Done() +void Startup::kcmPhase2Done() { if( state != FinishingStartup ) return; @@ -541,15 +397,15 @@ finishStartup(); } -void KSMServer::kcmPhase2Timeout() +void Startup::kcmPhase2Timeout() { if( !waitKcmInit2 ) return; qCDebug(KSMSERVER) << "Kcminit phase 2 timeout"; kcmPhase2Done(); } -void KSMServer::finishStartup() +void Startup::finishStartup() { if( state != FinishingStartup ) return; @@ -561,11 +417,11 @@ qCDebug(KSMSERVER)<< t.elapsed(); #endif - state = Idle; - setupXIOErrorHandler(); // From now on handle X errors as normal shutdown. + state = Waiting; + ksmserver->setupXIOErrorHandler(); // From now on handle X errors as normal shutdown. } -void KSMServer::upAndRunning( const QString& msg ) +void Startup::upAndRunning( const QString& msg ) { QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), QStringLiteral("/KSplash"), @@ -575,34 +431,20 @@ QDBusConnection::sessionBus().asyncCall(ksplashProgressMessage); } -void KSMServer::restoreSubSession( const QString& name ) -{ - sessionGroup = QStringLiteral( "SubSession: " ) + name; - - KConfigGroup configSessionGroup( KSharedConfig::openConfig(), sessionGroup); - int count = configSessionGroup.readEntry( "count", 0 ); - appsToStart = count; - lastAppStarted = 0; - lastIdStarted.clear(); - - state = RestoringSubSession; - tryRestoreNext(); -} - -void KSMServer::autoStart(int phase) +void Startup::autoStart(int phase) { if (m_autoStart.phase() >= phase) { return; } m_autoStart.setPhase(phase); if (phase == 0) { m_autoStart.loadAutoStartList(); } - QTimer::singleShot(0, this, &KSMServer::slotAutoStart); + QTimer::singleShot(0, this, &Startup::slotAutoStart); } -void KSMServer::slotAutoStart() +void Startup::slotAutoStart() { do { QString serviceName = m_autoStart.startService();