tdemessagebox.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Waldo Bastian (bastian@kde.org) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; version 2 00007 of the License. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 #ifndef _TDEMESSAGEBOX_H_ 00020 #define _TDEMESSAGEBOX_H_ 00021 00022 #include <tqstring.h> 00023 #include <tqmessagebox.h> 00024 00025 #include <kguiitem.h> 00026 #include <kstdguiitem.h> 00027 00028 class TQWidget; 00029 class TQStringList; 00030 class TDEConfig; 00031 class KDialogBase; 00032 00044 class TDEUI_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 // Reserved for: SSLMessageBox = 6 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(TQWidget *parent, 00116 const TQString &text, 00117 const TQString &caption = TQString::null, 00118 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00119 const KGuiItem &buttonNo = KStdGuiItem::no(), 00120 const TQString &dontAskAgainName = TQString::null, 00121 int options = Notify); 00127 static int questionYesNoWId(WId parent_id, 00128 const TQString &text, 00129 const TQString &caption = TQString::null, 00130 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00131 const KGuiItem &buttonNo = KStdGuiItem::no(), 00132 const TQString &dontAskAgainName = TQString::null, 00133 int options = Notify); 00166 static int questionYesNoCancel(TQWidget *parent, 00167 const TQString &text, 00168 const TQString &caption = TQString::null, 00169 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00170 const KGuiItem &buttonNo = KStdGuiItem::no(), 00171 const TQString &dontAskAgainName = TQString::null, 00172 int options = Notify); 00173 00179 static int questionYesNoCancelWId(WId parent_id, 00180 const TQString &text, 00181 const TQString &caption = TQString::null, 00182 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00183 const KGuiItem &buttonNo = KStdGuiItem::no(), 00184 const TQString &dontAskAgainName = TQString::null, 00185 int options = Notify); 00186 00221 static int questionYesNoList(TQWidget *parent, 00222 const TQString &text, 00223 const TQStringList &strlist, 00224 const TQString &caption = TQString::null, 00225 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00226 const KGuiItem &buttonNo = KStdGuiItem::no(), 00227 const TQString &dontAskAgainName = TQString::null, 00228 int options = Notify); 00229 00235 static int questionYesNoListWId(WId parent_id, 00236 const TQString &text, 00237 const TQStringList &strlist, 00238 const TQString &caption = TQString::null, 00239 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00240 const KGuiItem &buttonNo = KStdGuiItem::no(), 00241 const TQString &dontAskAgainName = TQString::null, 00242 int options = Notify); 00243 00274 static int warningYesNo(TQWidget *parent, 00275 const TQString &text, 00276 const TQString &caption = TQString::null, 00277 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00278 const KGuiItem &buttonNo = KStdGuiItem::no(), 00279 const TQString &dontAskAgainName = TQString::null, 00280 int options = Notify | Dangerous); 00281 00287 static int warningYesNoWId(WId parent_id, 00288 const TQString &text, 00289 const TQString &caption = TQString::null, 00290 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00291 const KGuiItem &buttonNo = KStdGuiItem::no(), 00292 const TQString &dontAskAgainName = TQString::null, 00293 int options = Notify | Dangerous); 00294 00329 static int warningYesNoList(TQWidget *parent, 00330 const TQString &text, 00331 const TQStringList &strlist, 00332 const TQString &caption = TQString::null, 00333 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00334 const KGuiItem &buttonNo = KStdGuiItem::no(), 00335 const TQString &dontAskAgainName = TQString::null, 00336 int options = Notify | Dangerous); 00337 00343 static int warningYesNoListWId(WId parent_id, 00344 const TQString &text, 00345 const TQStringList &strlist, 00346 const TQString &caption = TQString::null, 00347 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00348 const KGuiItem &buttonNo = KStdGuiItem::no(), 00349 const TQString &dontAskAgainName = TQString::null, 00350 int options = Notify | Dangerous); 00351 00381 static int warningContinueCancel(TQWidget *parent, 00382 const TQString &text, 00383 const TQString &caption = TQString::null, 00384 const KGuiItem &buttonContinue = KStdGuiItem::cont(), 00385 const TQString &dontAskAgainName = TQString::null, 00386 int options = Notify); 00387 00393 static int warningContinueCancelWId(WId parent_id, 00394 const TQString &text, 00395 const TQString &caption = TQString::null, 00396 const KGuiItem &buttonContinue = KStdGuiItem::cont(), 00397 const TQString &dontAskAgainName = TQString::null, 00398 int options = Notify); 00399 00433 static int warningContinueCancelList(TQWidget *parent, 00434 const TQString &text, 00435 const TQStringList &strlist, 00436 const TQString &caption = TQString::null, 00437 const KGuiItem &buttonContinue = KStdGuiItem::cont(), 00438 const TQString &dontAskAgainName = TQString::null, 00439 int options = Notify); 00440 00446 static int warningContinueCancelListWId(WId parent_id, 00447 const TQString &text, 00448 const TQStringList &strlist, 00449 const TQString &caption = TQString::null, 00450 const KGuiItem &buttonContinue = KStdGuiItem::cont(), 00451 const TQString &dontAskAgainName = TQString::null, 00452 int options = Notify); 00453 00490 static int warningYesNoCancel(TQWidget *parent, 00491 const TQString &text, 00492 const TQString &caption = TQString::null, 00493 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00494 const KGuiItem &buttonNo = KStdGuiItem::no(), 00495 const TQString &dontAskAgainName = TQString::null, 00496 int options = Notify); 00497 00503 static int warningYesNoCancelWId(WId parent_id, 00504 const TQString &text, 00505 const TQString &caption = TQString::null, 00506 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00507 const KGuiItem &buttonNo = KStdGuiItem::no(), 00508 const TQString &dontAskAgainName = TQString::null, 00509 int options = Notify); 00510 00552 static int warningYesNoCancelList(TQWidget *parent, 00553 const TQString &text, 00554 const TQStringList &strlist, 00555 const TQString &caption = TQString::null, 00556 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00557 const KGuiItem &buttonNo = KStdGuiItem::no(), 00558 const TQString &dontAskAgainName = TQString::null, 00559 int options = Notify); 00560 00566 static int warningYesNoCancelListWId(WId parent_id, 00567 const TQString &text, 00568 const TQStringList &strlist, 00569 const TQString &caption = TQString::null, 00570 const KGuiItem &buttonYes = KStdGuiItem::yes(), 00571 const KGuiItem &buttonNo = KStdGuiItem::no(), 00572 const TQString &dontAskAgainName = TQString::null, 00573 int options = Notify); 00574 00598 static void error(TQWidget *parent, 00599 const TQString &text, 00600 const TQString &caption = TQString::null, 00601 int options = Notify); 00602 00609 static void errorWId(WId parent_id, 00610 const TQString &text, 00611 const TQString &caption = TQString::null, 00612 int options = Notify); 00613 00642 static void errorList(TQWidget *parent, 00643 const TQString &text, 00644 const TQStringList &strlist, 00645 const TQString &caption = TQString::null, 00646 int options = Notify); 00647 00654 static void errorListWId(WId parent_id, 00655 const TQString &text, 00656 const TQStringList &strlist, 00657 const TQString &caption = TQString::null, 00658 int options = Notify); 00659 00686 static void detailedError(TQWidget *parent, 00687 const TQString &text, 00688 const TQString &details, 00689 const TQString &caption = TQString::null, 00690 int options = Notify); 00691 00697 static void detailedErrorWId(WId parent_id, 00698 const TQString &text, 00699 const TQString &details, 00700 const TQString &caption = TQString::null, 00701 int options = Notify); 00702 00713 static void queuedDetailedError( TQWidget *parent, 00714 const TQString &text, 00715 const TQString &details, 00716 const TQString &caption = TQString::null); 00717 00723 static void queuedDetailedErrorWId( WId parent_id, 00724 const TQString &text, 00725 const TQString &details, 00726 const TQString &caption = TQString::null); 00727 00750 static void sorry(TQWidget *parent, 00751 const TQString &text, 00752 const TQString &caption = TQString::null, 00753 int options = Notify); 00754 00760 static void sorryWId(WId parent_id, 00761 const TQString &text, 00762 const TQString &caption = TQString::null, 00763 int options = Notify); 00764 00793 static void detailedSorry(TQWidget *parent, 00794 const TQString &text, 00795 const TQString &details, 00796 const TQString &caption = TQString::null, 00797 int options = Notify); 00798 00804 static void detailedSorryWId(WId parent_id, 00805 const TQString &text, 00806 const TQString &details, 00807 const TQString &caption = TQString::null, 00808 int options = Notify); 00809 00836 static void information(TQWidget *parent, 00837 const TQString &text, 00838 const TQString &caption = TQString::null, 00839 const TQString &dontShowAgainName = TQString::null, 00840 int options = Notify); 00841 00847 static void informationWId(WId parent_id, 00848 const TQString &text, 00849 const TQString &caption = TQString::null, 00850 const TQString &dontShowAgainName = TQString::null, 00851 int options = Notify); 00852 00883 static void informationList(TQWidget *parent, 00884 const TQString &text, 00885 const TQStringList & strlist, 00886 const TQString &caption = TQString::null, 00887 const TQString &dontShowAgainName = TQString::null, 00888 int options = Notify); 00889 00895 static void informationListWId(WId parent_id, 00896 const TQString &text, 00897 const TQStringList & strlist, 00898 const TQString &caption = TQString::null, 00899 const TQString &dontShowAgainName = TQString::null, 00900 int options = Notify); 00901 00906 static void enableAllMessages(); 00907 00915 static void enableMessage(const TQString &dontShowAgainName); 00916 00936 static void about(TQWidget *parent, 00937 const TQString& text, 00938 const TQString& caption = TQString::null, 00939 int options = Notify); 00940 00965 static int messageBox( TQWidget *parent, DialogType type, const TQString &text, 00966 const TQString &caption, 00967 const KGuiItem &buttonYes, 00968 const KGuiItem &buttonNo, 00969 const TQString &dontShowAskAgainName, 00970 int options = Notify); 00971 00990 // KDE4 - merge with above? 00991 static int messageBox( TQWidget *parent, DialogType type, const TQString &text, 00992 const TQString &caption = TQString::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 TQString &text, 01003 const TQString &caption = TQString::null, 01004 const KGuiItem &buttonYes = KStdGuiItem::yes(), 01005 const KGuiItem &buttonNo = KStdGuiItem::no(), 01006 const TQString &dontShowAskAgainName = TQString::null, 01007 int options = Notify); 01008 01021 static void queuedMessageBox( TQWidget *parent, 01022 DialogType type, const TQString &text, 01023 const TQString &caption, 01024 int options ); 01025 01031 static void queuedMessageBoxWId( WId parent_id, 01032 DialogType type, const TQString &text, 01033 const TQString &caption, 01034 int options ); 01035 01042 static void queuedMessageBox( TQWidget *parent, 01043 DialogType type, const TQString &text, 01044 const TQString &caption = TQString::null ); 01045 01051 static void queuedMessageBoxWId( WId parent_id, 01052 DialogType type, const TQString &text, 01053 const TQString &caption = TQString::null ); 01054 01064 static bool shouldBeShownYesNo(const TQString &dontShowAgainName, 01065 ButtonCode &result); 01073 static bool shouldBeShownContinue(const TQString &dontShowAgainName); 01074 01083 static void saveDontShowAgainYesNo(const TQString &dontShowAgainName, 01084 ButtonCode result); 01085 01093 static void saveDontShowAgainContinue(const TQString &dontShowAgainName); 01094 01100 static void setDontShowAskAgainConfig(TDEConfig* cfg); 01101 01125 static int createKMessageBox(KDialogBase *dialog, TQMessageBox::Icon icon, 01126 const TQString &text, const TQStringList &strlist, 01127 const TQString &ask, bool *checkboxReturn, 01128 int options, const TQString &details=TQString::null); 01129 01156 static int createKMessageBox(KDialogBase *dialog, TQPixmap icon, 01157 const TQString &text, const TQStringList &strlist, 01158 const TQString &ask, bool *checkboxReturn, 01159 int options, const TQString &details=TQString::null, 01160 TQMessageBox::Icon notifyType=TQMessageBox::Information); 01161 01162 private: 01163 static TDEConfig* againConfig; 01164 }; 01165 01166 #endif