File indexing completed on 2024-04-21 05:27:34

0001 /*
0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
0003 
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #include "../ksldapp.h"
0007 #include <QCommandLineParser>
0008 #include <QGuiApplication>
0009 
0010 int main(int argc, char **argv)
0011 {
0012     QGuiApplication app(argc, argv);
0013 
0014     QCommandLineParser parser;
0015     parser.setApplicationDescription(
0016         QStringLiteral("This test application starts the screen locker immediately and\n"
0017                        "exits once the screen got successfully unlocked. The purpose is\n"
0018                        "to test changes in KSLD without having to restart KSMServer.\n"
0019                        "Thus it's a good way to verify grabbing of keyboard/pointer and\n"
0020                        "the communication with kscreenlocker_greet. If the lock is not\n"
0021                        "working properly the test application can be killed and the\n"
0022                        "screen is unlocked again. If one just wants to test the greeter\n"
0023                        "it's better to start just kscreenlocker_greet."));
0024 
0025     parser.addHelpOption();
0026 
0027     parser.process(app);
0028 
0029     ScreenLocker::KSldApp locker(&app);
0030     locker.initialize();
0031     QObject::connect(&locker, &ScreenLocker::KSldApp::unlocked, &app, &QGuiApplication::quit);
0032     locker.lock(ScreenLocker::EstablishLock::Immediate);
0033 
0034     return app.exec();
0035 }