kdeui Library: KHelpMenu Class Reference (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KHelpMenu Class Reference

Standard KDE help menu with dialog boxes. More...

`#include <khelpmenu.h>`

Inheritance diagram for KHelpMenu:

[legend]
Collaboration diagram for KHelpMenu:

[legend]
List of all members.

## Public Types
enum | MenuId { menuHelpContents = 0, menuWhatsThis = 1, menuAboutApp = 2, menuAboutKDE = 3, menuReportBug = 4 }
## Public Slots
void | appHelpActivated ()
void | contextHelpActivated ()
void | aboutApplication ()
void | aboutKDE ()
void | reportBug ()
## Signals
void | showAboutApplication ()
## Public Member Functions
| KHelpMenu (QWidget *parent=0, const QString &aboutAppText=QString::null, bool showWhatsThis=true)
| KHelpMenu (QWidget *parent, const KAboutData *aboutData, bool showWhatsThis=true, KActionCollection *actions=0)
| ~KHelpMenu ()
KPopupMenu * | menu ()
## Protected Member Functions
virtual void | virtual_hook (int id, void *data)

## Detailed Description

Standard KDE help menu with dialog boxes.

This class provides the standard KDE help menu with the default "about" dialog boxes and help entry.

This class is used in KMainWindow 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 KMainWindow you should use this class.

The usage is simple:

     mHelpMenu = new KHelpMenu( this, <someText> );
     kmenubar->insertItem(i18n("&Help"), mHelpMenu->menu() );

or if you just want to open a dialog box:

     mHelpMenu = new KHelpMenu( this, <someText> );
     connect( this, SIGNAL(someSignal()), mHelpMenu,SLOT(mHelpMenu->aboutKDE()));

IMPORTANT: The first time you use KHelpMenu::menu(), a KPopupMenu object is allocated. Only one object is created by the class so if you call KHelpMenu::menu() 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 KHelpMenu object will be deleted when its parent is destroyed but you can delete it yourself if you want. The code below will always work.

     MyClass::~MyClass()
     {
       delete mHelpMenu;
     }

Using your own "about application" dialog box:

The standard "about application" 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 showAboutApplication signal (preferred)

     void MyClass::myFunc()
     {
       ..
       KHelpMenu *helpMenu = new KHelpMenu( this );
       connect( helpMenu, SIGNAL(showAboutApplication()),
              this, SLOT(myDialogSlot()));
       ..
     }

     void MyClass::myDialogSlot()
     {
       <activate your custom dialog>
     }

Example 2 Old style - connecting directly to the menu entry.

     void MyClass::myFunc()
     {
       KHelpMenu *helpMenu = new KHelpMenu( this );
       KPopupMenu *help = mHelpMenu->menu();
       help->connectItem( KHelpMenu::menuAboutApp, this, SLOT(myDialogSlot()) );
     }

     void MyClass::myDialogSlot()
     {
       <activate your custom dialog>
     }

Author:
  Espen Sand (espen@kde.org)

Definition at line 131 of file khelpmenu.h.

## Constructor & Destructor Documentation

KHelpMenu::KHelpMenu | ( | QWidget * | parent = `0`,
|  | const QString & | aboutAppText = `QString::null`,
|  | bool | showWhatsThis = `true`
| ) |

  | Constructor. Parameters:
  | parent | The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
  | aboutAppText | 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 showAboutApplication() for more information.
  | showWhatsThis | Decides whether a "Whats this" entry will be added to the dialog.
Definition at line 61 of file khelpmenu.cpp.

KHelpMenu::KHelpMenu | ( | QWidget * | parent,
|  | const KAboutData * | aboutData,
|  | bool | showWhatsThis = `true`,
|  | KActionCollection * | actions = `0`
| ) |

  | Constructor. This alternative constructor is mainly useful if you want to overide the standard actions (aboutApplication(), aboutKDE(), helpContents(), reportBug, and optionally whatsThis). Parameters:
  | parent | The parent of the dialog boxes. The boxes are modeless and will be centered with respect to the parent.
  | aboutData | User and app data used in the About app dialog
  | showWhatsThis | Decides whether a "Whats this" entry will be added to the dialog.
  | actions | KActionCollection that is used instead of the standard actions.
Definition at line 72 of file khelpmenu.cpp. References KStdAction::aboutApp(), aboutApplication(), aboutKDE(), KStdAction::aboutKDE(), appHelpActivated(), contextHelpActivated(), KStdAction::helpContents(), reportBug(), KStdAction::reportBug(), and KStdAction::whatsThis().

KHelpMenu::~KHelpMenu | ( |  | ) |

| Destructor. Destroys dialogs and the menu pointer retuned by menu Definition at line 96 of file khelpmenu.cpp.

## Member Function Documentation

KPopupMenu * KHelpMenu::menu | ( |  | ) |

| 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 106 of file khelpmenu.cpp. References aboutApplication(), KInstance::aboutData(), aboutKDE(), appHelpActivated(), KAboutData::bugAddress(), QObject::connect(), QPopupMenu::connectItem(), contextHelpActivated(), QObject::destroyed(), QString::fromLatin1(), QToolButton::iconSet(), QPopupMenu::insertItem(), QPopupMenu::insertSeparator(), KGlobal::instance(), QString::isEmpty(), KAboutData::programName(), reportBug(), QPopupMenu::setAccel(), and QWhatsThis::whatsThisButton(). Referenced by KMainWindow::customHelpMenu(), and KMainWindow::helpMenu().

void KHelpMenu::appHelpActivated | ( |  | ) | `[slot]`

| 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 <appName>/index.html. Definition at line 172 of file khelpmenu.cpp. Referenced by KMainWindow::appHelpActivated(), KHelpMenu(), and menu().

void KHelpMenu::contextHelpActivated | ( |  | ) | `[slot]`

| Activates What's This help for the application. Definition at line 275 of file khelpmenu.cpp. References QWhatsThis::enterWhatsThisMode(), QWidget::isTopLevel(), QWidget::parentWidget(), and QApplication::widgetAt(). Referenced by KHelpMenu(), and menu().

void KHelpMenu::aboutApplication | ( |  | ) | `[slot]`

| 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 showAboutApplication() is emitted instead. Definition at line 178 of file khelpmenu.cpp. References QObject::connect(), KDialogBase::disableResize(), QString::isEmpty(), KDialogBase::setMainWidget(), QLabel::setPixmap(), KDialog::setPlainCaption(), QHBox::setSpacing(), QLabel::setText(), QDialog::show(), and showAboutApplication(). Referenced by KHelpMenu(), and menu().

void KHelpMenu::aboutKDE | ( |  | ) | `[slot]`

| Opens the standard "About KDE" dialog box. Definition at line 222 of file khelpmenu.cpp. References QObject::connect(), and KAboutDialog::show(). Referenced by KHelpMenu(), and menu().

void KHelpMenu::reportBug | ( |  | ) | `[slot]`

| Opens the standard "Report Bugs" dialog box. Definition at line 233 of file khelpmenu.cpp. References QObject::connect(), and QDialog::show(). Referenced by KHelpMenu(), and menu().

void KHelpMenu::showAboutApplication | ( |  | ) | `[signal]`

| This signal is emitted from aboutApplication() if no "about application" string has been defined. The standard application specific dialog box that is normally activated in aboutApplication() will not be displayed when this signal is emitted. Referenced by aboutApplication().

The documentation for this class was generated from the following files:

- khelpmenu.h
- khelpmenu.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:21:21 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003