KMessageBox

KMessageBox Namespace Reference

Typedefs

typedef QFlags< OptionOptions
 

Enumerations

enum  ButtonCode {
  Ok = 1, Cancel = 2, PrimaryAction = 3, SecondaryAction = 4,
  Yes = PrimaryAction, No = SecondaryAction, Continue = 5
}
 
enum  DialogType {
  QuestionTwoActions = 1, WarningTwoActions = 2, WarningContinueCancel = 3, WarningTwoActionsCancel = 4,
  Information = 5, Sorry = 7, Error = 8, QuestionTwoActionsCancel = 9,
  QuestionYesNo = QuestionTwoActions, WarningYesNo = WarningTwoActions, WarningYesNoCancel = WarningTwoActionsCancel, QuestionYesNoCancel = QuestionTwoActionsCancel
}
 
enum  Option {
  Notify = 1, AllowLink = 2, Dangerous = 4, PlainCaption = 8,
  NoExec = 16, WindowModal = 32
}
 

Functions

void about (QWidget *parent, const QString &text, const QString &title=QString(), Options options=Notify)
 
QDialogButtonBox::StandardButton createKMessageBox (QDialog *dialog, QDialogButtonBox *buttons, const QIcon &icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString(), QMessageBox::Icon notifyType=QMessageBox::Information)
 
QDialogButtonBox::StandardButton createKMessageBox (QDialog *dialog, QDialogButtonBox *buttons, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString())
 
void detailedError (QWidget *parent, const QString &text, const QString &details, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void detailedError (QWidget *parent, const QString &text, const QString &details, const QString &title=QString(), Options options=Notify)
 
void detailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void detailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &title=QString(), Options options=Notify)
 
void detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &title=QString(), Options options=Notify)
 
void detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &title=QString(), Options options=Notify)
 
void enableAllMessages ()
 
void enableMessage (const QString &dontShowAgainName)
 
void error (QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void error (QWidget *parent, const QString &text, const QString &title=QString(), Options options=Notify)
 
void errorList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), Options options=Notify)
 
void errorListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), Options options=Notify)
 
void errorWId (WId parent_id, const QString &text, const QString &title=QString(), Options options=Notify)
 
