kalarm/lib

MessageBox Class Reference

#include <messagebox.h>

List of all members.


Detailed Description

Enhanced KMessageBox.

The MessageBox class provides an extension to KMessageBox, including the option for Continue/Cancel message boxes to have a default button of Cancel.

Author:
David Jarvie <software@astrojar.org.uk>

Definition at line 36 of file messagebox.h.


Public Types

enum  AskType { CONT_CANCEL_DEF_CONT, CONT_CANCEL_DEF_CANCEL, YES_NO_DEF_NO }

Static Public Member Functions

static ButtonCode getContinueDefault (const QString &dontAskAgainName)
static void setContinueDefault (const QString &dontAskAgainName, ButtonCode defaultButton)
static int warningContinueCancel (QWidget *parent, ButtonCode defaultButton, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null)
static int warningContinueCancel (QWidget *parent, const QString &text, const QString &caption=QString::null, const KGuiItem &buttonContinue=KStdGuiItem::cont(), const QString &dontAskAgainName=QString::null)
static bool setDefaultShouldBeShownContinue (const QString &dontShowAgainName, bool defaultShow)
static bool shouldBeShownContinue (const QString &dontShowAgainName)
static void saveDontShowAgainYesNo (const QString &dontShowAgainName, bool dontShow=true, ButtonCode result=No)
static void saveDontShowAgainContinue (const QString &dontShowAgainName, bool dontShow=true)
static void setDontShowAskAgainConfig (KConfig *cfg)

Member Enumeration Documentation

MessageBox types.

  • CONT_CANCEL_DEF_CONT - Continue/Cancel, with Continue as the default button.
  • CONT_CANCEL_DEF_CANCEL - Continue/Cancel, with Cancel as the default button.
  • YES_NO_DEF_NO - Yes/No, with No as the default button.

Definition at line 44 of file messagebox.h.


Member Function Documentation

KMessageBox::ButtonCode MessageBox::getContinueDefault ( const QString &  dontAskAgainName  )  [static]

Gets the default button for the Continue/Cancel message box with the specified "don't ask again" name.

Parameters:
dontAskAgainName The identifier controlling whether the message box is suppressed.

Definition at line 43 of file messagebox.cpp.

void MessageBox::setContinueDefault ( const QString &  dontAskAgainName,
ButtonCode  defaultButton 
) [static]

Sets the default button for the Continue/Cancel message box with the specified "don't ask again" name.

Parameters:
dontAskAgainName The identifier controlling whether the message box is suppressed.
defaultButton The default button for the message box. Valid values are Continue or Cancel.

Definition at line 34 of file messagebox.cpp.

int MessageBox::warningContinueCancel ( QWidget *  parent,
ButtonCode  defaultButton,
const QString &  text,
const QString &  caption = QString::null,
const KGuiItem &  buttonContinue = KStdGuiItem::cont(),
const QString &  dontAskAgainName = QString::null 
) [static]

Displays a Continue/Cancel message box with the option as to which button is the default.

Parameters:
parent Parent widget
defaultButton The default button for the message box. Valid values are Continue or Cancel.
text Message string
caption Caption (window title) of the message box
buttonContinue The text for the first button (default = i18n("Continue"))
dontAskAgainName If specified, the message box will only be suppressed if the user chose Continue last time.

Definition at line 75 of file messagebox.cpp.

int MessageBox::warningContinueCancel ( QWidget *  parent,
const QString &  text,
const QString &  caption = QString::null,
const KGuiItem &  buttonContinue = KStdGuiItem::cont(),
const QString &  dontAskAgainName = QString::null 
) [static]

Displays a Continue/Cancel message box.

Parameters:
parent Parent widget
text Message string
caption Caption (window title) of the message box
buttonContinue The text for the first button (default = i18n("Continue"))
dontAskAgainName If specified, (1) The message box will only be suppressed if the user chose Continue last time, and (2) The default button is that last set with either setContinueDefault() or warningContinueCancel() for the same dontAskAgainName value. If neither method has been used to set a default button, Continue is the default.

Definition at line 63 of file messagebox.cpp.

bool MessageBox::setDefaultShouldBeShownContinue ( const QString &  dontShowAgainName,
bool  defaultShow 
) [static]

If there is no current setting for whether a non-Yes/No message box should be shown, sets it to defaultShow.

If a Continue/Cancel message box has Cancel as the default button, either setContinueDefault() or warningContinueCancel() must have been called previously to set this for the specified dontShowAgainName value.

Returns:
true if defaultShow was written.

Definition at line 106 of file messagebox.cpp.

bool MessageBox::shouldBeShownContinue ( const QString &  dontShowAgainName  )  [static]

Returns whether a non-Yes/No message box should be shown.

If the message box has Cancel as the default button, either setContinueDefault() or warningContinueCancel() must have been called previously to set this for the specified dontShowAgainName value.

Parameters:
dontShowAgainName The identifier controlling whether the message box is suppressed.

Definition at line 127 of file messagebox.cpp.

void MessageBox::saveDontShowAgainYesNo ( const QString &  dontShowAgainName,
bool  dontShow = true,
ButtonCode  result = No 
) [static]

Stores whether the Yes/No message box should or should not be shown again.

Parameters:
dontShowAgainName The identifier controlling whether the message box is suppressed.
dontShow If true, the message box will be suppressed and will return result.
result The button code to return if the message box is suppressed.

Definition at line 142 of file messagebox.cpp.

void MessageBox::saveDontShowAgainContinue ( const QString &  dontShowAgainName,
bool  dontShow = true 
) [static]

Stores whether a non-Yes/No message box should or should not be shown again.

If the message box has Cancel as the default button, either setContinueDefault() or warningContinueCancel() must have been called previously to set this for the specified dontShowAgainName value.

Parameters:
dontShowAgainName The identifier controlling whether the message box is suppressed.
dontShow If true, the message box will be suppressed and will return Continue.

Definition at line 155 of file messagebox.cpp.

static void MessageBox::setDontShowAskAgainConfig ( KConfig *  cfg  )  [inline, static]

Sets the KConfig object to be used by the MessageBox class.

Definition at line 117 of file messagebox.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys