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 //===========================================================================
39 // Screen saver handling process. Handles screensaver window,
40 // starting screensaver hacks, and password entry.
46 Q_CLASSINFO("D-Bus Interface", "org.kde.krunner_lock.LockProcess")
48 explicit LockProcess(bool child_saver
= false, bool useBlankOnly
= false);
52 * start the screensaver locked
57 * start the screensaver unlocked
62 * start the screensaver in plasma setup mode
63 * if plasma is disabled this just acts like defaultSave
68 * start the screensaver unlocked, and *never* automatically lock it
72 void setChildren(QList
<int> children
) { child_sockets
= children
; }
73 void setParent(int fd
) { mParent
= fd
; }
75 void msgBox( QWidget
*parent
, QMessageBox::Icon type
, const QString
&txt
);
76 int execDialog( QDialog
* dlg
);
84 * bring up the password dialog with @param reason displayed instead of the usual "this session
86 * @return true if the password was entered correctly
87 * if this returns true, it will also unlock the screensaver without quitting.
88 * it will re-lock after the lock timeout in the settings
90 Q_SCRIPTABLE
bool checkPass(const QString
&reason
);
92 * this will unlock and quit the screensaver, asking for a password first if necessary
94 Q_SCRIPTABLE
void quit();
96 * immediately lock the screen; it will now require a password to unlock.
98 Q_SCRIPTABLE
bool startLock();
101 virtual bool x11Event(XEvent
*);
102 virtual void timerEvent(QTimerEvent
*);
103 virtual bool eventFilter(QObject
*o
, QEvent
*e
);
107 void signalPipeSignal();
109 void checkDPMSActive();
110 void slotDeadTimePassed();
112 * check that plasma started properly (used for timeout)
113 * and disable it if it failed
117 * a new dbus service has come in
119 void newService(QString name
, QString oldOwner
, QString newOwner
);
121 * tell plasma we're in idle mode
123 void deactivatePlasma();
126 * immediately un-suppress the password dialog
127 * FIXME need a better name
129 void unSuppressUnlock();
134 void createSaverWindow();
135 void hideSaverWindow();
137 void setVRoot(Window win
, Window rw
);
138 void removeVRoot(Window win
);
143 void cantLock(const QString
&reason
);
152 * exec the password dialog
153 * @return true iff the password was checked and is valid
157 * returns true if plasma is up and the dbus interface is valid
159 bool isPlasmaValid();
161 * give up on plasma, probably because it crashed.
162 * this does *not* tell plasma to quit. it just stops using it.
164 void disablePlasma();
166 * give a fakefocusin to the right window
172 void resume( bool force
);
173 enum WindowType
{ IgnoreWindow
= 0 /** regular window to be left below the saver */,
174 SimpleWindow
= 1 /** simple popup that can't handle direct input */,
175 InputWindow
= 2 /** annoying dialog that needs direct input */,
176 DefaultWindow
= 6/** input window that's also the plasma view */
179 * @return the type of window, based on its X property
181 WindowType
windowType(WId id
);
183 static QVariant
getConf(void *ctx
, const char *key
, const QVariant
&dflt
);
184 bool loadGreetPlugin();
191 KProcess mPlasmaProc
;
192 org::kde::plasmaoverlay::App
*mPlasmaDBus
;
199 QList
<int> child_sockets
;
203 QTimer mSuspendTimer
;
207 QStack
< QWidget
* > mDialogs
;
208 QHash
< QWidget
*, QWidget
* > mFrames
;
209 bool mRestoreXF86Lock
;
211 QStringList mPlugins
, mPluginOptions
;
213 GreeterPluginHandle greetPlugin
;
214 QPixmap mSavedScreen
;
215 int mAutoLogoutTimerId
;
216 int mAutoLogoutTimeout
;
217 QTimer mSuppressUnlock
;
218 int mSuppressUnlockTimeout
;
219 QList
<WId
> mForeignWindows
;
220 QList
<WId
> mForeignInputWindows
;