~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kdm/kfrontend/kdmshutdown.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Shutdown dialog
 
4
 
 
5
Copyright (C) 1997, 1998 Steffen Hansen <hansen@kde.org>
 
6
Copyright (C) 2000-2003,2005 Oswald Buddenhagen <ossi@kde.org>
 
7
 
 
8
 
 
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.
 
13
 
 
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.
 
18
 
 
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.
 
22
 
 
23
*/
 
24
 
 
25
 
 
26
#ifndef KDMSHUTDOWN_H
 
27
#define KDMSHUTDOWN_H
 
28
 
 
29
#include "kdmconfig.h" // for HAVE_VTS
 
30
#include "kgverify.h"
 
31
 
 
32
#include <kpushbutton.h>
 
33
 
 
34
#include <QRadioButton>
 
35
 
 
36
class QGroupBox;
 
37
class QComboBox;
 
38
class QCheckBox;
 
39
class QLineEdit;
 
40
class KGuiItem;
 
41
 
 
42
struct DpySpec;
 
43
 
 
44
enum { Authed = QDialog::Accepted + 1, Schedule };
 
45
 
 
46
class KDMShutdownBase : public FDialog, public KGVerifyHandler {
 
47
    Q_OBJECT
 
48
    typedef FDialog inherited;
 
49
 
 
50
  public:
 
51
    KDMShutdownBase(int _uid, QWidget *_parent);
 
52
    virtual ~KDMShutdownBase();
 
53
 
 
54
  protected Q_SLOTS:
 
55
    virtual void accept();
 
56
 
 
57
  protected:
 
58
    virtual void accepted();
 
59
 
 
60
  protected:
 
61
    void updateNeedRoot();
 
62
    void complete(QWidget *prevWidget);
 
63
 
 
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;
 
71
 
 
72
  private Q_SLOTS:
 
73
    void slotSched();
 
74
    void slotActivatePlugMenu();
 
75
 
 
76
  private:
 
77
    KPushButton *okButton, *cancelButton;
 
78
    QLabel *rootlab;
 
79
    KGStdVerify *verify;
 
80
    int needRoot, uid;
 
81
 
 
82
    static int curPlugin;
 
83
    static PluginList pluginList;
 
84
 
 
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);
 
91
};
 
92
 
 
93
 
 
94
class KDMShutdown : public KDMShutdownBase {
 
95
    Q_OBJECT
 
96
    typedef KDMShutdownBase inherited;
 
97
 
 
98
  public:
 
99
    KDMShutdown(int _uid, QWidget *_parent = 0);
 
100
    static void scheduleShutdown(QWidget *_parent = 0);
 
101
 
 
102
  protected Q_SLOTS:
 
103
    virtual void accept();
 
104
 
 
105
  protected:
 
106
    virtual void accepted();
 
107
 
 
108
  private Q_SLOTS:
 
109
    void slotTargetChanged();
 
110
    void slotWhenChanged();
 
111
 
 
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;
 
121
 
 
122
};
 
123
 
 
124
class KDMRadioButton : public QRadioButton {
 
125
    Q_OBJECT
 
126
    typedef QRadioButton inherited;
 
127
 
 
128
  public:
 
129
    KDMRadioButton(const QString &label, QWidget *parent);
 
130
 
 
131
  private:
 
132
    virtual void mouseDoubleClickEvent(QMouseEvent *);
 
133
 
 
134
  Q_SIGNALS:
 
135
    void doubleClicked();
 
136
 
 
137
};
 
138
 
 
139
class KDMDelayedPushButton : public KPushButton {
 
140
    Q_OBJECT
 
141
    typedef KPushButton inherited;
 
142
 
 
143
  public:
 
144
    KDMDelayedPushButton(const KGuiItem &item, QWidget *parent);
 
145
    void setDelayedMenu(QMenu *pop);
 
146
 
 
147
  private:
 
148
    QTimer popt;
 
149
};
 
150
 
 
151
class KDMSlimShutdown : public FDialog {
 
152
    Q_OBJECT
 
153
    typedef FDialog inherited;
 
154
 
 
155
  public:
 
156
    KDMSlimShutdown(QWidget *_parent = 0);
 
157
    static void externShutdown(int type, const QString &os, int uid, bool ask);
 
158
 
 
159
  private Q_SLOTS:
 
160
    void slotHalt();
 
161
    void slotReboot();
 
162
    void slotReboot(QAction *);
 
163
    void slotSched();
 
164
 
 
165
  private:
 
166
    bool checkShutdown(int type, const QString &os);
 
167
    QStringList targetList;
 
168
 
 
169
};
 
170
 
 
171
class KDMConfShutdown : public KDMShutdownBase {
 
172
    Q_OBJECT
 
173
    typedef KDMShutdownBase inherited;
 
174
 
 
175
  public:
 
176
    KDMConfShutdown(int _uid, const QList<DpySpec> &sessions, int type,
 
177
                    const QString &os, QWidget *_parent = 0);
 
178
};
 
179
 
 
180
class KDMCancelShutdown : public KDMShutdownBase {
 
181
    Q_OBJECT
 
182
    typedef KDMShutdownBase inherited;
 
183
 
 
184
  public:
 
185
    KDMCancelShutdown(int how, int start, int timeout, int force, int uid,
 
186
                      const QString &os, QWidget *_parent);
 
187
};
 
188
 
 
189
#endif /* KDMSHUTDOWN_H */