\section{KHelp\-Menu Class Reference}
\label{classKHelpMenu}\index{KHelpMenu@{KHelpMenu}}
This class provides the standard {\bf KDE} help menu with the default \char`\"{}about\char`\"{} dialog boxes and help entry. Standard {\bf KDE} help menu with dialog boxes.  


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

Inheritance diagram for KHelp\-Menu:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=54pt]{classKHelpMenu__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KHelp\-Menu:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=356pt]{classKHelpMenu__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Menu\-Id} \{ \par
{\bf menu\-Help\-Contents} =  0, 
{\bf menu\-Whats\-This} =  1, 
{\bf menu\-About\-App} =  2, 
{\bf menu\-About\-KDE} =  3, 
\par
{\bf menu\-Report\-Bug} =  4
 \}
\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf app\-Help\-Activated} ()
\begin{CompactList}\small\item\em Opens the help page for the application. \item\end{CompactList}\item 
void {\bf context\-Help\-Activated} ()
\begin{CompactList}\small\item\em Activates What's This help for the application. \item\end{CompactList}\item 
void {\bf about\-Application} ()
\begin{CompactList}\small\item\em Opens an application specific dialog box. \item\end{CompactList}\item 
void {\bf about\-KDE} ()
\begin{CompactList}\small\item\em Opens the standard \char`\"{}About KDE\char`\"{} dialog box. \item\end{CompactList}\item 
void {\bf report\-Bug} ()
\begin{CompactList}\small\item\em Opens the standard \char`\"{}Report Bugs\char`\"{} dialog box. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf show\-About\-Application} ()
\begin{CompactList}\small\item\em This signal is emitted from {\bf about\-Application}{\rm (p.\,\pageref{classKHelpMenu_i2})}() if no \char`\"{}about application\char`\"{} string has been defined. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KHelp\-Menu} ({\bf QWidget} $\ast${\bf parent}=0, const  {\bf QString} \&about\-App\-Text=QString::null, bool show\-Whats\-This=true)
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item 
{\bf KHelp\-Menu} ({\bf QWidget} $\ast${\bf parent}, const  {\bf KAbout\-Data} $\ast$about\-Data, bool show\-Whats\-This=true, {\bf KAction\-Collection} $\ast$actions=0)
\begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item 
{\bf $\sim$KHelp\-Menu} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
{\bf KPopup\-Menu} $\ast$ {\bf menu} ()
\begin{CompactList}\small\item\em Returns a popup menu you can use in the menu bar or where you need it. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKHelpMenu_b0}

\end{CompactItemize}


\subsection{Detailed Description}
This class provides the standard {\bf KDE} help menu with the default \char`\"{}about\char`\"{} dialog boxes and help entry. Standard {\bf KDE} help menu with dialog boxes. 

This class is used in {\bf KMain\-Window}{\rm (p.\,\pageref{classKMainWindow})} so normally you don't need to use this class yourself. However, if you need the help menu or any of its dialog boxes in your code that is not subclassed from {\bf KMain\-Window}{\rm (p.\,\pageref{classKMainWindow})} you should use this class.

The usage is simple:

\small\begin{alltt}
 mHelpMenu = new KHelpMenu( this, <someText> );
 kmenubar-$>$insertItem(i18n("&Help"), mHelpMenu-$>${\bf menu()}{\rm (p.\,\pageref{classKHelpMenu_a3})} );
 \end{alltt}\normalsize 


or if you just want to open a dialog box:

\small\begin{alltt}
 mHelpMenu = new KHelpMenu( this, <someText> );
 connect( this, SIGNAL(someSignal()), mHelpMenu,SLOT(mHelpMenu-$>${\bf aboutKDE()}{\rm (p.\,\pageref{classKHelpMenu_i3})}));
 \end{alltt}\normalsize 


IMPORTANT: The first time you use {\bf KHelp\-Menu::menu}{\rm (p.\,\pageref{classKHelpMenu_a3})}(), a {\bf KPopup\-Menu}{\rm (p.\,\pageref{classKPopupMenu})} object is allocated. Only one object is created by the class so if you call {\bf KHelp\-Menu::menu}{\rm (p.\,\pageref{classKHelpMenu_a3})}() twice or more, the same pointer is returned. The class will destroy the popupmenu in the destructor so do not delete this pointer yourself.

The KHelp\-Menu object will be deleted when its parent is destroyed but you can delete it yourself if you want. The code below will always work.

\small\begin{alltt}
 MyClass::~MyClass()
 \{
   delete mHelpMenu;
 \}
 \end{alltt}\normalsize 


Using your own \char`\"{}about application\char`\"{} dialog box:

