\section{KMain\-Window Class Reference}
\label{classKMainWindow}\index{KMainWindow@{KMainWindow}}
Top level widget that provides toolbars, a status line and a frame. {\bf KDE} top level main window.  


{\tt \#include $<$kmainwindow.h$>$}

Inheritance diagram for KMain\-Window:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=182pt]{classKMainWindow__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KMain\-Window:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=202pt]{classKMainWindow__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
virtual void {\bf set\-Caption} (const  {\bf QString} \&caption)
\begin{CompactList}\small\item\em Makes a {\bf KDE} compliant caption. \item\end{CompactList}\item 
virtual void {\bf set\-Caption} (const  {\bf QString} \&caption, bool modified)
\begin{CompactList}\small\item\em Makes a {\bf KDE} compliant caption. \item\end{CompactList}\item 
virtual void {\bf set\-Plain\-Caption} (const  {\bf QString} \&caption)
\begin{CompactList}\small\item\em Make a plain caption without any modifications. \item\end{CompactList}\item 
void {\bf app\-Help\-Activated} (void)
\begin{CompactList}\small\item\em Open the help page for the application. \item\end{CompactList}\item 
virtual void {\bf slot\-State\-Changed} (const  {\bf QString} \&newstate)
\begin{CompactList}\small\item\em Apply a state change. \item\end{CompactList}\item 
void {\bf slot\-State\-Changed} (const  {\bf QString} \&newstate, KXMLGUIClient::Reverse\-State\-Change)
\begin{CompactList}\small\item\em Apply a state change. \item\end{CompactList}\item 
void {\bf set\-Settings\-Dirty} ()\label{classKMainWindow_i6}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KMain\-Window} ({\bf QWidget} $\ast$parent=0, const  char $\ast$name=0, WFlags f=WType\_\-Top\-Level$|$WDestructive\-Close)
\begin{CompactList}\small\item\em Construct a main window. \item\end{CompactList}\item 
virtual {\bf $\sim$KMain\-Window} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
{\bf KPopup\-Menu} $\ast$ {\bf help\-Menu} (const  {\bf QString} \&about\-App\-Text=QString::null, bool show\-Whats\-This=TRUE)
\begin{CompactList}\small\item\em Retrieve the standard help menu. \item\end{CompactList}\item 
{\bf KPopup\-Menu} $\ast$ {\bf custom\-Help\-Menu} (bool show\-Whats\-This=TRUE)
\begin{CompactList}\small\item\em Returns the help menu. \item\end{CompactList}\item 
bool {\bf restore} (int number, bool show=TRUE)
\begin{CompactList}\small\item\em Restore the session specified by {\tt number}. \item\end{CompactList}\item 
virtual {\bf KXMLGUIFactory} $\ast$ {\bf gui\-Factory} ()\label{classKMainWindow_a5}

\item 
void {\bf create\-GUI} (const  {\bf QString} \&xmlfile=QString::null, bool \_\-conserve\-Memory=TRUE)
\begin{CompactList}\small\item\em Create a GUI given a local XML file. \item\end{CompactList}\item 
void {\bf set\-Help\-Menu\-Enabled} (bool show\-Help\-Menu=true)
\begin{CompactList}\small\item\em Enables the build of a standard help menu when calling {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a6})}. \item\end{CompactList}\item 
bool {\bf is\-Help\-Menu\-Enabled} ()
\begin{CompactList}\small\item\em Return {\tt true} when the help menu is enabled. \item\end{CompactList}\item 
bool {\bf has\-Menu\-Bar} ()
\begin{CompactList}\small\item\em Returns true, if there is a menubar \begin{Desc}
\item[Since:]3.1. \end{Desc}
\item\end{CompactList}\item 
{\bf KMenu\-Bar} $\ast$ {\bf menu\-Bar} ()
\begin{CompactList}\small\item\em Returns a pointer to the menu bar. \item\end{CompactList}\item 
{\bf KStatus\-Bar} $\ast$ {\bf status\-Bar} ()
\begin{CompactList}\small\item\em Returns a pointer to the status bar. \item\end{CompactList}\item 
{\bf KTool\-Bar} $\ast$ {\bf tool\-Bar} (const  char $\ast$name=0)
\begin{CompactList}\small\item\em Returns a pointer to the toolbar with the specified name. \item\end{CompactList}\item 
{\bf QPtr\-List\-Iterator}$<$ {\bf KTool\-Bar} $>$ {\bf tool\-Bar\-Iterator} ()
\item 
{\bf KAccel} $\ast$ {\bf accel} ()
\item 
void {\bf set\-Frame\-Border\-Width} (int)\label{classKMainWindow_a15}

\item 
void {\bf set\-Auto\-Save\-Settings} (const  {\bf QString} \&group\-Name={\bf QString::from\-Latin1}(\char`\"{}Main\-Window\char`\"{}), bool save\-Window\-Size=true)
\begin{CompactList}\small\item\em Call this to enable \char`\"{}auto-save\char`\"{} of toolbar/menubar/statusbar settings (and optionally window size). \item\end{CompactList}\item 
void {\bf reset\-Auto\-Save\-Settings} ()
\begin{CompactList}\small\item\em Disable the auto-save-settings feature. \item\end{CompactList}\item 
bool {\bf auto\-Save\-Settings} () const 
\item 
{\bf QString} {\bf auto\-Save\-Group} () const 
\item 
void {\bf apply\-Main\-Window\-Settings} ({\bf KConfig} $\ast$config, const  {\bf QString} \&group\-Name=QString::null)
\begin{CompactList}\small\item\em Read settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them. \item\end{CompactList}\item 
void {\bf save\-Main\-Window\-Settings} ({\bf KConfig} $\ast$config, const  {\bf QString} \&group\-Name=QString::null)
\begin{CompactList}\small\item\em Save settings for statusbar, menubar and toolbar to their respective groups in the config file {\tt config}. \item\end{CompactList}\item 
void {\bf set\-Standard\-Tool\-Bar\-Menu\-Enabled} (bool enable)
\begin{CompactList}\small\item\em Sets whether KMain\-Window should provide a menu that allows showing/hiding the available toolbars ( using {\bf KToggle\-Tool\-Bar\-Action}{\rm (p.\,\pageref{classKToggleToolBarAction})} ) . \item\end{CompactList}\item 
bool {\bf is\-Standard\-Tool\-Bar\-Menu\-Enabled} () const 
\begin{CompactList}\small\item\em \begin{Desc}
\item[Since:]3.1 \end{Desc}
\item\end{CompactList}\item 
{\bf KAction} $\ast$ {\bf tool\-Bar\-Menu\-Action} ()
\begin{CompactList}\small\item\em Returns a pointer to the mainwindows action responsible for the toolbars menu \begin{Desc}
\item[Since:]3.1. \end{Desc}
\item\end{CompactList}\item 
virtual void {\bf finalize\-GUI} ({\bf KXMLGUIClient} $\ast$client)
\begin{CompactList}\small\item\em \begin{Desc}
\item[Since:]3.1 \end{Desc}
\item\end{CompactList}\item 
void {\bf finalize\-GUI} (bool force)\label{classKMainWindow_a26}

\item 
bool {\bf initial\-Geometry\-Set} () const 
\item 
{\bf QSize} {\bf size\-For\-Central\-Widget\-Size} ({\bf QSize} size)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
bool {\bf can\-Be\-Restored} (int number)
\item 
const  {\bf QString} {\bf class\-Name\-Of\-Toplevel} (int number)
\begin{CompactList}\small\item\em Returns the class\-Name() of the {\tt number} of the toplevel window which should be restored. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
{\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ {\bf member\-List} = 0L
\begin{CompactList}\small\item\em List of members of KMain\-Window class. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
virtual void {\bf show\-About\-Application} ()
\begin{CompactList}\small\item\em This slot does nothing. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf paint\-Event} ({\bf QPaint\-Event} $\ast$e)\label{classKMainWindow_b0}

\item 
void {\bf child\-Event} ({\bf QChild\-Event} $\ast$e)\label{classKMainWindow_b1}

\item 
void {\bf resize\-Event} ({\bf QResize\-Event} $\ast$e)\label{classKMainWindow_b2}

\item 
virtual void {\bf close\-Event} ({\bf QClose\-Event} $\ast$)
\begin{CompactList}\small\item\em Reimplemented to call the {\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} and {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} handlers. \item\end{CompactList}\item 
virtual bool {\bf query\-Exit} ()
\begin{CompactList}\small\item\em Called before the very last window is closed, either by the user or indirectly by the session manager. \item\end{CompactList}\item 
virtual bool {\bf query\-Close} ()
\begin{CompactList}\small\item\em Called before the window is closed, either by the user or indirectly by the session manager. \item\end{CompactList}\item 
virtual void {\bf save\-Properties} ({\bf KConfig} $\ast$)
\begin{CompactList}\small\item\em Save your instance-specific properties. \item\end{CompactList}\item 
virtual void {\bf read\-Properties} ({\bf KConfig} $\ast$)
\begin{CompactList}\small\item\em Read your instance-specific properties. \item\end{CompactList}\item 
virtual void {\bf save\-Global\-Properties} ({\bf KConfig} $\ast$session\-Config)
\begin{CompactList}\small\item\em Save your application-wide properties. \item\end{CompactList}\item 
virtual void {\bf read\-Global\-Properties} ({\bf KConfig} $\ast$session\-Config)
\begin{CompactList}\small\item\em The counterpart of {\bf save\-Global\-Properties}{\rm (p.\,\pageref{classKMainWindow_b8})}(). \item\end{CompactList}\item 
void {\bf save\-Properties\-Internal} ({\bf KConfig} $\ast$, int)\label{classKMainWindow_b10}

\item 
bool {\bf read\-Properties\-Internal} ({\bf KConfig} $\ast$, int)\label{classKMainWindow_b11}

\item 
bool {\bf settings\-Dirty} () const 
\begin{CompactList}\small\item\em For inherited classes. \item\end{CompactList}\item 
{\bf QString} {\bf settings\-Group} () const 
\begin{CompactList}\small\item\em For inherited classes. \item\end{CompactList}\item 
void {\bf save\-Window\-Size} ({\bf KConfig} $\ast$config) const 
\begin{CompactList}\small\item\em For inherited classes Note that the group must be set before calling. \item\end{CompactList}\item 
void {\bf restore\-Window\-Size} ({\bf KConfig} $\ast$config)
\begin{CompactList}\small\item\em For inherited classes Note that the group must be set before calling, and that a -geometry on the command line has priority. \item\end{CompactList}\item 
void {\bf parse\-Geometry} (bool parsewidth)
\begin{CompactList}\small\item\em parse the geometry from the geometry command line argument \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKMainWindow_b17}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KMWSession\-Managed}\label{classKMainWindow_n0}

\end{CompactItemize}


\subsection{Detailed Description}
Top level widget that provides toolbars, a status line and a frame. {\bf KDE} top level main window. 

It should be used as a top level (parent-less) widget. It manages the geometry for all its children, including your main widget.

Normally, you will inherit from KMain\-Window, then construct (or use some existing) widget as your main view. You can set only one main view.

You can add as many toolbars as you like. There can be only one menubar and only one statusbar.

The toolbars, menubar, and statusbar can be created by the KMain\-Window and - unlike the old KMain\-Window - may, but do not have to, be deleted by you. KMain\-Window will handle that internally.

Height and width can be operated independently from each other. Simply define the minimum/maximum height/width of your main widget and KMain\-Window will take this into account. For fixed size windows set your main widget to a fixed size.

Fixed aspect ratios (height\-For\-Width()) and fixed width widgets are not supported.

KMain\-Window will set icon, mini icon and caption, which it gets from {\bf KApplication}. It provides full session management, and will save its position, geometry and positions of toolbars and menubar on logout. If you want to save additional data, reimplement {\bf save\-Properties}{\rm (p.\,\pageref{classKMainWindow_b6})}() and (to read them again on next login) {\bf read\-Properties}{\rm (p.\,\pageref{classKMainWindow_b7})}(). To save special data about your data, reimplement {\bf save\-Global\-Properties}{\rm (p.\,\pageref{classKMainWindow_b8})}(). To warn user that application or windows have unsaved data on close or logout, reimplement {\bf query\-Close}{\rm (p.\,\pageref{classKMainWindow_b5})}() and/or {\bf query\-Exit}{\rm (p.\,\pageref{classKMainWindow_b4})}().

There is also a macro RESTORE which can restore all your windows on next login.

Note that a KMain\-Window per-default is created with the WDestructive\-Close flag, i.e. it is automatically destroyed when the window is closed. If you do not want this behavior, specify 0 as widget flag in the constructor.

\begin{Desc}
\item[See also:]{\bf KApplication} \end{Desc}
\begin{Desc}
\item[Author:]Reginald Stadlbauer ({\tt reggie@kde.org}) Stephan Kulow ({\tt coolo@kde.org}), Matthias Ettrich ({\tt ettrich@kde.org}), Chris Schlaeger ({\tt cs@kde.org}), Sven Radej ({\tt radej@kde.org}). Maintained by Sven Radej ({\tt radej@kde.org}) \end{Desc}




Definition at line 97 of file kmainwindow.h.

\subsection{Constructor \& Destructor Documentation}
\index{KMainWindow@{KMain\-Window}!KMainWindow@{KMainWindow}}
\index{KMainWindow@{KMainWindow}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMain\-Window::KMain\-Window ({\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0, WFlags {\em f} = WType\_\-Top\-Level$|$WDestructive\-Close)}\label{classKMainWindow_a0}


Construct a main window. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]The widget parent. This is usually 0 but it may also be the window group leader. In that case, the KMain\-Window becomes sort of a secondary window.\item[{\em name}]The object name. For session management and window management to work properly, all main windows in the application should have a different name. When passing 0 (the default), KMain\-Window will create a unique name, but it's recommended to explicitly pass a window name that will also describe the type of the window. If there can be several windows of the same type, append '\#' (hash) to the name, and KMain\-Window will append numbers to make the names unique. For example, for a mail client which has one main window showing the mails and folders, and which can also have one or more windows for composing mails, the name for the folders window should be e.g. \char`\"{}mainwindow\char`\"{} and for the composer windows \char`\"{}composer\#\char`\"{}.\item[{\em f}]Specify the widget flags. The default is WType\_\-Top\-Level and WDestructive\-Close. Top\-Level indicates that a main window is a toplevel window, regardless of whether it has a parent or not. Destructive\-Close indicates that a main window is automatically destroyed when its window is closed. Pass 0 if you do not want this behavior.\end{description}
\end{Desc}
KMain\-Windows must be created on the heap with 'new', like: \small\begin{alltt} KMainWindow *kmw = new KMainWindow (...\end{alltt}\normalsize 
 

Definition at line 158 of file kmainwindow.cpp.

References KStd\-Accel::name().\index{KMainWindow@{KMain\-Window}!~KMainWindow@{$\sim$KMainWindow}}
\index{~KMainWindow@{$\sim$KMainWindow}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMain\-Window::$\sim${\bf KMain\-Window} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a1}


Destructor. 

Will also destroy the toolbars, and menubar if needed. 

Definition at line 288 of file kmainwindow.cpp.

References member\-List, and QPtr\-List$<$ KMain\-Window $>$::remove().

\subsection{Member Function Documentation}
\index{KMainWindow@{KMain\-Window}!helpMenu@{helpMenu}}
\index{helpMenu@{helpMenu}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KMain\-Window::help\-Menu (const {\bf QString} \& {\em about\-App\-Text} = QString::null, bool {\em show\-Whats\-This} = TRUE)}\label{classKMainWindow_a2}


Retrieve the standard help menu. 

It contains entires for the help system (activated by F1), an optional \char`\"{}What's This?\char`\"{} entry (activated by Shift F1), an application specific dialog box, and an \char`\"{}About KDE\char`\"{} dialog box.

Example (adding a standard help menu to your application): \small\begin{alltt}
 {\bf KPopupMenu}{\rm (p.\,\pageref{classKPopupMenu})} *help = helpMenu( <myTextString> );
 {\bf menuBar()}{\rm (p.\,\pageref{classKMainWindow_a10})}-$>$insertItem( i18n("&Help"), help );
 \end{alltt}\normalsize 


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em about\-App\-Text}]The string that is used in the application specific dialog box. If you leave this string empty the information in the global {\bf KAbout\-Data} of the application will be used to make a standard dialog box.\item[{\em show\-Whats\-This}]Set this to false if you do not want to include the \char`\"{}What's This\char`\"{} menu entry.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A standard help menu. \end{Desc}


Definition at line 298 of file kmainwindow.cpp.

References KXMLGUIClient::instance(), QString::is\-Empty(), KHelp\-Menu::menu(), and show\-About\-Application().\index{KMainWindow@{KMain\-Window}!customHelpMenu@{customHelpMenu}}
\index{customHelpMenu@{customHelpMenu}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KMain\-Window::custom\-Help\-Menu (bool {\em show\-Whats\-This} = TRUE)}\label{classKMainWindow_a3}


Returns the help menu. 

Creates a standard help menu if none exists yet.

It contains entries for the help system (activated by F1), an optional \char`\"{}What's This?\char`\"{} entry (activated by Shift F1), an application specific dialog box, and an \char`\"{}About KDE\char`\"{} dialog box. You must create the application specific dialog box yourself. When the \char`\"{}About application\char`\"{} menu entry is activated, a signal will trigger the {\bf show\-About\-Application}{\rm (p.\,\pageref{classKMainWindow_j0})} slot. See {\bf show\-About\-Application}{\rm (p.\,\pageref{classKMainWindow_j0})} for more information.

Example (adding a help menu to your application): \small\begin{alltt}
 {\bf menuBar()}{\rm (p.\,\pageref{classKMainWindow_a10})}-$>$insertItem( i18n("&Help"), {\bf customHelpMenu()}{\rm (p.\,\pageref{classKMainWindow_a3})} );
 \end{alltt}\normalsize 


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em show\-Whats\-This}]Set this to {\tt false} if you do not want to include the \char`\"{}What's This\char`\"{} menu entry.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A standard help menu. \end{Desc}


Definition at line 315 of file kmainwindow.cpp.

References KHelp\-Menu::menu(), and show\-About\-Application().\index{KMainWindow@{KMain\-Window}!canBeRestored@{canBeRestored}}
\index{canBeRestored@{canBeRestored}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::can\-Be\-Restored (int {\em number})\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_e0}


{\bf  Session Management}

{\bf  Try to restore the toplevel widget as defined by the number (1..X).}

{\bf  If the session did not contain so high a number, the configuration is not changed and {\tt false} returned.}

{\bf  That means clients could simply do the following: \small\begin{alltt}
 if (kapp-$>$isRestored())\{
   int n = 1;
   while (KMainWindow::canBeRestored(n))\{
     (new childMW)-$>$restore(n);
     n++;
   \}
 \} else \{
 // create default application as usual
 \}
 \end{alltt}\normalsize 
 Note that {\bf QWidget::show}() is called implicitly in restore.}

{\bf  With this you can easily restore all toplevel windows of your application.}

{\bf  If your application uses different kinds of toplevel windows, then you can use {\bf KMain\-Window::class\-Name\-Of\-Toplevel}{\rm (p.\,\pageref{classKMainWindow_e1})}(n) to determine the exact type before calling the child\-MW constructor in the example from above.}

{\bf  If your client has only one kind of toplevel widgets (which should be pretty usual) then you should use the RESTORE-macro:}

{\bf  \small\begin{alltt}
 if (kapp-$>$isRestored())
   RESTORE(childMW)
 else \{
 // create default application as usual
 \}
 \end{alltt}\normalsize 
}

{\bf  The macro expands to the term above but is easier to use and less code to write.}

{\bf  \begin{Desc}
\item[See also:]{\bf restore()}{\rm (p.\,\pageref{classKMainWindow_a4})} 

{\bf class\-Name\-Of\-Toplevel()}{\rm (p.\,\pageref{classKMainWindow_e1})} \end{Desc}
}

Definition at line 326 of file kmainwindow.cpp.

References QString::from\-Latin1(), KIO::number(), KConfig\-Base::read\-Num\-Entry(), and KConfig\-Base::set\-Group().

Referenced by restore().\index{KMainWindow@{KMain\-Window}!classNameOfToplevel@{classNameOfToplevel}}
\index{classNameOfToplevel@{classNameOfToplevel}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf QString} KMain\-Window::class\-Name\-Of\-Toplevel (int {\em number})\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_e1}


Returns the class\-Name() of the {\tt number} of the toplevel window which should be restored. 

This is only useful if your application uses different kinds of toplevel windows. 

Definition at line 338 of file kmainwindow.cpp.

References QString::from\-Latin1(), KConfig\-Base::has\-Key(), KIO::number(), QString::prepend(), KConfig\-Base::read\-Entry(), KConfig\-Base::set\-Group(), and QString::set\-Num().\index{KMainWindow@{KMain\-Window}!restore@{restore}}
\index{restore@{restore}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::restore (int {\em number}, bool {\em show} = TRUE)}\label{classKMainWindow_a4}


Restore the session specified by {\tt number}. 

Returns {\tt false} if this fails, otherwise returns {\tt true} and shows the window. You should call {\bf can\-Be\-Restored}{\rm (p.\,\pageref{classKMainWindow_e0})}() first. If {\tt show} is true (default), this widget will be shown automatically. 

Definition at line 355 of file kmainwindow.cpp.

References can\-Be\-Restored(), and KIO::number().\index{KMainWindow@{KMain\-Window}!createGUI@{createGUI}}
\index{createGUI@{createGUI}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::create\-GUI (const {\bf QString} \& {\em xmlfile} = QString::null, bool {\em \_\-conserve\-Memory} = TRUE)}\label{classKMainWindow_a6}


Create a GUI given a local XML file. 

If {\tt xmlfile} is NULL, then it will try to construct a local XML filename like appnameui.rc where 'appname' is your app's name. If that file does not exist, then the XML UI code will only use the global (standard) XML file for the layout purposes.

Note that when passing true for the conserve\-Memory argument subsequent calls to gui\-Factory()-$>$add\-Client/remove\-Client may not work as expected. Also retrieving references to containers like popup menus or toolbars using the container method will not work.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em xmlfile}]The local xmlfile (relative or absolute) \item[{\em \_\-conserve\-Memory}]Specify whether {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a6})} should call KXMLGui\-Client::conserve\-Memory() to free all memory allocated by the {\bf QDom\-Document} and by the {\bf KXMLGUIFactory}{\rm (p.\,\pageref{classKXMLGUIFactory})}. \end{description}
\end{Desc}


Definition at line 375 of file kmainwindow.cpp.

References KXMLGUIClient::action\-Collection(), KXMLGUIFactory::add\-Client(), QDom\-Element::attribute(), QPtr\-List$<$ KTool\-Bar $>$::clear(), QMenu\-Bar::clear(), KXMLGUIClient::conserve\-Memory(), QDom\-Document::document\-Element(), KXMLGUIClient::dom\-Document(), KXMLGUIClient::instance(), QString::is\-Null(), locate(), KXMLGUIFactory::remove\-Client(), KXMLGUIFactory::reset\-Container(), QPtr\-List$<$ KTool\-Bar $>$::set\-Auto\-Delete(), KXMLGUIClient::set\-XMLFile(), QDom\-Element::tag\-Name(), and tool\-Bar\-Iterator().\index{KMainWindow@{KMain\-Window}!setHelpMenuEnabled@{setHelpMenuEnabled}}
\index{setHelpMenuEnabled@{setHelpMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Help\-Menu\-Enabled (bool {\em show\-Help\-Menu} = true)}\label{classKMainWindow_a7}


Enables the build of a standard help menu when calling {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a6})}. 

The default behavior is to build one, you must call this function to disable it 

Definition at line 452 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!isHelpMenuEnabled@{isHelpMenuEnabled}}
\index{isHelpMenuEnabled@{isHelpMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::is\-Help\-Menu\-Enabled ()}\label{classKMainWindow_a8}


Return {\tt true} when the help menu is enabled. 



Definition at line 457 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!hasMenuBar@{hasMenuBar}}
\index{hasMenuBar@{hasMenuBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::has\-Menu\-Bar ()}\label{classKMainWindow_a9}


Returns true, if there is a menubar \begin{Desc}
\item[Since:]3.1. \end{Desc}




Definition at line 885 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!menuBar@{menuBar}}
\index{menuBar@{menuBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KMenu\-Bar} $\ast$ KMain\-Window::menu\-Bar ()}\label{classKMainWindow_a10}


