Changeset View
Changeset View
Standalone View
Standalone View
src/core/usernotificationhandler_p.h
Show All 29 Lines | |||||
30 | class Slave; | 30 | class Slave; | ||
31 | class SlaveInterface; | 31 | class SlaveInterface; | ||
32 | 32 | | |||
33 | class UserNotificationHandler : public QObject | 33 | class UserNotificationHandler : public QObject | ||
34 | { | 34 | { | ||
35 | Q_OBJECT | 35 | Q_OBJECT | ||
36 | public: | 36 | public: | ||
37 | enum MessageBoxDataType { | 37 | enum MessageBoxDataType { | ||
38 | MSG_TYPE, | ||||
38 | MSG_TEXT, | 39 | MSG_TEXT, | ||
39 | MSG_CAPTION, | 40 | MSG_CAPTION, | ||
41 | MSG_DETAILS, | ||||
40 | MSG_YES_BUTTON_TEXT, | 42 | MSG_YES_BUTTON_TEXT, | ||
41 | MSG_NO_BUTTON_TEXT, | 43 | MSG_NO_BUTTON_TEXT, | ||
42 | MSG_YES_BUTTON_ICON, | 44 | MSG_YES_BUTTON_ICON, | ||
43 | MSG_NO_BUTTON_ICON, | 45 | MSG_NO_BUTTON_ICON, | ||
44 | MSG_DONT_ASK_AGAIN, | 46 | MSG_DONT_ASK_AGAIN, | ||
45 | MSG_META_DATA | 47 | MSG_META_DATA | ||
46 | }; | 48 | }; | ||
47 | 49 | | |||
50 | enum RequestType { | ||||
51 | REQUEST_MSGBOX, | ||||
52 | REQUEST_PRIVILEGE_CONFIRMATION | ||||
53 | }; | ||||
54 | | ||||
48 | class Request | 55 | class Request | ||
49 | { | 56 | { | ||
50 | 57 | | |||
51 | public: | 58 | public: | ||
52 | QString key() const; | 59 | QString key() const; | ||
53 | 60 | | |||
54 | int type; | 61 | int msgType; | ||
62 | RequestType type; | ||||
55 | QPointer<Slave> slave; | 63 | QPointer<Slave> slave; | ||
56 | QHash<MessageBoxDataType, QVariant> data; | 64 | QHash<MessageBoxDataType, QVariant> data; | ||
57 | }; | 65 | }; | ||
58 | 66 | | |||
59 | UserNotificationHandler(QObject *parent = nullptr); | 67 | UserNotificationHandler(QObject *parent = nullptr); | ||
60 | virtual ~UserNotificationHandler(); | 68 | virtual ~UserNotificationHandler(); | ||
61 | 69 | | |||
62 | void requestMessageBox(SlaveInterface *iface, int type, const QHash<MessageBoxDataType, QVariant> &data); | 70 | void createRequest(SlaveInterface *iface, RequestType type, const QHash<MessageBoxDataType, QVariant> &data); | ||
63 | 71 | | |||
64 | private Q_SLOTS: | 72 | private Q_SLOTS: | ||
65 | void processRequest(); | 73 | void processRequest(); | ||
66 | 74 | | |||
67 | private: | 75 | private: | ||
68 | QCache<QString, int> m_cachedResults; | 76 | QCache<QString, QVariant> m_cachedResults; | ||
69 | QList<Request *> m_pendingRequests; | 77 | QList<Request *> m_pendingRequests; | ||
70 | }; | 78 | }; | ||
71 | } | 79 | } | ||
72 | 80 | | |||
73 | #endif | 81 | #endif |