File indexing completed on 2024-06-23 05:28:19

0001 /*
0002  This file is part of LightDM-KDE.
0003 
0004  Copyright 2011, 2012 David Edmundson <kde@davidedmundson.co.uk>
0005 
0006  LightDM-KDE is free software: you can redistribute it and/or modify
0007  it under the terms of the GNU General Public License as published by
0008  the Free Software Foundation, either version 3 of the License, or
0009  (at your option) any later version.
0010 
0011  LightDM-KDE is distributed in the hope that it will be useful,
0012  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  GNU General Public License for more details.
0015 
0016  You should have received a copy of the GNU General Public License
0017  along with LightDM-KDE.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef FAKEGREETER_H
0021 #define FAKEGREETER_H
0022 
0023 #include <QtCore/QObject>
0024 #include <QtCore/QVariant>
0025 
0026 #include <QLightDM/Greeter>
0027 
0028 //this class wraps the real greeter, but doesn't ever actually connect to the backend
0029 //so all method calls fail, we then override some here
0030 
0031 class FakeGreeter : public QLightDM::Greeter
0032 {
0033     Q_OBJECT
0034 
0035     Q_PROPERTY(QString lastLoggedInUser READ lastLoggedInUser CONSTANT)
0036     Q_PROPERTY(QString guestLoginName READ guestLoginName CONSTANT)
0037 
0038 public:
0039     explicit FakeGreeter(QObject* parent=0);
0040     virtual ~FakeGreeter();
0041     QString lastLoggedInUser() const;
0042     QString guestLoginName() const;
0043 
0044     bool isAuthenticated() const;
0045 
0046 
0047 public slots:
0048     bool connectSync();
0049     void authenticate(const QString &username=QString());
0050     void authenticateAsGuest();
0051     void respond(const QString &response);
0052 //     void cancelAuthentication();
0053 //     void setLanguage (const QString &language);
0054     bool startSessionSync(const QString &session=QString());
0055 
0056 private slots:
0057     void onAuthenticationTimerExpired();
0058 
0059 private:
0060     bool m_isAuthenticated;
0061 };
0062 
0063 #endif // FAKEGREETER_H