KDEUI
KMessageBox Class Reference
Easy message dialog box. More...
#include <kmessagebox.h>
Public Types | |
enum | ButtonCode { Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 } |
enum | DialogType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, Sorry = 7, Error = 8, QuestionYesNoCancel = 9 } |
enum | Option { Notify = 1, AllowLink = 2, Dangerous = 4, PlainCaption = 8, NoExec = 16 } |
Static Public Member Functions | |
static void | about (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
static int | createKMessageBox (KDialog *dialog, 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) |
static int | createKMessageBox (KDialog *dialog, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString()) |
static void | detailedError (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
static void | detailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
static void | detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
static void | detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString(), Options options=Notify) |
static void | enableAllMessages () |
static void | enableMessage (const QString &dontShowAgainName) |
static void | error (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
static void | errorList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify) |
static void | errorListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), Options options=Notify) |
static void | errorWId (WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify) |
static void | information (QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
static void | informationList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
static void | informationListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
static void | informationWId (WId parent_id, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify) |
static int | messageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify) |
static int | messageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontShowAskAgainName=QString(), Options options=Notify) |
static int | questionYesNo (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | questionYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | questionYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | questionYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | questionYesNoWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static void | queuedDetailedError (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString()) |
static void | queuedDetailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString()) |
static void | queuedMessageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption=QString()) |
static void | queuedMessageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption, Options options) |
static void | queuedMessageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption=QString()) |
static void | queuedMessageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption, Options options) |
static void | saveDontShowAgainContinue (const QString &dontShowAgainName) |
static void | saveDontShowAgainYesNo (const QString &dontShowAgainName, ButtonCode result) |
static void | setDontShowAskAgainConfig (KConfig *cfg) |
static bool | shouldBeShownContinue (const QString &dontShowAgainName) |
static bool | shouldBeShownYesNo (const QString &dontShowAgainName, ButtonCode &result) |
static void | sorry (QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify) |
static void | sorryWId (WId parent_id, const QString &text, const QString &caption=QString(), Options options=Notify) |
static int | warningContinueCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningContinueCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningContinueCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningContinueCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningYesNo (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
static int | warningYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningYesNoCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningYesNoCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify) |
static int | warningYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
static int | warningYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous)) |
static int | warningYesNoWId (WId parent_id, const QString &text, const QString &caption=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.
- KDE 4 Porting Guide:
- Where applicable, the static functions now take an additional argument to specify the cancel button. Since a default argument is provided, this will affect your code only, if you specified dontAskAgainName and/or options. In those cases, adding an additional parameter KStandardGuiItem::cancel() leads to the old behavior. The following functions are affected (omitting function arguments in the list): questionYesNoCancel(), questionYesNoCancelWId(), warningContinueCancel(), warningContinueCancelWId(), warningContinueCancelList(), warningContinueCancelListWId(), warningYesNoCancel(), warningYesNoCancelWId(), warningYesNoCancelList(), warningYesNoCancelListWId(), messageBox(), messageBoxWId().
Definition at line 60 of file kmessagebox.h.
Member Enumeration Documentation
- Enumerator:
-
QuestionYesNo WarningYesNo WarningContinueCancel WarningYesNoCancel Information Sorry Error QuestionYesNoCancel
Definition at line 75 of file kmessagebox.h.
enum KMessageBox::Option |
- 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. PlainCaption Do not use KApplication::makeStdCaption(). NoExec Do not call exec() in createKMessageBox().
Definition at line 88 of file kmessagebox.h.
Member Function Documentation
void KMessageBox::about | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "About" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("About \<appname\>"). options see Options
The default button is "&OK".
NOTE: The ok button will always have the i18n'ed text '&OK'.
Definition at line 1046 of file kmessagebox.cpp.
int KMessageBox::createKMessageBox | ( | KDialog * | dialog, | |
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 | |||
) | [static] |
Create content and layout of a standard dialog.
- Parameters:
-
dialog The parent dialog base icon A QPixmap containing the icon to be displayed in the dialog next to the text. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox ask The text of the checkbox. If empty none will be shown. checkboxReturn The result of the checkbox. If it's initially true then the checkbox will be checked by default. options see Options details Detailed message string. notifyType The type of notification to send when this message is presentend.
- Returns:
- A KDialog button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the
dialog
(ie. will return KDialog::Yes [256] instead of KMessageBox::Yes [3]). Will return KMessageBox::Cancel if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.
- Note:
- Unless NoExec is used, the
dialog
that is passed in is deleted by this function. Do not delete it yourself.
Definition at line 155 of file kmessagebox.cpp.
int KMessageBox::createKMessageBox | ( | KDialog * | dialog, | |
QMessageBox::Icon | icon, | |||
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | ask, | |||
bool * | checkboxReturn, | |||
Options | options, | |||
const QString & | details = QString() | |||
) | [static] |
Create content and layout of a standard dialog.
- Parameters:
-
dialog The parent dialog base icon Which predefined icon the message box shall show. text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox ask The text of the checkbox. If empty none will be shown. checkboxReturn The result of the checkbox. If it's initially true then the checkbox will be checked by default. options see Options details Detailed message string.
- Returns:
- A KDialog button code, not a KMessageBox button code, based on the buttonmask given to the constructor of the
dialog
(ie. will return KDialog::Yes [256] instead of KMessageBox::Yes [3]). Will return KMessageBox::Cancel if the message box is queued for display instead of exec()ed immediately or if the option NoExec is set.
- Note:
- Unless NoExec is used, the
dialog
that is passed in is deleted by this function. Do not delete it yourself.
Definition at line 145 of file kmessagebox.cpp.
void KMessageBox::detailedError | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Displays an "Error" dialog with a "Details >>" button.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. details Detailed message string. caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
The details
message can conatin additional information about the problem and can be shown on request to advanced/interested users.
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
NOTE: The OK button will always have the i18n'ed text '&OK'.
Definition at line 852 of file kmessagebox.cpp.
void KMessageBox::detailedErrorWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 859 of file kmessagebox.cpp.
void KMessageBox::detailedSorry | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Displays a "Sorry" dialog with a "Details >>" button.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. details Detailed message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). options see Options
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'.
Definition at line 929 of file kmessagebox.cpp.
void KMessageBox::detailedSorryWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 936 of file kmessagebox.cpp.
void KMessageBox::enableAllMessages | ( | ) | [static] |
Enable all messages which have been turned off with the dontShowAgainName
feature.
Definition at line 1014 of file kmessagebox.cpp.
void KMessageBox::enableMessage | ( | const QString & | dontShowAgainName | ) | [static] |
Re-enable a specific dontShowAgainName
messages that had previously been turned off.
Definition at line 1033 of file kmessagebox.cpp.
void KMessageBox::error | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "Error" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
NOTE: The OK button will always have the i18n'ed text '&OK'.
Definition at line 809 of file kmessagebox.cpp.
void KMessageBox::errorList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "Error" dialog with a listbox.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as error(). caption Message box title. The application name is added to the title. The default title is i18n("Error"). options see Options
If your program detects the action specified by the user is somehow not allowed, this should never be reported with error(). Use sorry() instead to explain to the user that this action is not allowed.
The default button is "&OK". Pressing "Esc" selects the OK-button.
NOTE: The OK button will always have the i18n'ed text '&OK'.
Definition at line 821 of file kmessagebox.cpp.
void KMessageBox::errorListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 827 of file kmessagebox.cpp.
void KMessageBox::errorWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 815 of file kmessagebox.cpp.
void KMessageBox::information | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const QString & | dontShowAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "Information" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Information"). dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. options see Options
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 960 of file kmessagebox.cpp.
void KMessageBox::informationList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const QString & | dontShowAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "Information" dialog with a listbox.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as information. caption Message box title. The application name is added to the title. The default title is i18n("Information"). dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. options see Options
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 972 of file kmessagebox.cpp.
void KMessageBox::informationListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const QString & | dontShowAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 979 of file kmessagebox.cpp.
void KMessageBox::informationWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const QString & | dontShowAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 966 of file kmessagebox.cpp.
int KMessageBox::messageBox | ( | QWidget * | parent, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontShowAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Alternate method to show a messagebox:.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel... text Message string. caption Message box title. buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontShowAskAgainName If provided, a checkbox is added with which further questions/information can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No), if the message box needs an answer. The string is used to lookup and store the setting in the applications config file. options see Options Note: for ContinueCancel, buttonYes is the continue button and buttonNo is unused. and for Information, none is used.
- Returns:
- a button code, as defined in KMessageBox.
Definition at line 1072 of file kmessagebox.cpp.
int KMessageBox::messageBoxWId | ( | WId | parent_id, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontShowAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1081 of file kmessagebox.cpp.
int KMessageBox::questionYesNo | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a simple "question" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Option
- Returns:
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
The default button is "Yes". Pressing "Esc" selects "No".
Definition at line 339 of file kmessagebox.cpp.
int KMessageBox::questionYesNoCancel | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a simple "question" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
The default button is "Yes". Pressing "Esc" selects "Cancel".
Definition at line 482 of file kmessagebox.cpp.
int KMessageBox::questionYesNoCancelWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 495 of file kmessagebox.cpp.
int KMessageBox::questionYesNoList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a "question" dialog with a listbox to show information to the user.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
The default button is "Yes". Pressing "Esc" selects "No".
Definition at line 423 of file kmessagebox.cpp.
int KMessageBox::questionYesNoListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 435 of file kmessagebox.cpp.
int KMessageBox::questionYesNoWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 350 of file kmessagebox.cpp.
void KMessageBox::queuedDetailedError | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() | |||
) | [static] |
Like detailedError.
This function will return immediately, the messagebox will be shown once the application enters an event loop and no other messagebox is being shown.
Note that if the parent gets deleted, the messagebox will not be shown.
Definition at line 883 of file kmessagebox.cpp.
void KMessageBox::queuedDetailedErrorWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | details, | |||
const QString & | caption = QString() | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 890 of file kmessagebox.cpp.
void KMessageBox::queuedMessageBox | ( | QWidget * | parent, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption = QString() | |||
) | [static] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Definition at line 1131 of file kmessagebox.cpp.
void KMessageBox::queuedMessageBox | ( | QWidget * | parent, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption, | |||
Options | options | |||
) | [static] |
Like messageBox.
Only for message boxes of type Information, Sorry or Error.
This function will return immediately, the messagebox will be shown once the application enters an event loop and no other messagebox is being shown.
Note that if the parent gets deleted, the messagebox will not be shown.
Definition at line 1118 of file kmessagebox.cpp.
void KMessageBox::queuedMessageBoxWId | ( | WId | parent_id, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption = QString() | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1136 of file kmessagebox.cpp.
void KMessageBox::queuedMessageBoxWId | ( | WId | parent_id, | |
DialogType | type, | |||
const QString & | text, | |||
const QString & | caption, | |||
Options | options | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 1123 of file kmessagebox.cpp.
void KMessageBox::saveDontShowAgainContinue | ( | const QString & | dontShowAgainName | ) | [static] |
Save the fact that the continue/cancel message box should not be shown again.
- Parameters:
-
dontShowAgainName the name that identify the message box. If empty, this method does nothing.
Definition at line 404 of file kmessagebox.cpp.
void KMessageBox::saveDontShowAgainYesNo | ( | const QString & | dontShowAgainName, | |
ButtonCode | result | |||
) | [static] |
Save the fact that the yes/no message box should not be shown again.
- Parameters:
-
dontShowAgainName the name that identify the message box. If empty, this method does nothing. result the value (Yes or No) that should be used as the result for the message box.
Definition at line 389 of file kmessagebox.cpp.
void KMessageBox::setDontShowAskAgainConfig | ( | KConfig * | cfg | ) | [static] |
Use cfg
for all settings related to the dontShowAgainName feature.
If cfg
is 0 (default) KGlobal::config() will be used.
Definition at line 418 of file kmessagebox.cpp.
bool KMessageBox::shouldBeShownContinue | ( | const QString & | dontShowAgainName | ) | [static] |
- Returns:
- true if the corresponding continue/cancel message box should be shown.
- Parameters:
-
dontShowAgainName the name that identify the message box. If empty, true is always returned.
Definition at line 380 of file kmessagebox.cpp.
bool KMessageBox::shouldBeShownYesNo | ( | const QString & | dontShowAgainName, | |
ButtonCode & | result | |||
) | [static] |
- Returns:
- true if the corresponding yes/no message box should be shown.
- Parameters:
-
dontShowAgainName the name that identify the message box. If empty, true is always returned. result is set to the result (Yes or No) that was chosen the last time the message box was shown. Only meaningful, if the message box should not be shown.
Definition at line 361 of file kmessagebox.cpp.
void KMessageBox::sorry | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display an "Sorry" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Sorry"). options see OptionsType
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'.
Definition at line 900 of file kmessagebox.cpp.
void KMessageBox::sorryWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 906 of file kmessagebox.cpp.
int KMessageBox::warningContinueCancel | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a "warning" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonContinue The text for the first button. The default is KStandardGuiItem::cont(). buttonCancel The text for the second button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
Continue
is returned if the Continue-button is pressed.Cancel
is returned if the Cancel-button is pressed.
The default button is buttonContinue. Pressing "Esc" selects "Cancel".
Definition at line 633 of file kmessagebox.cpp.
int KMessageBox::warningContinueCancelList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a "warning" dialog with a listbox to show information to the user.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningContinueCancel. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonContinue The text for the first button. The default is KStandardGuiItem::cont(). buttonCancel The text for the second button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
Continue
is returned if the Continue-button is pressed.Cancel
is returned if the Cancel-button is pressed.
The default button is buttonContinue. Pressing "Esc" selects "Cancel".
Definition at line 657 of file kmessagebox.cpp.
int KMessageBox::warningContinueCancelListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 669 of file kmessagebox.cpp.
int KMessageBox::warningContinueCancelWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonContinue = KStandardGuiItem::cont() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 645 of file kmessagebox.cpp.
int KMessageBox::warningYesNo | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Options(Notify | Dangerous) | |||
) | [static] |
Display a "warning" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.
The default button is "No". Pressing "Esc" selects "No".
Definition at line 552 of file kmessagebox.cpp.
int KMessageBox::warningYesNoCancel | ( | QWidget * | parent, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a Yes/No/Cancel "warning" dialog.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.Cancel
is retunred if the Cancel- button is pressed.
The default button is "Yes". Pressing "Esc" selects "Cancel"
Definition at line 716 of file kmessagebox.cpp.
int KMessageBox::warningYesNoCancelList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
Display a Yes/No/Cancel "warning" dialog with a listbox to show information to the user.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningYesNoCancel. caption Message box title. The application name is added to the title. The default title is i18n("Warning"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). buttonCancel The text for the third button. The default is KStandardGuiItem::cancel(). dontAskAgainName If provided, a checkbox is added with which further questions can be turned off. If turned off all questions will be automatically answered with the last answer (either Yes or No). The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
Yes
is returned if the Yes-button is pressed.No
is returned if the No-button is pressed.Cancel
is retunred if the Cancel- button is pressed.
The default button is "Yes". Pressing "Esc" selects "Cancel"
Definition at line 740 of file kmessagebox.cpp.
int KMessageBox::warningYesNoCancelListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 753 of file kmessagebox.cpp.
int KMessageBox::warningYesNoCancelWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const KGuiItem & | buttonCancel = KStandardGuiItem::cancel() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Notify | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 728 of file kmessagebox.cpp.
int KMessageBox::warningYesNoList | ( | QWidget * | parent, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Options(Notify | Dangerous) | |||
) | [static] |
Display a "warning" dialog with a listbox to show information to the user.
- Parameters:
-
parent If parent
is 0, then the message box becomes an application-global modal dialog box. Ifparent
is a widget, the message box becomes modal relative to parent.text Message string. strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo. caption Message box title. The application name is added to the title. The default title is i18n("Question"). buttonYes The text for the first button. The default is KStandardGuiItem::yes(). buttonNo The text for the second button. The default is KStandardGuiItem::no(). dontAskAgainName If provided, a checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group. If dontAskAgainName
starts with a ':' then the setting is stored in the global config file.options see Options
- Returns:
- 'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
The default button is "No". Pressing "Esc" selects "No".
Definition at line 574 of file kmessagebox.cpp.
int KMessageBox::warningYesNoListWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QStringList & | strlist, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Options(Notify | Dangerous) | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 586 of file kmessagebox.cpp.
int KMessageBox::warningYesNoWId | ( | WId | parent_id, | |
const QString & | text, | |||
const QString & | caption = QString() , |
|||
const KGuiItem & | buttonYes = KStandardGuiItem::yes() , |
|||
const KGuiItem & | buttonNo = KStandardGuiItem::no() , |
|||
const QString & | dontAskAgainName = QString() , |
|||
Options | options = Options(Notify | Dangerous) | |||
) | [static] |
This function accepts the window id of the parent window, instead of QWidget*.
It should be used only when necessary.
Definition at line 563 of file kmessagebox.cpp.
The documentation for this class was generated from the following files: