Commit 41ef07d6 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Improve powerdevil's main

Summary:
Make it possible to restart the daemon for easier debugging.
Use Qt::AA_DisableSessionManager for all the performance.

Test Plan: Using it right now

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28492
parent 9dbae3f1
......@@ -203,16 +203,26 @@ void PowerDevilApp::migratePre512KeyboardShortcuts()
int main(int argc, char **argv)
{
QGuiApplication::setDesktopSettingsAware(false);
QGuiApplication::setAttribute(Qt::AA_DisableSessionManager);
KWorkSpace::detectPlatform(argc, argv);
PowerDevilApp app(argc, argv);
auto disableSessionManagement = [](QSessionManager &sm) {
sm.setRestartHint(QSessionManager::RestartNever);
};
QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement);
QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement);
bool replace = false;
{
QCommandLineParser parser;
QCommandLineOption replaceOption({QStringLiteral("replace")}, i18n("Replace an existing instance"));
KDBusService service(KDBusService::Unique);
parser.addOption(replaceOption);
KAboutData aboutData = KAboutData::applicationData();
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
replace = parser.isSet(replaceOption);
}
KDBusService service(KDBusService::Unique | KDBusService::StartupOption(replace ? KDBusService::Replace : 0));
KCrash::setFlags(KCrash::AutoRestart);
app.setQuitOnLastWindowClosed(false);
......
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