KUnifiedPush

nextpushprovider.h
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KUNIFIEDPUSH_NEXTPUSHPROVIDER_H
7#define KUNIFIEDPUSH_NEXTPUSHPROVIDER_H
8
9#include "abstractpushprovider.h"
10#include "serversenteventsstream.h"
11
12#include <QPointer>
13#include <QUrl>
14
15class QNetworkRequest;
16class QNetworkReply;
17
18namespace KUnifiedPush {
19
20/** NextPush push provider implementation.
21 * @see https://github.com/UP-NextPush/
22 */
23class NextPushProvider : public AbstractPushProvider
24{
25public:
26 explicit NextPushProvider(QObject *parent = nullptr);
27 ~NextPushProvider();
28
29 bool loadSettings(const QSettings &settings) override;
30 void resetSettings(QSettings &settings) override;
31 void connectToProvider(Urgency urgency) override;
32 void disconnectFromProvider() override;
33 void registerClient(const Client &client) override;
34 void unregisterClient(const Client &client) override;
35 void acknowledgeMessage(const Client &client, const QString &messageIdentifier) override;
36
37 static constexpr inline auto Id = QLatin1StringView("NextPush");
38protected:
39 void doChangeUrgency(Urgency urgency) override;
40
41private:
42 void waitForMessage(Urgency urgency);
43 QNetworkRequest prepareRequest(const char *restCmd, const QString &restArg = {}) const;
44
45 QUrl m_url;
46 QString m_userName;
47 QString m_appPassword;
48 QString m_deviceId;
49
50 QPointer<QNetworkReply> m_sseReply;
51 ServerSentEventsStream m_sseStream;
52};
53
54}
55
56#endif // KUNIFIEDPUSH_NEXTPUSHPROVIDER_H
Urgency urgency() const
The urgency level currently used by this provider.
Information about a registered client.
Definition client.h:20
void connectToProvider(Urgency urgency) override
Attempt to establish a connection to the push provider.
void registerClient(const Client &client) override
Register a new client with the provider.
void disconnectFromProvider() override
Disconnect and existing connection to the push provider.
void doChangeUrgency(Urgency urgency) override
Re-implement if urgency leve changes are done as a separate command.
void unregisterClient(const Client &client) override
Unregister a client from the provider.
bool loadSettings(const QSettings &settings) override
Load connection settings.
void acknowledgeMessage(const Client &client, const QString &messageIdentifier) override
Acknowledge a message.
void resetSettings(QSettings &settings) override
Reset any internal state for a fresh setup connecting to a different push server instance.
Sever-sent Events (SSE) stream.
Client-side integration with UnifiedPush.
Definition connector.h:14
QObject(QObject *parent)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 12:05:39 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.