The standard \char`\"{}about application\char`\"{} dialog box is quite simple. If you need a dialog box with more functionality you must design that one yourself. When you want to display the dialog you can choose one of two methods. Common for both is that you must make a help menu object with no text argument If the text is missing the default dialog box will not be displayed:

Example 1 Using {\bf show\-About\-Application}{\rm (p.\,\pageref{classKHelpMenu_l0})} signal (preferred) \small\begin{alltt}\end{alltt}\normalsize 


\small\begin{alltt} void MyClass::myFunc()
 \{
   ..
   KHelpMenu *helpMenu = new KHelpMenu( this );
   connect( helpMenu, SIGNAL({\bf showAboutApplication()}{\rm (p.\,\pageref{classKHelpMenu_l0})}),
          this, SLOT(myDialogSlot()));
   ..
 \}\end{alltt}\normalsize 


\small\begin{alltt} void MyClass::myDialogSlot()
 \{
   
 \}
 \end{alltt}\normalsize 


Example 2 Old style - connecting directly to the menu entry. \small\begin{alltt}\end{alltt}\normalsize 


\small\begin{alltt} void MyClass::myFunc()
 \{
   KHelpMenu *helpMenu = new KHelpMenu( this );
   {\bf KPopupMenu}{\rm (p.\,\pageref{classKPopupMenu})} *help = mHelpMenu-$>${\bf menu()}{\rm (p.\,\pageref{classKHelpMenu_a3})};
   help-$>$connectItem( KHelpMenu::menuAboutApp, this, SLOT(myDialogSlot()) );
 \}\end{alltt}\normalsize 


\small\begin{alltt} void MyClass::myDialogSlot()
 \{
   
 \}
 \end{alltt}\normalsize 


\begin{Desc}
\item[Author:]Espen Sand ({\tt espen@kde.org}) \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf khelpmenu.h}{\rm (p.\,\pageref{khelpmenu_8h})},v 1.24 2002/08/01 14:19:52 coolo Exp \end{Desc}
\end{Desc}




Definition at line 129 of file khelpmenu.h.

\subsection{Constructor \& Destructor Documentation}
\index{KHelpMenu@{KHelp\-Menu}!KHelpMenu@{KHelpMenu}}
\index{KHelpMenu@{KHelpMenu}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KHelp\-Menu::KHelp\-Menu ({\bf QWidget} $\ast$ {\em parent} = 0, const {\bf QString} \& {\em about\-App\-Text} = QString::null, bool {\em show\-Whats\-This} = true)}\label{classKHelpMenu_a0}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent. \item[{\em about\-App\-Text}]User definable string that is used in the application specific dialog box. Note: The help menu will not open this dialog box if you don't define a string. See {\bf show\-About\-Application}{\rm (p.\,\pageref{classKHelpMenu_l0})}() for more information. \item[{\em show\-Whats\-This}]Decides whether a \char`\"{}Whats this\char`\"{} entry will be added to the dialog. \end{description}
\end{Desc}


Definition at line 60 of file khelpmenu.cpp.\index{KHelpMenu@{KHelp\-Menu}!KHelpMenu@{KHelpMenu}}
\index{KHelpMenu@{KHelpMenu}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KHelp\-Menu::KHelp\-Menu ({\bf QWidget} $\ast$ {\em parent}, const {\bf KAbout\-Data} $\ast$ {\em about\-Data}, bool {\em show\-Whats\-This} = true, {\bf KAction\-Collection} $\ast$ {\em actions} = 0)}\label{classKHelpMenu_a1}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent. \item[{\em about\-Data}]User and app data used in the About app dialog \item[{\em show\-Whats\-This}]Decides whether a \char`\"{}Whats this\char`\"{} entry will be added to the dialog. \end{description}
\end{Desc}


Definition at line 71 of file khelpmenu.cpp.

References KStd\-Action::about\-App(), about\-Application(), about\-KDE(), KStd\-Action::about\-KDE(), app\-Help\-Activated(), context\-Help\-Activated(), KStd\-Action::help\-Contents(), report\-Bug(), KStd\-Action::report\-Bug(), and KStd\-Action::whats\-This().\index{KHelpMenu@{KHelp\-Menu}!~KHelpMenu@{$\sim$KHelpMenu}}
\index{~KHelpMenu@{$\sim$KHelpMenu}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KHelp\-Menu::$\sim${\bf KHelp\-Menu} ()}\label{classKHelpMenu_a2}


Destructor. 

Destroys dialogs and the menu pointer retuned by {\bf menu}{\rm (p.\,\pageref{classKHelpMenu_a3})} 

Definition at line 95 of file khelpmenu.cpp.

\subsection{Member Function Documentation}
\index{KHelpMenu@{KHelp\-Menu}!menu@{menu}}
\index{menu@{menu}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KPopup\-Menu} $\ast$ KHelp\-Menu::menu ()}\label{classKHelpMenu_a3}


