kmessagebox.h
/* This file is part of the KDE libraries
Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KMESSAGEBOX_H_
#define _KMESSAGEBOX_H_
#include <qstring.h>
#include <qmessagebox.h>
#include <kguiitem.h>
#include <kstdguiitem.h>
class QWidget;
class QStringList;
class KConfig;
class KDialogBase;
class KDEUI_EXPORT KMessageBox
{
public:
enum ButtonCode
{
Ok = 1,
Cancel = 2,
Yes = 3,
No = 4,
Continue = 5
};
enum DialogType
{
QuestionYesNo = 1,
WarningYesNo = 2,
WarningContinueCancel = 3,
WarningYesNoCancel = 4,
Information = 5,
// Reserved for: SSLMessageBox = 6
Sorry = 7,
Error = 8,
QuestionYesNoCancel = 9
};
enum OptionsType
{
Notify = 1,
AllowLink = 2,
Dangerous = 4,
PlainCaption = 8,
NoExec = 16
};
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static 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);
static void error(QWidget *parent,
const QString &text,
const QString &caption = QString::null,
int options = Notify);
static void errorWId(WId parent_id,
const QString &text,
const QString &caption = QString::null,
int options = Notify);
static void errorList(QWidget *parent,
const QString &text,
const QStringList &strlist,
const QString &caption = QString::null,
int options = Notify);
static void errorListWId(WId parent_id,
const QString &text,
const QStringList &strlist,
const QString &caption = QString::null,
int options = Notify);
static void detailedError(QWidget *parent,
const QString &text,
const QString &details,
const QString &caption = QString::null,
int options = Notify);
static void detailedErrorWId(WId parent_id,
const QString &text,
const QString &details,
const QString &caption = QString::null,
int options = Notify);
static void queuedDetailedError( QWidget *parent,
const QString &text,
const QString &details,
const QString &caption = QString::null);
static void queuedDetailedErrorWId( WId parent_id,
const QString &text,
const QString &details,
const QString &caption = QString::null);
static void sorry(QWidget *parent,
const QString &text,
const QString &caption = QString::null,
int options = Notify);
static void sorryWId(WId parent_id,
const QString &text,
const QString &caption = QString::null,
int options = Notify);
static void detailedSorry(QWidget *parent,
const QString &text,
const QString &details,
const QString &caption = QString::null,
int options = Notify);
static void detailedSorryWId(WId parent_id,
const QString &text,
const QString &details,
const QString &caption = QString::null,
int options = Notify);
static void information(QWidget *parent,
const QString &text,
const QString &caption = QString::null,
const QString &dontShowAgainName = QString::null,
int options = Notify);
static void informationWId(WId parent_id,
const QString &text,
const QString &caption = QString::null,
const QString &dontShowAgainName = QString::null,
int options = Notify);
static void informationList(QWidget *parent,
const QString &text,
const QStringList & strlist,
const QString &caption = QString::null,
const QString &dontShowAgainName = QString::null,
int options = Notify);
static void informationListWId(WId parent_id,
const QString &text,
const QStringList & strlist,
const QString &caption = QString::null,
const QString &dontShowAgainName = QString::null,
int options = Notify);
static void enableAllMessages();
static void enableMessage(const QString &dontShowAgainName);
static void about(QWidget *parent,
const QString& text,
const QString& caption = QString::null,
int options = Notify);
static int messageBox( QWidget *parent, DialogType type, const QString &text,
const QString &caption,
const KGuiItem &buttonYes,
const KGuiItem &buttonNo,
const QString &dontShowAskAgainName,
int options = Notify);
// KDE4 - merge with above?
static 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);
static 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);
static void queuedMessageBox( QWidget *parent,
DialogType type, const QString &text,
const QString &caption,
int options );
static void queuedMessageBoxWId( WId parent_id,
DialogType type, const QString &text,
const QString &caption,
int options );
static void queuedMessageBox( QWidget *parent,
DialogType type, const QString &text,
const QString &caption = QString::null );
static void queuedMessageBoxWId( WId parent_id,
DialogType type, const QString &text,
const QString &caption = QString::null );
static bool shouldBeShownYesNo(const QString &dontShowAgainName,
ButtonCode &result);
static bool shouldBeShownContinue(const QString &dontShowAgainName);
static void saveDontShowAgainYesNo(const QString &dontShowAgainName,
ButtonCode result);
static void saveDontShowAgainContinue(const QString &dontShowAgainName);
static void setDontShowAskAgainConfig(KConfig* cfg);
static 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);
static 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);
private:
static KConfig* againConfig;
};
#endif
KMessageBox
Easy message dialog box.
Definition: kmessagebox.h:44
KStdGuiItem::cont
static KGuiItem cont()
Returns a "continue" item.
Definition: kstdguiitem.cpp:212
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KGuiItem
An abstract class for GUI data such as ToolTip and Icon.
Definition: kguiitem.h:38
KMessageBox::OptionsType
OptionsType
Definition: kmessagebox.h:72
KMessageBox::ButtonCode
ButtonCode
Button types.
Definition: kmessagebox.h:50
KConfig

KDE Home | KDE Accessibility Home | Description of Access Keys