<aname="1"></a><p> A <em>session</em> is a group of running applications, each of which has a
particular state. The session is controlled by a service called the <em>session</em><em>manager</em>. The applications participating in the session are
called <em>session</em><em>clients</em>.
<p> The session manager issues commands to its clients on behalf of the
user. These commands may cause clients to commit unsaved changes (for
example by saving open files), to preserve their state for future
sessions, or to terminate gracefully. The set of these operations is
called <em>session</em><em>management</em>.
<p> In the common case, a session consists of all applications that a
user runs on their desktop at a time. Under Unix/X11, however, a
session may include applications running on different computers and
may span multiple displays.
<p><h2> Shutting a session down
</h2>
<aname="2"></a><p> A session is shut down by the session manager, usually on behalf of
the user when they want to log out. A system might also perform an
automatic shutdown in an emergency situation, for example, if power is
about to be lost. Clearly there is a significant difference between
these types of shutdown. During the first, the user may want to
interact with the application, specifying exactly which files should
be saved and which should be discarded. In the latter case, there's no
time for interaction. There may not even be a user sitting in front of
the machine!
<p><h2> Protocols and support on different platforms
</h2>
<aname="3"></a><p> On Mac OS X and MS-Windows, there is nothing like complete session
management for applications yet, i.e. no restoring of previous
sessions. They do support graceful logouts where applications
have the opportunity to cancel the process after getting confirmation
<p> Example code to this dialog can be found in the documentation of <ahref="tqsessionmanager.html#allowsInteraction">TQSessionManager::allowsInteraction</a>().
session. This saving is done by reimplementing <ahref="tqapplication.html#saveState">TQApplication::saveState</a>(). All state data you are saving in this
function, should be marked with the session identifier <ahref="tqapplication.html#sessionId">TQApplication::sessionId</a>(). This application specific identifier is
function. Check if <ahref="tqapplication.html#isSessionRestored">TQApplication::isSessionRestored</a>() is <tt>TRUE</tt>. If
that's the case, use the session identifier <ahref="tqapplication.html#sessionId">TQApplication::sessionId</a>() again to access your state data and restore
corresponds to the <ahref="tqapplication.html#saveState">TQApplication::saveState</a>() function. The <em>global</em> save type asks applications to save their unsaved changes in
permanent, globally accessible storage. It invokes <ahref="tqapplication.html#commitData">TQApplication::commitData</a>().