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>
19 #include <QMessageBox>
28 struct KGreeterPluginInfo
;
30 struct GreeterPluginHandle
{
32 KGreeterPluginInfo
*info
;
35 //===========================================================================
37 // Screen saver handling process. Handles screensaver window,
38 // starting screensaver hacks, and password entry.
45 explicit LockProcess(bool child_saver
= false, bool useBlankOnly
= false, bool plasmaSetupMode
= false);
54 void setChildren(QList
<int> children
) { child_sockets
= children
; }
55 void setParent(int fd
) { mParent
= fd
; }
57 void msgBox( QWidget
*parent
, QMessageBox::Icon type
, const QString
&txt
);
58 int execDialog( QDialog
* dlg
);
66 * bring up the password dialog with @param reason displayed instead of the usual "this session
68 * @return true if the password was entered correctly
69 * if this returns true, there is a grace period where the screensaver can be freely unlocked
70 * with the unlock method without re-entering the password.
72 Q_SCRIPTABLE
bool checkPass(const QString
&reason
);
74 * this will unlock and quit the screensaver, asking for a password first if necessary
76 Q_SCRIPTABLE
void unlock();
78 * immediately end the "free unlock" grace period; if the screen is locked, it will now require
79 * a password to unlock.
80 * this has no effect if the screen wasn't locked in the first place.
82 Q_SCRIPTABLE
void endFreeUnlock();
85 virtual bool x11Event(XEvent
*);
86 virtual void timerEvent(QTimerEvent
*);
90 void signalPipeSignal();
93 void checkDPMSActive();
94 void slotDeadTimePassed();
96 * a new dbus service has come in
98 void newService(QString name
);
100 * set the winid of plasma's view
101 * so that we can control it
103 void setPlasmaView(uint id
); //it's really a WId but qdbuscpp2xml is dumb
105 * tell plasma we're in idle mode
107 void deactivatePlasma();
110 * immediately un-suppress the password dialog
111 * FIXME need a better name
113 void unSuppressUnlock();
118 void createSaverWindow();
119 void hideSaverWindow();
121 void setVRoot(Window win
, Window rw
);
122 void removeVRoot(Window win
);
127 void cantLock(const QString
&reason
);
136 * if the password dialog is not suppressed, this execs it
137 * if the dialog *is* suppressed we just restart the timer
138 * @return true iff the password was checked and is valid
144 void resume( bool force
);
145 enum WindowType
{ IgnoreWindow
= 0 /** regular window to be left below the saver */,
146 SimpleWindow
= 1 /** simple popup that can't handle direct input */,
147 InputWindow
= 2 /** annoying dialog that needs direct input */,
148 DefaultWindow
= 6/** input window that's also the plasma view */
151 * @return the type of window, based on its X property
153 WindowType
windowType(WId id
);
155 static QVariant
getConf(void *ctx
, const char *key
, const QVariant
&dflt
);
162 KProcess mPlasmaProc
;
163 QDBusInterface
*mPlasmaDBus
;
171 QList
<int> child_sockets
;
175 QTimer mSuspendTimer
;
179 QStack
< QWidget
* > mDialogs
;
180 bool mRestoreXF86Lock
;
182 QStringList mPlugins
, mPluginOptions
;
184 GreeterPluginHandle greetPlugin
;
185 QPixmap mSavedScreen
;
186 int mAutoLogoutTimerId
;
187 int mAutoLogoutTimeout
;
189 QTimer mSuppressUnlock
;
190 int mSuppressUnlockTimeout
;
191 QList
<WId
> mForeignWindows
;
192 QList
<WId
> mForeignInputWindows
;