kalarm/lib

messagebox.h
1/*
2 * messagebox.h - enhanced KMessageBox class
3 * Program: kalarm
4 * Copyright (C) 2004 by David Jarvie <software@astrojar.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef MESSAGEBOX_H
22#define MESSAGEBOX_H
23
24#include <kstdguiitem.h>
25#include <tdemessagebox.h>
26
27
36class MessageBox : public KMessageBox
37{
38 public:
44 enum AskType { // MessageBox types
45 CONT_CANCEL_DEF_CONT, // Continue/Cancel, with default = Continue
46 CONT_CANCEL_DEF_CANCEL, // Continue/Cancel, with default = Cancel
47 YES_NO_DEF_NO // Yes/No, with default = No
48 };
53 static ButtonCode getContinueDefault(const TQString& dontAskAgainName);
59 static void setContinueDefault(const TQString& dontAskAgainName, ButtonCode defaultButton);
69 static int warningContinueCancel(TQWidget* parent, ButtonCode defaultButton, const TQString& text,
70 const TQString& caption = TQString(),
71 const KGuiItem& buttonContinue = KStdGuiItem::cont(),
72 const TQString& dontAskAgainName = TQString());
84 static int warningContinueCancel(TQWidget* parent, const TQString& text, const TQString& caption = TQString(),
85 const KGuiItem& buttonContinue = KStdGuiItem::cont(),
86 const TQString& dontAskAgainName = TQString());
94 static bool setDefaultShouldBeShownContinue(const TQString& dontShowAgainName, bool defaultShow);
101 static bool shouldBeShownContinue(const TQString& dontShowAgainName);
107 static void saveDontShowAgainYesNo(const TQString& dontShowAgainName, bool dontShow = true, ButtonCode result = No);
115 static void saveDontShowAgainContinue(const TQString& dontShowAgainName, bool dontShow = true);
117 static void setDontShowAskAgainConfig(TDEConfig* cfg) { mConfig = cfg; }
118
119 private:
120 static void saveDontShowAgain(const TQString& dontShowAgainName, bool yesno, bool dontShow, const char* yesnoResult = 0);
121 static TDEConfig* mConfig;
122 static TQMap<TQString, ButtonCode> mContinueDefaults;
123};
124
125#endif
Enhanced KMessageBox.
Definition: messagebox.h:37
static bool shouldBeShownContinue(const TQString &dontShowAgainName)
Returns whether a non-Yes/No message box should be shown.
Definition: messagebox.cpp:127
static void saveDontShowAgainContinue(const TQString &dontShowAgainName, bool dontShow=true)
Stores whether a non-Yes/No message box should or should not be shown again.
Definition: messagebox.cpp:155
static void setContinueDefault(const TQString &dontAskAgainName, ButtonCode defaultButton)
Sets the default button for the Continue/Cancel message box with the specified "don't ask again" name...
Definition: messagebox.cpp:34
AskType
MessageBox types.
Definition: messagebox.h:44
static int warningContinueCancel(TQWidget *parent, ButtonCode defaultButton, const TQString &text, const TQString &caption=TQString(), const KGuiItem &buttonContinue=KStdGuiItem::cont(), const TQString &dontAskAgainName=TQString())
Displays a Continue/Cancel message box with the option as to which button is the default.
Definition: messagebox.cpp:75
static bool setDefaultShouldBeShownContinue(const TQString &dontShowAgainName, bool defaultShow)
If there is no current setting for whether a non-Yes/No message box should be shown,...
Definition: messagebox.cpp:106
static void setDontShowAskAgainConfig(TDEConfig *cfg)
Sets the TDEConfig object to be used by the MessageBox class.
Definition: messagebox.h:117
static ButtonCode getContinueDefault(const TQString &dontAskAgainName)
Gets the default button for the Continue/Cancel message box with the specified "don't ask again" name...
Definition: messagebox.cpp:43
static void saveDontShowAgainYesNo(const TQString &dontShowAgainName, bool dontShow=true, ButtonCode result=No)
Stores whether the Yes/No message box should or should not be shown again.
Definition: messagebox.cpp:142