kalarm/lib

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 QString& dontAskAgainName);
00059         static void setContinueDefault(const QString& dontAskAgainName, ButtonCode defaultButton);
00069         static int  warningContinueCancel(QWidget* parent, ButtonCode defaultButton, const QString& text,
00070                                           const QString& caption = QString::null,
00071                                           const KGuiItem& buttonContinue = KStdGuiItem::cont(),
00072                                           const QString& dontAskAgainName = QString::null);
00084         static int  warningContinueCancel(QWidget* parent, const QString& text, const QString& caption = QString::null,
00085                                           const KGuiItem& buttonContinue = KStdGuiItem::cont(),
00086                                           const QString& dontAskAgainName = QString::null);
00094         static bool setDefaultShouldBeShownContinue(const QString& dontShowAgainName, bool defaultShow);
00101         static bool shouldBeShownContinue(const QString& dontShowAgainName);
00107         static void saveDontShowAgainYesNo(const QString& dontShowAgainName, bool dontShow = true, ButtonCode result = No);
00115         static void saveDontShowAgainContinue(const QString& dontShowAgainName, bool dontShow = true);
00117         static void setDontShowAskAgainConfig(KConfig* cfg)    { mConfig = cfg; }
00118 
00119     private:
00120         static void saveDontShowAgain(const QString& dontShowAgainName, bool yesno, bool dontShow, const char* yesnoResult = 0);
00121         static KConfig*                  mConfig;
00122         static QMap<QString, ButtonCode> mContinueDefaults;
00123 };
00124 
00125 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys