Commit fea129cc authored by Martin Flöser's avatar Martin Flöser

[ksmserver/screenlocker] Port Greeter from KApplication to QApplication

* Use QCommandLineParser instead of KCmdLineArgs
* Inherit QApplication instead of KApplication
* Use QCoreApplication::setApplicationName and friends
* Drop k4aboutdata
parent 7fc64ab6
......@@ -22,6 +22,7 @@ target_link_libraries(kscreenlocker_greet
KF5::Service
KF5::Declarative
KF5::Crash
KF5::I18n
Qt5::Quick
Qt5::Qml
Qt5::X11Extras
......
......@@ -64,8 +64,8 @@ namespace ScreenLocker
static const char *DEFAULT_MAIN_PACKAGE = "org.kde.passworddialog";
// App
UnlockApp::UnlockApp()
: KApplication()
UnlockApp::UnlockApp(int &argc, char **argv)
: QApplication(argc, argv)
, m_resetRequestIgnoreTimer(new QTimer(this))
, m_delayedLockTimer(0)
, m_package(Plasma::PluginLoader::self()->loadPackage("Plasma/Applet"))
......
......@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SCREENLOCKER_GREETERAPP_H
#define SCREENLOCKER_GREETERAPP_H
#include <KApplication>
#include <QApplication>
#include <Plasma/PackageStructure>
#include <QQuickView>
......@@ -35,11 +35,11 @@ namespace ScreenLocker
{
class Unlocker;
class UnlockApp : public KApplication
class UnlockApp : public QApplication
{
Q_OBJECT
public:
UnlockApp();
explicit UnlockApp(int &argc, char **argv);
virtual ~UnlockApp();
void setTesting(bool enable);
......
......@@ -16,63 +16,42 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include <KCmdLineArgs>
#include <KLocale>
#include <k4aboutdata.h>
#include <KLocalizedString>
#include <KGlobal>
#include <QDateTime>
#include <QCommandLineParser>
#include <iostream>
#include "greeterapp.h"
static const char description[] = I18N_NOOP( "Greeter for the KDE Plasma Workspaces Screen locker" );
static const char version[] = "0.1";
int main(int argc, char* argv[])
{
K4AboutData aboutData( "kscreenlocker_greet", 0, ki18n( "KScreenLocker Greeter" ),
version, ki18n(description), K4AboutData::License_GPL,
ki18n("(c) 2011, Martin Gräßlin") );
aboutData.addAuthor( ki18n("Martin Gräßlin"),
ki18n( "Author and maintainer" ),
"mgraesslin@kde.org");
aboutData.addAuthor( ki18n("Chani Armitage"),
ki18n("Author"),
"chanika@gmail.com");
aboutData.addAuthor( ki18n("Oswald Buddenhagen"),
ki18n("Author"),
"ossi@kde.org");
aboutData.addAuthor( ki18n("Chris Howells"),
ki18n("Author"),
"howells@kde.org");
aboutData.addAuthor( ki18n("Luboš Luňák"),
ki18n("Author"),
"l.lunak@kde.org");
aboutData.addAuthor( ki18n("Martin R. Jones"),
ki18n("Author"),
"mjones@kde.org");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("testing", ki18n("Starts the greeter in testing mode"));
options.add("immediateLock", ki18n("Lock immediately, ignoring any grace time etc."));
KCmdLineArgs::addCmdLineOptions(options);
ScreenLocker::UnlockApp app;
app.disableSessionManagement(); // manually-started
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("testing")) {
ScreenLocker::UnlockApp app(argc, argv);
QCoreApplication::setApplicationName(QStringLiteral("kscreenlocker_greet"));
QCoreApplication::setApplicationVersion(QStringLiteral("0.1"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCommandLineParser parser;
parser.setApplicationDescription(i18n("Greeter for the KDE Plasma Workspaces Screen locker"));
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption testingOption(QStringLiteral("testing"),
i18n("Starts the greeter in testing mode"));
QCommandLineOption immediateLockOption(QStringLiteral("immediateLock"),
i18n("Lock immediately, ignoring any grace time etc."));
parser.addOption(testingOption);
parser.addOption(immediateLockOption);
parser.process(app);
if (parser.isSet(testingOption)) {
app.setTesting(true);
app.setImmediateLock(true);
} else {
app.setImmediateLock(args->isSet("immediateLock"));
app.setImmediateLock(parser.isSet(immediateLockOption));
}
args->clear();
app.desktopResized();
// This allow ksmserver to know when the applicaion has actually finished setting itself up.
......
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