Returns a popup menu you can use in the menu bar or where you need it. 

Note: This method will only create one instance of the menu. If you call this method twice or more the same pointer is returned 

Definition at line 105 of file khelpmenu.cpp.

References about\-Application(), KInstance::about\-Data(), about\-KDE(), app\-Help\-Activated(), QObject::connect(), QPopup\-Menu::connect\-Item(), context\-Help\-Activated(), QObject::destroyed(), QString::from\-Latin1(), QTool\-Button::icon\-Set(), QPopup\-Menu::insert\-Item(), QPopup\-Menu::insert\-Separator(), KGlobal::instance(), KAbout\-Data::program\-Name(), report\-Bug(), QPopup\-Menu::set\-Accel(), KIcon::Size\-Small, and QWhats\-This::whats\-This\-Button().

Referenced by KMain\-Window::custom\-Help\-Menu(), and KMain\-Window::help\-Menu().\index{KHelpMenu@{KHelp\-Menu}!appHelpActivated@{appHelpActivated}}
\index{appHelpActivated@{appHelpActivated}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::app\-Help\-Activated ()\hspace{0.3cm}{\tt  [slot]}}\label{classKHelpMenu_i0}


Opens 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. 

Definition at line 171 of file khelpmenu.cpp.

Referenced by KMain\-Window::app\-Help\-Activated(), KHelp\-Menu(), and menu().\index{KHelpMenu@{KHelp\-Menu}!contextHelpActivated@{contextHelpActivated}}
\index{contextHelpActivated@{contextHelpActivated}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::context\-Help\-Activated ()\hspace{0.3cm}{\tt  [slot]}}\label{classKHelpMenu_i1}


Activates What's This help for the application. 



Definition at line 274 of file khelpmenu.cpp.

References QWhats\-This::enter\-Whats\-This\-Mode(), QWidget::is\-Top\-Level(), QWidget::parent\-Widget(), QCursor::pos(), and QApplication::widget\-At().

Referenced by KHelp\-Menu(), and menu().\index{KHelpMenu@{KHelp\-Menu}!aboutApplication@{aboutApplication}}
\index{aboutApplication@{aboutApplication}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::about\-Application ()\hspace{0.3cm}{\tt  [slot]}}\label{classKHelpMenu_i2}


Opens an application specific dialog box. 

The dialog box will display the string that was defined in the constructor. If that string was empty the {\bf show\-About\-Application}{\rm (p.\,\pageref{classKHelpMenu_l0})}() is emitted instead. 

Definition at line 177 of file khelpmenu.cpp.

References QObject::connect(), KDialog\-Base::disable\-Resize(), QString::is\-Empty(), KDialog::margin\-Hint(), KDialog\-Base::set\-Main\-Widget(), QLabel::set\-Pixmap(), KDialog::set\-Plain\-Caption(), QHBox::set\-Spacing(), QLabel::set\-Text(), QDialog::show(), show\-About\-Application(), and KDialog::spacing\-Hint().

Referenced by KHelp\-Menu(), and menu().\index{KHelpMenu@{KHelp\-Menu}!aboutKDE@{aboutKDE}}
\index{aboutKDE@{aboutKDE}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::about\-KDE ()\hspace{0.3cm}{\tt  [slot]}}\label{classKHelpMenu_i3}


Opens the standard \char`\"{}About KDE\char`\"{} dialog box. 



Definition at line 221 of file khelpmenu.cpp.

References QObject::connect(), and KAbout\-Dialog::show().

Referenced by KHelp\-Menu(), and menu().\index{KHelpMenu@{KHelp\-Menu}!reportBug@{reportBug}}
\index{reportBug@{reportBug}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::report\-Bug ()\hspace{0.3cm}{\tt  [slot]}}\label{classKHelpMenu_i4}


Opens the standard \char`\"{}Report Bugs\char`\"{} dialog box. 



Definition at line 232 of file khelpmenu.cpp.

References QObject::connect(), and QDialog::show().

Referenced by KHelp\-Menu(), and menu().\index{KHelpMenu@{KHelp\-Menu}!showAboutApplication@{showAboutApplication}}
\index{showAboutApplication@{showAboutApplication}!KHelpMenu@{KHelp\-Menu}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KHelp\-Menu::show\-About\-Application ()\hspace{0.3cm}{\tt  [signal]}}\label{classKHelpMenu_l0}


This signal is emitted from {\bf about\-Application}{\rm (p.\,\pageref{classKHelpMenu_i2})}() if no \char`\"{}about application\char`\"{} string has been defined. 

The standard application specific dialog box that is normally activated in {\bf about\-Application}{\rm (p.\,\pageref{classKHelpMenu_i2})}() will not be displayed when this signal is emitted. 

Referenced by about\-Application().

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