KMessageBox

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KMessageBox Class Reference

`from PyKDE4.kdeui import *`

## Detailed Description

Easy message dialog box.

Provides convenience functions for some i18n'ed standard dialogs, as well as audible notification via KNotification

The text in message boxes is wrapped automatically. The text may either be plaintext or richtext. If the text is plaintext, a newline-character may be used to indicate the end of a paragraph.

Where applicable, the static functions now take an additional argument to specify the cancel button. Since a default argument is provided, this will affect your code only, if you specified dontAskAgainName and/or options. In those cases, adding an additional parameter KStandardGuiItem.cancel() leads to the old behavior. The following functions are affected (omitting function arguments in the list): questionYesNoCancel(), questionYesNoCancelWId(), warningContinueCancel(), warningContinueCancelWId(), warningContinueCancelList(), warningContinueCancelListWId(), warningYesNoCancel(), warningYesNoCancelWId(), warningYesNoCancelList(), warningYesNoCancelListWId(), messageBox(), messageBoxWId().

"KDE Message Box (using questionYesNo())"

Author:
  Waldo Bastian (bastian@kde.org)

## Enumerations
ButtonCode | { Ok, Cancel, Yes, No, Continue }
DialogType | { QuestionYesNo, WarningYesNo, WarningContinueCancel, WarningYesNoCancel, Information, Sorry, Error, QuestionYesNoCancel }
Option | { Notify, AllowLink, Dangerous, PlainCaption, NoExec }
## Static Methods
| about (QWidget parent, QString text, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
int, bool checkboxReturn | createKMessageBox (KDialog dialog, QMessageBox::Icon icon, QString text, QStringList strlist, QString ask, bool checkboxReturn, KMessageBox.Options options, QString details=QString())
int, bool checkboxReturn | createKMessageBox (KDialog dialog, QIcon icon, QString text, QStringList strlist, QString ask, KMessageBox.Options options, QString details=QString(), QMessageBox::Icon notifyType=QMessageBox.Information)
| detailedError (QWidget parent, QString text, QString details, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| detailedErrorWId (int parent_id, QString text, QString details, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| detailedSorry (QWidget parent, QString text, QString details, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| detailedSorryWId (int parent_id, QString text, QString details, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| enableAllMessages ()
| enableMessage (QString dontShowAgainName)
| error (QWidget parent, QString text, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| errorList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| errorListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| errorWId (int parent_id, QString text, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| information (QWidget parent, QString text, QString caption=QString(), QString dontShowAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
| informationList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), QString dontShowAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
| informationListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), QString dontShowAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
| informationWId (int parent_id, QString text, QString caption=QString(), QString dontShowAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | messageBox (QWidget parent, KMessageBox.DialogType type, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontShowAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | messageBoxWId (int parent_id, KMessageBox.DialogType type, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontShowAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNo (QWidget parent, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNoCancel (QWidget parent, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNoCancelWId (int parent_id, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNoList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNoListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | questionYesNoWId (int parent_id, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
| queuedDetailedError (QWidget parent, QString text, QString details, QString caption=QString())
| queuedDetailedErrorWId (int parent_id, QString text, QString details, QString caption=QString())
| queuedMessageBox (QWidget parent, KMessageBox.DialogType type, QString text, QString caption, KMessageBox.Options options)
| queuedMessageBox (QWidget parent, KMessageBox.DialogType type, QString text, QString caption=QString())
| queuedMessageBoxWId (int parent_id, KMessageBox.DialogType type, QString text, QString caption, KMessageBox.Options options)
| queuedMessageBoxWId (int parent_id, KMessageBox.DialogType type, QString text, QString caption=QString())
| saveDontShowAgainContinue (QString dontShowAgainName)
| saveDontShowAgainYesNo (QString dontShowAgainName, KMessageBox.ButtonCode result)
| setDontShowAskAgainConfig (KConfig cfg)
bool | shouldBeShownContinue (QString dontShowAgainName)
bool | shouldBeShownYesNo (QString dontShowAgainName, KMessageBox.ButtonCode result)
| sorry (QWidget parent, QString text, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
| sorryWId (int parent_id, QString text, QString caption=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningContinueCancel (QWidget parent, QString text, QString caption=QString(), KGuiItem buttonContinue=KStandardGuiItem.cont(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningContinueCancelList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonContinue=KStandardGuiItem.cont(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningContinueCancelListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonContinue=KStandardGuiItem.cont(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningContinueCancelWId (int parent_id, QString text, QString caption=QString(), KGuiItem buttonContinue=KStandardGuiItem.cont(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningYesNo (QWidget parent, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous))
int | warningYesNoCancel (QWidget parent, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningYesNoCancelList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningYesNoCancelListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningYesNoCancelWId (int parent_id, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), KGuiItem buttonCancel=KStandardGuiItem.cancel(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Notify)
int | warningYesNoList (QWidget parent, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous))
int | warningYesNoListWId (int parent_id, QString text, QStringList strlist, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous))
int | warningYesNoWId (int parent_id, QString text, QString caption=QString(), KGuiItem buttonYes=KStandardGuiItem.yes(), KGuiItem buttonNo=KStandardGuiItem.no(), QString dontAskAgainName=QString(), KMessageBox.Options options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous))

## Static Method Documentation

about | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "About" dialog.

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.
  | caption | Message box title. The application name is added to the title. The default title is i18n("About <appname>").
  | options | see Options

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

int, bool checkboxReturn createKMessageBox | ( | KDialog | dialog,
|  | QMessageBox::Icon | icon,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | ask,
|  | bool | checkboxReturn,
|  | KMessageBox.Options | options,
|  | QString | details=QString()
| ) |  |  |

Create content and layout of a standard dialog

Parameters:

  | dialog | The parent dialog base
  | icon | A QPixmap containing the icon to be displayed in the dialog next to the text.
  | text | Message string.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox
  | ask | The text of the checkbox. If empty none will be shown.
  | checkboxReturn | The result of the checkbox. If it's initially true then the checkbox will be checked by default. May be 0.
  | options | see Options
  | details | Detailed message string.
  | notifyType | The type of notification to send when this message is presentend.

Returns:
  A KDialog button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the

dialog (ie. will return KDialog.Yes [256] instead of KMessageBox.Yes [3]). Will return KMessageBox.Cancel if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.

Note:
  Unless NoExec is used, the dialog that is passed in is deleted by this function. Do not delete it yourself.

int, bool checkboxReturn createKMessageBox | ( | KDialog | dialog,
|  | QIcon | icon,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | ask,
|  | KMessageBox.Options | options,
|  | QString | details=QString(),
|  | QMessageBox::Icon | notifyType=QMessageBox.Information
| ) |  |  |

Create content and layout of a standard dialog

Parameters:

  | dialog | The parent dialog base
  | icon | A QPixmap containing the icon to be displayed in the dialog next to the text.
  | text | Message string.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox
  | ask | The text of the checkbox. If empty none will be shown.
  | checkboxReturn | The result of the checkbox. If it's initially true then the checkbox will be checked by default. May be 0.
  | options | see Options
  | details | Detailed message string.
  | notifyType | The type of notification to send when this message is presentend.

Returns:
  A KDialog button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the

dialog (ie. will return KDialog.Yes [256] instead of KMessageBox.Yes [3]). Will return KMessageBox.Cancel if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.

Note:
  Unless NoExec is used, the dialog that is passed in is deleted by this function. Do not delete it yourself.

detailedError | ( | QWidget | parent,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Displays an "Error" dialog with a "Details >>" button.

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.
  | details | Detailed message string.
  | caption | Message box title. The application name is added to the title. The default title is i18n("Error").
  | options | see Options

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

The details message can contain additional information about the problem and can be shown on request to advanced/interested users.

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

detailedErrorWId | ( | int | parent_id,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

detailedSorry | ( | QWidget | parent,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Displays a "Sorry" dialog with a "Details >>" button.

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.
  | details | Detailed message string.
  | caption | Message box title. The application name is added to the title. The default title is i18n("Sorry").
  | options | see Options

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

And then details can contain something like "foobar.txt was not found in any of the following directories: /usr/bin,/usr/local/bin,/usr/sbin"

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

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

detailedSorryWId | ( | int | parent_id,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

enableAllMessages | ( |  | ) |

Enable all messages which have been turned off with the dontShowAgainName feature.

enableMessage | ( | QString | dontShowAgainName
| ) |  |  |

Re-enable a specific dontShowAgainName messages that had previously been turned off.

See also:
  saveDontShowAgainYesNo()

See also:
  saveDontShowAgainContinue()

error | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "Error" dialog.

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.
  | caption | Message box title. The application name is added to the title. The default title is i18n("Error").
  | options | see Options

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

errorList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "Error" dialog with a listbox.

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.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as error().
  | caption | Message box title. The application name is added to the title. The default title is i18n("Error").
  | options | see Options

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

errorListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

errorWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

information | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | QString | dontShowAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "Information" dialog.

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.
  | 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. The setting is stored in the "Notification Messages" group.
  | options | see Options

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

informationList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | QString | dontShowAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "Information" dialog with a listbox.

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.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as information.
  | 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. The setting is stored in the "Notification Messages" group.
  | options | see Options

Your program wants to tell the user something. To be used for things like: "The following 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'.

informationListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | QString | dontShowAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

informationWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | QString | dontShowAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int messageBox | ( | QWidget | parent,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontShowAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Alternate method to show a messagebox:

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.
  | type | type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
  | text | Message string.
  | caption | Message box title.
  | buttonYes | The text for the first button. The default is KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | buttonCancel | The text for the third button. The default is KStandardGuiItem.cancel().
  | dontShowAskAgainName | If provided, a checkbox is added with which further questions/information can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No), if the message box needs an answer. The string is used to lookup and store the setting in the applications config file.
  | options | see Options Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused. and for Information, none is used.

Returns:
  a button code, as defined in KMessageBox.

int messageBoxWId | ( | int | parent_id,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontShowAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int questionYesNo | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display a simple "question" dialog.

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Option

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

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

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

int questionYesNoCancel | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display a simple "question" dialog.

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | buttonCancel | The text for the third button. The default is KStandardGuiItem.cancel().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

To be used for questions like "Do you want to discard the message or save it for later?",

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

int questionYesNoCancelWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int questionYesNoList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

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

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

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

int questionYesNoListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int questionYesNoWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

queuedDetailedError | ( | QWidget | parent,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString()
| ) |  |  |

Like detailedError

This function will return immediately, the messagebox will be shown once the application enters an event loop and no other messagebox is being shown.

Note that if the parent gets deleted, the messagebox will not be shown.

queuedDetailedErrorWId | ( | int | parent_id,
|  | QString | text,
|  | QString | details,
|  | QString | caption=QString()
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

queuedMessageBox | ( | QWidget | parent,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption,
|  | KMessageBox.Options | options
| ) |  |  |

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

queuedMessageBox | ( | QWidget | parent,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption=QString()
| ) |  |  |

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

queuedMessageBoxWId | ( | int | parent_id,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption,
|  | KMessageBox.Options | options
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

queuedMessageBoxWId | ( | int | parent_id,
|  | KMessageBox.DialogType | type,
|  | QString | text,
|  | QString | caption=QString()
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

saveDontShowAgainContinue | ( | QString | dontShowAgainName
| ) |  |  |

Save the fact that the continue/cancel message box should not be shown again.

Parameters:

  | dontShowAgainName | the name that identify the message box. If empty, this method does nothing.

saveDontShowAgainYesNo | ( | QString | dontShowAgainName,
|  | KMessageBox.ButtonCode | result
| ) |  |  |

Save the fact that the yes/no message box should not be shown again.

Parameters:

  | dontShowAgainName | the name that identify the message box. If empty, this method does nothing.
  | result | the value (Yes or No) that should be used as the result for the message box.

setDontShowAskAgainConfig | ( | KConfig | cfg
| ) |  |  |

Use cfg for all settings related to the dontShowAgainName feature. If cfg is 0 (default) KGlobal.config() will be used.

bool shouldBeShownContinue | ( | QString | dontShowAgainName
| ) |  |  |

Returns:
  true if the corresponding continue/cancel message box should be shown.

Parameters:

  | dontShowAgainName | the name that identify the message box. If empty, true is always returned.

bool shouldBeShownYesNo | ( | QString | dontShowAgainName,
|  | KMessageBox.ButtonCode | result
| ) |  |  |

Returns:
  true if the corresponding yes/no message box should be shown.

Parameters:

  | dontShowAgainName | the name that identify the message box. If empty, true is always returned.
  | result | is set to the result (Yes or No) that was chosen the last time the message box was shown. Only meaningful, if the message box should not be shown.

sorry | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display an "Sorry" dialog.

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.
  | caption | Message box title. The application name is added to the title. The default title is i18n("Sorry").
  | options | see OptionsType

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

sorryWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningContinueCancel | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonContinue=KStandardGuiItem.cont(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display a "warning" dialog.

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.
  | 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. The default is KStandardGuiItem.cont().
  | buttonCancel | The text for the second button. The default is KStandardGuiItem.cancel().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

Cancel is returned if the Cancel-button is pressed.

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

int warningContinueCancelList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonContinue=KStandardGuiItem.cont(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display a "warning" dialog with a listbox to show information to the user.

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.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningContinueCancel.
  | 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. The default is KStandardGuiItem.cont().
  | buttonCancel | The text for the second button. The default is KStandardGuiItem.cancel().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

Cancel is returned if the Cancel-button is pressed.

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

int warningContinueCancelListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonContinue=KStandardGuiItem.cont(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningContinueCancelWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonContinue=KStandardGuiItem.cont(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningYesNo | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous)
| ) |  |  |

Display a "warning" dialog.

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

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

int warningYesNoCancel | ( | QWidget | parent,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

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

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | buttonCancel | The text for the third button. The default is KStandardGuiItem.cancel().
  | dontAskAgainName | If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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.

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"

int warningYesNoCancelList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

Display a Yes/No/Cancel "warning" dialog with a listbox to show information to the user.

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.
  | strlist | List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningYesNoCancel.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | buttonCancel | The text for the third button. The default is KStandardGuiItem.cancel().
  | dontAskAgainName | If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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.

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"

int warningYesNoCancelListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningYesNoCancelWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | KGuiItem | buttonCancel=KStandardGuiItem.cancel(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Notify
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningYesNoList | ( | QWidget | parent,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous)
| ) |  |  |

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

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.
  | 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 KStandardGuiItem.yes().
  | buttonNo | The text for the second button. The default is KStandardGuiItem.no().
  | dontAskAgainName | If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName starts with a ':' then the setting is stored in the global config file.
  | options | see Options

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

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 "No". Pressing "Esc" selects "No".

int warningYesNoListWId | ( | int | parent_id,
|  | QString | text,
|  | QStringList | strlist,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous)
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

int warningYesNoWId | ( | int | parent_id,
|  | QString | text,
|  | QString | caption=QString(),
|  | KGuiItem | buttonYes=KStandardGuiItem.yes(),
|  | KGuiItem | buttonNo=KStandardGuiItem.no(),
|  | QString | dontAskAgainName=QString(),
|  | KMessageBox.Options | options=KMessageBox.Options(KMessageBox.Notify|KMessageBox.Dangerous)
| ) |  |  |

This function accepts the window id of the parent window, instead of QWidget*. It should be used only when necessary.

## Enumeration Documentation

ButtonCode

Button types.

Enumerator:

  Ok = 1 |
  Cancel = 2 |
  Yes = 3 |
  No = 4 |
  Continue = 5 |

DialogType

Enumerator:

  QuestionYesNo = 1 |
  WarningYesNo = 2 |
  WarningContinueCancel = 3 |
  WarningYesNoCancel = 4 |
  Information = 5 |
  Sorry = 7 |
  Error = 8 |
  QuestionYesNoCancel = 9 |

Option

Enumerator:

  EditTime = 0x0001 |
  SelectTime = 0x0002 |
  ForceTime = 0x0004 |
  WarnOnInvalid = 0x0008 |