File indexing completed on 2024-04-14 14:20:23

0001 /*  This file is part of the KDE libraries
0002     Copyright (C) 2006 Michaël Larouche <michael.larouche@kdemail.net>
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; version 2
0007     of the License.
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 #ifndef KDEUI_KPASSIVEPOPUPMESSAGEHANDLER_H
0020 #define KDEUI_KPASSIVEPOPUPMESSAGEHANDLER_H
0021 
0022 #include <kdelibs4support_export.h>
0023 #include <kmessage.h>
0024 
0025 #include <QObject>
0026 
0027 class QWidget;
0028 /**
0029  * @brief This is a convenience KMessageHandler that uses KPassivePopup.
0030  *
0031  * @author Michaël Larouche <michael.larouche@kdemail.net>
0032  */
0033 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KPassivePopupMessageHandler : public QObject, public KMessageHandler
0034 {
0035     Q_OBJECT
0036 public:
0037     /**
0038      * @brief Create a new KPassivePopupMessageHandler
0039      * @param parent Parent widget to use for the KPassivePopup.
0040      */
0041     KDELIBS4SUPPORT_DEPRECATED explicit KPassivePopupMessageHandler(QWidget *parent = nullptr);
0042 
0043     /**
0044      * @copydoc KMessageHandler::message
0045      */
0046     void message(KMessage::MessageType messageType, const QString &text, const QString &caption) override;
0047 
0048 private:
0049     /**
0050      * @internal Actual call of KPassivePopup.
0051      * @param messageType Message type.
0052      * @param text the text to display.
0053      * @param caption the caption of the passive popup.
0054      */
0055     void showPassivePopup(KMessage::MessageType messageType, const QString &text, const QString &caption);
0056     /**
0057      * @internal Get the parent widget to be used by the KPassivePopup.
0058      * @return the parent widget.
0059      */
0060     QWidget *parentWidget();
0061 };
0062 
0063 #endif