kdeui Library API Documentation

KMessageBox Class Reference

Easy message dialog box. More...

#include <kmessagebox.h>

List of all members.

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  OptionsType { Notify = 1, AllowLink = 2, Dangerous = 4 }

Static Public Member Functions

int questionYesNo (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int questionYesNoWId (WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int questionYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int questionYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int questionYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int questionYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningYesNo (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
int warningYesNoWId (WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
int warningYesNoList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
int warningYesNoListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify|Dangerous)
int warningContinueCancel (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningContinueCancelWId (WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningContinueCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningContinueCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningYesNoCancel (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningYesNoCancelWId (WId parent_id, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningYesNoCancelList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
int warningYesNoCancelListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontAskAgainName=QString::null, int options=Notify)
void error (QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
void errorWId (WId parent_id, const QString &text, const QString &caption=QString::null, int options=Notify)
void detailedError (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
void detailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
void queuedDetailedError (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null)
void queuedDetailedErrorWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null)
void sorry (QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
void sorryWId (WId parent_id, const QString &text, const QString &caption=QString::null, int options=Notify)
void detailedSorry (QWidget *parent, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
void detailedSorryWId (WId parent_id, const QString &text, const QString &details, const QString &caption=QString::null, int options=Notify)
void information (QWidget *parent, const QString &text, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
void informationWId (WId parent_id, const QString &text, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
void informationList (QWidget *parent, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
void informationListWId (WId parent_id, const QString &text, const QStringList &strlist, const QString &caption=QString::null, const QString &dontShowAgainName=QString::null, int options=Notify)
void enableAllMessages ()
void enableMessage (const QString &dontShowAgainName)
void about (QWidget *parent, const QString &text, const QString &caption=QString::null, int options=Notify)
int messageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption, const KGuiItem &buttonYes, const KGuiItem &buttonNo, const QString &dontShowAskAgainName, int options=Notify)
int messageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), int options=Notify)
int messageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontShowAskAgainName=QString::null, int options=Notify)
void queuedMessageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption, int options)
void queuedMessageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption, int options)
void queuedMessageBox (QWidget *parent, DialogType type, const QString &text, const QString &caption=QString::null)
void queuedMessageBoxWId (WId parent_id, DialogType type, const QString &text, const QString &caption=QString::null)
bool shouldBeShownYesNo (const QString &dontShowAgainName, ButtonCode &result)
bool shouldBeShownContinue (const QString &dontShowAgainName)
void saveDontShowAgainYesNo (const QString &dontShowAgainName, ButtonCode result)
void saveDontShowAgainContinue (const QString &dontShowAgainName)
void setDontShowAskAgainConfig (KConfig *cfg)
int createKMessageBox (KDialogBase *dialog, QMessageBox::Icon icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, int options, const QString &details=QString::null)
int createKMessageBox (KDialogBase *dialog, QPixmap icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, int options, const QString &details=QString::null, QMessageBox::Icon notifyType=QMessageBox::Information)


Detailed Description

Easy message dialog box.

Provides convenience functions for some i18n'ed standard dialogs.

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.

Author:
Waldo Bastian (bastian@kde.org)

Definition at line 44 of file kmessagebox.h.


Member Enumeration Documentation

enum KMessageBox::ButtonCode
 

Button types.

Definition at line 50 of file kmessagebox.h.

Referenced by questionYesNoCancelWId(), questionYesNoListWId(), warningYesNoCancelListWId(), and warningYesNoListWId().

enum KMessageBox::OptionsType
 

  • Notify Emit a KNotifyClient event
  • AllowLink The message may contain links.

  • Dangerous The action to be confirmed by the dialog is a potentially destructive one
Definition at line 77 of file kmessagebox.h.


Member Function Documentation

int KMessageBox::questionYesNo QWidget parent,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&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 OptionsType
Returns:
'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you have a printer?"

The default button is "Yes". Pressing "Esc" selects "No". Definition at line 304 of file kmessagebox.cpp.

References questionYesNoList().

Referenced by KBugReport::slotOk().

int KMessageBox::questionYesNoWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 316 of file kmessagebox.cpp.

References questionYesNoListWId().

Referenced by messageBoxWId().

int KMessageBox::questionYesNoCancel QWidget parent,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&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 OptionsType
Returns:
'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you want to discard the message or save it for later?",

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

NOTE: The cancel button will always have the i18n'ed text '&Cancel'. Definition at line 435 of file kmessagebox.cpp.

References questionYesNoCancelWId().

int KMessageBox::questionYesNoCancelWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 448 of file kmessagebox.cpp.

References ButtonCode, createKMessageBox(), saveDontShowAgainYesNo(), and shouldBeShownYesNo().

Referenced by messageBoxWId(), and questionYesNoCancel().

int KMessageBox::questionYesNoList QWidget parent,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo.
caption Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&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 OptionsType
Returns:
'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you really want to delete these files?" And show the user exactly which files are going to be deleted in case he presses "Yes"

The default button is "Yes". Pressing "Esc" selects "No". Definition at line 388 of file kmessagebox.cpp.

References questionYesNoListWId().

Referenced by questionYesNo().

int KMessageBox::questionYesNoListWId WId  parent_id,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 401 of file kmessagebox.cpp.

References ButtonCode, createKMessageBox(), saveDontShowAgainYesNo(), and shouldBeShownYesNo().

Referenced by questionYesNoList(), and questionYesNoWId().

int KMessageBox::warningYesNo QWidget parent,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&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 OptionsType
Returns:
Yes is returned if the Yes-button is pressed. No is returned if the No-button is pressed.
To be used for questions "Shall I update your configuration?" The text should explain the implication of both options.

The default button is "No". Pressing "Esc" selects "No". Definition at line 484 of file kmessagebox.cpp.

References warningYesNoList().

Referenced by KBugReport::slotCancel().

int KMessageBox::warningYesNoWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify|Dangerous
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 496 of file kmessagebox.cpp.

References warningYesNoListWId().

Referenced by messageBoxWId().

int KMessageBox::warningYesNoList QWidget parent,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as questionYesNo.
caption Message box title. The application name is added to the title. The default title is i18n("Question").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&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 OptionsType
Returns:
'Yes' is returned if the Yes-button is pressed. 'No' is returned if the No-button is pressed.
To be used for questions like "Do you really want to delete these files?" And show the user exactly which files are going to be deleted in case he presses "Yes"

The default button is "No". Pressing "Esc" selects "No". Definition at line 508 of file kmessagebox.cpp.

References warningYesNoListWId().

Referenced by warningYesNo().

int KMessageBox::warningYesNoListWId WId  parent_id,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify|Dangerous
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 521 of file kmessagebox.cpp.

References ButtonCode, createKMessageBox(), saveDontShowAgainYesNo(), and shouldBeShownYesNo().

Referenced by warningYesNoList(), and warningYesNoWId().

int KMessageBox::warningContinueCancel QWidget parent,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonContinue = KStdGuiItem::cont(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

Display a "warning" dialog.

Parameters:
parent If parent is 0, then the message box becomes an application-global modal dialog box. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonContinue The text for the first button.
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 OptionsType
The second button always has the text "Cancel".

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 560 of file kmessagebox.cpp.

References warningContinueCancelList().

int KMessageBox::warningContinueCancelWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonContinue = KStdGuiItem::cont(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 572 of file kmessagebox.cpp.

References warningContinueCancelListWId().

Referenced by messageBoxWId().

int KMessageBox::warningContinueCancelList QWidget parent,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonContinue = KStdGuiItem::cont(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningContinueCancel.
caption Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonContinue The text for the first button.
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 OptionsType
The second button always has the text "Cancel".

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 584 of file kmessagebox.cpp.

References warningContinueCancelListWId().

Referenced by warningContinueCancel().

int KMessageBox::warningContinueCancelListWId WId  parent_id,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonContinue = KStdGuiItem::cont(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 596 of file kmessagebox.cpp.

References createKMessageBox(), saveDontShowAgainContinue(), and shouldBeShownContinue().

Referenced by warningContinueCancelList(), and warningContinueCancelWId().

int KMessageBox::warningYesNoCancel QWidget parent,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&No").
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 OptionsType
Returns:
Yes is returned if the Yes-button is pressed. No is returned if the No-button is pressed. Cancel is retunred if the Cancel- button is pressed.
To be used for questions "Do you want to save your changes?" The text should explain the implication of choosing 'No'.

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

NOTE: The cancel button will always have the i18n'ed text '&Cancel'. Definition at line 629 of file kmessagebox.cpp.

References warningYesNoCancelList().

int KMessageBox::warningYesNoCancelWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 641 of file kmessagebox.cpp.

References warningYesNoCancelListWId().

Referenced by messageBoxWId().

int KMessageBox::warningYesNoCancelList QWidget parent,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as warningYesNoCancel.
caption Message box title. The application name is added to the title. The default title is i18n("Warning").
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&No").
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 OptionsType
Returns:
Yes is returned if the Yes-button is pressed. No is returned if the No-button is pressed. Cancel is retunred if the Cancel- button is pressed.
To be used for questions "Do you want to save your changes?" The text should explain the implication of choosing 'No'.

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

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

Since:
3.2
Definition at line 653 of file kmessagebox.cpp.

References warningYesNoCancelListWId().

Referenced by warningYesNoCancel().

int KMessageBox::warningYesNoCancelListWId WId  parent_id,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 666 of file kmessagebox.cpp.

References ButtonCode, createKMessageBox(), saveDontShowAgainYesNo(), and shouldBeShownYesNo().

Referenced by warningYesNoCancelList(), and warningYesNoCancelWId().

void KMessageBox::error QWidget parent,
const QString text,
const QString caption = QString::null,
int  options = Notify
[static]
 

Display an "Error" dialog.

Parameters:
parent If parent is 0, then the message box becomes an application-global modal dialog box. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Error").
options see OptionsType
Your program messed up and now it's time to inform the user. To be used for important things like "Sorry, I deleted your hard disk."

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

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

NOTE: The OK button will always have the i18n'ed text '&OK'. Definition at line 701 of file kmessagebox.cpp.

References errorWId().

Referenced by KBugReport::slotOk().

void KMessageBox::errorWId WId  parent_id,
const QString text,
const QString caption = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 708 of file kmessagebox.cpp.

References createKMessageBox().

Referenced by error(), and messageBoxWId().

void KMessageBox::detailedError QWidget parent,
const QString text,
const QString details,
const QString caption = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
details Detailed message string.
caption Message box title. The application name is added to the title. The default title is i18n("Error").
options see OptionsType
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 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 725 of file kmessagebox.cpp.

References detailedErrorWId().

void KMessageBox::detailedErrorWId WId  parent_id,
const QString text,
const QString details,
const QString caption = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 733 of file kmessagebox.cpp.

References createKMessageBox().

Referenced by detailedError(), and queuedDetailedErrorWId().

void KMessageBox::queuedDetailedError QWidget parent,
const QString text,
const QString details,
const QString caption = QString::null
[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 751 of file kmessagebox.cpp.

References queuedDetailedErrorWId().

void KMessageBox::queuedDetailedErrorWId WId  parent_id,
const QString text,
const QString details,
const QString caption = QString::null
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 759 of file kmessagebox.cpp.

References detailedErrorWId().

Referenced by queuedDetailedError().

void KMessageBox::sorry QWidget parent,
const QString text,
const QString caption = QString::null,
int  options = Notify
[static]
 

Display an "Sorry" dialog.

Parameters:
parent If parent is 0, then the message box becomes an application-global modal dialog box. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Sorry").
options see OptionsType
Either your program messed up and asks for understanding or your user did something stupid.

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

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

NOTE: The ok button will always have the i18n'ed text '&OK'. Definition at line 770 of file kmessagebox.cpp.

References sorryWId().

Referenced by KPasswordDialog::slotOk().

void KMessageBox::sorryWId WId  parent_id,
const QString text,
const QString caption = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 777 of file kmessagebox.cpp.

References createKMessageBox().

Referenced by messageBoxWId(), and sorry().

void KMessageBox::detailedSorry QWidget parent,
const QString text,
const QString details,
const QString caption = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
details Detailed message string.
caption Message box title. The application name is added to the title. The default title is i18n("Sorry").
options see OptionsType
Either your program messed up and asks for understanding or your user did something stupid.

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

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 794 of file kmessagebox.cpp.

References detailedSorryWId().

void KMessageBox::detailedSorryWId WId  parent_id,
const QString text,
const QString details,
const QString caption = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 802 of file kmessagebox.cpp.

References createKMessageBox().

Referenced by detailedSorry().

void KMessageBox::information QWidget parent,
const QString text,
const QString caption = QString::null,
const QString dontShowAgainName = QString::null,
int  options = Notify
[static]
 

Display an "Information" dialog.

Parameters:
parent If parent is 0, then the message box becomes an application-global modal dialog box. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("Information").
dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group.
options see OptionsType
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 820 of file kmessagebox.cpp.

References informationList().

Referenced by KBugReport::slotOk().

void KMessageBox::informationWId WId  parent_id,
const QString text,
const QString caption = QString::null,
const QString dontShowAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 827 of file kmessagebox.cpp.

References informationListWId().

Referenced by messageBoxWId().

void KMessageBox::informationList QWidget parent,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const QString dontShowAgainName = QString::null,
int  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. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
strlist List of strings to be written in the listbox. If the list is empty, it doesn't show any listbox, working as information.
caption Message box title. The application name is added to the title. The default title is i18n("Information").
dontShowAgainName If provided, a checkbox is added with which further notifications can be turned off. The string is used to lookup and store the setting in the applications config file. The setting is stored in the "Notification Messages" group.
options see OptionsType
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'.

Since:
3.1
Definition at line 834 of file kmessagebox.cpp.

References informationListWId().

Referenced by information().

void KMessageBox::informationListWId WId  parent_id,
const QString text,
const QStringList strlist,
const QString caption = QString::null,
const QString dontShowAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 842 of file kmessagebox.cpp.

References createKMessageBox(), saveDontShowAgainContinue(), and shouldBeShownContinue().

Referenced by informationList(), and informationWId().

void KMessageBox::enableAllMessages  )  [static]
 

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

Definition at line 869 of file kmessagebox.cpp.

References KGlobal::config(), KConfigBase::deleteEntry(), KConfig::entryMap(), KConfigBase::hasGroup(), and KConfigBase::sync().

void KMessageBox::enableMessage const QString dontShowAgainName  )  [static]
 

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

See also:
saveDontShowAgainYesNo()

saveDontShowAgainContinue()

Since:
3.2
Definition at line 889 of file kmessagebox.cpp.

References KGlobal::config(), KConfigBase::deleteEntry(), KConfigBase::hasGroup(), and KConfigBase::sync().

void KMessageBox::about QWidget parent,
const QString text,
const QString caption = QString::null,
int  options = Notify
[static]
 

Display an "About" dialog.

Parameters:
parent If parent is 0, then the message box becomes an application-global modal dialog box. If parent is a widget, the message box becomes modal relative to parent.
text Message string.
caption Message box title. The application name is added to the title. The default title is i18n("About \<appname\>").
options see OptionsType
Your program wants to show some general information about the application like the authors's names and email addresses.

The default button is "&OK".

NOTE: The ok button will always have the i18n'ed text '&OK'. Definition at line 903 of file kmessagebox.cpp.

References createKMessageBox(), KApplication::icon(), and KApplication::kApplication().

int KMessageBox::messageBox QWidget parent,
DialogType  type,
const QString text,
const QString caption,
const KGuiItem buttonYes,
const KGuiItem buttonNo,
const QString dontShowAskAgainName,
int  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. If parent is a widget, the message box becomes modal relative to parent.
type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
text Message string.
caption Message box title.
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&No").
dontShowAskAgainName If provided, a checkbox is added with which further questions/informations 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 OptionsType 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 927 of file kmessagebox.cpp.

References messageBoxWId().

int KMessageBox::messageBox QWidget parent,
DialogType  type,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
int  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. If parent is a widget, the message box becomes modal relative to parent.
type type of message box: QuestionYesNo, WarningYesNo, WarningContinueCancel...
text Message string.
caption Message box title.
buttonYes The text for the first button. The default is i18n("&Yes").
buttonNo The text for the second button. The default is i18n("&No").
options see OptionsType 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 936 of file kmessagebox.cpp.

References messageBoxWId().

int KMessageBox::messageBoxWId WId  parent_id,
DialogType  type,
const QString text,
const QString caption = QString::null,
const KGuiItem buttonYes = KStdGuiItem::yes(),
const KGuiItem buttonNo = KStdGuiItem::no(),
const QString dontShowAskAgainName = QString::null,
int  options = Notify
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 944 of file kmessagebox.cpp.

References errorWId(), informationWId(), questionYesNoCancelWId(), questionYesNoWId(), sorryWId(), KGuiItem::text(), warningContinueCancelWId(), warningYesNoCancelWId(), and warningYesNoWId().

Referenced by messageBox(), and queuedMessageBoxWId().

void KMessageBox::queuedMessageBox QWidget parent,
DialogType  type,
const QString text,
const QString caption,
int  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 981 of file kmessagebox.cpp.

References queuedMessageBoxWId().

void KMessageBox::queuedMessageBoxWId WId  parent_id,
DialogType  type,
const QString text,
const QString caption,
int  options
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 986 of file kmessagebox.cpp.

References messageBoxWId().

Referenced by queuedMessageBox().

void KMessageBox::queuedMessageBox QWidget parent,
DialogType  type,
const QString text,
const QString caption = QString::null
[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 994 of file kmessagebox.cpp.

References queuedMessageBoxWId().

void KMessageBox::queuedMessageBoxWId WId  parent_id,
DialogType  type,
const QString text,
const QString caption = QString::null
[static]
 

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

It should be used only when necessary.

Since:
3.2
Definition at line 999 of file kmessagebox.cpp.

References messageBoxWId().

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.
Since:
3.2
Definition at line 328 of file kmessagebox.cpp.

References KGlobal::config(), and KConfigBase::readEntry().

Referenced by questionYesNoCancelWId(), questionYesNoListWId(), warningYesNoCancelListWId(), and warningYesNoListWId().

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.
Since:
3.2
Definition at line 348 of file kmessagebox.cpp.

References KGlobal::config(), and KConfigBase::readBoolEntry().

Referenced by informationListWId(), and warningContinueCancelListWId().

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.
Since:
3.2
Definition at line 358 of file kmessagebox.cpp.

References KGlobal::config(), KConfigBase::sync(), and KConfigBase::writeEntry().

Referenced by questionYesNoCancelWId(), questionYesNoListWId(), warningYesNoCancelListWId(), and warningYesNoListWId().

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.
Since:
3.2
Definition at line 370 of file kmessagebox.cpp.

References KGlobal::config(), KConfigBase::sync(), and KConfigBase::writeEntry().

Referenced by informationListWId(), and warningContinueCancelListWId().

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.

Since:
3.2
Definition at line 382 of file kmessagebox.cpp.

int KMessageBox::createKMessageBox KDialogBase dialog,
QMessageBox::Icon  icon,
const QString text,
const QStringList strlist,
const QString ask,
bool *  checkboxReturn,
int  options,
const QString details = QString::null
[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 OptionsType
details Detailed message string.
Since:
3.3
Definition at line 140 of file kmessagebox.cpp.

Referenced by about(), detailedErrorWId(), detailedSorryWId(), errorWId(), informationListWId(), questionYesNoCancelWId(), questionYesNoListWId(), sorryWId(), warningContinueCancelListWId(), warningYesNoCancelListWId(), and warningYesNoListWId().

int KMessageBox::createKMessageBox KDialogBase dialog,
QPixmap  icon,
const QString text,
const QStringList strlist,
const QString ask,
bool *  checkboxReturn,
int  options,
const QString details = QString::null,
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 OptionsType
details Detailed message string.
notifyType The type of notification to send when this message is presentend.
Since:
3.3
Definition at line 149 of file kmessagebox.cpp.

References KDialogBase::actionButton(), KGlobalSettings::desktopGeometry(), KDialogBase::disableResize(), KDialogBase::enableButtonSeparator(), KDialogBase::setDetailsWidget(), KDialogBase::setMainWidget(), and KActiveLabel::sizeHint().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:40:39 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003