Returns a pointer to the menu bar. 

If there is no menu bar yet one will be created. 

Definition at line 890 of file kmainwindow.cpp.

References QMain\-Window::menu\-Bar().

Referenced by size\-For\-Central\-Widget\-Size().\index{KMainWindow@{KMain\-Window}!statusBar@{statusBar}}
\index{statusBar@{statusBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KStatus\-Bar} $\ast$ KMain\-Window::status\-Bar ()}\label{classKMainWindow_a11}


Returns a pointer to the status bar. 

If there is no status bar yet one will be created. 

Definition at line 902 of file kmainwindow.cpp.

References QMain\-Window::status\-Bar().

Referenced by KXMLGUIBuilder::create\-Container().\index{KMainWindow@{KMain\-Window}!toolBar@{toolBar}}
\index{toolBar@{toolBar}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KTool\-Bar} $\ast$ KMain\-Window::tool\-Bar (const char $\ast$ {\em name} = 0)}\label{classKMainWindow_a12}


Returns a pointer to the toolbar with the specified name. 

This refers to toolbars created dynamically from the XML UI framework. If the toolbar does not exist one will be created.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]The internal name of the toolbar. If no name is specified \char`\"{}main\-Tool\-Bar\char`\"{} is assumed.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A pointer to the toolbar or {\tt 0L} if it doesn't exist \end{Desc}


Definition at line 960 of file kmainwindow.cpp.

References KStd\-Accel::name().

Referenced by KToggle\-Tool\-Bar\-Action::plug(), and size\-For\-Central\-Widget\-Size().\index{KMainWindow@{KMain\-Window}!toolBarIterator@{toolBarIterator}}
\index{toolBarIterator@{toolBarIterator}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List\-Iterator}$<$ {\bf KTool\-Bar} $>$ KMain\-Window::tool\-Bar\-Iterator ()}\label{classKMainWindow_a13}


\begin{Desc}
\item[Returns:]An iterator over the list of all toolbars for this window. \end{Desc}


Definition at line 975 of file kmainwindow.cpp.

References QPtr\-List$<$ KTool\-Bar $>$::append(), QPtr\-List$<$ KTool\-Bar $>$::clear(), QPtr\-List::first(), QPtr\-List::next(), and QMain\-Window::tool\-Bars().

Referenced by apply\-Main\-Window\-Settings(), create\-GUI(), and save\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!accel@{accel}}
\index{accel@{accel}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KAccel} $\ast$ KMain\-Window::accel ()}\label{classKMainWindow_a14}


\begin{Desc}
\item[Returns:]A {\bf KAccel} instance bound to this mainwindow. Used automatically by {\bf KAction}{\rm (p.\,\pageref{classKAction})} to make keybindings work in all cases. \end{Desc}


Definition at line 990 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!setAutoSaveSettings@{setAutoSaveSettings}}
\index{setAutoSaveSettings@{setAutoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Auto\-Save\-Settings (const {\bf QString} \& {\em group\-Name} = {\bf QString::from\-Latin1}(\char`\"{}Main\-Window\char`\"{}), bool {\em save\-Window\-Size} = true)}\label{classKMainWindow_a16}


Call this to enable \char`\"{}auto-save\char`\"{} of toolbar/menubar/statusbar settings (and optionally window size). 

If the $\ast$bars were moved around/shown/hidden when the window is closed, save\-Main\-Window\-Settings( {\bf KGlobal::config()}, group\-Name ) will be called.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em group\-Name}]a name that identifies this \char`\"{}type of window\char`\"{}. You can have several types of window in the same application.\item[{\em save\-Window\-Size}]set it to true to include the window size when saving.\end{description}
\end{Desc}
Typically, you will call {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a16})} in your KMain\-Window-inherited class constructor, and it will take care of restoring and saving automatically. Make sure you call this \_\-after all\_\- your $\ast$bars have been created. 

Definition at line 839 of file kmainwindow.cpp.

References apply\-Main\-Window\-Settings(), KGlobal::config(), and QMain\-Window::dock\-Window\-Position\-Changed().\index{KMainWindow@{KMain\-Window}!resetAutoSaveSettings@{resetAutoSaveSettings}}
\index{resetAutoSaveSettings@{resetAutoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::reset\-Auto\-Save\-Settings ()}\label{classKMainWindow_a17}


Disable the auto-save-settings feature. 

You don't normally need to call this, ever. 

Definition at line 851 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!autoSaveSettings@{autoSaveSettings}}
\index{autoSaveSettings@{autoSaveSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::auto\-Save\-Settings () const}\label{classKMainWindow_a18}


\begin{Desc}
\item[Returns:]the current autosave setting, i.e. true if {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a16})} was called, false by default or if {\bf reset\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a17})} was called. \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 858 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!autoSaveGroup@{autoSaveGroup}}
\index{autoSaveGroup@{autoSaveGroup}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMain\-Window::auto\-Save\-Group () const}\label{classKMainWindow_a19}


\begin{Desc}
\item[Returns:]the group used for setting-autosaving. Only meaningful if {\bf set\-Auto\-Save\-Settings()}{\rm (p.\,\pageref{classKMainWindow_a16})} was called. This can be useful for forcing a save or an apply, e.g. before and after using {\bf KEdit\-Toolbar}{\rm (p.\,\pageref{classKEditToolbar})}. \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 863 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!applyMainWindowSettings@{applyMainWindowSettings}}
\index{applyMainWindowSettings@{applyMainWindowSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::apply\-Main\-Window\-Settings ({\bf KConfig} $\ast$ {\em config}, const {\bf QString} \& {\em group\-Name} = QString::null)}\label{classKMainWindow_a20}


Read settings for statusbar, menubar and toolbar from their respective groups in the config file and apply them. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]Config file to read the settings from. \item[{\em group\-Name}]Group name to use. If not specified, the last used group name is used. \end{description}
\end{Desc}


Definition at line 700 of file kmainwindow.cpp.

References KTool\-Bar::apply\-Settings(), QPtr\-List\-Iterator::current(), finalize\-GUI(), QString::from\-Latin1(), QMenu\-Bar::hide(), QString::is\-Empty(), QString::number(), QString::prepend(), KConfig\-Base::read\-List\-Entry(), restore\-Window\-Size(), KConfig\-Base::set\-Group(), QMenu\-Bar::show(), and tool\-Bar\-Iterator().

Referenced by set\-Auto\-Save\-Settings().\index{KMainWindow@{KMain\-Window}!saveMainWindowSettings@{saveMainWindowSettings}}
\index{saveMainWindowSettings@{saveMainWindowSettings}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Main\-Window\-Settings ({\bf KConfig} $\ast$ {\em config}, const {\bf QString} \& {\em group\-Name} = QString::null)}\label{classKMainWindow_a21}


Save settings for statusbar, menubar and toolbar to their respective groups in the config file {\tt config}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]Config file to save the settings to. \item[{\em group\-Name}]Group name to use. If not specified, the last used group name is used \end{description}
\end{Desc}


Definition at line 596 of file kmainwindow.cpp.

References QPtr\-List\-Iterator::current(), QString::from\-Latin1(), QString::is\-Empty(), QString::number(), QString::prepend(), KTool\-Bar::save\-Settings(), save\-Window\-Size(), KConfig\-Base::set\-Group(), tool\-Bar\-Iterator(), and KConfig\-Base::write\-Entry().\index{KMainWindow@{KMain\-Window}!setStandardToolBarMenuEnabled@{setStandardToolBarMenuEnabled}}
\index{setStandardToolBarMenuEnabled@{setStandardToolBarMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Standard\-Tool\-Bar\-Menu\-Enabled (bool {\em enable})}\label{classKMainWindow_a22}


Sets whether KMain\-Window should provide a menu that allows showing/hiding the available toolbars ( using {\bf KToggle\-Tool\-Bar\-Action}{\rm (p.\,\pageref{classKToggleToolBarAction})} ) . 

In case there is only one toolbar configured a simple 'Show ' menu item is shown.

The menu / menu item is implemented using xmlgui. It will be inserted in your menu structure in the 'Settings' menu.

If your application uses a non-standard xmlgui resource file then you can specify the exact position of the menu / menu item by adding a $<$Merge name=\char`\"{}Standard\-Tool\-Bar\-Menu\-Handler\char`\"{} /$>$ line to the settings menu section of your resource file ( usually appname.rc ).

Note that you should enable this feature before calling {\bf create\-GUI()}{\rm (p.\,\pageref{classKMainWindow_a6})} ( or similar ) . You enable/disable it anytime if you pass false to the conserve\-Memory argument of create\-GUI. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 649 of file kmainwindow.cpp.

References KXMLGUIFactory::add\-Client(), KXMLGUIClient::factory(), and KXMLGUIFactory::remove\-Client().\index{KMainWindow@{KMain\-Window}!isStandardToolBarMenuEnabled@{isStandardToolBarMenuEnabled}}
\index{isStandardToolBarMenuEnabled@{isStandardToolBarMenuEnabled}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::is\-Standard\-Tool\-Bar\-Menu\-Enabled () const}\label{classKMainWindow_a23}


\begin{Desc}
\item[Since:]3.1 \end{Desc}




Definition at line 671 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!toolBarMenuAction@{toolBarMenuAction}}
\index{toolBarMenuAction@{toolBarMenuAction}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KAction} $\ast$ KMain\-Window::tool\-Bar\-Menu\-Action ()}\label{classKMainWindow_a24}


Returns a pointer to the mainwindows action responsible for the toolbars menu \begin{Desc}
\item[Since:]3.1. \end{Desc}




Definition at line 244 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!finalizeGUI@{finalizeGUI}}
\index{finalizeGUI@{finalizeGUI}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::finalize\-GUI ({\bf KXMLGUIClient} $\ast$ {\em client})\hspace{0.3cm}{\tt  [virtual]}}\label{classKMainWindow_a25}


\begin{Desc}
\item[Since:]3.1 \end{Desc}




Reimplemented from {\bf KXMLGUIBuilder} {\rm (p.\,\pageref{classKXMLGUIBuilder})}.

Definition at line 1040 of file kmainwindow.cpp.

Referenced by apply\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!initialGeometrySet@{initialGeometrySet}}
\index{initialGeometrySet@{initialGeometrySet}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::initial\-Geometry\-Set () const}\label{classKMainWindow_a27}


\begin{Desc}
\item[Returns:]true if a -geometry argument was given on the command line, and this is the first window created (the one on which this option applies) \end{Desc}


Definition at line 807 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!sizeForCentralWidgetSize@{sizeForCentralWidgetSize}}
\index{sizeForCentralWidgetSize@{sizeForCentralWidgetSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QSize} KMain\-Window::size\-For\-Central\-Widget\-Size ({\bf QSize} {\em size})}\label{classKMainWindow_a28}


\begin{Desc}
\item[Returns:]the size the mainwindow should have so that the central widget will be of {\tt size}. \end{Desc}


Definition at line 1002 of file kmainwindow.cpp.

References KTool\-Bar::bar\-Pos(), QMain\-Window::dock\-Windows\-Movable(), QSize::height(), QMenu\-Bar::height\-For\-Width(), menu\-Bar(), KTool\-Bar::size\-Hint(), tool\-Bar(), and QSize::width().\index{KMainWindow@{KMain\-Window}!setCaption@{setCaption}}
\index{setCaption@{setCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Caption (const {\bf QString} \& {\em caption})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i0}


Makes a {\bf KDE} compliant caption. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. {\em Do\/} {\em not\/} include the application name in this string. It will be added automatically according to the {\bf KDE} standard. \end{description}
\end{Desc}


Definition at line 462 of file kmainwindow.cpp.

References set\-Plain\-Caption().\index{KMainWindow@{KMain\-Window}!setCaption@{setCaption}}
\index{setCaption@{setCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Caption (const {\bf QString} \& {\em caption}, bool {\em modified})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i1}


Makes a {\bf KDE} compliant caption. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. {\em Do\/} {\em not\/} include the application name in this string. It will be added automatically according to the {\bf KDE} standard. \item[{\em modified}]Specify whether the document is modified. This displays an additional sign in the title bar, usually \char`\"{}$\ast$$\ast$\char`\"{}. \end{description}
\end{Desc}


Definition at line 467 of file kmainwindow.cpp.

References set\-Plain\-Caption().\index{KMainWindow@{KMain\-Window}!setPlainCaption@{setPlainCaption}}
\index{setPlainCaption@{setPlainCaption}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::set\-Plain\-Caption (const {\bf QString} \& {\em caption})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i2}


Make a plain caption without any modifications. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em caption}]Your caption. This is the string that will be displayed in the window title. \end{description}
\end{Desc}


