Akonadi

agentbase/accountsintegration.h
1/*
2 SPDX-FileCopyrightText: 2019 Daniel Vrátil <dvratil@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadiagentbase_export.h"
10#include <QObject>
11
12#include <functional>
13#include <optional>
14
15class Akonadi__AccountsAdaptor;
16namespace Akonadi
17{
18class AKONADIAGENTBASE_EXPORT AccountsIntegration : public QObject
19{
20 Q_OBJECT
21
22 friend class ::Akonadi__AccountsAdaptor;
23
24public:
25 explicit AccountsIntegration();
26 ~AccountsIntegration() override = default;
27
28 /**
29 * Returns whether Accounts integration is enabled.
30 */
31 [[nodiscard]] bool isEnabled() const;
32
33 using AuthDataCallback = std::function<void(const QVariantMap &)>;
34 using ErrorCallback = std::function<void(const QString &)>;
35 void requestAuthData(const QString &serviceType, AuthDataCallback &&cb, ErrorCallback &&err);
36
37 std::optional<QString> accountName() const;
38public Q_SLOTS:
39 std::optional<quint32> accountId() const;
40 void setAccountId(quint32 accountId);
41
42Q_SIGNALS:
43 void accountChanged();
44
45private:
46 // For DBus adaptor which doesn't understand std::optional
47 AKONADIAGENTBASE_NO_EXPORT quint32 getAccountId() const;
48
49 std::optional<quint32> mAccountId;
50};
51
52} // namespace Akonadi
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.