1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
/*****************************************************************
ksmserver - the KDE session management server
Copyright (C) 2012 Serghei Amelian <serghei.amelian@gmail.com>
Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/
#ifndef SHUTDOWNDLG_H
#define SHUTDOWNDLG_H
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqdatetime.h>
#include <kdialog.h>
#include <kpushbutton.h>
#include <tqpushbutton.h>
#include <tqframe.h>
#include <kguiitem.h>
#include <tqtoolbutton.h>
#include <krootpixmap.h>
#include <ntqprogressbar.h>
class TQPushButton;
class TQVButtonGroup;
class TQPopupMenu;
class TQTimer;
class TQPainter;
class TQString;
class TDEAction;
#include "timed.h"
#include <tdeapplication.h>
#include <kpixmapio.h>
#include <config.h>
namespace SuspendType {
enum SuspendType {
NotSpecified = 0,
Freeze,
Standby,
Suspend,
Hibernate,
HybridSuspend
};
};
// The (singleton) widget that makes/fades the desktop gray.
class KSMShutdownFeedback : public TQWidget
{
TQ_OBJECT
public:
static void start() { s_pSelf = new KSMShutdownFeedback(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownFeedback * self() { return s_pSelf; }
protected:
~KSMShutdownFeedback() {}
private slots:
void slotPaintEffect();
private:
static KSMShutdownFeedback * s_pSelf;
KSMShutdownFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
float m_grayOpacity;
float m_compensation;
bool m_fadeBackwards;
bool m_readDelayComplete;
TQImage m_unfadedImage;
TQImage m_grayImage;
TQTime m_fadeTime;
int m_rowsDone;
KPixmapIO m_pmio;
bool m_greyImageCreated;
};
// The (singleton) widget that shows either pretty pictures or a black screen during logout
class KSMShutdownIPFeedback : public TQWidget
{
TQ_OBJECT
public:
static void start() { s_pSelf = new KSMShutdownIPFeedback(); }
static void showit() { if ( s_pSelf != 0L ) s_pSelf->showNow(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownIPFeedback * self() { return s_pSelf; }
static bool ispainted() { if ( s_pSelf != 0L ) return s_pSelf->m_isPainted; else return false; }
protected:
~KSMShutdownIPFeedback();
virtual void resizeEvent(TQResizeEvent* re);
public slots:
void slotPaintEffect();
void slotSetBackgroundPixmap(const TQPixmap &);
private:
/**
* Asks KDesktop to export the desktop background as a TDESharedPixmap.
* This method uses DCOP to call KBackgroundIface/setExport(int).
*/
void enableExports();
private:
static KSMShutdownIPFeedback * s_pSelf;
KSMShutdownIPFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
void showNow( void );
int m_timeout;
bool m_isPainted;
bool m_paintedFromSharedRootPixmap;
KRootPixmap* m_sharedRootPixmap;
TQPixmap m_rootPixmap;
int mPixmapTimeout;
TQRect m_screenGeometry;
};
// The confirmation dialog
class KSMShutdownDlg : public TQDialog
{
TQ_OBJECT
public:
static bool confirmShutdown( bool maysd, bool mayrb, TDEApplication::ShutdownType& sdtype, TQString& bopt, int* selection=0 );
public slots:
void slotLogout();
void slotHalt();
void slotReboot();
void slotReboot(int);
void slotSuspend();
void slotHibernate();
void slotFreeze();
void slotHybridSuspend();
protected:
~KSMShutdownDlg();
private:
KSMShutdownDlg( TQWidget* parent, bool maysd, bool mayrb, TDEApplication::ShutdownType sdtype, int* selection=0 );
TDEApplication::ShutdownType m_shutdownType;
TQString m_bootOption;
TQPopupMenu *targets;
TQStringList rebootOptions;
bool m_lockOnResume;
int* m_selection;
};
// The shutdown-in-progress dialog
class KSMShutdownIPDlg : public KSMModalDialog
{
TQ_OBJECT
public:
static TQWidget* showShutdownIP();
void showNotificationActionButtons();
void hideNotificationActionButtons();
void setNotificationActionButtonsSkipText(TQString text);
void setProgressBarTotalSteps(int total_steps);
void setProgressBarProgress(int step);
signals:
void abortLogoutClicked();
void skipNotificationClicked();
protected:
~KSMShutdownIPDlg();
private:
KSMShutdownIPDlg( TQWidget* parent );
TQProgressBar *m_progressbar;
};
class KSMDelayedPushButton : public KPushButton
{
TQ_OBJECT
public:
KSMDelayedPushButton( const KGuiItem &item, TQWidget *parent, const char *name = 0 );
void setPopup( TQPopupMenu *pop);
private slots:
void slotTimeout();
void slotPressed();
void slotReleased();
private:
TQPopupMenu *pop;
TQTimer *popt;
};
class KSMPushButton : public KPushButton
{
TQ_OBJECT
public:
KSMPushButton( const KGuiItem &item, TQWidget *parent, const char *name = 0 );
protected:
virtual void keyPressEvent(TQKeyEvent*e);
virtual void keyReleaseEvent(TQKeyEvent*e);
private:
bool m_pressed;
};
class FlatButton : public TQToolButton
{
TQ_OBJECT
public:
FlatButton( TQWidget *parent = 0, const char *name = 0 );
~FlatButton();
protected:
virtual void keyPressEvent(TQKeyEvent*e);
virtual void keyReleaseEvent(TQKeyEvent*e);
private slots:
private:
void init();
bool m_pressed;
TQString m_text;
TQPixmap m_pixmap;
};
class TQLabel;
class KSMDelayedMessageBox : public TimedLogoutDlg
{
TQ_OBJECT
public:
KSMDelayedMessageBox( TDEApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
static bool showTicker( TDEApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
protected slots:
void updateText();
private:
TQString m_template;
int m_remaining;
};
#endif
|