1/*
2
3Conversation widget for kdm greeter
4
5Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
6Copyright (C) 2008 Oswald Buddenhagen <ossi@kde.org>
7
8based on classic kdm greeter:
9
10 Copyright (C) 1997, 1998, 2000 Steffen Hansen <hansen@kde.org>
11 Copyright (C) 2000-2003 Oswald Buddenhagen <ossi@kde.org>
12
13This program is free software; you can redistribute it and/or modify
14it under the terms of the GNU General Public License as published by
15the Free Software Foundation; either version 2 of the License, or
16(at your option) any later version.
17
18This program is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with this program; if not, write to the Free Software
25Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
27*/
28
29#ifndef KGREET_GENERIC_H
30#define KGREET_GENERIC_H
31
32#include "kgreeterplugin.h"
33
34#include <QObject>
35
36class QGridLayout;
37class QWidget;
38class KLineEdit;
39
40class KGenericGreeter : public QObject, public KGreeterPlugin {
41 Q_OBJECT
42
43 public:
44 KGenericGreeter(KGreeterPluginHandler *handler,
45 QWidget *parent, const QString &fixedEntitiy,
46 Function func, Context ctx);
47 ~KGenericGreeter();
48 virtual void loadUsers(const QStringList &users);
49 virtual void presetEntity(const QString &entity, int field);
50 virtual QString getEntity() const;
51 virtual void setUser(const QString &user);
52 virtual void setEnabled(bool on);
53 virtual bool textMessage(const char *message, bool error);
54 virtual void textPrompt(const char *prompt, bool echo, bool nonBlocking);
55 virtual bool binaryPrompt(const char *prompt, bool nonBlocking);
56 virtual void start();
57 virtual void suspend();
58 virtual void resume();
59 virtual void next();
60 virtual void abort();
61 virtual void succeeded();
62 virtual void failed();
63 virtual void revive();
64 virtual void clear();
65
66 public slots:
67 void slotLoginLostFocus();
68 void slotChanged();
69
70 private:
71 QGridLayout *m_grid;
72 QList<QWidget *> m_children;
73 KLineEdit *m_lineEdit;
74 QWidget *m_parentWidget;
75 QList<QString> m_infoMsgs;
76 QString fixedUser, curUser;
77 QStringList m_users;
78 Function func;
79 Context ctx;
80 int exp, m_line;
81 bool running, m_echo;
82};
83
84#endif /* KGREET_GENERIC_H */
85