00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _KMESSAGEBOX_H_
00020 #define _KMESSAGEBOX_H_
00021
00022 #include <qstring.h>
00023 #include <qmessagebox.h>
00024
00025 #include <kguiitem.h>
00026 #include <kstdguiitem.h>
00027
00028 class QWidget;
00029 class QStringList;
00030 class KConfig;
00031 class KDialogBase;
00032
00044 class KDEUI_EXPORT KMessageBox
00045 {
00046 public:
00050 enum ButtonCode
00051 {
00052 Ok = 1,
00053 Cancel = 2,
00054 Yes = 3,
00055 No = 4,
00056 Continue = 5
00057 };
00058
00059 enum DialogType
00060 {
00061 QuestionYesNo = 1,
00062 WarningYesNo = 2,
00063 WarningContinueCancel = 3,
00064 WarningYesNoCancel = 4,
00065 Information = 5,
00066
00067 Sorry = 7,
00068 Error = 8,
00069 QuestionYesNoCancel = 9
00070 };
00071
00072 enum OptionsType
00073 {
00074 Notify = 1,
00075 AllowLink = 2,
00076 Dangerous = 4,
00077 PlainCaption = 8,
00080 NoExec = 16
00083 };
00084
00115 static int questionYesNo(QWidget *parent,
00116 const QString &text,
00117 const QString &caption = QString::null,
00118 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00119 const KGuiItem &buttonNo = KStdGuiItem::no(),
00120 const QString &dontAskAgainName = QString::null,
00121 int options = Notify);
00127 static int questionYesNoWId(WId parent_id,
00128 const QString &text,
00129 const QString &caption = QString::null,
00130 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00131 const KGuiItem &buttonNo = KStdGuiItem::no(),
00132 const QString &dontAskAgainName = QString::null,
00133 int options = Notify);
00166 static int questionYesNoCancel(QWidget *parent,
00167 const QString &text,
00168 const QString &caption = QString::null,
00169 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00170 const KGuiItem &buttonNo = KStdGuiItem::no(),
00171 const QString &dontAskAgainName = QString::null,
00172 int options = Notify);
00173
00179 static int questionYesNoCancelWId(WId parent_id,
00180 const QString &text,
00181 const QString &caption = QString::null,
00182 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00183 const KGuiItem &buttonNo = KStdGuiItem::no(),
00184 const QString &dontAskAgainName = QString::null,
00185 int options = Notify);
00186
00221 static int questionYesNoList(QWidget *parent,
00222 const QString &text,
00223 const QStringList &strlist,
00224 const QString &caption = QString::null,
00225 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00226 const KGuiItem &buttonNo = KStdGuiItem::no(),
00227 const QString &dontAskAgainName = QString::null,
00228 int options = Notify);
00229
00235 static int questionYesNoListWId(WId parent_id,
00236 const QString &text,
00237 const QStringList &strlist,
00238 const QString &caption = QString::null,
00239 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00240 const KGuiItem &buttonNo = KStdGuiItem::no(),
00241 const QString &dontAskAgainName = QString::null,
00242 int options = Notify);
00243
00274 static int warningYesNo(QWidget *parent,
00275 const QString &text,
00276 const QString &caption = QString::null,
00277 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00278 const KGuiItem &buttonNo = KStdGuiItem::no(),
00279 const QString &dontAskAgainName = QString::null,
00280 int options = Notify | Dangerous);
00281
00287 static int warningYesNoWId(WId parent_id,
00288 const QString &text,
00289 const QString &caption = QString::null,
00290 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00291 const KGuiItem &buttonNo = KStdGuiItem::no(),
00292 const QString &dontAskAgainName = QString::null,
00293 int options = Notify | Dangerous);
00294
00329 static int warningYesNoList(QWidget *parent,
00330 const QString &text,
00331 const QStringList &strlist,
00332 const QString &caption = QString::null,
00333 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00334 const KGuiItem &buttonNo = KStdGuiItem::no(),
00335 const QString &dontAskAgainName = QString::null,
00336 int options = Notify | Dangerous);
00337
00343 static int warningYesNoListWId(WId parent_id,
00344 const QString &text,
00345 const QStringList &strlist,
00346 const QString &caption = QString::null,
00347 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00348 const KGuiItem &buttonNo = KStdGuiItem::no(),
00349 const QString &dontAskAgainName = QString::null,
00350 int options = Notify | Dangerous);
00351
00381 static int warningContinueCancel(QWidget *parent,
00382 const QString &text,
00383 const QString &caption = QString::null,
00384 const KGuiItem &buttonContinue = KStdGuiItem::cont(),
00385 const QString &dontAskAgainName = QString::null,
00386 int options = Notify);
00387
00393 static int warningContinueCancelWId(WId parent_id,
00394 const QString &text,
00395 const QString &caption = QString::null,
00396 const KGuiItem &buttonContinue = KStdGuiItem::cont(),
00397 const QString &dontAskAgainName = QString::null,
00398 int options = Notify);
00399
00433 static int warningContinueCancelList(QWidget *parent,
00434 const QString &text,
00435 const QStringList &strlist,
00436 const QString &caption = QString::null,
00437 const KGuiItem &buttonContinue = KStdGuiItem::cont(),
00438 const QString &dontAskAgainName = QString::null,
00439 int options = Notify);
00440
00446 static int warningContinueCancelListWId(WId parent_id,
00447 const QString &text,
00448 const QStringList &strlist,
00449 const QString &caption = QString::null,
00450 const KGuiItem &buttonContinue = KStdGuiItem::cont(),
00451 const QString &dontAskAgainName = QString::null,
00452 int options = Notify);
00453
00490 static int warningYesNoCancel(QWidget *parent,
00491 const QString &text,
00492 const QString &caption = QString::null,
00493 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00494 const KGuiItem &buttonNo = KStdGuiItem::no(),
00495 const QString &dontAskAgainName = QString::null,
00496 int options = Notify);
00497
00503 static int warningYesNoCancelWId(WId parent_id,
00504 const QString &text,
00505 const QString &caption = QString::null,
00506 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00507 const KGuiItem &buttonNo = KStdGuiItem::no(),
00508 const QString &dontAskAgainName = QString::null,
00509 int options = Notify);
00510
00552 static int warningYesNoCancelList(QWidget *parent,
00553 const QString &text,
00554 const QStringList &strlist,
00555 const QString &caption = QString::null,
00556 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00557 const KGuiItem &buttonNo = KStdGuiItem::no(),
00558 const QString &dontAskAgainName = QString::null,
00559 int options = Notify);
00560
00566 static int warningYesNoCancelListWId(WId parent_id,
00567 const QString &text,
00568 const QStringList &strlist,
00569 const QString &caption = QString::null,
00570 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00571 const KGuiItem &buttonNo = KStdGuiItem::no(),
00572 const QString &dontAskAgainName = QString::null,
00573 int options = Notify);
00574
00598 static void error(QWidget *parent,
00599 const QString &text,
00600 const QString &caption = QString::null,
00601 int options = Notify);
00602
00609 static void errorWId(WId parent_id,
00610 const QString &text,
00611 const QString &caption = QString::null,
00612 int options = Notify);
00613
00642 static void errorList(QWidget *parent,
00643 const QString &text,
00644 const QStringList &strlist,
00645 const QString &caption = QString::null,
00646 int options = Notify);
00647
00654 static void errorListWId(WId parent_id,
00655 const QString &text,
00656 const QStringList &strlist,
00657 const QString &caption = QString::null,
00658 int options = Notify);
00659
00686 static void detailedError(QWidget *parent,
00687 const QString &text,
00688 const QString &details,
00689 const QString &caption = QString::null,
00690 int options = Notify);
00691
00697 static void detailedErrorWId(WId parent_id,
00698 const QString &text,
00699 const QString &details,
00700 const QString &caption = QString::null,
00701 int options = Notify);
00702
00713 static void queuedDetailedError( QWidget *parent,
00714 const QString &text,
00715 const QString &details,
00716 const QString &caption = QString::null);
00717
00723 static void queuedDetailedErrorWId( WId parent_id,
00724 const QString &text,
00725 const QString &details,
00726 const QString &caption = QString::null);
00727
00750 static void sorry(QWidget *parent,
00751 const QString &text,
00752 const QString &caption = QString::null,
00753 int options = Notify);
00754
00760 static void sorryWId(WId parent_id,
00761 const QString &text,
00762 const QString &caption = QString::null,
00763 int options = Notify);
00764
00793 static void detailedSorry(QWidget *parent,
00794 const QString &text,
00795 const QString &details,
00796 const QString &caption = QString::null,
00797 int options = Notify);
00798
00804 static void detailedSorryWId(WId parent_id,
00805 const QString &text,
00806 const QString &details,
00807 const QString &caption = QString::null,
00808 int options = Notify);
00809
00836 static void information(QWidget *parent,
00837 const QString &text,
00838 const QString &caption = QString::null,
00839 const QString &dontShowAgainName = QString::null,
00840 int options = Notify);
00841
00847 static void informationWId(WId parent_id,
00848 const QString &text,
00849 const QString &caption = QString::null,
00850 const QString &dontShowAgainName = QString::null,
00851 int options = Notify);
00852
00883 static void informationList(QWidget *parent,
00884 const QString &text,
00885 const QStringList & strlist,
00886 const QString &caption = QString::null,
00887 const QString &dontShowAgainName = QString::null,
00888 int options = Notify);
00889
00895 static void informationListWId(WId parent_id,
00896 const QString &text,
00897 const QStringList & strlist,
00898 const QString &caption = QString::null,
00899 const QString &dontShowAgainName = QString::null,
00900 int options = Notify);
00901
00906 static void enableAllMessages();
00907
00915 static void enableMessage(const QString &dontShowAgainName);
00916
00936 static void about(QWidget *parent,
00937 const QString& text,
00938 const QString& caption = QString::null,
00939 int options = Notify);
00940
00965 static int messageBox( QWidget *parent, DialogType type, const QString &text,
00966 const QString &caption,
00967 const KGuiItem &buttonYes,
00968 const KGuiItem &buttonNo,
00969 const QString &dontShowAskAgainName,
00970 int options = Notify);
00971
00990
00991 static int messageBox( QWidget *parent, DialogType type, const QString &text,
00992 const QString &caption = QString::null,
00993 const KGuiItem &buttonYes = KStdGuiItem::yes(),
00994 const KGuiItem &buttonNo = KStdGuiItem::no(),
00995 int options = Notify);
00996
01002 static int messageBoxWId( WId parent_id, DialogType type, const QString &text,
01003 const QString &caption = QString::null,
01004 const KGuiItem &buttonYes = KStdGuiItem::yes(),
01005 const KGuiItem &buttonNo = KStdGuiItem::no(),
01006 const QString &dontShowAskAgainName = QString::null,
01007 int options = Notify);
01008
01021 static void queuedMessageBox( QWidget *parent,
01022 DialogType type, const QString &text,
01023 const QString &caption,
01024 int options );
01025
01031 static void queuedMessageBoxWId( WId parent_id,
01032 DialogType type, const QString &text,
01033 const QString &caption,
01034 int options );
01035
01042 static void queuedMessageBox( QWidget *parent,
01043 DialogType type, const QString &text,
01044 const QString &caption = QString::null );
01045
01051 static void queuedMessageBoxWId( WId parent_id,
01052 DialogType type, const QString &text,
01053 const QString &caption = QString::null );
01054
01064 static bool shouldBeShownYesNo(const QString &dontShowAgainName,
01065 ButtonCode &result);
01073 static bool shouldBeShownContinue(const QString &dontShowAgainName);
01074
01083 static void saveDontShowAgainYesNo(const QString &dontShowAgainName,
01084 ButtonCode result);
01085
01093 static void saveDontShowAgainContinue(const QString &dontShowAgainName);
01094
01100 static void setDontShowAskAgainConfig(KConfig* cfg);
01101
01125 static int createKMessageBox(KDialogBase *dialog, QMessageBox::Icon icon,
01126 const QString &text, const QStringList &strlist,
01127 const QString &ask, bool *checkboxReturn,
01128 int options, const QString &details=QString::null);
01129
01156 static int createKMessageBox(KDialogBase *dialog, QPixmap icon,
01157 const QString &text, const QStringList &strlist,
01158 const QString &ask, bool *checkboxReturn,
01159 int options, const QString &details=QString::null,
01160 QMessageBox::Icon notifyType=QMessageBox::Information);
01161
01162 private:
01163 static KConfig* againConfig;
01164 };
01165
01166 #endif