1// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
2// SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
3
4#pragma once
5
6#include <QObject>
7
8#include "attica_export.h"
9#include "platformdependent_v2.h"
10
11namespace Attica
12{
13
14/**
15 * @brief Platform integration plugin v3
16 *
17 * Version 3 introduces an async ready state where dependents need to mark themselves ready for requests before
18 * Attica dispatches them. This in particular allows dependents to carry out async initializations such as loading
19 * credentials.
20 */
21class ATTICA_EXPORT PlatformDependentV3 : public QObject, public PlatformDependentV2
22{
23 Q_OBJECT
24 Q_PROPERTY(bool ready READ isReady NOTIFY readyChanged)
25public:
26 using QObject::QObject;
27 ~PlatformDependentV3() override;
28 Q_DISABLE_COPY_MOVE(PlatformDependentV3)
29
30 /**
31 * Whether the dependent is ready for use (e.g. has loaded credentials).
32 * No requests are dispatched to this dependent until the ready change has been reached!
33 */
34 [[nodiscard]] virtual bool isReady() = 0;
35
36Q_SIGNALS:
37 /**
38 * Emit this when the ready state changes. Please note that reverting to not ready results in undefined behavior.
39 */
40 void readyChanged();
41};
42
43} // namespace Attica
44
45Q_DECLARE_INTERFACE(Attica::PlatformDependentV3, "org.kde.Attica.InternalsV3/1.0")
46

source code of attica/src/platformdependent_v3.h