1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2006 Michaël Larouche <michael.larouche@kdemail.net> |
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; version 2 |
7 | of the License. |
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 | #ifndef KDEUI_KPASSIVEPOPUPMESSAGEHANDLER_H |
20 | #define KDEUI_KPASSIVEPOPUPMESSAGEHANDLER_H |
21 | |
22 | #include <kdeui_export.h> |
23 | #include <kmessage.h> |
24 | |
25 | #include <QtCore/QObject> |
26 | |
27 | class QWidget; |
28 | /** |
29 | * @brief This is a convenience KMessageHandler that uses KPassivePopup. |
30 | * |
31 | * @author Michaël Larouche <michael.larouche@kdemail.net> |
32 | */ |
33 | class KDEUI_EXPORT KPassivePopupMessageHandler : public QObject, public KMessageHandler |
34 | { |
35 | Q_OBJECT |
36 | public: |
37 | /** |
38 | * @brief Create a new KPassivePopupMessageHandler |
39 | * @param parent Parent widget to use for the KPassivePopup. |
40 | */ |
41 | explicit KPassivePopupMessageHandler(QWidget *parent = 0); |
42 | |
43 | /** |
44 | * @copydoc KMessageHandler::message |
45 | */ |
46 | virtual void message(KMessage::MessageType messageType, const QString &text, const QString &caption); |
47 | |
48 | private: |
49 | /** |
50 | * @internal Actual call of KPassivePopup. |
51 | * @param messageType Message type. |
52 | * @param text the text to display. |
53 | * @param caption the caption of the passive popup. |
54 | */ |
55 | void showPassivePopup(KMessage::MessageType messageType, const QString &text, const QString &caption); |
56 | /** |
57 | * @internal Get the parent widget to be used by the KPassivePopup. |
58 | * @return the parent widget. |
59 | */ |
60 | QWidget *parentWidget(); |
61 | }; |
62 | |
63 | #endif |
64 | // kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on; |
65 | |