File indexing completed on 2024-05-12 16:39:37
0001 /* This file is part of the KDE project 0002 Copyright (C) 2004-2013 Jarosław Staniek <staniek@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KEXIGUIMSGHANDLER_H 0021 #define KEXIGUIMSGHANDLER_H 0022 0023 #include <core/kexi.h> 0024 0025 #include <KDbMessageHandler> 0026 0027 class KEXICORE_EXPORT KexiGUIMessageHandler : public KDbMessageHandler 0028 { 0029 public: 0030 explicit KexiGUIMessageHandler(QWidget *parent = 0); 0031 virtual ~KexiGUIMessageHandler(); 0032 0033 using KDbMessageHandler::showErrorMessage; 0034 0035 void showErrorMessage(const QString &message, const QString &details, const KDbResultable *resultable); 0036 void showErrorMessage(const QString &message, const KDbResultable *resultable); 0037 void showErrorMessage(Kexi::ObjectStatus *status); 0038 void showErrorMessage(const QString &message, Kexi::ObjectStatus *status); 0039 void showErrorMessage(const QString &title, const QString &details); 0040 0041 /*! Displays a "Sorry" message with \a title text and optional \a details. */ 0042 void showSorryMessage(const QString &title, const QString &details = QString()); 0043 0044 /*! Displays a message of a type \a type, with \a title text and optional \a details. 0045 \a dontShowAgainName can be specified to add "Do not show again" option if \a type is Warning. */ 0046 virtual void showMessage(MessageType type, const QString &title, const QString &details, 0047 const QString& dontShowAgainName = QString()); 0048 0049 /*! Displays a Warning message with \a title text and optional \a details 0050 with "Continue" button instead "OK". 0051 \a dontShowAgainName can be specified to add "Do not show again" option. */ 0052 virtual void showWarningContinueMessage(const QString &title, const QString &details = QString(), 0053 const QString& dontShowAgainName = QString()); 0054 0055 /*! Shows error message with @a title (it is not caption) and details. */ 0056 virtual void showErrorMessage( 0057 KDbMessageHandler::MessageType messageType, 0058 const QString &message, 0059 const QString &details = QString(), 0060 const QString &caption = QString() 0061 ) override; 0062 0063 /*! Shows error message with @a message text. Existing error message from @a obj object 0064 is also copied, if present. */ 0065 virtual void showErrorMessage( 0066 const KDbResult& result, 0067 KDbMessageHandler::MessageType messageType = Error, 0068 const QString& message = QString(), 0069 const QString& caption = QString() 0070 ) override; 0071 0072 /*! Interactively asks a question. For GUI version, message boxes are used. 0073 @a defaultResult is returned in case when no message handler is installed. 0074 @a message should contain translated string. 0075 Value of ButtonCode is returned. 0076 Reimplement this. This implementation does nothing, just returns @a defaultResult. */ 0077 virtual KDbMessageHandler::ButtonCode askQuestion( 0078 KDbMessageHandler::QuestionType messageType, 0079 const QString &message, 0080 const QString &caption = QString(), 0081 KDbMessageHandler::ButtonCode defaultResult = KDbMessageHandler::Yes, 0082 const KDbGuiItem &buttonYes = KDbGuiItem(), 0083 const KDbGuiItem &buttonNo = KDbGuiItem(), 0084 const QString &dontShowAskAgainName = QString(), 0085 KDbMessageHandler::Options options = 0, 0086 KDbMessageHandler* msgHandler = 0) override; 0087 0088 //! @return GUI message redirection for this handler or 0 if there is no GUI redirection. 0089 KexiGUIMessageHandler* guiRedirection(); 0090 0091 protected: 0092 //using KDbMessageHandler::showErrorMessage; 0093 }; 0094 0095 #endif