File indexing completed on 2024-10-06 09:39:30
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2012 Dawit Alemayehu <adawit@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef USERNOTIFICATIONHANDLER_P_H 0009 #define USERNOTIFICATIONHANDLER_P_H 0010 0011 #include <QCache> 0012 #include <QHash> 0013 #include <QObject> 0014 #include <QPointer> 0015 #include <QVariant> 0016 0017 namespace KIO 0018 { 0019 class Slave; 0020 class SlaveInterface; 0021 0022 class UserNotificationHandler : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 enum MessageBoxDataType { 0027 MSG_TEXT, 0028 MSG_TITLE, 0029 MSG_PRIMARYACTION_TEXT, 0030 MSG_SECONDARYACTION_TEXT, 0031 MSG_PRIMARYACTION_ICON, 0032 MSG_SECONDARYACTION_ICON, 0033 MSG_DONT_ASK_AGAIN, 0034 MSG_DETAILS, 0035 MSG_META_DATA, 0036 }; 0037 0038 class Request 0039 { 0040 public: 0041 QString key() const; 0042 0043 int type; 0044 QPointer<Slave> slave; 0045 QHash<MessageBoxDataType, QVariant> data; 0046 }; 0047 0048 explicit UserNotificationHandler(QObject *parent = nullptr); 0049 ~UserNotificationHandler() override; 0050 0051 void requestMessageBox(SlaveInterface *iface, int type, const QHash<MessageBoxDataType, QVariant> &data); 0052 0053 private Q_SLOTS: 0054 void processRequest(); 0055 void slotProcessRequest(int result); 0056 0057 private: 0058 QCache<QString, int> m_cachedResults; 0059 QList<Request *> m_pendingRequests; 0060 }; 0061 } 0062 0063 #endif