kexi

msghandler.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004-2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXIDB_MSGHANDLER_H
00021 #define KEXIDB_MSGHANDLER_H
00022 
00023 #include <kexidb/object.h>
00024 #include <qguardedptr.h>
00025 #include <qwidget.h>
00026 
00027 namespace KexiDB {
00028 
00038 class KEXI_DB_EXPORT MessageTitle
00039 {
00040     public:
00041         MessageTitle(KexiDB::Object* o, const QString& msg = QString::null);
00042         ~MessageTitle();
00043     
00044     protected:
00045         Object* m_obj;
00046         QString m_prevMsgTitle;
00047 };
00048 
00052 class KEXI_DB_EXPORT MessageHandler
00053 {
00054     public:
00055         enum MessageType { Error, Sorry };
00056 
00059         MessageHandler(QWidget *parent = 0);
00060         virtual ~MessageHandler();
00061 
00068         inline void enableMessages(bool enable) { m_enableMessages = enable; }
00069 
00071         virtual void showErrorMessage(const QString &title, 
00072             const QString &details = QString::null) = 0;
00073         
00076         virtual void showErrorMessage(KexiDB::Object *obj, const QString& msg = QString::null) = 0;
00077 
00084         virtual int askQuestion( const QString& message, 
00085             KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult,
00086             const KGuiItem &buttonYes=KStdGuiItem::yes(), 
00087             const KGuiItem &buttonNo=KStdGuiItem::no(),
00088             const QString &dontShowAskAgainName = QString::null,
00089             int options = KMessageBox::Notify );
00090 
00091     protected:
00092         QGuardedPtr<QWidget> m_messageHandlerParentWidget;
00093         bool m_enableMessages : 1;
00094 };
00095 
00096 }
00097 
00098 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys