Disable session management

This commit is contained in:
Nicolas Fella 2019-06-02 14:01:42 +00:00 committed by Albert Vaca
parent 377f478aeb
commit 095560f0be

View file

@ -26,6 +26,7 @@
#include <QCommandLineParser>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QSessionManager>
#include <KDBusService>
#include <KNotification>
@ -116,6 +117,13 @@ int main(int argc, char* argv[])
Daemon* daemon = new DesktopDaemon;
QObject::connect(daemon, SIGNAL(destroyed(QObject*)), &app, SLOT(quit()));
// kdeconnectd is autostarted, so disable session management to speed up startup
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
return app.exec();
}