# class KMessageBox | Easy message dialog box. More...
Definition | `#include <kmessagebox.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum { Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 }

#### Public Static Methods

- static int questionYesNo (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true)
- static int questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true)
- static int warningYesNo (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true)
- static int warningContinueCancel (QWidget *parent, const QString &text, const QString &caption, const QString &buttonContinue, bool notify=true)
- static int warningYesNoCancel (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true)
- static void error (QWidget *parent, const QString &text, const QString &caption = QString::null, bool notify=true)
- static void sorry (QWidget *parent, const QString &text, const QString &caption = QString::null, bool notify=true)
- static void information (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &dontShowAgainName = QString::null, bool notify=true)
- static void enableAllMessages ()
- static void about (QWidget *parent, const QString& text, const QString& caption = QString::null, bool notify=true)

## Detailed Description

Easy message dialog box.

Provides convenience functions for some i18n'ed standard dialogs.

enum { Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 } | ###

Button types.

int questionYesNo (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true) | ### questionYesNo

[static]

Display a simple "question" dialog.

To be used for questions like "Do you have a printer?"

The default button is "Yes". Pressing "Esc" selects "No".

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes | The text for the first button. The default is i18n("&Yes").
buttonNo | The text for the second button. The default is i18n("&No").
notify | Emit a KNotify event.

Returns: 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.

int questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true) | ### questionYesNoList

[static]

Display a "question" dialog with a listbox to show information to the user

To be used for questions like "Do you really want to delete these files?" And show the user exactly which files are going to be deleted in case he presses "Yes"

The default button is "Yes". Pressing "Esc" selects "No".

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo.
caption | Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes | The text for the first button. The default is i18n("&Yes").
buttonNo | The text for the second button. The default is i18n("&No").
notify | Emit a KNotify event.

Returns: 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.

int warningYesNo (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true) | ### warningYesNo

[static]

Display a "warning" dialog.

To be used for questions "Shall I update your configuration?" The text should explain the implication of both options.

The default button is "No". Pressing "Esc" selects "No".

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonYes | The text for the first button. The default is i18n("&Yes").
buttonNo | The text for the second button. The default is i18n("&No").
notify | Emit a KNotify event.

Returns: `Yes` is returned if the Yes-button is pressed. `No` is returned if the No-button is pressed.

int warningContinueCancel (QWidget *parent, const QString &text, const QString &caption, const QString &buttonContinue, bool notify=true) | ### warningContinueCancel

[static]

Display a "warning" dialog.

The second button always has the text "Cancel".

To be used for questions like "You are about to Print. Are you sure?" the continueButton should then be labeled "Print".

The default button is buttonContinue. Pressing "Esc" selects "Cancel".

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonContinue | The text for the first button.
notify | Emit a KNotify event.

Returns: `Continue` is returned if the Continue-button is pressed. `Cancel` is returned if the Cancel-button is pressed.

int warningYesNoCancel (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &buttonYes = QString::null, const QString &buttonNo = QString::null, bool notify=true) | ### warningYesNoCancel

[static]

Display a Yes/No/Cancel "warning" dialog.

To be used for questions "Do you want to save your changes?" The text should explain the implication of choosing 'No'.

The default button is "Yes". Pressing "Esc" selects "Cancel"

NOTE: The cancel button will always have the i18n'ed text '&Cancel'.

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonYes | The text for the first button. The default is i18n("&Yes").
buttonNo | The text for the second button. The default is i18n("&No").
notify | Emit a KNotify event.

Returns: `Yes` is returned if the Yes-button is pressed. `No` is returned if the No-button is pressed. `Cancel` is retunred if the Cancel- button is pressed.

void error (QWidget *parent, const QString &text, const QString &caption = QString::null, bool notify=true) | ### error

[static]

Display an "Error" dialog.

Your program messed up and now it's time to inform the user. To be used for important things like "Sorry, I deleted your hard disk."

If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.

The default button is "&OK". Pressing "Esc" selects the OK-button.

NOTE: The OK button will always have the i18n'ed text '&OK'.

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Error").
notify | Emit a KNotify event.

void sorry (QWidget *parent, const QString &text, const QString &caption = QString::null, bool notify=true) | ### sorry

[static]

Display an "Sorry" dialog.

Either your program messed up and asks for understanding or your user did something stupid.

To be used for small problems like "Sorry, I can't find the file you specified."

The default button is "&OK". Pressing "Esc" selects the OK-button.

NOTE: The ok button will always have the i18n'ed text '&OK'.

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Sorry").
notify | Emit a KNotify event.

void information (QWidget *parent, const QString &text, const QString &caption = QString::null, const QString &dontShowAgainName = QString::null, bool notify=true) | ### information

[static]

Display an "Information" dialog.

Your program wants to tell the user something. To be used for things like: "Your bookmarks have been rearranged."

The default button is "&OK". Pressing "Esc" selects the OK-button.

NOTE: The OK button will always have the i18n'ed text '&OK'.

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("Information").
dontShowAgainName | If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file.
notify | Emit a KNotify event.

void enableAllMessages () | ### enableAllMessages

[static]

Enable all messages which have been turned off with the `dontShowAgainName` feature of the information dialog.

void about (QWidget *parent, const QString& text, const QString& caption = QString::null, bool notify=true) | ### about

[static]

Display an "About" dialog.

Your program wants to show some general information about the application like the authors's names and email addresses.

The default button is "&OK".

NOTE: The ok button will always have the i18n'ed text '&OK'.

Parameters:

parent | If `parent` is 0, then the message box becomes an application-global modal dialog box. If `parent` is a widget, the message box becomes modal relative to parent.
text | Message string. May contain newlines.
caption | Message box title. The application name is added to the title. The default title is i18n("About <appname>").
notify | Emit a KNotify event.

- Version: $Id: kmessagebox.h,v 1.17 2000/09/23 20:33:38 pfeiffer Exp $
- Author: Waldo Bastian (bastian@kde.org)
- Generated: root@i386.ports.openbsd.org on Wed Apr 25 13:58:24 2001, using kdoc 2.0a53.