not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kdm / kfrontend / kdmshutdown.h
blob1c220fdaeabe1706112a7788d377959a03b8ad9b
1 /*
3 Shutdown dialog
5 Copyright (C) 1997, 1998 Steffen Hansen <hansen@kde.org>
6 Copyright (C) 2000-2003,2005 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 KDMSHUTDOWN_H
27 #define KDMSHUTDOWN_H
29 #include "kdmconfig.h" // for HAVE_VTS
30 #include "kgverify.h"
32 #include <kpushbutton.h>
34 #include <QRadioButton>
36 class QGroupBox;
37 class QComboBox;
38 class QCheckBox;
39 class QLineEdit;
40 class KGuiItem;
42 struct DpySpec;
44 enum { Authed = QDialog::Accepted + 1, Schedule };
46 class KDMShutdownBase : public FDialog, public KGVerifyHandler {
47 Q_OBJECT
48 typedef FDialog inherited;
50 public:
51 KDMShutdownBase( int _uid, QWidget *_parent );
52 virtual ~KDMShutdownBase();
54 protected Q_SLOTS:
55 virtual void accept();
57 protected:
58 virtual void accepted();
60 protected:
61 void updateNeedRoot();
62 void complete( QWidget *prevWidget );
64 QVBoxLayout *box;
65 #ifdef HAVE_VTS
66 bool willShut;
67 #else
68 static const bool willShut = true;
69 #endif
70 bool mayNuke, doesNuke, mayOk, maySched;
72 private Q_SLOTS:
73 void slotSched();
74 void slotActivatePlugMenu();
76 private:
77 KPushButton *okButton, *cancelButton;
78 QLabel *rootlab;
79 KGStdVerify *verify;
80 int needRoot, uid;
82 static int curPlugin;
83 static PluginList pluginList;
85 public: // from KGVerifyHandler
86 virtual void verifyPluginChanged( int id );
87 virtual void verifyOk();
88 virtual void verifyFailed();
89 virtual void verifyRetry();
90 virtual void verifySetUser( const QString &user );
94 class KDMShutdown : public KDMShutdownBase {
95 Q_OBJECT
96 typedef KDMShutdownBase inherited;
98 public:
99 KDMShutdown( int _uid, QWidget *_parent = 0 );
100 static void scheduleShutdown( QWidget *_parent = 0 );
102 protected Q_SLOTS:
103 virtual void accept();
105 protected:
106 virtual void accepted();
108 private Q_SLOTS:
109 void slotTargetChanged();
110 void slotWhenChanged();
112 private:
113 QGroupBox *howGroup;
114 QGroupBox *schedGroup;
115 QRadioButton *restart_rb;
116 QLineEdit *le_start, *le_timeout;
117 QCheckBox *cb_force;
118 QComboBox *targets;
119 int oldTarget;
120 int sch_st, sch_to;
124 class KDMRadioButton : public QRadioButton {
125 Q_OBJECT
126 typedef QRadioButton inherited;
128 public:
129 KDMRadioButton( const QString &label, QWidget *parent );
131 private:
132 virtual void mouseDoubleClickEvent( QMouseEvent * );
134 Q_SIGNALS:
135 void doubleClicked();
139 class KDMDelayedPushButton : public KPushButton {
140 Q_OBJECT
141 typedef KPushButton inherited;
143 public:
144 KDMDelayedPushButton( const KGuiItem &item, QWidget *parent );
145 void setDelayedMenu( QMenu *pop );
147 private:
148 QTimer popt;
151 class KDMSlimShutdown : public FDialog {
152 Q_OBJECT
153 typedef FDialog inherited;
155 public:
156 KDMSlimShutdown( QWidget *_parent = 0 );
157 static void externShutdown( int type, const QString &os, int uid );
159 private Q_SLOTS:
160 void slotHalt();
161 void slotReboot();
162 void slotReboot( QAction * );
163 void slotSched();
165 private:
166 bool checkShutdown( int type, const QString &os );
167 QStringList targetList;
171 class KDMConfShutdown : public KDMShutdownBase {
172 Q_OBJECT
173 typedef KDMShutdownBase inherited;
175 public:
176 KDMConfShutdown( int _uid, const QList<DpySpec> &sessions, int type,
177 const QString &os, QWidget *_parent = 0 );
180 class KDMCancelShutdown : public KDMShutdownBase {
181 Q_OBJECT
182 typedef KDMShutdownBase inherited;
184 public:
185 KDMCancelShutdown( int how, int start, int timeout, int force, int uid,
186 const QString &os, QWidget *_parent );
189 #endif /* KDMSHUTDOWN_H */