KMessageBox

KMessageBox Namespace Reference

Typedefs

typedef QFlags< OptionOptions
 

Enumerations

enum  ButtonCode {
  Ok = 1 , Cancel = 2 , PrimaryAction = 3 , SecondaryAction = 4 ,
  Continue = 5
}
 
enum  DialogType {
  QuestionTwoActions = 1 , WarningTwoActions = 2 , WarningContinueCancel = 3 , WarningTwoActionsCancel = 4 ,
  Information = 5 , Error = 8 , QuestionTwoActionsCancel = 9
}
 
enum  Option {
  Notify = 1 , AllowLink = 2 , Dangerous = 4 , NoExec = 16 ,
  WindowModal = 32
}
 

Functions

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 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, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, 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, const KGuiItem &primaryAction, const KGuiItem &secondaryAction, 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)
 
void saveDontShowAgainContinue (const QString &dontShowAgainName)
 
void saveDontShowAgainTwoActions (const QString &dontShowAgainName, ButtonCode result)
 
void setDontShowAgainConfig (KConfig *cfg)
 
void setDontShowAgainInterface (KMessageBoxDontAskAgainInterface *dontAskAgainInterface)
 
void setNotifyInterface (KMessageBoxNotifyInterface *notifyInterface)
 
bool shouldBeShownContinue (const QString &dontShowAgainName)
 
bool shouldBeShownTwoActions (const QString &dontShowAgainName, ButtonCode &result)
 
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))
 

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.nosp@m.an@k.nosp@m.de.or.nosp@m.g)

Typedef Documentation

◆ Options

Stores a combination of Option values.

Definition at line 82 of file kmessagebox.h.

Enumeration Type Documentation

◆ ButtonCode

Button types.

Enumerator
Ok 

Ok button.

Cancel 

Cancel button.

PrimaryAction 

Primary action button;.

Since
5.100
SecondaryAction 

Secondary action button;.

Since
5.100
Continue 

Continue button.

Definition at line 48 of file kmessagebox.h.

◆ DialogType

Enumerator
QuestionTwoActions 

Question dialog with two buttons;.

Since
5.100
WarningTwoActions 

Warning dialog with two buttons;.

Since
5.100
WarningContinueCancel 

Warning dialog with Continue and Cancel.

WarningTwoActionsCancel 

Warning dialog with two buttons and Cancel;.

Since
5.100
Information 

Information dialog.

Error 

Error dialog.

QuestionTwoActionsCancel 

Question dialog with two buttons and Cancel;.

Since
5.100

Definition at line 56 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.

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 70 of file kmessagebox.h.

Function Documentation

◆ 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 857 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 852 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 1100 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 1095 of file kmessagebox.cpp.

◆ enableAllMessages()

void KMessageBox::enableAllMessages ( )

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

Definition at line 427 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 432 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 812 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 807 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 831 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 1090 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 1085 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 862 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 904 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 1110 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 1105 of file kmessagebox.cpp.

◆ messageBox()

ButtonCode KMessageBox::messageBox ( QWidget * parent,
DialogType type,
const QString & text,
const QString & title,
const KGuiItem & primaryAction,
const KGuiItem & secondaryAction,
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.
secondaryActionThe KGuiItem for the second button.
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 950 of file kmessagebox.cpp.

◆ messageBoxWId()

ButtonCode KMessageBox::messageBoxWId ( WId parent_id,
DialogType type,
const QString & text,
const QString & title,
const KGuiItem & primaryAction,
const KGuiItem & secondaryAction,
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 1115 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 384 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 548 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 986 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 485 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 974 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 963 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 419 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 411 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 437 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

◆ 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 403 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 395 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 626 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 695 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 683 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 1032 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 1021 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 560 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 707 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 771 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 1064 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 1052 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 614 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 1009 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 998 of file kmessagebox.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:40:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.