Definition at line 472 of file kmainwindow.cpp.

References QString::utf8().

Referenced by set\-Caption().\index{KMainWindow@{KMain\-Window}!appHelpActivated@{appHelpActivated}}
\index{appHelpActivated@{appHelpActivated}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::app\-Help\-Activated (void)\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i3}


Open the help page for the application. 

The application name is used as a key to determine what to display and the system will attempt to open /index.html.

This method is intended for use by a help button in the toolbar or components outside the regular help menu. Use {\bf help\-Menu}{\rm (p.\,\pageref{classKMainWindow_a2})}() when you want to provide access to the help system from the help menu.

Example (adding a help button to the first toolbar):

\small\begin{alltt}
 {\bf KIconLoader} \&loader = *KGlobal::iconLoader();
 {\bf QPixmap} pixmap = loader.loadIcon( "help" );
 toolBar(0)-$>$insertButton( pixmap, 0, SIGNAL(clicked()),
   this, SLOT({\bf appHelpActivated()}{\rm (p.\,\pageref{classKMainWindow_i3})}), true, i18n("Help") );
 \end{alltt}\normalsize 
 

Definition at line 481 of file kmainwindow.cpp.

References KHelp\-Menu::app\-Help\-Activated().\index{KMainWindow@{KMain\-Window}!slotStateChanged@{slotStateChanged}}
\index{slotStateChanged@{slotStateChanged}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::slot\-State\-Changed (const {\bf QString} \& {\em newstate})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKMainWindow_i4}


Apply a state change. 

Enable and disable actions as defined in the XML rc file \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 491 of file kmainwindow.cpp.

References KXMLGUIClient::state\-Changed().\index{KMainWindow@{KMain\-Window}!slotStateChanged@{slotStateChanged}}
\index{slotStateChanged@{slotStateChanged}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::slot\-State\-Changed (const {\bf QString} \& {\em newstate}, KXMLGUIClient::Reverse\-State\-Change)\hspace{0.3cm}{\tt  [slot]}}\label{classKMainWindow_i5}


Apply a state change. 

Enable and disable actions as defined in the XML rc file, can \char`\"{}reverse\char`\"{} the state (disable the actions which should be enabled, and vice-versa) if specified. \begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 499 of file kmainwindow.cpp.

