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
40 //===========================================================================
42 // Screen saver handling process. Handles screensaver window,
43 // starting screensaver hacks, and password entry.
49 Q_CLASSINFO("D-Bus Interface", "org.kde.screenlocker.LockProcess")
51 explicit LockProcess(bool child_saver
= false, bool useBlankOnly
= false);
55 * start the screensaver locked
60 * start the screensaver unlocked
65 * start the screensaver in plasma setup mode
66 * if plasma is disabled this just acts like defaultSave
71 * start the screensaver unlocked, and *never* automatically lock it
75 void setChildren(QList
<int> children
) { child_sockets
= children
; }
76 void setParent(int fd
) { mParent
= fd
; }
78 void msgBox( QWidget
*parent
, QMessageBox::Icon type
, const QString
&txt
);
79 int execDialog( QDialog
* dlg
);
87 * bring up the password dialog with @param reason displayed instead of the usual "this session
89 * @return true if the password was entered correctly
90 * if this returns true, it will also unlock the screensaver without quitting.
91 * it will re-lock after the lock timeout in the settings
93 Q_SCRIPTABLE
bool checkPass(const QString
&reason
);
95 * this will unlock and quit the screensaver, asking for a password first if necessary
97 Q_SCRIPTABLE
void quit();
99 * immediately lock the screen; it will now require a password to unlock.
101 Q_SCRIPTABLE
bool startLock();
104 virtual bool x11Event(XEvent
*);
105 virtual void timerEvent(QTimerEvent
*);
106 virtual bool eventFilter(QObject
*o
, QEvent
*e
);
110 void signalPipeSignal();
112 void checkDPMSActive();
113 void slotDeadTimePassed();
115 * check that plasma started properly (used for timeout)
116 * and disable it if it failed
120 * a new dbus service has come in
122 void newService(QString name
, QString oldOwner
, QString newOwner
);
124 * tell plasma we're in idle mode
126 void deactivatePlasma();
129 * immediately un-suppress the password dialog
130 * FIXME need a better name
132 void unSuppressUnlock();
137 void createSaverWindow();
138 void hideSaverWindow();
140 void setVRoot(Window win
, Window rw
);
141 void removeVRoot(Window win
);
146 void cantLock(const QString
&reason
);
155 * exec the password dialog
156 * @return true iff the password was checked and is valid
160 * returns true if plasma is up and the dbus interface is valid
162 bool isPlasmaValid();
164 * give up on plasma, probably because it crashed.
165 * this does *not* tell plasma to quit. it just stops using it.
167 void disablePlasma();
169 * give a fakefocusin to the right window
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();
194 org::kde::plasmaoverlay::App
*mPlasmaDBus
;
201 QList
<int> child_sockets
;
205 QTimer mSuspendTimer
;
209 QStack
< QWidget
* > mDialogs
;
210 QHash
< QWidget
*, QWidget
* > mFrames
;
211 bool mRestoreXF86Lock
;
213 QStringList mPlugins
, mPluginOptions
;
215 GreeterPluginHandle greetPlugin
;
216 QPixmap mSavedScreen
;
217 int mAutoLogoutTimerId
;
218 int mAutoLogoutTimeout
;
219 QTimer mSuppressUnlock
;
220 int mSuppressUnlockTimeout
;
221 QList
<WId
> mForeignWindows
;
222 QList
<WId
> mForeignInputWindows
;