1
//===========================================================================
3
// This file is part of the KDE project
5
// Copyright 1999 Martin R. Jones <mjones@kde.org>
6
// Copyright 2003 Oswald Buddenhagen <ossi@kde.org>
7
// Copyright 2008 Chani Armitage <chanika@gmail.com>
20
#include <QMessageBox>
26
#include "plasmaapp_interface.h"
30
struct KGreeterPluginInfo;
32
struct GreeterPluginHandle {
34
KGreeterPluginInfo *info;
37
const int TIMEOUT_CODE = 2; //from PasswordDlg
39
class QDBusServiceWatcher;
41
//===========================================================================
43
// Screen saver handling process. Handles screensaver window,
44
// starting screensaver hacks, and password entry.
50
Q_CLASSINFO("D-Bus Interface", "org.kde.screenlocker.LockProcess")
52
explicit LockProcess(bool child_saver = false, bool useBlankOnly = false);
56
* start the screensaver locked
58
bool lock(bool initial = false);
61
* start the screensaver unlocked
66
* start the screensaver in plasma setup mode
67
* if plasma is disabled this just acts like defaultSave
72
* start the screensaver unlocked, and *never* automatically lock it
76
void setChildren(QList<int> children) { child_sockets = children; }
77
void setParent(int fd) { mParent = fd; }
79
void msgBox( QWidget *parent, QMessageBox::Icon type, const QString &txt );
80
int execDialog( QDialog* dlg );
86
* bring up the password dialog with @param reason displayed instead of the usual "this session
88
* @return true if the password was entered correctly
89
* if this returns true, it will also unlock the screensaver without quitting.
90
* it will re-lock after the lock timeout in the settings
92
Q_SCRIPTABLE bool checkPass(const QString &reason);
94
* this will unlock and quit the screensaver, asking for a password first if necessary
96
Q_SCRIPTABLE void quit();
98
* immediately lock the screen; it will now require a password to unlock.
100
Q_SCRIPTABLE bool startLock();
103
virtual bool x11Event(XEvent *);
104
virtual void timerEvent(QTimerEvent *);
105
virtual bool eventFilter(QObject *o, QEvent *e);
109
void signalPipeSignal();
111
void checkDPMSActive();
112
void slotDeadTimePassed();
114
* check that plasma started properly (used for timeout)
115
* and disable it if it failed
119
* a new dbus service has come in
121
void newService(QString name, QString oldOwner, QString newOwner);
123
* tell plasma we're in idle mode
125
void deactivatePlasma();
128
* immediately un-suppress the password dialog
129
* FIXME need a better name
131
void unSuppressUnlock();
136
void createSaverWindow();
137
void hideSaverWindow();
139
void setVRoot(Window win, Window rw);
140
void removeVRoot(Window win);
145
void cantLock(const QString &reason);
154
* exec the password dialog
155
* @return true iff the password was checked and is valid
159
* returns true if plasma is up and the dbus interface is valid
161
bool isPlasmaValid();
163
* give up on plasma, probably because it crashed.
164
* this does *not* tell plasma to quit. it just stops using it.
166
void disablePlasma();
168
* give a fakefocusin to the right window
172
int findWindowInfo( Window window ); // returns index in windowInfo or -1
175
void resume( bool force );
176
enum WindowType { IgnoreWindow = 0 /** regular window to be left below the saver */,
177
SimpleWindow = 1 /** simple popup that can't handle direct input */,
178
InputWindow = 2 /** annoying dialog that needs direct input */,
179
DefaultWindow = 6/** input window that's also the plasma view */
182
* @return the type of window, based on its X property
184
WindowType windowType(WId id);
186
static QVariant getConf(void *ctx, const char *key, const QVariant &dflt);
187
bool loadGreetPlugin();
195
org::kde::plasmaoverlay::App *mPlasmaDBus;
196
QDBusServiceWatcher *mServiceWatcher;
203
QList<int> child_sockets;
207
QTimer mSuspendTimer;
211
QStack< QWidget* > mDialogs;
212
QHash< QWidget*, QWidget* > mFrames;
213
QList<WId> mVisibleDialogs;
214
QQueue<XEvent> mEventQueue;
216
bool mRestoreXF86Lock;
218
QStringList mPlugins, mPluginOptions;
220
GreeterPluginHandle greetPlugin;
221
QPixmap mSavedScreen;
222
QTimer mSnapshotTimer;
223
int mAutoLogoutTimerId;
224
int mAutoLogoutTimeout;
225
QTimer mSuppressUnlock;
226
int mSuppressUnlockTimeout;
227
QList<WId> mForeignWindows;
228
QList<WId> mForeignInputWindows;
234
QList<WindowInfo> windowInfo;