References KXMLGUIClient::state\-Changed().\index{KMainWindow@{KMain\-Window}!closeEvent@{closeEvent}}
\index{closeEvent@{closeEvent}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::close\-Event ({\bf QClose\-Event} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b3}


Reimplemented to call the {\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} and {\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} handlers. 

We recommend that you reimplement the handlers rather than {\bf close\-Event}{\rm (p.\,\pageref{classKMainWindow_b3})}(). If you do it anyway, ensure to call the base implementation to keep {\bf query\-Exit}{\rm (p.\,\pageref{classKMainWindow_b4})}() running. 

Reimplemented in {\bf UIServer}.

Definition at line 515 of file kmainwindow.cpp.

References QClose\-Event::accept(), QPtr\-List\-Iterator::current(), QClose\-Event::ignore(), member\-List, query\-Close(), query\-Exit(), and QPtr\-List\-Iterator::to\-First().\index{KMainWindow@{KMain\-Window}!queryExit@{queryExit}}
\index{queryExit@{queryExit}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::query\-Exit ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b4}


Called before the very last window is closed, either by the user or indirectly by the session manager. 

It is not recommended to do any user interaction in this function other than indicating severe errors. Better ask the user on {\bf query\-Close}{\rm (p.\,\pageref{classKMainWindow_b5})}() (see below).

However, {\bf query\-Exit}{\rm (p.\,\pageref{classKMainWindow_b4})}() is useful to do some final cleanups. A typical example would be to write configuration data back.

Note that the application may continue to run after {\bf query\-Exit}{\rm (p.\,\pageref{classKMainWindow_b4})}() (the user may have cancelled a shutdown). The purpose of {\bf query\-Exit}{\rm (p.\,\pageref{classKMainWindow_b4})}() is purely to prepare the application (with possible user interaction) so it can safely be closed later (without user interaction).

If you need to do serious things on exit (like shutting a dial-up connection down), connect to the signal {\bf KApplication::shut\-Down}().

Default implementation returns {\tt true}. Returning {\tt false} will cancel the exiting. In the latter case, the last window will remain visible. If {\bf KApplication::session\-Saving()} is true, refusing the exit will also cancel {\bf KDE} logout.

\begin{Desc}
\item[See also:]{\bf query\-Close()}{\rm (p.\,\pageref{classKMainWindow_b5})} 

{\bf KApplication::session\-Saving()} \end{Desc}


Definition at line 544 of file kmainwindow.cpp.

Referenced by close\-Event().\index{KMainWindow@{KMain\-Window}!queryClose@{queryClose}}
\index{queryClose@{queryClose}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::query\-Close ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b5}


Called before the window is closed, either by the user or indirectly by the session manager. 

The purpose of this function is to prepare the window in a way that it is safe to close it, i.e. without the user losing some data.

Default implementation returns true. Returning {\tt false} will cancel the closing, and, if {\bf KApplication::session\-Saving()} is true, it will also cancel {\bf KDE} logout.

Reimplement this function to prevent the user from losing data. Example: \small\begin{alltt}\end{alltt}\normalsize 


\small\begin{alltt}           switch ( {\bf KMessageBox::warningYesNoCancel}{\rm (p.\,\pageref{classKMessageBox_e6})}( this,
				   i18n("Save changes to Document Foo?")) ) \{
           case KMessageBox::Yes :
             // save document here. If saving fails, return FALSE;
             return TRUE;
           case KMessageBox::No :
             return TRUE;
           default: // cancel
             return FALSE;\end{alltt}\normalsize 


\small\begin{alltt}    \end{alltt}\normalsize 


\begin{Desc}
\item[See also:]{\bf query\-Exit()}{\rm (p.\,\pageref{classKMainWindow_b4})} 

{\bf KApplication::session\-Saving()} \end{Desc}


Definition at line 549 of file kmainwindow.cpp.

Referenced by close\-Event().\index{KMainWindow@{KMain\-Window}!saveProperties@{saveProperties}}
\index{saveProperties@{saveProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KMain\-Window::save\-Properties ({\bf KConfig} $\ast$)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKMainWindow_b6}


Save your instance-specific properties. 

The function is invoked when the session manager requests your application to save its state.

You {\em must\/} {\em not\/} change the group of the {\tt kconfig} object, since KMain\-Window uses one group for each window. Please reimplement these function in childclasses.

Note: No user interaction is allowed in this function! 

Definition at line 635 of file kmainwindow.h.\index{KMainWindow@{KMain\-Window}!readProperties@{readProperties}}
\index{readProperties@{readProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KMain\-Window::read\-Properties ({\bf KConfig} $\ast$)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKMainWindow_b7}


Read your instance-specific properties. 



Definition at line 640 of file kmainwindow.h.\index{KMainWindow@{KMain\-Window}!saveGlobalProperties@{saveGlobalProperties}}
\index{saveGlobalProperties@{saveGlobalProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Global\-Properties ({\bf KConfig} $\ast$ {\em session\-Config})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b8}


Save your application-wide properties. 

The function is invoked when the session manager requests your application to save its state.

This function is similar to {\bf save\-Properties}{\rm (p.\,\pageref{classKMainWindow_b6})}() but is only called for the very first main window, regardless how many main window are open.

Override it if you need to save other data about your documents on session end. session\-Config is a config to which that data should be saved. Normally, you don't need this function. But if you want to save data about your documents that are not in opened windows you might need it.

Default implementation does nothing. 

Definition at line 554 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!readGlobalProperties@{readGlobalProperties}}
\index{readGlobalProperties@{readGlobalProperties}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::read\-Global\-Properties ({\bf KConfig} $\ast$ {\em session\-Config})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKMainWindow_b9}


The counterpart of {\bf save\-Global\-Properties}{\rm (p.\,\pageref{classKMainWindow_b8})}(). 

Read the application-specific properties in again. 

Definition at line 558 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!settingsDirty@{settingsDirty}}
\index{settingsDirty@{settingsDirty}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMain\-Window::settings\-Dirty () const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b12}


For inherited classes. 



Definition at line 829 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!settingsGroup@{settingsGroup}}
\index{settingsGroup@{settingsGroup}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KMain\-Window::settings\-Group () const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b13}


For inherited classes. 



Definition at line 834 of file kmainwindow.cpp.\index{KMainWindow@{KMain\-Window}!saveWindowSize@{saveWindowSize}}
\index{saveWindowSize@{saveWindowSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::save\-Window\-Size ({\bf KConfig} $\ast$ {\em config}) const\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b14}


For inherited classes Note that the group must be set before calling. 



Definition at line 774 of file kmainwindow.cpp.

References QApplication::desktop(), QString::from\-Latin1(), QRect::height(), QRect::width(), and KConfig\-Base::write\-Entry().

Referenced by save\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!restoreWindowSize@{restoreWindowSize}}
\index{restoreWindowSize@{restoreWindowSize}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::restore\-Window\-Size ({\bf KConfig} $\ast$ {\em config})\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b15}


For inherited classes Note that the group must be set before calling, and that a -geometry on the command line has priority. 



Definition at line 782 of file kmainwindow.cpp.

References QApplication::desktop(), QString::from\-Latin1(), QRect::height(), QSize::is\-Empty(), parse\-Geometry(), KConfig\-Base::read\-Num\-Entry(), QRect::width(), and KConfig\-Base::write\-Entry().

Referenced by apply\-Main\-Window\-Settings().\index{KMainWindow@{KMain\-Window}!parseGeometry@{parseGeometry}}
\index{parseGeometry@{parseGeometry}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::parse\-Geometry (bool {\em parsewidth})\hspace{0.3cm}{\tt  [protected]}}\label{classKMainWindow_b16}


parse the geometry from the geometry command line argument 



Definition at line 252 of file kmainwindow.cpp.

References QApplication::desktop(), QSize::height(), KIO::move(), and QSize::width().

Referenced by restore\-Window\-Size().\index{KMainWindow@{KMain\-Window}!showAboutApplication@{showAboutApplication}}
\index{showAboutApplication@{showAboutApplication}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMain\-Window::show\-About\-Application ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKMainWindow_j0}


This slot does nothing. 

It must be reimplemented if you want to use a custom About Application dialog box. This slot is connected to the About Application entry in the menu returned by {\bf custom\-Help\-Menu}{\rm (p.\,\pageref{classKMainWindow_a3})}.

Example: \small\begin{alltt}\end{alltt}\normalsize 


\small\begin{alltt} void MyMainLevel::setupInterface()
 \{
   ..
   {\bf menuBar()}{\rm (p.\,\pageref{classKMainWindow_a10})}-$>$insertItem( i18n("&Help"), {\bf customHelpMenu()}{\rm (p.\,\pageref{classKMainWindow_a3})} );
   ..
 \}\end{alltt}\normalsize 


\small\begin{alltt} void MyMainLevel::showAboutApplication()
 \{
   
 \}
 \end{alltt}\normalsize 
 

Definition at line 568 of file kmainwindow.cpp.

Referenced by custom\-Help\-Menu(), and help\-Menu().

\subsection{Member Data Documentation}
\index{KMainWindow@{KMain\-Window}!memberList@{memberList}}
\index{memberList@{memberList}!KMainWindow@{KMain\-Window}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPtr\-List}$<$ {\bf KMain\-Window} $>$ $\ast$ {\bf KMain\-Window::member\-List} = 0L\hspace{0.3cm}{\tt  [static]}}\label{classKMainWindow_s0}


List of members of KMain\-Window class. 



Definition at line 70 of file kmainwindow.cpp.

Referenced by close\-Event(), and $\sim$KMain\-Window().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmainwindow.h\item 
kmainwindow.cpp\end{CompactItemize}
