1 /* This file is part of the KDE libraries
2 Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
23 #include <kdemacros.h>
29 * The possible values for the @p confirm parameter of requestShutDown().
31 enum ShutdownConfirm
{
33 * Obey the user's confirmation setting.
35 ShutdownConfirmDefault
= -1,
37 * Don't confirm, shutdown without asking.
39 ShutdownConfirmNo
= 0,
41 * Always confirm, ask even if the user turned it off.
43 ShutdownConfirmYes
= 1
47 * The possible values for the @p sdtype parameter of requestShutDown().
51 * Select previous action or the default if it's the first time.
53 ShutdownTypeDefault
= -1,
59 * Log out and reboot the machine.
61 ShutdownTypeReboot
= 1,
63 * Log out and halt the machine.
69 * The possible values for the @p sdmode parameter of requestShutDown().
73 * Select previous mode or the default if it's the first time.
75 ShutdownModeDefault
= -1,
77 * Schedule a shutdown (halt or reboot) for the time all active sessions
80 ShutdownModeSchedule
= 0,
82 * Shut down, if no sessions are active. Otherwise do nothing.
84 ShutdownModeTryNow
= 1,
86 * Force shutdown. Kill any possibly active sessions.
88 ShutdownModeForceNow
= 2,
90 * Pop up a dialog asking the user what to do if sessions are still active.
92 ShutdownModeInteractive
= 3
96 * Asks the session manager to shut the session down.
98 * Using @p confirm == ShutdownConfirmYes or @p sdtype != ShutdownTypeDefault or
99 * @p sdmode != ShutdownModeDefault causes the use of ksmserver's DCOP
100 * interface. The remaining two combinations use the standard XSMP and
101 * will work with any session manager compliant with it.
103 * @param confirm Whether to ask the user if he really wants to log out.
105 * @param sdtype The action to take after logging out. ShutdownType
106 * @param sdmode If/When the action should be taken. ShutdownMode
107 * @return true on success, false if the session manager could not be
110 KDE_EXPORT
bool requestShutDown( ShutdownConfirm confirm
= ShutdownConfirmDefault
,
111 ShutdownType sdtype
= ShutdownTypeDefault
,
112 ShutdownMode sdmode
= ShutdownModeDefault
);
115 * Propagates the network address of the session manager in the
116 * SESSION_MANAGER environment variable so that child processes can
119 * If SESSION_MANAGER isn't defined yet, the address is searched in
122 * This function is called by clients that are started outside the
123 * session ( i.e. before ksmserver is started), but want to launch
124 * other processes that should participate in the session. Examples
125 * are kdesktop or kicker.
127 KDE_EXPORT
void propagateSessionManager();