46
46
// helper class, nuke when qt supports suspend()/resume()
47
47
class QXTimer : public QObject {
49
typedef QObject inherited;
49
typedef QObject inherited;
53
void start( int msec );
70
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
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
82
struct GreeterPluginHandle {
84
KGreeterPluginInfo *info;
84
KGreeterPluginInfo *info;
88
88
typedef QVector<int> PluginList;
90
90
class KGVerify : public QObject, public KGreeterPluginHandler {
92
typedef QObject inherited;
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 );
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;
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 );
158
void performAutoLogin();
159
bool scheduleAutoLogin(bool initial);
160
void doReject(bool initial);
164
void slotPluginSelected( QAction * );
164
void slotPluginSelected(QAction *);
169
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 );
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 );
178
static QVariant getConf(void *ctx, const char *key, const QVariant &dflt);
181
181
class KGStdVerify : public KGVerify {
183
typedef KGVerify inherited;
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 );
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;
200
int failedLabelState;
202
202
public: // from KGreetPluginHandler
203
virtual bool gplugHasNode( const QString &id );
203
virtual bool gplugHasNode(const QString &id);
206
206
class KGThemedVerify : public KGVerify {
208
typedef KGVerify inherited;
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 );
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;
225
QSet<QString> showTypes;
227
227
public: // from KGreetPluginHandler
228
virtual bool gplugHasNode( const QString &id );
228
virtual bool gplugHasNode(const QString &id);
231
231
class KGChTok : public FDialog, public KGVerifyHandler {
233
typedef FDialog inherited;
233
typedef FDialog inherited;
236
KGChTok( QWidget *parent, const QString &user,
237
const PluginList &pluginList, int curPlugin,
238
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx );
236
KGChTok(QWidget *parent, const QString &user,
237
const PluginList &pluginList, int curPlugin,
238
KGreeterPlugin::Function func, KGreeterPlugin::Context ctx);
245
KPushButton *okButton, *cancelButton;
245
KPushButton *okButton, *cancelButton;
248
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 );
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
256
#endif /* KGVERIFY_H */