File indexing completed on 2025-01-05 05:01:15
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2022-2023 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <memory> 0007 0008 #include <QNetworkAccessManager> 0009 #include <QObject> 0010 0011 #include "sentrydsns.h" 0012 #include "sentryenvelope.h" 0013 0014 // Manager for sentry envelope construction and delivery 0015 class SentryPostbox : public QObject 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit SentryPostbox(const QString &applicationName, std::shared_ptr<SentryConnection> connection, QObject *parent = nullptr); 0020 0021 void addEventPayload(const QJsonDocument &document); 0022 void addUserFeedback(const QString &feedbackString); 0023 0024 void deliver(); 0025 bool hasDelivered() const; 0026 bool isReadyToDeliver() const; 0027 [[nodiscard]] QString eventId() const; 0028 0029 Q_SIGNALS: 0030 void hasDeliveredChanged(); 0031 0032 private Q_SLOTS: 0033 void onDSNsLoaded(); 0034 0035 private: 0036 SentryEnvelope m_envelope; 0037 SentryDSNs m_dsns; 0038 SentryDSNContext m_dsnContext; 0039 0040 QString m_applicationName; 0041 bool m_hasDelivered = false; 0042 bool m_dsnSet = false; 0043 };