KNotifications

knotificationreplyaction.h
1/*
2 This file is part of the KDE Frameworks
3 SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KNOTIFICATIONREPLYACTION_H
9#define KNOTIFICATIONREPLYACTION_H
10
11#include <knotifications_export.h>
12
13#include <QObject>
14
15#include <memory>
16
17class QString;
18
19class KNotificationReplyActionPrivate;
20
21/**
22 * @class KNotificationReplyAction knotificationreplyaction.h KNotificationReplyAction
23 *
24 * @brief An inline reply action
25 *
26 * This class represents an inline reply action, which lets the user type a
27 * reply to a chat message or email in the notification popup.
28 */
29class KNOTIFICATIONS_EXPORT KNotificationReplyAction : public QObject
30{
32 /**
33 * @copydoc label
34 * @since 5.88
35 */
37 /**
38 * @copydoc placeholderText
39 * @since 5.88
40 */
42 /**
43 * @copydoc submitButtonText
44 * @since 5.88
45 */
47 /**
48 * @copydoc submitButtonIconName
49 * @since 5.88
50 */
52 /**
53 * @copydoc fallbackBehavior
54 * @since 5.88
55 */
57
58public:
59 /**
60 * Creates a inline reply action with given label
61 * @param label The label for the action
62 */
63 explicit KNotificationReplyAction(const QString &label);
64 /**
65 * Destroys this inline reply action
66 */
68
69 /**
70 * The label for the action button
71 */
72 QString label() const;
73 /**
74 * Set the label for the action button
75 */
76 void setLabel(const QString &label);
77
78 /**
79 * The placeholder text for the inline reply text field
80 */
82 /**
83 * Set the placeholder text for the inline reply text field, for example "Reply to Konqi..."
84 */
86
87 /**
88 * The label for the button to send the typed reply
89 */
91 /**
92 * Set the label for the button to send the typed reply
93 */
95
96 /**
97 * The icon name for the button to send the typed reply
98 */
100 /**
101 * Set the icon name for the button to send the typed reply
102 */
104
105 /**
106 * Behavior when the notification server does not support inline replies
107 */
108 enum class FallbackBehavior {
109 /**
110 * Don't add the reply action (default)
111 */
113 /**
114 * Add the reply action as regular button
115 *
116 * Use this if you want to provide your own reply functionality
117 *
118 * @note The @c activated signal is emitted instead of @c replied!
119 */
121 };
122 Q_ENUM(FallbackBehavior)
123
124 /**
125 * Gets the fallback behavior when the notification server does not support inline replies
126 */
127 FallbackBehavior fallbackBehavior() const;
128 /**
129 * Set the fallback behavior for when the notification server does not support inline replies
130 */
131 void setFallbackBehavior(FallbackBehavior fallbackBehavior);
132
133Q_SIGNALS:
134 /**
135 * Emitted when the user has submitted a reply
136 *
137 * @note This is never emitted when the notification server does not support inline replies
138 *
139 * @param text The text the user entered
140 */
141 void replied(const QString &text);
142 /**
143 * Emitted when the user clicks the reply fallback button
144 *
145 * @note This is emitted when the notification server does not support inline replies
146 * and fallbackBehavior is set to @c UseRegularAction.
147 */
148 void activated();
149
150 /**
151 * Emitted when @p label changed.
152 * @since 5.88
153 */
155 /**
156 * Emitted when @p placeholderText changed.
157 * @since 5.88
158 */
160 /**
161 * Emitted when @p submitButtonText changed.
162 * @since 5.88
163 */
165 /**
166 * Emitted when @p submitButtonIconName changed.
167 * @since 5.88
168 */
170 /**
171 * Emitted when @p fallbackBehavior changed.
172 * @since 5.88
173 */
175
176private:
177 std::unique_ptr<KNotificationReplyActionPrivate> const d;
178};
179
180#endif // KNOTIFICATIONREPLYACTION_H
void labelChanged()
Emitted when label changed.
void fallbackBehaviorChanged()
Emitted when fallbackBehavior changed.
void placeholderTextChanged()
Emitted when placeholderText changed.
void setSubmitButtonText(const QString &submitButtonText)
Set the label for the button to send the typed reply.
void setFallbackBehavior(FallbackBehavior fallbackBehavior)
Set the fallback behavior for when the notification server does not support inline replies.
void setLabel(const QString &label)
Set the label for the action button.
void setSubmitButtonIconName(const QString &submitButtonIconName)
Set the icon name for the button to send the typed reply.
FallbackBehavior
Behavior when the notification server does not support inline replies.
@ UseRegularAction
Add the reply action as regular button.
@ HideAction
Don't add the reply action (default)
KNotificationReplyAction(const QString &label)
Creates a inline reply action with given label.
void setPlaceholderText(const QString &placeholderText)
Set the placeholder text for the inline reply text field, for example "Reply to Konqi....
void submitButtonIconNameChanged()
Emitted when submitButtonIconName changed.
void activated()
Emitted when the user clicks the reply fallback button.
void submitButtonTextChanged()
Emitted when submitButtonText changed.
void replied(const QString &text)
Emitted when the user has submitted a reply.
QObject(QObject *parent)
Q_ENUM(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 28 2025 11:50:59 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.