3
Shell for kdm conversation plugins
5
Copyright (C) 1997, 1998 Steffen Hansen <hansen@kde.org>
6
Copyright (C) 2000-2004 Oswald Buddenhagen <ossi@kde.org>
9
This program is free software; you can redistribute it and/or modify
10
it under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
#include "kgreeterplugin.h"
32
#include <QGridLayout>
44
class QSocketNotifier;
46
// helper class, nuke when qt supports suspend()/resume()
47
class QXTimer : public QObject {
49
typedef QObject inherited;
70
class KGVerifyHandler {
72
virtual ~KGVerifyHandler() {}
73
virtual void verifyPluginChanged(int id) = 0;
74
virtual void verifyClear();
75
virtual void verifyOk() = 0;
76
virtual void verifyFailed() = 0;
77
virtual void verifyRetry() = 0;
78
virtual void verifySetUser(const QString &user) = 0;
79
virtual void updateStatus(bool fail, bool caps, int left); // for themed only
82
struct GreeterPluginHandle {
84
KGreeterPluginInfo *info;
88
typedef QVector<int> PluginList;
90
class KGVerify : public QObject, public KGreeterPluginHandler {
92
typedef QObject inherited;
95
KGVerify(KGVerifyHandler *handler,
96
QWidget *parent, QWidget *predecessor,
97
const QString &fixedEntity, const PluginList &pluginList,
98
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx);
100
QMenu *getPlugMenu();
101
void loadUsers(const QStringList &users);
102
void presetEntity(const QString &entity, int field);
103
QString getEntity() const;
104
void setUser(const QString &user);
105
virtual void selectPlugin(int id);
106
bool entitiesLocal() const;
107
bool entitiesFielded() const;
108
bool entityPresettable() const;
109
bool isClassic() const;
110
QString pluginName() const;
111
void setEnabled(bool on);
118
enum { CoreIdle, CorePrompting, CoreBusy } coreState;
120
static bool handleFailVerify(QWidget *parent, bool showUser);
121
static PluginList init(const QStringList &plugins);
128
bool eventFilter(QObject *, QEvent *);
129
void msgBox(QMessageBox::Icon typ, const QString &msg);
131
void updateLockStatus();
132
virtual void updateStatus() = 0;
135
QString fixedEntity, presEnt, curUser, pamUser;
136
PluginList pluginList;
137
KGVerifyHandler *handler;
138
QSocketNotifier *sockNot;
139
QWidget *parent, *predecessor;
140
KGreeterPlugin *greet;
142
int curPlugin, presFld, timedLeft, deadTicks;
144
KGreeterPlugin::Function func;
145
KGreeterPlugin::Context ctx;
147
bool enabled, running, suspended, failed, delayed;
148
bool authTok, isClear, timeable;
150
static void vrfMsgBox(QWidget *parent, const QString &user, QMessageBox::Icon type, const QString &mesg);
151
static void vrfErrBox(QWidget *parent, const QString &user, const char *msg);
152
static void vrfInfoBox(QWidget *parent, const QString &user, const char *msg);
154
static QVector<GreeterPluginHandle> greetPlugins;
158
void performAutoLogin();
159
bool scheduleAutoLogin(bool initial);
160
void doReject(bool initial);
164
void slotPluginSelected(QAction *);
169
public: // from KGreetPluginHandler
170
virtual void gplugReturnText(const char *text, int tag);
171
virtual void gplugReturnBinary(const char *data);
172
virtual void gplugSetUser(const QString &user);
173
virtual void gplugStart();
174
virtual void gplugChanged();
175
virtual void gplugActivity();
176
virtual void gplugMsgBox(QMessageBox::Icon type, const QString &text);
178
static QVariant getConf(void *ctx, const char *key, const QVariant &dflt);
181
class KGStdVerify : public KGVerify {
183
typedef KGVerify inherited;
186
KGStdVerify(KGVerifyHandler *handler, QWidget *parent,
187
QWidget *predecessor, const QString &fixedEntity,
188
const PluginList &pluginList,
189
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx);
190
virtual ~KGStdVerify();
191
QLayout *getLayout() const { return grid; }
192
void selectPlugin(int id);
200
int failedLabelState;
202
public: // from KGreetPluginHandler
203
virtual bool gplugHasNode(const QString &id);
206
class KGThemedVerify : public KGVerify {
208
typedef KGVerify inherited;
211
KGThemedVerify(KGVerifyHandler *handler, KdmThemer *themer,
212
QWidget *parent, QWidget *predecessor,
213
const QString &fixedEntity,
214
const PluginList &pluginList,
215
KGreeterPlugin::Function func,
216
KGreeterPlugin::Context ctx);
217
virtual ~KGThemedVerify();
218
void selectPlugin(int id);
225
QSet<QString> showTypes;
227
public: // from KGreetPluginHandler
228
virtual bool gplugHasNode(const QString &id);
231
class KGChTok : public FDialog, public KGVerifyHandler {
233
typedef FDialog inherited;
236
KGChTok(QWidget *parent, const QString &user,
237
const PluginList &pluginList, int curPlugin,
238
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx);
245
KPushButton *okButton, *cancelButton;
248
public: // from KGVerifyHandler
249
virtual void verifyPluginChanged(int id);
250
virtual void verifyOk();
251
virtual void verifyFailed();
252
virtual void verifyRetry();
253
virtual void verifySetUser(const QString &user);
256
#endif /* KGVERIFY_H */