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>
29 struct KGreeterPluginInfo
;
31 struct GreeterPluginHandle
{
33 KGreeterPluginInfo
*info
;
36 //===========================================================================
38 // Screen saver handling process. Handles screensaver window,
39 // starting screensaver hacks, and password entry.
45 Q_CLASSINFO("D-Bus Interface", "org.kde.krunner_lock.LockProcess")
47 explicit LockProcess(bool child_saver
= false, bool useBlankOnly
= false);
51 * start the screensaver locked
56 * start the screensaver unlocked
61 * start the screensaver in plasma setup mode
62 * if plasma is disabled this just acts like defaultSave
67 * start the screensaver unlocked, and *never* automatically lock it
71 void setChildren(QList
<int> children
) { child_sockets
= children
; }
72 void setParent(int fd
) { mParent
= fd
; }
74 void msgBox( QWidget
*parent
, QMessageBox::Icon type
, const QString
&txt
);
75 int execDialog( QDialog
* dlg
);
83 * bring up the password dialog with @param reason displayed instead of the usual "this session
85 * @return true if the password was entered correctly
86 * if this returns true, it will also unlock the screensaver without quitting.
87 * it will re-lock after the lock timeout in the settings
89 Q_SCRIPTABLE
bool checkPass(const QString
&reason
);
91 * this will unlock and quit the screensaver, asking for a password first if necessary
93 Q_SCRIPTABLE
void quit();
95 * immediately lock the screen; it will now require a password to unlock.
97 Q_SCRIPTABLE
bool startLock();
100 virtual bool x11Event(XEvent
*);
101 virtual void timerEvent(QTimerEvent
*);
102 virtual bool eventFilter(QObject
*o
, QEvent
*e
);
106 void signalPipeSignal();
108 void checkDPMSActive();
109 void slotDeadTimePassed();
111 * a new dbus service has come in
113 void newService(QString name
);
115 * set the winid of plasma's view
116 * so that we can control it
118 void setPlasmaView(uint id
); //it's really a WId but qdbuscpp2xml is dumb
120 * tell plasma we're in idle mode
122 void deactivatePlasma();
125 * immediately un-suppress the password dialog
126 * FIXME need a better name
128 void unSuppressUnlock();
133 void createSaverWindow();
134 void hideSaverWindow();
136 void setVRoot(Window win
, Window rw
);
137 void removeVRoot(Window win
);
142 void cantLock(const QString
&reason
);
151 * exec the password dialog
152 * @return true iff the password was checked and is valid
158 void resume( bool force
);
159 enum WindowType
{ IgnoreWindow
= 0 /** regular window to be left below the saver */,
160 SimpleWindow
= 1 /** simple popup that can't handle direct input */,
161 InputWindow
= 2 /** annoying dialog that needs direct input */,
162 DefaultWindow
= 6/** input window that's also the plasma view */
165 * @return the type of window, based on its X property
167 WindowType
windowType(WId id
);
169 static QVariant
getConf(void *ctx
, const char *key
, const QVariant
&dflt
);
170 bool loadGreetPlugin();
177 KProcess mPlasmaProc
;
178 QDBusInterface
*mPlasmaDBus
;
186 QList
<int> child_sockets
;
190 QTimer mSuspendTimer
;
194 QStack
< QWidget
* > mDialogs
;
195 QHash
< QWidget
*, QWidget
* > mFrames
;
196 bool mRestoreXF86Lock
;
198 QStringList mPlugins
, mPluginOptions
;
200 GreeterPluginHandle greetPlugin
;
201 QPixmap mSavedScreen
;
202 int mAutoLogoutTimerId
;
203 int mAutoLogoutTimeout
;
205 QTimer mSuppressUnlock
;
206 int mSuppressUnlockTimeout
;
207 QList
<WId
> mForeignWindows
;
208 QList
<WId
> mForeignInputWindows
;