messagebox.h
00001 /* 00002 * messagebox.h - enhanced KMessageBox class 00003 * Program: kalarm 00004 * Copyright (C) 2004 by David Jarvie <software@astrojar.org.uk> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef MESSAGEBOX_H 00022 #define MESSAGEBOX_H 00023 00024 #include <kstdguiitem.h> 00025 #include <kmessagebox.h> 00026 00027 00036 class MessageBox : public KMessageBox 00037 { 00038 public: 00044 enum AskType { // MessageBox types 00045 CONT_CANCEL_DEF_CONT, // Continue/Cancel, with default = Continue 00046 CONT_CANCEL_DEF_CANCEL, // Continue/Cancel, with default = Cancel 00047 YES_NO_DEF_NO // Yes/No, with default = No 00048 }; 00053 static ButtonCode getContinueDefault(const TQString& dontAskAgainName); 00059 static void setContinueDefault(const TQString& dontAskAgainName, ButtonCode defaultButton); 00069 static int warningContinueCancel(TQWidget* parent, ButtonCode defaultButton, const TQString& text, 00070 const TQString& caption = TQString(), 00071 const KGuiItem& buttonContinue = KStdGuiItem::cont(), 00072 const TQString& dontAskAgainName = TQString()); 00084 static int warningContinueCancel(TQWidget* parent, const TQString& text, const TQString& caption = TQString(), 00085 const KGuiItem& buttonContinue = KStdGuiItem::cont(), 00086 const TQString& dontAskAgainName = TQString()); 00094 static bool setDefaultShouldBeShownContinue(const TQString& dontShowAgainName, bool defaultShow); 00101 static bool shouldBeShownContinue(const TQString& dontShowAgainName); 00107 static void saveDontShowAgainYesNo(const TQString& dontShowAgainName, bool dontShow = true, ButtonCode result = No); 00115 static void saveDontShowAgainContinue(const TQString& dontShowAgainName, bool dontShow = true); 00117 static void setDontShowAskAgainConfig(KConfig* cfg) { mConfig = cfg; } 00118 00119 private: 00120 static void saveDontShowAgain(const TQString& dontShowAgainName, bool yesno, bool dontShow, const char* yesnoResult = 0); 00121 static KConfig* mConfig; 00122 static TQMap<TQString, ButtonCode> mContinueDefaults; 00123 }; 00124 00125 #endif