1 /* This file is part of the KDE project 2 Copyright (C) 2004-2013 Jarosław Staniek <staniek@kde.org> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef KEXIGUIMSGHANDLER_H 21 #define KEXIGUIMSGHANDLER_H 22 23 #include <core/kexi.h> 24 25 #include <KDbMessageHandler> 26 27 class KEXICORE_EXPORT KexiGUIMessageHandler : public KDbMessageHandler 28 { 29 public: 30 explicit KexiGUIMessageHandler(QWidget *parent = 0); 31 virtual ~KexiGUIMessageHandler(); 32 33 using KDbMessageHandler::showErrorMessage; 34 35 void showErrorMessage(const QString &message, const QString &details, const KDbResultable *resultable); 36 void showErrorMessage(const QString &message, const KDbResultable *resultable); 37 void showErrorMessage(Kexi::ObjectStatus *status); 38 void showErrorMessage(const QString &message, Kexi::ObjectStatus *status); 39 void showErrorMessage(const QString &title, const QString &details); 40 41 /*! Displays a "Sorry" message with \a title text and optional \a details. */ 42 void showSorryMessage(const QString &title, const QString &details = QString()); 43 44 /*! Displays a message of a type \a type, with \a title text and optional \a details. 45 \a dontShowAgainName can be specified to add "Do not show again" option if \a type is Warning. */ 46 virtual void showMessage(MessageType type, const QString &title, const QString &details, 47 const QString& dontShowAgainName = QString()); 48 49 /*! Displays a Warning message with \a title text and optional \a details 50 with "Continue" button instead "OK". 51 \a dontShowAgainName can be specified to add "Do not show again" option. */ 52 virtual void showWarningContinueMessage(const QString &title, const QString &details = QString(), 53 const QString& dontShowAgainName = QString()); 54 55 /*! Shows error message with @a title (it is not caption) and details. */ 56 virtual void showErrorMessage( 57 KDbMessageHandler::MessageType messageType, 58 const QString &message, 59 const QString &details = QString(), 60 const QString &caption = QString() 61 ); 62 63 /*! Shows error message with @a message text. Existing error message from @a obj object 64 is also copied, if present. */ 65 virtual void showErrorMessage( 66 const KDbResult& result, 67 KDbMessageHandler::MessageType messageType = Error, 68 const QString& message = QString(), 69 const QString& caption = QString() 70 ); 71 72 /*! Interactively asks a question. For GUI version, message boxes are used. 73 @a defaultResult is returned in case when no message handler is installed. 74 @a message should contain translated string. 75 Value of ButtonCode is returned. 76 Reimplement this. This implementation does nothing, just returns @a defaultResult. */ 77 virtual KDbMessageHandler::ButtonCode askQuestion( 78 KDbMessageHandler::QuestionType messageType, 79 const QString &message, 80 const QString &caption = QString(), 81 KDbMessageHandler::ButtonCode defaultResult = KDbMessageHandler::Yes, 82 const KDbGuiItem &buttonYes = KDbGuiItem(), 83 const KDbGuiItem &buttonNo = KDbGuiItem(), 84 const QString &dontShowAskAgainName = QString(), 85 KDbMessageHandler::Options options = 0, 86 KDbMessageHandler* msgHandler = 0); 87 88 //! @return GUI message redirection for this handler or 0 if there is no GUI redirection. 89 KexiGUIMessageHandler* guiRedirection(); 90 91 protected: 92 //using KDbMessageHandler::showErrorMessage; 93 }; 94 95 #endif 96