File indexing completed on 2024-04-28 16:54:35

0001 /*
0002     SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDBusArgument>
0010 #include <QDateTime>
0011 #include <QImage>
0012 #include <QList>
0013 #include <QString>
0014 #include <QUrl>
0015 
0016 #include <KService>
0017 
0018 #include "notifications.h"
0019 
0020 namespace NotificationManager
0021 {
0022 class Q_DECL_HIDDEN Notification::Private
0023 {
0024 public:
0025     Private();
0026     ~Private();
0027 
0028     static QString sanitize(const QString &text);
0029     static QImage decodeNotificationSpecImageHint(const QDBusArgument &arg);
0030     static void sanitizeImage(QImage &image);
0031 
0032     void loadImagePath(const QString &path);
0033 
0034     static QString defaultComponentName();
0035     static QSize maximumImageSize();
0036 
0037     static KService::Ptr serviceForDesktopEntry(const QString &desktopEntry);
0038 
0039     void setDesktopEntry(const QString &desktopEntry);
0040     void processHints(const QVariantMap &hints);
0041 
0042     void setUrgency(Notifications::Urgency urgency);
0043 
0044     uint id = 0;
0045     // Bus name of the creator/sender
0046     QString dBusService;
0047     QDateTime created;
0048     QDateTime updated;
0049     bool read = false;
0050 
0051     QString summary;
0052     QString body;
0053     // raw body text without sanitize called.
0054     QString rawBody;
0055     // Can be theme icon name or path
0056     QString icon;
0057     QImage image;
0058 
0059     QString applicationName;
0060     QString desktopEntry;
0061     bool configurableService = false;
0062     QString serviceName; // "Name" field in KService from desktopEntry
0063     QString applicationIconName;
0064 
0065     QString originName;
0066 
0067     QStringList actionNames;
0068     QStringList actionLabels;
0069     bool hasDefaultAction = false;
0070     QString defaultActionLabel;
0071 
0072     bool hasConfigureAction = false;
0073     QString configureActionLabel;
0074 
0075     bool configurableNotifyRc = false;
0076     QString notifyRcName;
0077     QString eventId;
0078 
0079     bool hasReplyAction = false;
0080     QString replyActionLabel;
0081     QString replyPlaceholderText;
0082     QString replySubmitButtonText;
0083     QString replySubmitButtonIconName;
0084 
0085     QString category;
0086     QString xdgTokenAppId;
0087 
0088     QList<QUrl> urls;
0089     QVariantMap hints = QVariantMap();
0090 
0091     bool userActionFeedback = false;
0092     Notifications::Urgency urgency = Notifications::NormalUrgency;
0093     int timeout = -1;
0094 
0095     bool expired = false;
0096     bool dismissed = false;
0097 
0098     bool resident = false;
0099     bool transient = false;
0100 };
0101 
0102 } // namespace NotificationManager