not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kdm / kfrontend / kgreeter.h
blobb4e18bcb3a6bf47b71ca280e4cb6710a5aaf9232
1 /*
3 Greeter widget for kdm
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.
26 #ifndef KGREETER_H
27 #define KGREETER_H
29 #include "kgverify.h"
30 #include "kgdialog.h"
32 class UserListView;
33 class KdmClock;
34 class KdmItem;
36 class KConfigGroup;
37 class QListWidgetItem;
38 class QActionGroup;
40 struct SessType {
41 QString name, type;
42 QAction *action;
43 bool hid;
44 int prio;
46 SessType() {}
47 SessType( const QString &n, const QString &t, bool h, int p ) :
48 name( n ), type( t ), action( 0 ), hid( h ), prio( p ) {}
49 bool operator<( const SessType &st ) const {
50 return hid != st.hid ? hid < st.hid :
51 prio != st.prio ? prio < st.prio :
52 name < st.name;
56 class KGreeter : public KGDialog, public KGVerifyHandler {
57 Q_OBJECT
58 typedef KGDialog inherited;
60 public:
61 KGreeter( bool themed = false );
62 ~KGreeter();
64 public Q_SLOTS:
65 void accept();
66 void reject();
67 void slotUserClicked( QListWidgetItem * );
68 void slotSessionSelected();
69 void slotUserEntered();
71 protected:
72 void installUserList();
73 void insertUser( const QImage &, const QString &, struct passwd * );
74 void insertUsers();
75 void putSession( const QString &, const QString &, bool, const char * );
76 void insertSessions();
77 virtual void pluginSetup();
78 void setPrevWM( QAction * );
80 QString curUser, dName;
81 KConfigGroup *stsGroup;
82 UserListView *userView;
83 QStringList *userList;
84 QMenu *sessMenu;
85 QActionGroup *sessGroup;
86 QVector<SessType> sessionTypes;
87 int nNormals, nSpecials;
88 QAction *curPrev;
89 bool prevValid;
90 bool needLoad;
92 static int curPlugin;
93 static PluginList pluginList;
95 private Q_SLOTS:
96 void slotLoadPrevWM();
98 public: // from KGVerifyHandler
99 virtual void verifyPluginChanged( int id );
100 virtual void verifyClear();
101 virtual void verifyOk();
102 virtual void verifyFailed();
103 virtual void verifyRetry();
104 virtual void verifySetUser( const QString &user );
107 class KStdGreeter : public KGreeter {
108 Q_OBJECT
109 typedef KGreeter inherited;
111 public:
112 KStdGreeter();
114 protected:
115 virtual void pluginSetup();
117 private:
118 KdmClock *clock;
119 QLabel *pixLabel;
120 QPushButton *goButton;
122 public: // from KGVerifyHandler
123 virtual void verifyFailed();
124 virtual void verifyRetry();
127 class KThemedGreeter : public KGreeter {
128 Q_OBJECT
129 typedef KGreeter inherited;
131 public:
132 KThemedGreeter( KdmThemer *_themer );
133 ~KThemedGreeter();
135 public Q_SLOTS:
136 void slotThemeActivated( const QString &id );
137 void slotSessMenu();
138 void slotActionMenu();
140 protected:
141 virtual void updateStatus( bool fail, bool caps, int timedleft );
142 virtual void pluginSetup();
143 virtual void keyPressEvent( QKeyEvent * );
144 virtual bool event( QEvent *e );
146 private:
147 // KdmClock *clock;
148 KdmThemer *themer;
149 KdmItem *caps_warning, *xauth_warning, *pam_error, *timed_label,
150 *userlist_node, *userlist_rect,
151 *session_button, *system_button;
153 // public: // from KGVerifyHandler
154 // virtual void verifyFailed();
155 // virtual void verifyRetry();
158 #endif /* KGREETER_H */