00001
00002
00003
00004
00005
00006
00007 #ifndef SHUTDOWNDLG_H
00008 #define SHUTDOWNDLG_H
00009
00010 #include <tqpixmap.h>
00011 #include <tqimage.h>
00012 #include <tqdatetime.h>
00013 #include <tqdialog.h>
00014 #include <kpushbutton.h>
00015 #include <tqpushbutton.h>
00016 #include <tqframe.h>
00017 #include <kguiitem.h>
00018 #include <tqtoolbutton.h>
00019
00020 class TQPushButton;
00021 class TQVButtonGroup;
00022 class TQPopupMenu;
00023 class TQTimer;
00024 class TQPainter;
00025 class TQString;
00026 class KAction;
00027
00028
00029 #include "timed.h"
00030 #include <kapplication.h>
00031 #include <kpixmapio.h>
00032
00033
00034 #define DBUS_API_SUBJECT_TO_CHANGE
00035 #include <dbus/connection.h>
00036 #include <libhal.h>
00037
00038
00039 class KSMShutdownFeedback : public QWidget
00040 {
00041 Q_OBJECT
00042
00043 public:
00044 static void start() { s_pSelf = new KSMShutdownFeedback(); }
00045 static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
00046 static KSMShutdownFeedback * self() { return s_pSelf; }
00047
00048 protected:
00049 ~KSMShutdownFeedback() {}
00050
00051 private slots:
00052 void slotPaintEffect();
00053
00054 private:
00055 static KSMShutdownFeedback * s_pSelf;
00056 KSMShutdownFeedback();
00057 int m_currentY;
00058 TQPixmap m_root;
00059 void fadeBack( void );
00060 float m_grayOpacity;
00061 float m_compensation;
00062 bool m_fadeBackwards;
00063 bool m_readDelayComplete;
00064 TQImage m_unfadedImage;
00065 TQImage m_grayImage;
00066 TQTime m_fadeTime;
00067 int m_rowsDone;
00068 KPixmapIO m_pmio;
00069 bool m_greyImageCreated;
00070
00071 };
00072
00073
00074
00075 class KSMShutdownDlg : public QDialog
00076 {
00077 Q_OBJECT
00078
00079 public:
00080 static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bopt );
00081
00082 public slots:
00083 void slotLogout();
00084 void slotHalt();
00085 void slotReboot();
00086 void slotReboot(int);
00087 void slotSuspend();
00088 void slotHibernate();
00089
00090 protected:
00091 ~KSMShutdownDlg();
00092
00093 private:
00094 KSMShutdownDlg( TQWidget* parent, bool maysd, KApplication::ShutdownType sdtype );
00095 KApplication::ShutdownType m_shutdownType;
00096 TQString m_bootOption;
00097 TQPopupMenu *targets;
00098 TQStringList rebootOptions;
00099 LibHalContext* m_halCtx;
00100 DBusConnection *m_dbusConn;
00101 bool m_lockOnResume;
00102 };
00103
00104 class KSMDelayedPushButton : public KPushButton
00105 {
00106 Q_OBJECT
00107
00108 public:
00109
00110 KSMDelayedPushButton( const KGuiItem &item, TQWidget *parent, const char *name = 0 );
00111 void setPopup( TQPopupMenu *pop);
00112
00113 private slots:
00114 void slotTimeout();
00115 void slotPressed();
00116 void slotReleased();
00117
00118 private:
00119 TQPopupMenu *pop;
00120 TQTimer *popt;
00121 };
00122
00123 class KSMPushButton : public KPushButton
00124 {
00125 Q_OBJECT
00126
00127 public:
00128
00129 KSMPushButton( const KGuiItem &item, TQWidget *parent, const char *name = 0 );
00130
00131 protected:
00132 virtual void keyPressEvent(TQKeyEvent*e);
00133 virtual void keyReleaseEvent(TQKeyEvent*e);
00134
00135 private:
00136
00137 bool m_pressed;
00138
00139 };
00140
00141
00142
00143 class FlatButton : public QToolButton
00144 {
00145 Q_OBJECT
00146
00147 public:
00148
00149 FlatButton( TQWidget *parent = 0, const char *name = 0 );
00150 ~FlatButton();
00151
00152 protected:
00153 virtual void keyPressEvent(TQKeyEvent*e);
00154 virtual void keyReleaseEvent(TQKeyEvent*e);
00155
00156 private slots:
00157
00158 private:
00159 void init();
00160
00161 bool m_pressed;
00162 TQString m_text;
00163 TQPixmap m_pixmap;
00164
00165 };
00166
00167
00168
00169
00170 class TQLabel;
00171
00172 class KSMDelayedMessageBox : public TimedLogoutDlg
00173 {
00174 Q_OBJECT
00175
00176 public:
00177 KSMDelayedMessageBox( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
00178 static bool showTicker( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
00179
00180 protected slots:
00181 void updateText();
00182
00183 private:
00184 TQString m_template;
00185 int m_remaining;
00186 };
00187
00188 #endif