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 * 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 *
21 * \internal
22 */
23class ATTICA_EXPORT PlatformDependentV3 : public QObject, public PlatformDependentV2
24{
25 Q_OBJECT
26 Q_PROPERTY(bool ready READ isReady NOTIFY readyChanged)
27public:
28 using QObject::QObject;
29 ~PlatformDependentV3() override;
30 Q_DISABLE_COPY_MOVE(PlatformDependentV3)
31
32 /*!
33 * Whether the dependent is ready for use (e.g. has loaded credentials).
34 * No requests are dispatched to this dependent until the ready change has been reached!
35 */
36 [[nodiscard]] virtual bool isReady() = 0;
37
38Q_SIGNALS:
39 /*!
40 * Emit this when the ready state changes. Please note that reverting to not ready results in undefined behavior.
41 */
42 void readyChanged();
43};
44
45} // namespace Attica
46
47Q_DECLARE_INTERFACE(Attica::PlatformDependentV3, "org.kde.Attica.InternalsV3/1.0")
48

source code of attica/src/platformdependent_v3.h