KUnifiedPush

kcmpushnotifications.h
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KCMPUSHNOTIFICATIONS_H
7#define KCMPUSHNOTIFICATIONS_H
8
9#include "clientmodel.h"
10
11#include <KQuickConfigModule>
12
13#include <QDBusServiceWatcher>
14#include <QNetworkAccessManager>
15
16#include <memory>
17
19class OrgKdeKunifiedpushManagementInterface;
20class SelfTest;
21
22/** KCM to configure push notifications. */
23class KCMPushNotifications : public KQuickConfigModule
24{
26 Q_PROPERTY(bool hasDistributor READ hasDistributor NOTIFY distributorChanged)
27 Q_PROPERTY(bool hasKDEDistributor READ hasKDEDistributor NOTIFY distributorChanged)
28 Q_PROPERTY(int distributorStatus READ distributorStatus NOTIFY distributorStatusChanged)
29 Q_PROPERTY(QString distributorErrorMessage READ distributorErrorMessage NOTIFY distributorErrorMessageChanged)
30 Q_PROPERTY(QString pushProviderId READ pushProviderId NOTIFY pushProviderChanged)
31 Q_PROPERTY(ClientModel* clientModel READ clientModel CONSTANT)
32 Q_PROPERTY(SelfTest* selfTest READ selfTest CONSTANT)
33public:
34 explicit KCMPushNotifications(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
35 ~KCMPushNotifications();
36
37 [[nodiscard]] bool hasDistributor() const;
38 [[nodiscard]] bool hasKDEDistributor() const;
39 [[nodiscard]] int distributorStatus() const;
40 [[nodiscard]] QString distributorErrorMessage() const;
41 [[nodiscard]] QString pushProviderId() const;
42 [[nodiscard]] ClientModel *clientModel() const;
43 [[nodiscard]] SelfTest *selfTest() const;
44
45 Q_INVOKABLE [[nodiscard]] QVariantMap pushProviderConfiguration(const QString &pushProviderId) const;
46
47 Q_INVOKABLE void nextcloudAuthenticate(const QUrl &url);
48
49 void save() override;
50
51public Q_SLOTS:
52 void forceUnregister(const QString &token);
53 void setPushProviderConfiguration(const QString &pushProviderId, const QVariantMap &config);
54
56 void distributorChanged();
57 void distributorStatusChanged();
58 void distributorErrorMessageChanged();
59 void pushProviderChanged();
60
61 void nextcloudAuthenticated(const QString &loginName, const QString &appPassword);
62
63 void saveRequested();
64
65private:
66 OrgKdeKunifiedpushManagementInterface *m_mgmtIface = nullptr;
67 ClientModel *m_clientModel = nullptr;
68 SelfTest *m_selfTest = nullptr;
69 QDBusServiceWatcher m_serviceWatcher;
70
72 std::unique_ptr<NextcloudAuthenticator> m_nextcloudAuthenticator;
73};
74
75#endif // KCMPUSHNOTIFICATIONS_H
Model for all registered push notification client.
Definition clientmodel.h:15
KQuickConfigModule(QObject *parent, const KPluginMetaData &metaData)
Implementation of https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/ind...
Push notification self-test state machine.
Definition selftest.h:22
QObject(QObject *parent)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
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.