void information (QWidget *parent, const QString &text, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
 
void informationList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
 
void informationListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
 
void informationWId (WId parent_id, const QString &text, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
 
ButtonCode messageBox (QWidget *parent, DialogType type, const QString &text, const QString &title=QString(), const KGuiItem &primaryAction=KStandardGuiItem::yes(), const KGuiItem &secondaryAction=KStandardGuiItem::no(), const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify)
 
ButtonCode messageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &title=QString(), const KGuiItem &primaryAction=KStandardGuiItem::yes(), const KGuiItem &secondaryAction=KStandardGuiItem::no(), const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActions (QWidget *parent, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActionsCancel (QWidget *parent, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActionsCancelWId (WId parent_id, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActionsList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActionsListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionTwoActionsWId (WId parent_id, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNo (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNoCancel (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNoCancelWId (WId parent_id, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode questionYesNoWId (WId parent_id, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
void saveDontShowAgainContinue (const QString &dontShowAgainName)
 
void saveDontShowAgainTwoActions (const QString &dontShowAgainName, ButtonCode result)
 
void saveDontShowAgainYesNo (const QString &dontShowAgainName, ButtonCode result)
 
void setDontShowAgainConfig (KConfig *cfg)
 
void setDontShowAgainInterface (KMessageBoxDontAskAgainInterface *dontAskAgainInterface)
 
void setDontShowAskAgainConfig (KConfig *cfg)
 
void setNotifyInterface (KMessageBoxNotifyInterface *notifyInterface)
 
bool shouldBeShownContinue (const QString &dontShowAgainName)
 
bool shouldBeShownTwoActions (const QString &dontShowAgainName, ButtonCode &result)
 
bool shouldBeShownYesNo (const QString &dontShowAgainName, ButtonCode &result)
 
void sorry (QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
 
void sorry (QWidget *parent, const QString &text, const QString &title=QString(), Options options=Notify)
 
void sorryWId (WId parent_id, const QString &text, const QString &title=QString(), Options options=Notify)
 
ButtonCode warningContinueCancel (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningContinueCancelDetailed (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify, const QString &details=QString())
 
ButtonCode warningContinueCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningContinueCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningContinueCancelWId (WId parent_id, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningTwoActions (QWidget *parent, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsCancel (QWidget *parent, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsCancelWId (WId parent_id, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const KGuiItem &cancelAction=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningTwoActionsWId (WId parent_id, const QString &text, const QString &title, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningYesNo (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningYesNoCancel (QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningYesNoCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningYesNoCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningYesNoCancelWId (WId parent_id, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
 
ButtonCode warningYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 
ButtonCode warningYesNoWId (WId parent_id, const QString &text, const QString &title=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous))
 

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.

An information dialog box
Author
Waldo Bastian (basti[email protected][email protected][email protected]de.or[email protected]g)

Typedef Documentation

◆ Options

Stores a combination of Option values.

Definition at line 106 of file kmessagebox.h.

Enumeration Type Documentation

◆ ButtonCode

Button types.

Enumerator
PrimaryAction 
Since
5.100
SecondaryAction 
Since
5.100
Yes 
Deprecated:
Since 5.100, use PrimaryAction.
No 
Deprecated:
Since 5.100, use SecondaryAction.

Definition at line 48 of file kmessagebox.h.

◆ DialogType

Enumerator
QuestionTwoActions 
Since
5.100
WarningTwoActions 
Since
5.100
WarningTwoActionsCancel 
Since
5.100
Sorry 
Deprecated:
Since 5.97, use Error.
QuestionTwoActionsCancel 
Since
5.100
QuestionYesNo 
Deprecated:
Since 5.100, use QuestionTwoActions.
WarningYesNo 
Deprecated:
Since 5.100, use WarningTwoActions.
WarningYesNoCancel 
Deprecated:
Since 5.100, use WarningTwoActionsCancel.
QuestionYesNoCancel 
Deprecated:
Since 5.100, use QuestionTwoActionsCancel.

Definition at line 62 of file kmessagebox.h.

◆ Option

See also
Options
Enumerator
Notify 

Emit a KNotify event.

AllowLink 

The message may contain links.

Dangerous 

The action to be confirmed by the dialog is a potentially destructive one.

The default button will be set to Cancel or SecondaryAction, depending on which is available.

PlainCaption 
Deprecated:
Since 5.0 this option is ignored.
NoExec 

Do not call exec() in createKMessageBox()

WindowModal 

The window is to be modal relative to its parent. By default, it is application modal.

Definition at line 90 of file kmessagebox.h.

Function Documentation

◆ about()

void KMessageBox::about ( QWidget parent,
const QString text,
const QString title = QString(),
Options  options = Notify 
)

Display an "About" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("About \<appname\>").
optionssee 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'.
Deprecated:
Since 5.0, use QMessageBox::about(). No known users of the extre features here.

Definition at line 1098 of file kmessagebox.cpp.

◆ createKMessageBox() [1/2]

QDialogButtonBox::StandardButton KMessageBox::createKMessageBox ( QDialog dialog,
QDialogButtonBox buttons,
const QIcon icon,
const QString text,
const QStringList strlist,
const QString ask,
bool *  checkboxReturn,
Options  options,
const QString details = QString(),
QMessageBox::Icon  notifyType = QMessageBox::Information 
)

Create content and layout of a standard dialog.

Parameters
dialogThe parent dialog base
buttonsa QDialogButtonBox instance. This function will take care of connecting to it.
iconA QPixmap containing the icon to be displayed in the dialog next to the text.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox
askThe text of the checkbox. If empty none will be shown.
checkboxReturnThe result of the checkbox. If it's initially true then the checkbox will be checked by default. May be a null pointer. Incompatible with NoExec.
optionssee Options
detailsDetailed message string.
notifyTypeThe type of notification to send when this message is presentend.
Returns
A QDialogButtonBox::StandardButton button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the dialog (ie. will return QDialogButtonBox::Yes instead of KMessageBox::PrimaryAction). Will return QDialogButtonBox::NoButton 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.

Definition at line 156 of file kmessagebox.cpp.

◆ createKMessageBox() [2/2]

QDialogButtonBox::StandardButton KMessageBox::createKMessageBox ( QDialog dialog,
QDialogButtonBox buttons,
QMessageBox::Icon  icon,
const QString text,
const QStringList strlist,
const QString ask,
bool *  checkboxReturn,
Options  options,
const QString details = QString() 
)

Create content and layout of a standard dialog.

Parameters
dialogThe parent dialog base
buttonsa QDialogButtonBox instance. This function will take care of connecting to it.
iconWhich predefined icon the message box shall show.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox
askThe text of the checkbox. If empty none will be shown.
checkboxReturnThe result of the checkbox. If it's initially true then the checkbox will be checked by default. May be a null pointer. Incompatible with NoExec.
optionssee Options
detailsDetailed message string.
Returns
A QDialogButtonBox::StandardButton button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the dialog (ie. will return QDialogButtonBox::Yes instead of KMessageBox::PrimaryAction). Will return QDialogButtonBox::NoButton 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.

Definition at line 124 of file kmessagebox.cpp.

◆ detailedError() [1/2]

void KMessageBox::detailedError ( QWidget parent,
const QString text,
const QString details,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
detailsDetailed message string.
titleMessage box title. The application name is added to the title. The default title is i18n("Error").
buttonOkThe text for the only button. The default is KStandardGuiItem::ok().
optionssee 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.

There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.

Since
5.97

Definition at line 982 of file kmessagebox.cpp.

◆ detailedError() [2/2]

void KMessageBox::detailedError ( QWidget parent,
const QString text,
const QString details,
const QString title = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
detailsDetailed message string.
titleMessage box title. The application name is added to the title. The default title is i18n("Error").
optionssee 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.

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

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

Definition at line 977 of file kmessagebox.cpp.

◆ detailedErrorWId() [1/2]

void KMessageBox::detailedErrorWId ( WId  parent_id,
const QString text,
const QString details,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Since
5.97

Definition at line 1414 of file kmessagebox.cpp.

◆ detailedErrorWId() [2/2]

void KMessageBox::detailedErrorWId ( WId  parent_id,
const QString text,
const QString details,
const QString title = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1409 of file kmessagebox.cpp.

◆ detailedSorry() [1/2]

void KMessageBox::detailedSorry ( QWidget parent,
const QString text,
const QString details,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
detailsDetailed message string.
titleMessage box title. The application name is added to the title. The default title is i18n("Sorry").
buttonOkThe text for the only button. The default is KStandardGuiItem::ok().
optionssee 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"

There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.

Since
5.63
Deprecated:
Since 5.97 use detailedError().

Definition at line 1044 of file kmessagebox.cpp.

◆ detailedSorry() [2/2]

void KMessageBox::detailedSorry ( QWidget parent,
const QString text,
const QString details,
const QString title = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
detailsDetailed message string.
titleMessage box title. The application name is added to the title. The default title is i18n("Sorry").
optionssee 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'. See the overload with a KGuiItem argument to change that.
Deprecated:
Since 5.97 use detailedError().

Definition at line 1037 of file kmessagebox.cpp.

◆ detailedSorryWId() [1/2]

void KMessageBox::detailedSorryWId ( WId  parent_id,
const QString text,
const QString details,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Since
5.63
Deprecated:
Since 5.97 use detailedErrorWId().

Definition at line 1447 of file kmessagebox.cpp.

◆ detailedSorryWId() [2/2]

void KMessageBox::detailedSorryWId ( WId  parent_id,
const QString text,
const QString details,
const QString title = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.97 use detailedErrorWId().

Definition at line 1440 of file kmessagebox.cpp.

◆ enableAllMessages()

void KMessageBox::enableAllMessages ( )

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

Definition at line 468 of file kmessagebox.cpp.

◆ enableMessage()

void KMessageBox::enableMessage ( const QString dontShowAgainName)

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

See also
saveDontShowAgainTwoActions()
saveDontShowAgainContinue()

Definition at line 473 of file kmessagebox.cpp.

◆ error() [1/2]

void KMessageBox::error ( QWidget parent,
const QString text,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

Display an "Error" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Error").
buttonOkThe text for the only button. The default is KStandardGuiItem::ok().
optionssee Options

There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.

Since
5.97

Definition at line 937 of file kmessagebox.cpp.

◆ error() [2/2]

void KMessageBox::error ( QWidget parent,
const QString text,
const QString title = QString(),
Options  options = Notify 
)

Display an "Error" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Error").
optionssee 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 default button is "&OK". Pressing "Esc" selects the OK-button.

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

Definition at line 932 of file kmessagebox.cpp.

◆ errorList()

void KMessageBox::errorList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
Options  options = Notify 
)

Display an "Error" dialog with a listbox.

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as error().
titleMessage box title. The application name is added to the title. The default title is i18n("Error").
optionssee 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 default button is "&OK". Pressing "Esc" selects the OK-button.

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

Definition at line 956 of file kmessagebox.cpp.

◆ errorListWId()

void KMessageBox::errorListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1404 of file kmessagebox.cpp.

◆ errorWId()

void KMessageBox::errorWId ( WId  parent_id,
const QString text,
const QString title = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1399 of file kmessagebox.cpp.

◆ information()

void KMessageBox::information ( QWidget parent,
const QString text,
const QString title = QString(),
const QString dontShowAgainName = QString(),
Options  options = Notify 
)

Display an "Information" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Information").
dontShowAgainNameIf 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.
optionssee 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'.

Definition at line 1050 of file kmessagebox.cpp.

◆ informationList()

void KMessageBox::informationList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
const QString dontShowAgainName = QString(),
Options  options = Notify 
)

Display an "Information" dialog with a listbox.

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as information.
titleMessage box title. The application name is added to the title. The default title is i18n("Information").
dontShowAgainNameIf 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.
optionssee 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'.

Definition at line 1092 of file kmessagebox.cpp.

◆ informationListWId()

void KMessageBox::informationListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
const QString dontShowAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1458 of file kmessagebox.cpp.

◆ informationWId()

void KMessageBox::informationWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const QString dontShowAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1453 of file kmessagebox.cpp.

◆ messageBox()

ButtonCode KMessageBox::messageBox ( QWidget parent,
DialogType  type,
const QString text,
const QString title = QString(),
const KGuiItem primaryAction = KStandardGuiItem::yes(),
const KGuiItem secondaryAction = KStandardGuiItem::no(),
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontShowAskAgainName = QString(),
Options  options = Notify 
)

Alternate method to show a messagebox:

Parameters
parentParent widget.
typetype of message box: QuestionTwoActions, WarningTwoActions, WarningContinueCancel...
textMessage string.
titleMessage box title.
primaryActionThe KGuiItem for the first button. The default (deprecated since 5.100) is KStandardGuiItem::yes().
secondaryActionThe KGuiItem for the second button. The default (deprecated since 5.100) is KStandardGuiItem::no().
cancelActionThe text for the third button. The default is KStandardGuiItem::cancel().
dontShowAskAgainNameIf 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 PrimaryAction or SecondaryAction), if the message box needs an answer. The string is used to lookup and store the setting in the applications config file.
optionssee Options Note: for ContinueCancel, primaryAction is the continue button and secondaryAction is unused. and for Information, none is used.
Returns
a button code, as defined in KMessageBox.

Definition at line 1167 of file kmessagebox.cpp.

◆ messageBoxWId()

ButtonCode KMessageBox::messageBoxWId ( WId  parent_id,
DialogType  type,
const QString text,
const QString title = QString(),
const KGuiItem primaryAction = KStandardGuiItem::yes(),
const KGuiItem secondaryAction = KStandardGuiItem::no(),
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontShowAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1463 of file kmessagebox.cpp.

◆ questionTwoActions()

ButtonCode KMessageBox::questionTwoActions ( QWidget parent,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a "question" dialog with two action buttons.

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

The default button is the primary button. Pressing "Esc" triggers the secondary button.

Parameters
parentthe parent widget
textthe message string
titlethe message box title. If an empty string, defaults to i18n("Question").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
dontAskAgainNameIf not an empty string, 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.
optionssee Option
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered.
Since
5.100

Definition at line 397 of file kmessagebox.cpp.

◆ questionTwoActionsCancel()

ButtonCode KMessageBox::questionTwoActionsCancel ( QWidget parent,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a "question" dialog with two action buttons and a cancel button.

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

The default button is the primary button. Pressing "Esc" triggers the cancel button.

Parameters
parentthe parent widget
textthe message string
titlethe message box title. If an empty string, defaults to i18n("Question").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
cancelActionthe action for the cancel button
dontAskAgainNameIf not an empty string, 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.
optionssee Option
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered. Cancel if the cancel button is triggered.
Since
5.100

Definition at line 617 of file kmessagebox.cpp.

◆ questionTwoActionsCancelWId()

ButtonCode KMessageBox::questionTwoActionsCancelWId ( WId  parent_id,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
questionTwoActionsCancel()
Since
5.100

Definition at line 1244 of file kmessagebox.cpp.

◆ questionTwoActionsList()

ButtonCode KMessageBox::questionTwoActionsList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a "question" dialog with a listbox to show information to the user and two action buttons.

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.

The default button is the primary button. Pressing "Esc" triggers the secondary button.

Parameters
parentthe parent widget
textthe message string
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionTwoActions().
titlethe message box title. If an empty string, defaults to i18n("Question").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
dontAskAgainNameIf not an empty string, 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.
optionssee Option
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered.
Since
5.100

Definition at line 540 of file kmessagebox.cpp.

◆ questionTwoActionsListWId()

ButtonCode KMessageBox::questionTwoActionsListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
questionTwoActionsList()
Since
5.100

Definition at line 1218 of file kmessagebox.cpp.

◆ questionTwoActionsWId()

ButtonCode KMessageBox::questionTwoActionsWId ( WId  parent_id,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
questionTwoActions()
Since
5.100

Definition at line 1193 of file kmessagebox.cpp.

◆ questionYesNo()

ButtonCode KMessageBox::questionYesNo ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a simple "question" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Question").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
dontAskAgainNameIf 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.
optionssee 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".

Deprecated:
Since 5.100, use questionTwoActions()

Definition at line 385 of file kmessagebox.cpp.

◆ questionYesNoCancel()

ButtonCode KMessageBox::questionYesNoCancel ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a simple "question" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Question").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
buttonCancelThe text for the third button. The default is KStandardGuiItem::cancel().
dontAskAgainNameIf 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.
optionssee 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".

Deprecated:
Since 5.100, use questionTwoActionsCancel()

Definition at line 604 of file kmessagebox.cpp.

◆ questionYesNoCancelWId()

ButtonCode KMessageBox::questionYesNoCancelWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use questionTwoActionsCancelWId()

Definition at line 1231 of file kmessagebox.cpp.

◆ questionYesNoList()

ButtonCode KMessageBox::questionYesNoList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo.
titleMessage box title. The application name is added to the title. The default title is i18n("Question").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
dontAskAgainNameIf 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.
optionssee 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".

Deprecated:
Since 5.100, use questionTwoActionsList()

Definition at line 527 of file kmessagebox.cpp.

◆ questionYesNoListWId()

ButtonCode KMessageBox::questionYesNoListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use questionTwoActionsListWId()

Definition at line 1205 of file kmessagebox.cpp.

◆ questionYesNoWId()

ButtonCode KMessageBox::questionYesNoWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use questionTwoActionsWId()

Definition at line 1181 of file kmessagebox.cpp.

◆ saveDontShowAgainContinue()

void KMessageBox::saveDontShowAgainContinue ( const QString dontShowAgainName)

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

Parameters
dontShowAgainNamethe name that identify the message box. If empty, this method does nothing.

Definition at line 460 of file kmessagebox.cpp.

◆ saveDontShowAgainTwoActions()

void KMessageBox::saveDontShowAgainTwoActions ( const QString dontShowAgainName,
ButtonCode  result 
)

Save the fact that a two actions message box should not be shown again.

Parameters
dontShowAgainNamethe name that identifies the message box. If empty, this method does nothing.
resultthe value (PrimaryAction or SecondaryAction) that should be used as the result for the message box.
Since
5.100

Definition at line 448 of file kmessagebox.cpp.

◆ saveDontShowAgainYesNo()

void KMessageBox::saveDontShowAgainYesNo ( const QString dontShowAgainName,
ButtonCode  result 
)

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

Parameters
dontShowAgainNamethe name that identify the message box. If empty, this method does nothing.
resultthe value (Yes or No) that should be used as the result for the message box.
Deprecated:
Since 5.100, use saveDontShowAgainTwoActions()

Definition at line 439 of file kmessagebox.cpp.

◆ setDontShowAgainConfig()

void KMessageBox::setDontShowAgainConfig ( KConfig cfg)

Use cfg for all settings related to the dontShowAgainName feature.

If cfg is 0 (default) KGlobal::config() will be used.

Definition at line 478 of file kmessagebox.cpp.

◆ setDontShowAgainInterface()

void KMessageBox::setDontShowAgainInterface ( KMessageBoxDontAskAgainInterface dontAskAgainInterface)

Use dontAskAgainInterface for all settings related to the dontShowAgain feature.

This method does not take ownership of dontAskAgainInterface.

Since
5.0

◆ setDontShowAskAgainConfig()

void KMessageBox::setDontShowAskAgainConfig ( KConfig cfg)
inline
Deprecated:
since 5.0, use setDontShowAgainConfig()

Definition at line 1266 of file kmessagebox.h.

◆ setNotifyInterface()

void KMessageBox::setNotifyInterface ( KMessageBoxNotifyInterface notifyInterface)

Use notifyInterface to send notifications.

This method does not take ownership of notifyInterface.

Since
5.0

◆ shouldBeShownContinue()

bool KMessageBox::shouldBeShownContinue ( const QString dontShowAgainName)
Returns
true if the corresponding continue/cancel message box should be shown.
Parameters
dontShowAgainNamethe name that identify the message box. If empty, true is always returned.

Definition at line 430 of file kmessagebox.cpp.

◆ shouldBeShownTwoActions()

bool KMessageBox::shouldBeShownTwoActions ( const QString dontShowAgainName,
ButtonCode result 
)
Parameters
dontShowAgainNamethe name that identifies the message box. If empty, true is always returned.
resultreference to a variable to be set to the choice (PrimaryAction or SecondaryAction) that was chosen the last time the message box was shown. Only meaningful if the message box should not be shown.
Returns
true if the corresponding two actions message box should be shown, false otherwise.
Since
5.100

Definition at line 418 of file kmessagebox.cpp.

◆ shouldBeShownYesNo()

bool KMessageBox::shouldBeShownYesNo ( const QString dontShowAgainName,
ButtonCode result 
)
Returns
true if the corresponding yes/no message box should be shown.
Parameters
dontShowAgainNamethe name that identify the message box. If empty, true is always returned.
resultis 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.
Deprecated:
Since 5.100, use shouldBeShownTwoActions()

Definition at line 409 of file kmessagebox.cpp.

◆ sorry() [1/2]

void KMessageBox::sorry ( QWidget parent,
const QString text,
const QString title,
const KGuiItem buttonOk,
Options  options = Notify 
)

Display a "Sorry" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Sorry").
buttonOkThe text for the only button. The default is KStandardGuiItem::ok().
optionssee 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.

There is only one button, therefore it's the default button, and pressing "Esc" selects it as well.

Since
5.63
Deprecated:
Since 5.97 use error().

Definition at line 1012 of file kmessagebox.cpp.

◆ sorry() [2/2]

void KMessageBox::sorry ( QWidget parent,
const QString text,
const QString title = QString(),
Options  options = Notify 
)

Display a "Sorry" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Sorry").
optionssee 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'. See the overload with a KGuiItem argument to change that.
Deprecated:
Since 5.97, use error().

Definition at line 1005 of file kmessagebox.cpp.

◆ sorryWId()

void KMessageBox::sorryWId ( WId  parent_id,
const QString text,
const QString title = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.97 use errorWId().

Definition at line 1420 of file kmessagebox.cpp.

◆ warningContinueCancel()

ButtonCode KMessageBox::warningContinueCancel ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonContinue = KStandardGuiItem::cont(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

Display a "warning" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Warning").
buttonContinueThe text for the first button. The default is KStandardGuiItem::cont().
buttonCancelThe text for the second button. The default is KStandardGuiItem::cancel().
dontAskAgainNameIf 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.
optionssee 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".

Definition at line 722 of file kmessagebox.cpp.

◆ warningContinueCancelDetailed()

ButtonCode KMessageBox::warningContinueCancelDetailed ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonContinue = KStandardGuiItem::cont(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify,
const QString details = QString() 
)

Display a "warning" dialog with a collapsible "Details" section.

Since
5.61

Definition at line 791 of file kmessagebox.cpp.

◆ warningContinueCancelList()

ButtonCode KMessageBox::warningContinueCancelList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonContinue = KStandardGuiItem::cont(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningContinueCancel.
titleMessage box title. The application name is added to the title. The default title is i18n("Warning").
buttonContinueThe text for the first button. The default is KStandardGuiItem::cont().
buttonCancelThe text for the second button. The default is KStandardGuiItem::cancel().
dontAskAgainNameIf 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.
optionssee 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".

Definition at line 779 of file kmessagebox.cpp.

◆ warningContinueCancelListWId()

ButtonCode KMessageBox::warningContinueCancelListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonContinue = KStandardGuiItem::cont(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1317 of file kmessagebox.cpp.

◆ warningContinueCancelWId()

ButtonCode KMessageBox::warningContinueCancelWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const KGuiItem buttonContinue = KStandardGuiItem::cont(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Definition at line 1306 of file kmessagebox.cpp.

◆ warningTwoActions()

ButtonCode KMessageBox::warningTwoActions ( QWidget parent,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

Display a "warning" dialog with two action buttons.

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

The default button is the secondary button. Pressing "Esc" triggers the secondary button.

Parameters
parentthe parent widget
textthe message string
titlethe message box title. If an empty string, defaults to i18n("Warning").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
dontAskAgainNameIf not an empty string, 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.
optionssee Options
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered.
Since
5.100

Definition at line 642 of file kmessagebox.cpp.

◆ warningTwoActionsCancel()

ButtonCode KMessageBox::warningTwoActionsCancel ( QWidget parent,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

Display a "warning" dialog with two action buttons and a cancel button.

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

The default button is the cancel button. Pressing "Esc" triggers the cancel button.

Parameters
parentthe parent widget
textthe message string
titlethe message box title. If an empty string, defaults to i18n("Warning").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
cancelActionthe action for the cancel button
dontAskAgainNameIf not an empty string, 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.
optionssee Options
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered. Cancel if the cancel button is triggered.
Since
5.100

Definition at line 817 of file kmessagebox.cpp.

◆ warningTwoActionsCancelList()

ButtonCode KMessageBox::warningTwoActionsCancelList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

Display a "warning" dialog with a listbox to show information to the user, two action buttons and a cancel button.

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

The default button is the cancel button. Pressing "Esc" triggers the cancel button.

Parameters
parentthe parent widget
textthe message string
strlista List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningTwoActionsCancel().
titlethe message box title. If an empty string, defaults to i18n("Warning").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
cancelActionthe action for the cancel button
dontAskAgainNameIf not an empty string, 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.
optionssee Options
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered. Cancel if the cancel button is triggered.
Since
5.100

Definition at line 896 of file kmessagebox.cpp.

◆ warningTwoActionsCancelListWId()

ButtonCode KMessageBox::warningTwoActionsCancelListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
warningTwoActionsCancelList()
Since
5.100

Definition at line 1378 of file kmessagebox.cpp.

◆ warningTwoActionsCancelWId()

ButtonCode KMessageBox::warningTwoActionsCancelWId ( WId  parent_id,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const KGuiItem cancelAction = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
warningTwoActionsCancel()
Since
5.100

Definition at line 1351 of file kmessagebox.cpp.

◆ warningTwoActionsList()

ButtonCode KMessageBox::warningTwoActionsList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

Display a "warning" dialog with a listbox to show information to the user and two action buttons.

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

The default button is the secondary button. Pressing "Esc" triggers the secondary button.

Parameters
parentthe parent widget
textthe message string
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningTwoActions.
titlethe message box title. If an empty string, defaults to i18n("Warning").
primaryActionthe action for the primary button
secondaryActionthe action for the secondary button
dontAskAgainNameIf not an empty string, 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.
optionssee Options
Returns
PrimaryAction if the primary button is triggered, SecondaryAction if the secondary button is triggered.
Since
5.100

Definition at line 710 of file kmessagebox.cpp.

◆ warningTwoActionsListWId()

ButtonCode KMessageBox::warningTwoActionsListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
warningTwoActionsList()
Since
5.100

Definition at line 1294 of file kmessagebox.cpp.

◆ warningTwoActionsWId()

ButtonCode KMessageBox::warningTwoActionsWId ( WId  parent_id,
const QString text,
const QString title,
const KGuiItem primaryAction,
const KGuiItem secondaryAction,
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

See also
warningTwoActions()
Since
5.100

Definition at line 1269 of file kmessagebox.cpp.

◆ warningYesNo()

ButtonCode KMessageBox::warningYesNo ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

Display a "warning" dialog.

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Warning").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
dontAskAgainNameIf 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.
optionssee 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".

Deprecated:
Since 5.100, use warningTwoActions()

Definition at line 630 of file kmessagebox.cpp.

◆ warningYesNoCancel()

ButtonCode KMessageBox::warningYesNoCancel ( QWidget parent,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
titleMessage box title. The application name is added to the title. The default title is i18n("Warning").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
buttonCancelThe text for the third button. The default is KStandardGuiItem::cancel().
dontAskAgainNameIf 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.
optionssee 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"

Deprecated:
Since 5.100, use warningTwoActionsCancel()

Definition at line 804 of file kmessagebox.cpp.

◆ warningYesNoCancelList()

ButtonCode KMessageBox::warningYesNoCancelList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

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

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningYesNoCancel.
titleMessage box title. The application name is added to the title. The default title is i18n("Warning").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
buttonCancelThe text for the third button. The default is KStandardGuiItem::cancel().
dontAskAgainNameIf 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.
optionssee 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"

Deprecated:
Since 5.100, use warningTwoActionsCancelList()

Definition at line 882 of file kmessagebox.cpp.

◆ warningYesNoCancelListWId()

ButtonCode KMessageBox::warningYesNoCancelListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use warningTwoActionsCancelListWId()

Definition at line 1364 of file kmessagebox.cpp.

◆ warningYesNoCancelWId()

ButtonCode KMessageBox::warningYesNoCancelWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const KGuiItem buttonCancel = KStandardGuiItem::cancel(),
const QString dontAskAgainName = QString(),
Options  options = Notify 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use warningTwoActionsCancelWId()

Definition at line 1338 of file kmessagebox.cpp.

◆ warningYesNoList()

ButtonCode KMessageBox::warningYesNoList ( QWidget parent,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

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

Parameters
parentParent widget.
textMessage string.
strlistList of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo.
titleMessage box title. The application name is added to the title. The default title is i18n("Question").
buttonYesThe text for the first button. The default is KStandardGuiItem::yes().
buttonNoThe text for the second button. The default is KStandardGuiItem::no().
dontAskAgainNameIf 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.
optionssee 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".

Deprecated:
Since 5.100, use warningTwoActionsList()

Definition at line 697 of file kmessagebox.cpp.

◆ warningYesNoListWId()

ButtonCode KMessageBox::warningYesNoListWId ( WId  parent_id,
const QString text,
const QStringList strlist,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use warningTwoActionsListWId()

Definition at line 1281 of file kmessagebox.cpp.

◆ warningYesNoWId()

ButtonCode KMessageBox::warningYesNoWId ( WId  parent_id,
const QString text,
const QString title = QString(),
const KGuiItem buttonYes = KStandardGuiItem::yes(),
const KGuiItem buttonNo = KStandardGuiItem::no(),
const QString dontAskAgainName = QString(),
Options  options = Options(Notify|Dangerous) 
)

This function accepts the window id of the parent window, instead of QWidget*.

It should be used only when necessary.

Deprecated:
Since 5.100, use warningTwoActionsWId()

Definition at line 1257 of file kmessagebox.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 04:01:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.