Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/main.cpp
Show All 35 Lines | |||||
36 | #include <kdbusservice.h> | 36 | #include <kdbusservice.h> | ||
37 | #include <KLocalizedString> | 37 | #include <KLocalizedString> | ||
38 | #include <kconfig.h> | 38 | #include <kconfig.h> | ||
39 | #include <KSharedConfig> | 39 | #include <KSharedConfig> | ||
40 | #include <kmanagerselection.h> | 40 | #include <kmanagerselection.h> | ||
41 | #include <kwindowsystem.h> | 41 | #include <kwindowsystem.h> | ||
42 | #include <ksmserver_debug.h> | 42 | #include <ksmserver_debug.h> | ||
43 | #include "server.h" | 43 | #include "server.h" | ||
44 | #include "startup.h" | | |||
45 | #include "shutdown.h" | | |||
46 | #include <QX11Info> | 44 | #include <QX11Info> | ||
47 | 45 | | |||
48 | #include <QApplication> | 46 | #include <QApplication> | ||
49 | #include <QCommandLineParser> | 47 | #include <QCommandLineParser> | ||
50 | #include <QQuickWindow> | 48 | #include <QQuickWindow> | ||
51 | #include <X11/extensions/Xrender.h> | 49 | #include <X11/extensions/Xrender.h> | ||
52 | 50 | | |||
53 | static const char version[] = "0.4"; | 51 | static const char version[] = "0.4"; | ||
▲ Show 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | 300 | #endif | |||
308 | if (parser.isSet(lockscreenOption)) { | 306 | if (parser.isSet(lockscreenOption)) { | ||
309 | flags |= KSMServer::InitFlag::ImmediateLockScreen; | 307 | flags |= KSMServer::InitFlag::ImmediateLockScreen; | ||
310 | } | 308 | } | ||
311 | if (parser.isSet(noLockscreenOption)) { | 309 | if (parser.isSet(noLockscreenOption)) { | ||
312 | flags |= KSMServer::InitFlag::NoLockScreen; | 310 | flags |= KSMServer::InitFlag::NoLockScreen; | ||
313 | } | 311 | } | ||
314 | 312 | | |||
315 | KSMServer *server = new KSMServer( wm, flags); | 313 | KSMServer *server = new KSMServer( wm, flags); | ||
316 | auto startup = new Startup(server); | | |||
317 | new Shutdown(a); | | |||
318 | 314 | | |||
319 | // for the KDE-already-running check in startkde | 315 | // for the KDE-already-running check in startkde | ||
320 | KSelectionOwner kde_running( "_KDE_RUNNING", 0 ); | 316 | KSelectionOwner kde_running( "_KDE_RUNNING", 0 ); | ||
321 | kde_running.claim( false ); | 317 | kde_running.claim( false ); | ||
322 | 318 | | |||
323 | IceSetIOErrorHandler( IoErrorHandler ); | 319 | IceSetIOErrorHandler( IoErrorHandler ); | ||
324 | 320 | | |||
325 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | 321 | KConfigGroup config(KSharedConfig::openConfig(), "General"); | ||
326 | 322 | | |||
327 | QString loginMode = config.readEntry( "loginMode", "restorePreviousLogout" ); | 323 | QString loginMode = config.readEntry( "loginMode", "restorePreviousLogout" ); | ||
328 | 324 | | |||
329 | if ( parser.isSet( restoreOption )) | 325 | if ( parser.isSet( restoreOption )) | ||
330 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | 326 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | ||
331 | else if ( loginMode == QStringLiteral( "restorePreviousLogout" ) ) | 327 | else if ( loginMode == QStringLiteral( "restorePreviousLogout" ) ) | ||
332 | server->restoreSession( QStringLiteral( SESSION_PREVIOUS_LOGOUT ) ); | 328 | server->restoreSession( QStringLiteral( SESSION_PREVIOUS_LOGOUT ) ); | ||
333 | else if ( loginMode == QStringLiteral( "restoreSavedSession" ) ) | 329 | else if ( loginMode == QStringLiteral( "restoreSavedSession" ) ) | ||
334 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | 330 | server->restoreSession( QStringLiteral( SESSION_BY_USER ) ); | ||
335 | else | 331 | else | ||
336 | server->startDefaultSession(); | 332 | server->startDefaultSession(); | ||
337 | startup->upAndRunning(QStringLiteral( "ksmserver" )); | | |||
338 | 333 | | |||
339 | KDBusService service(KDBusService::Unique); | 334 | KDBusService service(KDBusService::Unique); | ||
340 | 335 | | |||
336 | server->setupShortcuts(); | ||||
341 | int ret = a->exec(); | 337 | int ret = a->exec(); | ||
342 | kde_running.release(); // needs to be done before QApplication destruction | 338 | kde_running.release(); // needs to be done before QApplication destruction | ||
343 | delete a; | 339 | delete a; | ||
344 | return ret; | 340 | return ret; | ||
345 | } | 341 | } |